# New material for Scintillator building

**URL:** <https://geant4-forum.web.cern.ch/t/new-material-for-scintillator-building/5889>\
**Category:** Geometry, Fields and Transportation\
**Created:** [August 9, 2021, 3:01am UTC](https://geant4-forum.web.cern.ch/t/new-material-for-scintillator-building/5889 "2021-08-09T03:01:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhinabmuk](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/abhinabmuk/32/3493_2.png) [@abhinabmuk](https://geant4-forum.web.cern.ch/u/abhinabmuk)\
**Post date:** [August 9, 2021, 3:01am UTC](https://geant4-forum.web.cern.ch/t/new-material-for-scintillator-building/5889/1 "2021-08-09T03:01:46Z")

</div>

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 :

```auto

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) :

```auto

 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.

---

<div class="post-metadata">

**Author:** ![dsawkey](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/dsawkey/32/4016_2.png) [@dsawkey](https://geant4-forum.web.cern.ch/u/dsawkey)\
**Post date:** [August 11, 2021, 7:39pm UTC](https://geant4-forum.web.cern.ch/t/new-material-for-scintillator-building/5889/2 "2021-08-11T19:39:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abhinabmuk](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/abhinabmuk/32/3493_2.png) [@abhinabmuk](https://geant4-forum.web.cern.ch/u/abhinabmuk)\
**Post date:** [August 11, 2021, 10:51pm UTC](https://geant4-forum.web.cern.ch/t/new-material-for-scintillator-building/5889/3 "2021-08-11T22:51:37Z")

</div>

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

```auto
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

```auto
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.

---

<div class="post-metadata">

**Author:** ![dsawkey](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/dsawkey/32/4016_2.png) [@dsawkey](https://geant4-forum.web.cern.ch/u/dsawkey)\
**Post date:** [August 12, 2021, 7:25pm UTC](https://geant4-forum.web.cern.ch/t/new-material-for-scintillator-building/5889/4 "2021-08-12T19:25:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![abhinabmuk](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/abhinabmuk/32/3493_2.png) [@abhinabmuk](https://geant4-forum.web.cern.ch/u/abhinabmuk)\
**Post date:** [August 12, 2021, 8:14pm UTC](https://geant4-forum.web.cern.ch/t/new-material-for-scintillator-building/5889/5 "2021-08-12T20:14:02Z")

</div>

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