New material for Scintillator building

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.

There should be text output, either in the terminal or the Qt text window, showing what materials are used. You might need to turn up the verbosity with
/run/verbose 2

Hi thank you for your feedback. I looked at terminal output and it does indeed show optical material (verbose is set to 2):

Checking overlaps for volume Scint (G4Box) ... OK!
Checking overlaps for volume Sensor (G4Box) ... OK!
World is registered to the default region.
physicsList->Construct() start.
G4OpticalPhysics:: Add Optical Physics Processes
### Birks coefficients used in run time
plasticScint     0.126 mm/MeV     0.012978 g/cm^2/MeV  massFactor=  101.167 effCharge= 0.027027
G4_POLYSTYRENE     0.07943 mm/MeV     0.00841958 g/cm^2/MeV  massFactor=  101.167 effCharge= 0.027027

It does show two different material (One I specified and default G4_POLYSTYRENE) is built. It seems that the 1st set of values i.e 0.126 mm/MeV is Birks constants which is then multiplied with density (which I specified 1.03*g/cm3). I am just unsure that as G4_POLYSTYRENE was also build whether in this line

scintMat->AddMaterial(G4NistManager::Instance() >FindOrBuildMaterial("G4_POLYSTYRENE"), 1.0);

The scintMat inherits properties defined in previous line or is it redefined by properties of G4_POLYSTYRENE ?

Thank you again for your time.

I don’t know. You may want to try building plasticScint from scratch (that is, without reference to G4_POLYSTYRENE). Then, presumably, the material won’t inherit anything from G4_POLYSTYRENE.

1 Like

Thank you for the advice and help, I will do that.