Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:29:34

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file WLSMaterials.cc
0027 /// \brief Implementation of the WLSMaterials class
0028 
0029 #include "WLSMaterials.hh"
0030 
0031 #include "G4NistManager.hh"
0032 #include "G4SystemOfUnits.hh"
0033 
0034 WLSMaterials* WLSMaterials::fInstance = nullptr;
0035 
0036 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0037 
0038 WLSMaterials::WLSMaterials()
0039 {
0040   fNistMan = G4NistManager::Instance();
0041   fNistMan->SetVerbose(2);
0042 
0043   CreateMaterials();
0044 }
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 WLSMaterials::~WLSMaterials()
0049 {
0050   delete fAir;
0051   delete fPMMA;
0052   delete fPethylene;
0053   delete fFPethylene;
0054   delete fPolystyrene;
0055   delete fSilicone;
0056   delete fCoating;
0057 }
0058 
0059 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0060 
0061 WLSMaterials* WLSMaterials::GetInstance()
0062 {
0063   if (!fInstance) {
0064     fInstance = new WLSMaterials();
0065   }
0066   return fInstance;
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 G4Material* WLSMaterials::GetMaterial(const G4String material)
0072 {
0073   G4Material* mat = fNistMan->FindOrBuildMaterial(material);
0074 
0075   if (!mat) mat = G4Material::GetMaterial(material);
0076   if (!mat) {
0077     G4ExceptionDescription ed;
0078     ed << "Material " << material << " not found!";
0079     G4Exception("WLSMaterials::GetMaterial", "", FatalException, ed);
0080   }
0081 
0082   return mat;
0083 }
0084 
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0086 
0087 void WLSMaterials::CreateMaterials()
0088 {
0089   G4double density;
0090   G4int ncomponents;
0091   G4double fractionmass;
0092   std::vector<G4int> natoms;
0093   std::vector<G4double> fractionMass;
0094   std::vector<G4String> elements;
0095 
0096   // Materials Definitions
0097   // =====================
0098 
0099   //--------------------------------------------------
0100   // Vacuum
0101   //--------------------------------------------------
0102 
0103   fNistMan->FindOrBuildMaterial("G4_Galactic");
0104 
0105   //--------------------------------------------------
0106   // Air
0107   //--------------------------------------------------
0108 
0109   fAir = fNistMan->FindOrBuildMaterial("G4_AIR");
0110 
0111   //--------------------------------------------------
0112   // WLSfiber PMMA
0113   //--------------------------------------------------
0114 
0115   elements.push_back("C");
0116   natoms.push_back(5);
0117   elements.push_back("H");
0118   natoms.push_back(8);
0119   elements.push_back("O");
0120   natoms.push_back(2);
0121 
0122   density = 1.190 * g / cm3;
0123 
0124   fPMMA = fNistMan->ConstructNewMaterial("PMMA", elements, natoms, density);
0125 
0126   elements.clear();
0127   natoms.clear();
0128 
0129   //--------------------------------------------------
0130   // Cladding (polyethylene)
0131   //--------------------------------------------------
0132 
0133   elements.push_back("C");
0134   natoms.push_back(2);
0135   elements.push_back("H");
0136   natoms.push_back(4);
0137 
0138   density = 1.200 * g / cm3;
0139 
0140   fPethylene = fNistMan->ConstructNewMaterial("Pethylene", elements, natoms, density);
0141 
0142   elements.clear();
0143   natoms.clear();
0144 
0145   //--------------------------------------------------
0146   // Double Cladding (fluorinated polyethylene)
0147   //--------------------------------------------------
0148 
0149   elements.push_back("C");
0150   natoms.push_back(2);
0151   elements.push_back("H");
0152   natoms.push_back(4);
0153 
0154   density = 1.400 * g / cm3;
0155 
0156   fFPethylene = fNistMan->ConstructNewMaterial("FPethylene", elements, natoms, density);
0157 
0158   elements.clear();
0159   natoms.clear();
0160 
0161   //--------------------------------------------------
0162   // Polystyrene
0163   //--------------------------------------------------
0164 
0165   elements.push_back("C");
0166   natoms.push_back(8);
0167   elements.push_back("H");
0168   natoms.push_back(8);
0169 
0170   density = 1.050 * g / cm3;
0171 
0172   fPolystyrene = fNistMan->ConstructNewMaterial("Polystyrene", elements, natoms, density);
0173 
0174   elements.clear();
0175   natoms.clear();
0176 
0177   //--------------------------------------------------
0178   // Silicone (Template for Optical Grease)
0179   //--------------------------------------------------
0180 
0181   elements.push_back("C");
0182   natoms.push_back(2);
0183   elements.push_back("H");
0184   natoms.push_back(6);
0185 
0186   density = 1.060 * g / cm3;
0187 
0188   fSilicone = fNistMan->ConstructNewMaterial("Silicone", elements, natoms, density);
0189 
0190   elements.clear();
0191   natoms.clear();
0192 
0193   //--------------------------------------------------
0194   // Aluminium
0195   //--------------------------------------------------
0196 
0197   fNistMan->FindOrBuildMaterial("G4_Al");
0198 
0199   //--------------------------------------------------
0200   // TiO2
0201   //--------------------------------------------------
0202 
0203   elements.push_back("Ti");
0204   natoms.push_back(1);
0205   elements.push_back("O");
0206   natoms.push_back(2);
0207 
0208   density = 4.26 * g / cm3;
0209 
0210   G4Material* TiO2 = fNistMan->ConstructNewMaterial("TiO2", elements, natoms, density);
0211 
0212   elements.clear();
0213   natoms.clear();
0214 
0215   //--------------------------------------------------
0216   // Scintillator Coating - 15% TiO2 and 85% polystyrene by weight.
0217   //--------------------------------------------------
0218 
0219   density = 1.52 * g / cm3;
0220 
0221   fCoating = new G4Material("Coating", density, ncomponents = 2);
0222 
0223   fCoating->AddMaterial(TiO2, fractionmass = 15 * perCent);
0224   fCoating->AddMaterial(fPolystyrene, fractionmass = 85 * perCent);
0225 
0226   //
0227   // ------------ Generate & Add Material Properties Table ------------
0228   //
0229 
0230   std::vector<G4double> energy = {
0231     2.00 * eV, 2.03 * eV, 2.06 * eV, 2.09 * eV, 2.12 * eV, 2.15 * eV, 2.18 * eV, 2.21 * eV,
0232     2.24 * eV, 2.27 * eV, 2.30 * eV, 2.33 * eV, 2.36 * eV, 2.39 * eV, 2.42 * eV, 2.45 * eV,
0233     2.48 * eV, 2.51 * eV, 2.54 * eV, 2.57 * eV, 2.60 * eV, 2.63 * eV, 2.66 * eV, 2.69 * eV,
0234     2.72 * eV, 2.75 * eV, 2.78 * eV, 2.81 * eV, 2.84 * eV, 2.87 * eV, 2.90 * eV, 2.93 * eV,
0235     2.96 * eV, 2.99 * eV, 3.02 * eV, 3.05 * eV, 3.08 * eV, 3.11 * eV, 3.14 * eV, 3.17 * eV,
0236     3.20 * eV, 3.23 * eV, 3.26 * eV, 3.29 * eV, 3.32 * eV, 3.35 * eV, 3.38 * eV, 3.41 * eV,
0237     3.44 * eV, 3.47 * eV};
0238 
0239   std::vector<G4double> energySmall = {2.0 * eV, 3.47 * eV};
0240 
0241   //--------------------------------------------------
0242   // Air
0243   //--------------------------------------------------
0244 
0245   std::vector<G4double> refractiveIndex = {1.0, 1.0};
0246 
0247   auto mpt = new G4MaterialPropertiesTable();
0248   mpt->AddProperty("RINDEX", energySmall, refractiveIndex);
0249 
0250   fAir->SetMaterialPropertiesTable(mpt);
0251 
0252   //--------------------------------------------------
0253   //  PMMA for WLSfibers
0254   //--------------------------------------------------
0255 
0256   std::vector<G4double> refractiveIndexWLSfiber = {1.60, 1.60};
0257 
0258   std::vector<G4double> absWLSfiber = {
0259     5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m,
0260     5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m,
0261     5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m,
0262     5.40 * m, 5.40 * m, 1.10 * m, 1.10 * m, 1.10 * m, 1.10 * m, 1.10 * m, 1.10 * m, 1.10 * m,
0263     1. * mm,  1. * mm,  1. * mm,  1. * mm,  1. * mm,  1. * mm,  1. * mm,  1. * mm,  1. * mm,
0264     1. * mm,  1. * mm,  1. * mm,  1. * mm,  1. * mm};
0265 
0266   std::vector<G4double> emissionFib = {0.05, 0.10, 0.30, 0.50, 0.75, 1.00, 1.50, 1.85, 2.30, 2.75,
0267                                        3.25, 3.80, 4.50, 5.20, 6.00, 7.00, 8.50, 9.50, 11.1, 12.4,
0268                                        12.9, 13.0, 12.8, 12.3, 11.1, 11.0, 12.0, 11.0, 17.0, 16.9,
0269                                        15.0, 9.00, 2.50, 1.00, 0.05, 0.00, 0.00, 0.00, 0.00, 0.00,
0270                                        0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00};
0271 
0272   // Add entries into properties table
0273   auto mptWLSfiber = new G4MaterialPropertiesTable();
0274   mptWLSfiber->AddProperty("RINDEX", energySmall, refractiveIndexWLSfiber);
0275   mptWLSfiber->AddProperty("WLSABSLENGTH", energy, absWLSfiber);
0276   mptWLSfiber->AddProperty("WLSCOMPONENT", energy, emissionFib);
0277   mptWLSfiber->AddConstProperty("WLSTIMECONSTANT", 0.5 * ns);
0278 
0279   fPMMA->SetMaterialPropertiesTable(mptWLSfiber);
0280 
0281   //--------------------------------------------------
0282   //  Polyethylene
0283   //--------------------------------------------------
0284 
0285   std::vector<G4double> refractiveIndexClad1 = {1.49, 1.49};
0286 
0287   std::vector<G4double> absClad = {20.0 * m, 20.0 * m};
0288 
0289   // Add entries into properties table
0290   auto mptClad1 = new G4MaterialPropertiesTable();
0291   mptClad1->AddProperty("RINDEX", energySmall, refractiveIndexClad1);
0292   mptClad1->AddProperty("ABSLENGTH", energySmall, absClad);
0293 
0294   fPethylene->SetMaterialPropertiesTable(mptClad1);
0295 
0296   //--------------------------------------------------
0297   // Fluorinated Polyethylene
0298   //--------------------------------------------------
0299 
0300   std::vector<G4double> refractiveIndexClad2 = {1.42, 1.42};
0301 
0302   // Add entries into properties table
0303   auto mptClad2 = new G4MaterialPropertiesTable();
0304   mptClad2->AddProperty("RINDEX", energySmall, refractiveIndexClad2);
0305   mptClad2->AddProperty("ABSLENGTH", energySmall, absClad);
0306 
0307   fFPethylene->SetMaterialPropertiesTable(mptClad2);
0308 
0309   //--------------------------------------------------
0310   // Silicone
0311   //--------------------------------------------------
0312 
0313   std::vector<G4double> refractiveIndexSilicone = {1.46, 1.46};
0314 
0315   // Add entries into properties table
0316   auto mptSilicone = new G4MaterialPropertiesTable();
0317   mptSilicone->AddProperty("RINDEX", energySmall, refractiveIndexSilicone);
0318   mptSilicone->AddProperty("ABSLENGTH", energySmall, absClad);
0319 
0320   fSilicone->SetMaterialPropertiesTable(mptSilicone);
0321 
0322   //--------------------------------------------------
0323   //  Polystyrene
0324   //--------------------------------------------------
0325 
0326   std::vector<G4double> refractiveIndexPS = {1.50, 1.50};
0327 
0328   std::vector<G4double> absPS = {2. * cm, 2. * cm};
0329 
0330   std::vector<G4double> scintilFast = {
0331     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0332     0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0,
0333     1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
0334 
0335   // Add entries into properties table
0336   auto mptPolystyrene = new G4MaterialPropertiesTable();
0337   mptPolystyrene->AddProperty("RINDEX", energySmall, refractiveIndexPS);
0338   mptPolystyrene->AddProperty("ABSLENGTH", energySmall, absPS);
0339   mptPolystyrene->AddProperty("SCINTILLATIONCOMPONENT1", energy, scintilFast);
0340   mptPolystyrene->AddConstProperty("SCINTILLATIONYIELD", 10. / keV);
0341   mptPolystyrene->AddConstProperty("RESOLUTIONSCALE", 1.0);
0342   mptPolystyrene->AddConstProperty("SCINTILLATIONTIMECONSTANT1", 10. * ns);
0343 
0344   fPolystyrene->SetMaterialPropertiesTable(mptPolystyrene);
0345 
0346   // Set the Birks Constant for the Polystyrene scintillator
0347   fPolystyrene->GetIonisation()->SetBirksConstant(0.126 * mm / MeV);
0348 }