Hello Geant4 users!
I am pretty new to GEANT4 and Linux. I am currently building a polystyrene scintillator bar however I want to change the default polystyrene material density to 1.03 g/cm^3. I tried doing this in DetectorConstruction.cc below :
void DetectorConstruction::DefineMaterials()
{
auto nistManager = G4NistManager::Instance();
// keep this for now :
G4Material* scintMat = new G4Material ("plasticScint", 1.03*g/cm3, 1, kStateSolid);
scintMat->AddMaterial(G4NistManager::Instance()->FindOrBuildMaterial("G4_POLYSTYRENE"), 1.0);
// Air
nistManager->FindOrBuildMaterial("G4_AIR");
// ------------ Generate & Add Material Properties Table ------------
G4double photonEnergy[] ={2.034 * eV, 2.068 * eV, 2.103 * eV, 2.139 * eV,
2.177 * eV, 2.216 * eV, 2.256 * eV, 2.298 * eV,
2.341 * eV, 2.386 * eV, 2.433 * eV, 2.481 * eV,
2.532 * eV, 2.585 * eV, 2.640 * eV, 2.697 * eV,
2.757 * eV, 2.820 * eV, 2.885 * eV, 2.954 * eV,
3.026 * eV, 3.102 * eV, 3.181 * eV, 3.265 * eV,
3.353 * eV, 3.446 * eV, 3.545 * eV, 3.649 * eV,
3.760 * eV, 3.877 * eV, 4.002 * eV, 4.136 * eV};
const G4int nEntries = sizeof (photonEnergy) / sizeof (G4double);
//
G4double refractiveIndex[] ={1.57 , 1.57 , 1.57 , 1.57 , 1.57 ,
1.57 , 1.57 , 1.57 , 1.57 ,1.57 ,
1.57 , 1.57 , 1.57 , 1.57 ,1.57 ,
1.57 , 1.57 , 1.57 , 1.57 ,1.57 ,
1.57 , 1.57 , 1.57 , 1.57 , 1.57 ,
1.57 , 1.57 , 1.57 , 1.57 , 1.57 ,
1.57 , 1.57 };
G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
myMPT1->AddProperty("RINDEX", photonEnergy, refractiveIndex, nEntries)->SetSpline(true);
scintMat->SetMaterialPropertiesTable(myMPT1);
scintMat->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
}
Then in next field I build scintillator bar like this [I didn’t include world volume declaration here) :
G4NistManager* nist = G4NistManager::Instance();
G4bool checkOverlaps = true;
G4double ScintX = 5.*cm;
G4double ScintY = 5.*cm;
G4double ScintZ = 37.5*cm; // on each side adding to 75 cm total
auto solidScint = new G4Box("Scint",ScintX, ScintY,ScintZ);
auto logicScint = new G4LogicalVolume(solidScint, nist->FindOrBuildMaterial("plasticScint"), "Scint");
G4double Scint_pX = 0.0*cm;
G4double Scint_pY = 0.0*cm;
G4double Scint_pZ = 0.0*cm;
auto physTube = new G4PVPlacement(0, G4ThreeVector(Scint_pX, Scint_pY, Scint_pZ), logicScint, "Scint", logicWorld, false, 0, checkOverlaps);
The code does run but I am not sure if the code worked or it used the default G4_POLYSTYRENE density of 1.06*g/cm3. I also want to know if there is a way to check the properties of volume placed such as density from visualization QT OpenGL screen.
Thank you for your time.