Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:45:05

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