Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-10 02:20:15

0001 /** \file MaterialProperties.cc
0002  *
0003  *
0004  *  $Date: 2007/06/11 14:44:29 $
0005  *  $Revision: 1.3 $
0006  *  \author Maarten Thomas
0007  */
0008 
0009 #include "Alignment/LaserAlignmentSimulation/interface/MaterialProperties.h"
0010 #include "G4LogicalVolumeStore.hh"
0011 
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 
0014 #include <CLHEP/Units/SystemOfUnits.h>
0015 using CLHEP::cm;
0016 using CLHEP::fermi;
0017 using CLHEP::m;
0018 using CLHEP::MeV;
0019 using CLHEP::micrometer;
0020 using CLHEP::mm;
0021 using CLHEP::ns;
0022 
0023 MaterialProperties::MaterialProperties(int DebugLevel, double SiAbsLengthScale)
0024     : theMaterialTable(),
0025       theMPDebugLevel(0),
0026       theSiAbsLengthScalingFactor(0),
0027       theMPT(),
0028       theTECWafer(),
0029       theTOBWafer(),
0030       theTIBWafer() {
0031   theMPDebugLevel = DebugLevel;
0032   theSiAbsLengthScalingFactor = SiAbsLengthScale;
0033   /* *********************************************************************** */
0034   /*
0035   define the materials for the sensitive detectors in TEC, TIB and TOB
0036           we need this to specify different properties for Barrel and Endcap
0037           detectors, which is by default no longer possible in CMSSW due to
0038           the fact that all modules are made out of the same G4Material
0039   */
0040   /* *********************************************************************** */
0041   G4double theDensity = 2.33 * CLHEP::g / CLHEP::cm3;
0042   G4double theAtomicWeight = 28.09 * CLHEP::g / CLHEP::mole;
0043   G4double theAtomicNumber = 14.0;
0044 
0045   theTECWafer = new G4Material("TEC_Wafer", theAtomicNumber, theAtomicWeight, theDensity);
0046   theTOBWafer = new G4Material("TOB_Wafer", theAtomicNumber, theAtomicWeight, theDensity);
0047   theTIBWafer = new G4Material("TIB_Wafer", theAtomicNumber, theAtomicWeight, theDensity);
0048 
0049   // set the properties of the materials
0050   setMaterialProperties();
0051 }
0052 
0053 MaterialProperties::~MaterialProperties() {
0054   if (theMPT != nullptr) {
0055     delete theMPT;
0056   }
0057   if (theTECWafer != nullptr) {
0058     delete theTECWafer;
0059   }
0060   if (theTOBWafer != nullptr) {
0061     delete theTOBWafer;
0062   }
0063   if (theTIBWafer != nullptr) {
0064     delete theTIBWafer;
0065   }
0066 }
0067 
0068 void MaterialProperties::setMaterialProperties() {
0069   /* *********************************************************************** */
0070   /*
0071   use this function to define material properties (like refraction
0072           index, absorptionlenght and so on) and add them to the
0073           MaterialPropertiesTable. Finally set the MPT to a give Material.
0074   */
0075   /* *********************************************************************** */
0076 
0077   // get the MaterialTable as it is defined in OSCAR (CMSSW now)
0078   theMaterialTable = G4Material::GetMaterialTable();
0079 
0080   /* *********************************************************************** */
0081   /*
0082   with the following code one can access the MaterialTable defined in
0083           OSCAR. This contains all the materials needed for the CMS detector,
0084           which are defined in the Geometry and DDD packages. COBRA takes care
0085           of the proper conversion between a DDMaterial and a G4Material.
0086   */
0087   /* *********************************************************************** */
0088 
0089   //   if (theMPDebugLevel > 1)
0090   //     {
0091   // print the materialtable
0092   LogDebug("SimLaserAlignment:MaterialProperties")
0093       << " **** here comes the material table **** " << *(G4Material::GetMaterialTable());
0094   //     }
0095 
0096   // define the MateriapropertiesTable for the Sensitive Regions in the Tracker
0097   // TOB_Wafer, TOB_Silicon, TID_Wafer, TIB_Wafer and TEC_Wafer
0098 
0099   const G4int nEntries = 3;
0100 
0101   // Photon energies
0102   G4double PhotonEnergy[nEntries] = {1.10 * CLHEP::eV, 1.15 * CLHEP::eV, 1.20 * CLHEP::eV};
0103 
0104   // scintillation
0105   G4double Scintillation[nEntries] = {0.1, 1.0, 0.1};
0106 
0107   // Refractive Index
0108   G4double RefractiveIndex[nEntries] = {3.5400, 3.5425, 3.5450};
0109   // Refractive Index of the Mirrors (BK7)
0110   G4double RefractiveIndexMirror[nEntries] = {1.50669, 1.50669, 1.50669};
0111 
0112   /* *********************************************************************** */
0113   /*  set the refractive index for the other materials to 1.0. This is       *
0114    *  needed to propagate the optical photons through the detector according *
0115    *  to Peter Gumplinger.                                                   */
0116   /* *********************************************************************** */
0117   G4double RefractiveIndexGeneral[nEntries] = {1.0, 1.0, 1.0};
0118 
0119   // Absorption Length
0120   // G4double AbsorptionLengthSi[nEntries] = { 198.8 * micrometer, 198.8 *
0121   // micrometer, 198.8 * micrometer }; ///////////////////////////////////
0122   G4double AbsorptionLengthSi[nEntries] = {1136 * micrometer, 1136 * micrometer, 1136 * micrometer};
0123 
0124   G4double AbsorptionLengthSiBarrel[nEntries] = {0.1 * fermi, 0.1 * fermi, 0.1 * fermi};
0125 
0126   // Absorption length of the mirrors
0127   G4double AbsorptionLengthMirror[nEntries] = {11.7 * cm, 0.5 * 11.7 * cm, 11.7 * cm};
0128 
0129   // Absorption Length for dead material in the tracker; set to small values
0130   // to kill the optical photons outside the TEC. Maybe this is later a problem
0131   // when implementing Ray 1 to connect both TECs which eachother and with TIB
0132   // and TOB!??
0133   G4double AbsorptionLengthDead[nEntries] = {0.001 * micrometer, 0.001 * micrometer, 0.001 * micrometer};
0134 
0135   // Absorption Length of the other Materials in the Tracker
0136   G4double AbsorptionLengthGeneral[nEntries] = {75 * cm, 75 * cm, 75 * cm};
0137 
0138   // Absorption Length of the Air in the Tracker
0139   G4double AbsorptionLengthTAir[nEntries] = {10 * m, 1.8 * m, 10 * m};
0140 
0141   G4double AbsorptionLengthAl[nEntries] = {10 * mm, 10 * mm, 10 * mm};
0142   G4double AbsorptionLengthTOB_CF_Str[nEntries] = {1 * cm, 10 * cm, 1 * cm};
0143   G4double AbsorptionLengthTOBCF[nEntries] = {0.1 * mm, 20 * mm, 0.1 * mm};
0144   G4double AbsorptionLengthTIBCF[nEntries] = {15.0 * cm, 15.0 * cm, 15.0 * cm};
0145 
0146   // Reflectivity of the modules
0147   G4double SiReflectivity[nEntries] = {0.0, 0.0, 0.0};
0148 
0149   // Efficiency of the modules
0150   G4double TECEfficiency[nEntries] = {0.9, 0.9, 0.9};
0151   G4double BarrelEfficiency[nEntries] = {1.0, 1.0, 1.0};
0152 
0153   // Reflectivity of the mirrors in the Alignment Tubes
0154   G4double Reflectivity[nEntries] = {0.05, 0.05, 0.05};
0155 
0156   /* *********************************************************************** */
0157 
0158   /* *********************************************************************** */
0159   /*
0160   define the materials for the sensitive detectors in TEC, TIB and TOB
0161           we need this to specify different properties for Barrel and Endcap
0162           detectors, which is by default no longer possible in CMSSW due to
0163           the fact that all modules are made out of the same G4Material
0164   */
0165   /* *********************************************************************** */
0166 
0167   // set the options for the materials
0168   {
0169     for (G4MaterialTable::const_iterator theMTEntry = theMaterialTable->begin(); theMTEntry != theMaterialTable->end();
0170          theMTEntry++) {
0171       if (*theMTEntry) {
0172         G4Material *theMaterial = const_cast<G4Material *>(*theMTEntry);
0173 
0174         if (theMaterial->GetMaterialPropertiesTable()) {
0175           theMPT = theMaterial->GetMaterialPropertiesTable();
0176         } else {
0177           theMPT = new G4MaterialPropertiesTable;
0178         }
0179 
0180         // properties of the TEC_Wafer
0181         if (theMaterial->GetName() == "TEC_Wafer") {
0182           theMPT->AddProperty("FASTCOMPONENT", PhotonEnergy, Scintillation, nEntries);
0183           theMPT->AddProperty("SLOWCOMPONENT", PhotonEnergy, Scintillation, nEntries);
0184           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex, nEntries);
0185           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthSi, nEntries);
0186           theMPT->AddProperty("EFFICIENCY", PhotonEnergy, TECEfficiency, nEntries);
0187 
0188           theMPT->AddConstProperty("SCINTILLATIONYIELD", 12000.0 / MeV);
0189           theMPT->AddConstProperty("RESOLTUIONSCALE", 1.0);
0190           theMPT->AddConstProperty("FASTTIMECONSTANT", 20.0 * ns);
0191           theMPT->AddConstProperty("SLOWTIMECONSTANT", 45.0 * ns);
0192           theMPT->AddConstProperty("YIELDRATIO", 1.0);
0193 
0194           // set the MaterialPropertiesTable
0195           theMaterial->SetMaterialPropertiesTable(theMPT);
0196         }
0197 
0198         // properties of Silicon (used as Module Material in CMSSW)
0199         else if (theMaterial->GetName() == "Silicon") {
0200           theMPT->AddProperty("FASTCOMPONENT", PhotonEnergy, Scintillation, nEntries);
0201           theMPT->AddProperty("SLOWCOMPONENT", PhotonEnergy, Scintillation, nEntries);
0202           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex, nEntries);
0203           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthSi, nEntries);
0204           theMPT->AddProperty("EFFICIENCY", PhotonEnergy, TECEfficiency, nEntries);
0205 
0206           theMPT->AddConstProperty("SCINTILLATIONYIELD", 12000.0 / MeV);
0207           theMPT->AddConstProperty("RESOLTUIONSCALE", 1.0);
0208           theMPT->AddConstProperty("FASTTIMECONSTANT", 20.0 * ns);
0209           theMPT->AddConstProperty("SLOWTIMECONSTANT", 45.0 * ns);
0210           theMPT->AddConstProperty("YIELDRATIO", 1.0);
0211 
0212           // set the MaterialPropertiesTable
0213           theMaterial->SetMaterialPropertiesTable(theMPT);
0214         }
0215 
0216         // properties of the TOB_Wafer, TOB_Silicon, TIB_Wafer
0217         else if ((theMaterial->GetName() == "TOB_Wafer") || (theMaterial->GetName() == "TIB_Wafer")) {
0218           theMPT->AddProperty("FASTCOMPONENT", PhotonEnergy, Scintillation, nEntries);
0219           theMPT->AddProperty("SLOWCOMPONENT", PhotonEnergy, Scintillation, nEntries);
0220           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex, nEntries);
0221           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthSiBarrel, nEntries);
0222           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, SiReflectivity, nEntries);
0223           theMPT->AddProperty("EFFICIENCY", PhotonEnergy, BarrelEfficiency, nEntries);
0224 
0225           theMPT->AddConstProperty("SCINTILLATIONYIELD", 12000.0 / MeV);
0226           theMPT->AddConstProperty("RESOLTUIONSCALE", 1.0);
0227           theMPT->AddConstProperty("FASTTIMECONSTANT", 20.0 * ns);
0228           theMPT->AddConstProperty("SLOWTIMECONSTANT", 45.0 * ns);
0229           theMPT->AddConstProperty("YIELDRATIO", 1.0);
0230 
0231           // set the MaterialPropertiesTable
0232           theMaterial->SetMaterialPropertiesTable(theMPT);
0233         }
0234 
0235         // properties of the TIB_ledge_side
0236         else if (theMaterial->GetName() == "TIB_ledge_side") {
0237           // set the refractive index
0238           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0239           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthGeneral, nEntries);
0240 
0241           // set the MaterialPropertiesTable
0242           theMaterial->SetMaterialPropertiesTable(theMPT);
0243         }
0244 
0245         // properties of air
0246         else if ((theMaterial->GetName() == "T_Air") || (theMaterial->GetName() == "Air")) {
0247           // set the refractive index
0248           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0249           // set the reflectivity
0250           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, SiReflectivity, nEntries);
0251           // set the absorptionlength
0252           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthTAir, nEntries);
0253 
0254           // set the MaterialPropertiesTable
0255           theMaterial->SetMaterialPropertiesTable(theMPT);
0256         }
0257 
0258         // properties of some materials in the Barrel
0259         // used to absorb photons to avoid hits in other TEC
0260         else if ((theMaterial->GetName() == "TIB_connector") || (theMaterial->GetName() == "TIB_cylinder") ||
0261                  (theMaterial->GetName() == "TID_Connector")) {
0262           // set the refractive index
0263           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0264           // set the reflectivity
0265           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, SiReflectivity, nEntries);
0266           // set the absorptionlength
0267           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthDead, nEntries);
0268 
0269           // set the MaterialPropertiesTable
0270           theMaterial->SetMaterialPropertiesTable(theMPT);
0271         }
0272 
0273         // properties of SiO2; used for the mirrors of the Alignment Tubes
0274         else if (theMaterial->GetName() == "Si O_2") {
0275           // set the refractive index
0276           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexMirror, nEntries);
0277           // set the absorptionlength
0278           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthMirror, nEntries);
0279           // set the reflectivity
0280           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, Reflectivity, nEntries);
0281 
0282           // set the MaterialPropertiesTable
0283           theMaterial->SetMaterialPropertiesTable(theMPT);
0284         }
0285 
0286         // properties of Aluminium
0287         else if ((theMaterial->GetName() == "TOB_Aluminium") || (theMaterial->GetName() == "Aluminium")) {
0288           // set the refractive index
0289           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0290           // set the reflectivity
0291           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, SiReflectivity, nEntries);
0292           // set the absorptionlength
0293           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthAl, nEntries);
0294 
0295           // set the MaterialPropertiesTable
0296           theMaterial->SetMaterialPropertiesTable(theMPT);
0297         }
0298 
0299         // properties of TOB_CF_Str
0300         else if ((theMaterial->GetName() == "TOB_CF_Str")) {
0301           // set the refractive index
0302           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0303           // set the reflectivity
0304           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, SiReflectivity, nEntries);
0305           // set the absorptionlength
0306           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthTOB_CF_Str, nEntries);
0307 
0308           // set the MaterialPropertiesTable
0309           theMaterial->SetMaterialPropertiesTable(theMPT);
0310         }
0311 
0312         // some other Tracker materials
0313         else if ((theMaterial->GetName() == "TID_CF") || (theMaterial->GetName() == "Nomex") ||
0314                  (theMaterial->GetName() == "TOB_Nomex") || (theMaterial->GetName() == "TID_Nomex") ||
0315                  (theMaterial->GetName() == "TOB_plate_C") || (theMaterial->GetName() == "TOB_rod") ||
0316                  (theMaterial->GetName() == "TOB_cool_DS") || (theMaterial->GetName() == "TOB_cool_SS") ||
0317                  (theMaterial->GetName() == "TID_in_cable") || (theMaterial->GetName() == "TOB_PA_rphi") ||
0318                  (theMaterial->GetName() == "TOB_frame_ele") || (theMaterial->GetName() == "TOB_PA_ster") ||
0319                  (theMaterial->GetName() == "TOB_ICB") || (theMaterial->GetName() == "TOB_CONN1") ||
0320                  (theMaterial->GetName() == "TOB_CONN2") || (theMaterial->GetName() == "TOB_CONN3") ||
0321                  (theMaterial->GetName() == "TOB_rail") || (theMaterial->GetName() == "TOB_sid_rail1") ||
0322                  (theMaterial->GetName() == "TOB_sid_rail2")) {
0323           // set the refractive index
0324           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0325           // set the reflectivity
0326           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, SiReflectivity, nEntries);
0327           // set the absorptionlength
0328           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthTOBCF, nEntries);
0329 
0330           // set the MaterialPropertiesTable
0331           theMaterial->SetMaterialPropertiesTable(theMPT);
0332         }
0333 
0334         // properties of some TIB materials
0335         else if ((theMaterial->GetName() == "TIB_CF") || (theMaterial->GetName() == "TIB_cables_ax_out") ||
0336                  (theMaterial->GetName() == "TIB_outer_supp") || (theMaterial->GetName() == "TIB_PA_rphi") ||
0337                  (theMaterial->GetName() == "TIB_rail") || (theMaterial->GetName() == "TIB_sid_rail1") ||
0338                  (theMaterial->GetName() == "TIB_sid_rail2") || (theMaterial->GetName() == "TIB_mod_cool")) {
0339           // set the refractive index
0340           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0341           // set the reflectivity
0342           theMPT->AddProperty("REFLECTIVITY", PhotonEnergy, SiReflectivity, nEntries);
0343           // set the absorptionlength
0344           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthTIBCF, nEntries);
0345 
0346           // set the MaterialPropertiesTable
0347           theMaterial->SetMaterialPropertiesTable(theMPT);
0348         }
0349 
0350         // properties of all other materials in the detector
0351         else {
0352           // set the refractive index
0353           theMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexGeneral, nEntries);
0354           // set the absorptionlength
0355           theMPT->AddProperty("ABSLENGTH", PhotonEnergy, AbsorptionLengthGeneral, nEntries);
0356 
0357           // set the MaterialPropertiesTable
0358           theMaterial->SetMaterialPropertiesTable(theMPT);
0359         }
0360       }
0361     }
0362   }
0363 
0364   // loop over the logical volumes and set the material for the sensitive
0365   // detectors
0366   const G4LogicalVolumeStore *theLogicalVolumeStore = G4LogicalVolumeStore::GetInstance();
0367   std::vector<G4LogicalVolume *>::const_iterator theLogicalVolume;
0368 
0369   for (theLogicalVolume = theLogicalVolumeStore->begin(); theLogicalVolume != theLogicalVolumeStore->end();
0370        theLogicalVolume++) {
0371     if (((*theLogicalVolume)->GetName() == "TECModule0StereoActive") ||
0372         ((*theLogicalVolume)->GetName() == "TECModule0RphiActive") ||
0373         ((*theLogicalVolume)->GetName() == "TECModule1StereoActive") ||
0374         ((*theLogicalVolume)->GetName() == "TECModule1RphiActive") ||
0375         ((*theLogicalVolume)->GetName() == "TECModule2RphiActive") ||
0376         ((*theLogicalVolume)->GetName() == "TECModule3RphiActive") ||
0377         ((*theLogicalVolume)->GetName() == "TECModule4StereoActive") ||
0378         ((*theLogicalVolume)->GetName() == "TECModule4RphiActive") ||
0379         ((*theLogicalVolume)->GetName() == "TECModule5RphiActive") ||
0380         ((*theLogicalVolume)->GetName() == "TECModule6RphiActive")) {
0381       // set the material
0382       (*theLogicalVolume)->SetMaterial(theTECWafer);
0383 
0384       if (theMPDebugLevel > 2) {
0385         std::cout << "  AC1CMS: found a logical volume: " << (*theLogicalVolume)->GetName() << std::endl;
0386         std::cout << "  AC1CMS: the logical volume material = " << (*theLogicalVolume)->GetMaterial()->GetName()
0387                   << std::endl;
0388         std::cout << "  AC1CMS: the MaterialPropertiesTable = " << std::endl;
0389         (*theLogicalVolume)->GetMaterial()->GetMaterialPropertiesTable()->DumpTable();
0390       }
0391     } else if (((*theLogicalVolume)->GetName() == "TOBActiveSter0") ||
0392                ((*theLogicalVolume)->GetName() == "TOBActiveRphi0") ||
0393                ((*theLogicalVolume)->GetName() == "TOBActiveRphi2") ||
0394                ((*theLogicalVolume)->GetName() == "TOBActiveRphi4")) {
0395       // set the material
0396       (*theLogicalVolume)->SetMaterial(theTOBWafer);
0397 
0398       if (theMPDebugLevel > 2) {
0399         std::cout << "  AC1CMS: found a logical volume: " << (*theLogicalVolume)->GetName() << std::endl;
0400         std::cout << "  AC1CMS: the logical volume material = " << (*theLogicalVolume)->GetMaterial()->GetName()
0401                   << std::endl;
0402         std::cout << "  AC1CMS: the MaterialPropertiesTable = " << std::endl;
0403         (*theLogicalVolume)->GetMaterial()->GetMaterialPropertiesTable()->DumpTable();
0404       }
0405     } else if (((*theLogicalVolume)->GetName() == "TIBActiveSter0") ||
0406                ((*theLogicalVolume)->GetName() == "TIBActiveRphi0") ||
0407                ((*theLogicalVolume)->GetName() == "TIBActiveRphi2")) {
0408       // set the material
0409       (*theLogicalVolume)->SetMaterial(theTIBWafer);
0410 
0411       if (theMPDebugLevel > 2) {
0412         std::cout << "  AC1CMS: found a logical volume: " << (*theLogicalVolume)->GetName() << std::endl;
0413         std::cout << "  AC1CMS: the logical volume material = " << (*theLogicalVolume)->GetMaterial()->GetName()
0414                   << std::endl;
0415         std::cout << "  AC1CMS: the MaterialPropertiesTable = " << std::endl;
0416         (*theLogicalVolume)->GetMaterial()->GetMaterialPropertiesTable()->DumpTable();
0417       }
0418     }
0419   }
0420 }