#include <Validation/Geometry/interface/MaterialBudgetCategorizer.h>
Public Member Functions | |
std::vector< float > | l0fraction (std::string s) |
int | material (std::string s) |
MaterialBudgetCategorizer () | |
int | volume (std::string s) |
std::vector< float > | x0fraction (std::string s) |
Private Member Functions | |
void | buildCategoryMap (std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap) |
void | buildMaps () |
Private Attributes | |
std::map< std::string, std::vector< float > > | theL0Map |
std::map< std::string, int > | theMaterialMap |
std::map< std::string, int > | theVolumeMap |
std::map< std::string, std::vector< float > > | theX0Map |
Definition at line 15 of file MaterialBudgetCategorizer.h.
MaterialBudgetCategorizer::MaterialBudgetCategorizer | ( | ) |
Definition at line 20 of file MaterialBudgetCategorizer.cc.
References buildMaps().
00021 { 00022 buildMaps(); 00023 }
void MaterialBudgetCategorizer::buildCategoryMap | ( | std::string | theMaterialFileName, | |
std::map< std::string, std::vector< float > > & | theMap | |||
) | [private] |
Definition at line 131 of file MaterialBudgetCategorizer.cc.
References parsecf::pyparsing::col(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and Exception.
Referenced by buildMaps().
00131 { 00132 // const G4MaterialTable* matTable = G4Material::GetMaterialTable(); 00133 // G4int matSize = matTable->size(); 00134 00135 std::ifstream theMaterialFile(theMaterialFileName.c_str()); 00136 if (!theMaterialFile) 00137 cms::Exception("LogicError") <<" File not found " << theMaterialFile; 00138 00139 // fill everything as "other" 00140 float sup,sen,cab,col,ele,oth,air; 00141 sup=sen=cab=col=ele=0.; 00142 oth=1.; 00143 air=0; 00144 00145 // 00146 std::string materialName; 00147 while(theMaterialFile) { 00148 theMaterialFile >> materialName; 00149 theMaterialFile >> sup >> sen >> cab >> col >> ele; 00150 oth = 0.000; 00151 air = 0.000; 00152 theMap[materialName].clear(); // clear before re-filling 00153 theMap[materialName].push_back(sup); // sup 00154 theMap[materialName].push_back(sen); // sen 00155 theMap[materialName].push_back(cab); // cab 00156 theMap[materialName].push_back(col); // col 00157 theMap[materialName].push_back(ele); // ele 00158 theMap[materialName].push_back(oth); // oth 00159 theMap[materialName].push_back(air); // air 00160 cout << " material " << materialName << " filled " 00161 << " SUP " << sup 00162 << " SEN " << sen 00163 << " CAB " << cab 00164 << " COL " << col 00165 << " ELE " << ele 00166 << " OTH " << oth 00167 << " AIR " << air 00168 << endl; 00169 } 00170 00171 }
void MaterialBudgetCategorizer::buildMaps | ( | ) | [private] |
Definition at line 25 of file MaterialBudgetCategorizer.cc.
References buildCategoryMap(), parsecf::pyparsing::col(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), theL0Map, theMaterialMap, theVolumeMap, and theX0Map.
Referenced by MaterialBudgetCategorizer().
00026 { 00027 //----- Build map volume name - volume index 00028 G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance(); 00029 G4LogicalVolumeStore::iterator ite; 00030 int ii = 0; 00031 for (ite = lvs->begin(); ite != lvs->end(); ite++) { 00032 theVolumeMap[(*ite)->GetName()] = ii++; 00033 } 00034 00035 //----- Build map material name - volume index 00036 const G4MaterialTable* matTable = G4Material::GetMaterialTable(); 00037 G4int matSize = matTable->size(); 00038 for( ii = 0; ii < matSize; ii++ ) { 00039 theMaterialMap[ (*matTable)[ii]->GetName()] = ii++; 00040 } 00041 00042 // rr 00043 00044 //----- Build map material name 00045 for( int ii = 0; ii < matSize; ii++ ) { 00046 float sup,sen,cab,col,ele,oth,air; 00047 sup=sen=cab=col=ele=0.; 00048 oth=1.; 00049 air=0; 00050 cout << " material " << (*matTable)[ii]->GetName() << " prepared" 00051 << endl; 00052 if((*matTable)[ii]->GetName()=="Air" 00053 || 00054 (*matTable)[ii]->GetName()=="Vacuum" 00055 ) { 00056 air=1.000; 00057 oth=0.000; 00058 } 00059 // actually this class does not work if there are spaces into material names --> Recover material properties 00060 if((*matTable)[ii]->GetName()=="Carbon fibre str.") { 00061 sup=1.000; 00062 oth=0.000; 00063 } 00064 // X0 00065 theX0Map[ (*matTable)[ii]->GetName() ].push_back(sup); // sup 00066 theX0Map[ (*matTable)[ii]->GetName() ].push_back(sen); // sen 00067 theX0Map[ (*matTable)[ii]->GetName() ].push_back(cab); // cab 00068 theX0Map[ (*matTable)[ii]->GetName() ].push_back(col); // col 00069 theX0Map[ (*matTable)[ii]->GetName() ].push_back(ele); // ele 00070 theX0Map[ (*matTable)[ii]->GetName() ].push_back(oth); // oth 00071 theX0Map[ (*matTable)[ii]->GetName() ].push_back(air); // air 00072 // L0 00073 theL0Map[ (*matTable)[ii]->GetName() ].push_back(sup); // sup 00074 theL0Map[ (*matTable)[ii]->GetName() ].push_back(sen); // sen 00075 theL0Map[ (*matTable)[ii]->GetName() ].push_back(cab); // cab 00076 theL0Map[ (*matTable)[ii]->GetName() ].push_back(col); // col 00077 theL0Map[ (*matTable)[ii]->GetName() ].push_back(ele); // ele 00078 theL0Map[ (*matTable)[ii]->GetName() ].push_back(oth); // oth 00079 theL0Map[ (*matTable)[ii]->GetName() ].push_back(air); // air 00080 } 00081 // 00082 00083 //----- Build map material name - X0 contributes 00084 cout << endl << endl << "MaterialBudgetCategorizer::Fill X0 Map" << endl; 00085 std::string theMaterialX0FileName = edm::FileInPath("Validation/Geometry/data/trackerMaterials.x0").fullPath(); 00086 buildCategoryMap(theMaterialX0FileName, theX0Map); 00087 //----- Build map material name - L0 contributes 00088 cout << endl << endl << "MaterialBudgetCategorizer::Fill L0 Map" << endl; 00089 std::string theMaterialL0FileName = edm::FileInPath("Validation/Geometry/data/trackerMaterials.l0").fullPath(); 00090 buildCategoryMap(theMaterialL0FileName, theL0Map); 00091 // summary of all the materials loaded 00092 cout << endl << endl << "MaterialBudgetCategorizer::Material Summary --------" << endl; 00093 G4EmCalculator calc; 00094 for( ii = 0; ii < matSize; ii++ ) { 00095 // edm::LogInfo("MaterialBudgetCategorizer") 00096 cout << " material " << (*matTable)[ii]->GetName() 00097 << endl 00098 << "\t density = " << G4BestUnit((*matTable)[ii]->GetDensity(),"Volumic Mass") 00099 << endl 00100 << "\t X0 = " << (*matTable)[ii]->GetRadlen() << " mm" 00101 << endl 00102 << "\t Energy threshold for photons for 100 mm range = " 00103 << G4BestUnit(calc.ComputeEnergyCutFromRangeCut(100, G4String("gamma"), (*matTable)[ii]->GetName()) , "Energy") 00104 << endl 00105 << " SUP " << theX0Map[ (*matTable)[ii]->GetName() ][0] 00106 << " SEN " << theX0Map[ (*matTable)[ii]->GetName() ][1] 00107 << " CAB " << theX0Map[ (*matTable)[ii]->GetName() ][2] 00108 << " COL " << theX0Map[ (*matTable)[ii]->GetName() ][3] 00109 << " ELE " << theX0Map[ (*matTable)[ii]->GetName() ][4] 00110 << " OTH " << theX0Map[ (*matTable)[ii]->GetName() ][5] 00111 << " AIR " << theX0Map[ (*matTable)[ii]->GetName() ][6] 00112 << endl 00113 << "\t Lambda0 = " << (*matTable)[ii]->GetNuclearInterLength() << " mm" 00114 << endl 00115 << " SUP " << theL0Map[ (*matTable)[ii]->GetName() ][0] 00116 << " SEN " << theL0Map[ (*matTable)[ii]->GetName() ][1] 00117 << " CAB " << theL0Map[ (*matTable)[ii]->GetName() ][2] 00118 << " COL " << theL0Map[ (*matTable)[ii]->GetName() ][3] 00119 << " ELE " << theL0Map[ (*matTable)[ii]->GetName() ][4] 00120 << " OTH " << theL0Map[ (*matTable)[ii]->GetName() ][5] 00121 << " AIR " << theL0Map[ (*matTable)[ii]->GetName() ][6] 00122 << endl; 00123 if( theX0Map[ (*matTable)[ii]->GetName() ][5] == 1 || theL0Map[ (*matTable)[ii]->GetName() ][5] == 1 ) 00124 std::cout << "WARNING: material with no category: " << (*matTable)[ii]->GetName() << std::endl; 00125 } 00126 // 00127 // rr 00128 00129 }
std::vector<float> MaterialBudgetCategorizer::l0fraction | ( | std::string | s | ) | [inline] |
Definition at line 24 of file MaterialBudgetCategorizer.h.
References theL0Map.
Referenced by MaterialBudgetData::dataPerStep().
int MaterialBudgetCategorizer::material | ( | std::string | s | ) | [inline] |
Definition at line 21 of file MaterialBudgetCategorizer.h.
References theMaterialMap.
Referenced by MaterialBudgetData::dataPerStep().
00021 {return theMaterialMap[s];}
int MaterialBudgetCategorizer::volume | ( | std::string | s | ) | [inline] |
Definition at line 20 of file MaterialBudgetCategorizer.h.
References theVolumeMap.
Referenced by MaterialBudgetData::dataPerStep().
00020 {return theVolumeMap[s];}
std::vector<float> MaterialBudgetCategorizer::x0fraction | ( | std::string | s | ) | [inline] |
Definition at line 23 of file MaterialBudgetCategorizer.h.
References theX0Map.
Referenced by MaterialBudgetData::dataPerStep().
std::map<std::string,std::vector<float> > MaterialBudgetCategorizer::theL0Map [private] |
Definition at line 32 of file MaterialBudgetCategorizer.h.
Referenced by buildMaps(), and l0fraction().
std::map<std::string,int> MaterialBudgetCategorizer::theMaterialMap [private] |
Definition at line 29 of file MaterialBudgetCategorizer.h.
Referenced by buildMaps(), and material().
std::map<std::string,int> MaterialBudgetCategorizer::theVolumeMap [private] |
std::map<std::string,std::vector<float> > MaterialBudgetCategorizer::theX0Map [private] |
Definition at line 31 of file MaterialBudgetCategorizer.h.
Referenced by buildMaps(), and x0fraction().