3 #include "G4LogicalVolumeStore.hh" 4 #include "G4Material.hh" 5 #include "G4UnitsTable.hh" 6 #include "G4EmCalculator.hh" 7 #include "G4UnitsTable.hh" 23 G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
24 G4LogicalVolumeStore::iterator ite;
26 for (ite = lvs->begin(); ite != lvs->end(); ite++) {
31 const G4MaterialTable* matTable = G4Material::GetMaterialTable();
32 G4int matSize = matTable->size();
33 for( ii = 0; ii < matSize; ii++ ) {
38 for(
int ii = 0; ii < matSize; ii++ ) {
39 float sup,sen,cab,
col,ele,oth,air;
40 sup=sen=cab=col=ele=0.;
43 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCategorizer: Material " << (*matTable)[
ii]->GetName() <<
" prepared";
44 if((*matTable)[ii]->GetName()==
"Air" 46 (*matTable)[ii]->GetName()==
"Vacuum" 52 if((*matTable)[ii]->GetName()==
"Carbon fibre str.") {
57 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(sup);
58 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(sen);
59 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(cab);
60 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(col);
61 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(ele);
62 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(oth);
63 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(air);
65 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(sup);
66 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(sen);
67 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(cab);
68 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(col);
69 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(ele);
70 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(oth);
71 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(air);
75 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCategorizer: Fill X0 Map";
82 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCategorizer: Fill L0 Map";
89 edm::LogInfo(
"MaterialBudget") <<
"MaterialBudgetCategorizer: Material Summary Starts";
91 for( ii = 0; ii < matSize; ii++ ) {
93 <<
"MaterialBudgetCateogorizer: Material " << (*matTable)[
ii]->GetName()
95 <<
"\t density = " << G4BestUnit((*matTable)[ii]->GetDensity(),
"Volumic Mass")
97 <<
"\t X0 = " << (*matTable)[
ii]->GetRadlen() <<
" mm" 99 <<
"\t Energy threshold for photons for 100 mm range = " 100 << G4BestUnit(calc.ComputeEnergyCutFromRangeCut(100, G4String(
"gamma"), (*matTable)[ii]->GetName()) ,
"Energy")
102 <<
" SUP " <<
theX0Map[ (*matTable)[
ii]->GetName() ][0]
103 <<
" SEN " <<
theX0Map[ (*matTable)[
ii]->GetName() ][1]
104 <<
" CAB " <<
theX0Map[ (*matTable)[
ii]->GetName() ][2]
105 <<
" COL " <<
theX0Map[ (*matTable)[
ii]->GetName() ][3]
106 <<
" ELE " <<
theX0Map[ (*matTable)[
ii]->GetName() ][4]
107 <<
" OTH " <<
theX0Map[ (*matTable)[
ii]->GetName() ][5]
108 <<
" AIR " <<
theX0Map[ (*matTable)[
ii]->GetName() ][6]
110 <<
"\t Lambda0 = " << (*matTable)[
ii]->GetNuclearInterLength() <<
" mm" 112 <<
" SUP " <<
theL0Map[ (*matTable)[
ii]->GetName() ][0]
113 <<
" SEN " <<
theL0Map[ (*matTable)[
ii]->GetName() ][1]
114 <<
" CAB " <<
theL0Map[ (*matTable)[
ii]->GetName() ][2]
115 <<
" COL " <<
theL0Map[ (*matTable)[
ii]->GetName() ][3]
116 <<
" ELE " <<
theL0Map[ (*matTable)[
ii]->GetName() ][4]
117 <<
" OTH " <<
theL0Map[ (*matTable)[
ii]->GetName() ][5]
118 <<
" AIR " <<
theL0Map[ (*matTable)[
ii]->GetName() ][6]
120 if(
theX0Map[ (*matTable)[ii]->GetName() ][5] == 1 ||
theL0Map[ (*matTable)[ii]->GetName() ][5] == 1 )
122 <<
"MaterialBudgetCategorizer Material with no category: " << (*matTable)[
ii]->GetName();
128 std::ifstream theMaterialFile(theMaterialFileName);
129 if (!theMaterialFile)
130 cms::Exception(
"LogicError") <<
" File not found " << theMaterialFileName;
133 float sup,sen,cab,
col,ele,oth,air;
134 sup=sen=cab=col=ele=0.;
138 while(theMaterialFile) {
139 theMaterialFile >> materialName;
140 theMaterialFile >> sup >> sen >> cab >> col >> ele;
143 theMap[materialName].clear();
144 theMap[materialName].push_back(sup);
145 theMap[materialName].push_back(sen);
146 theMap[materialName].push_back(cab);
147 theMap[materialName].push_back(col);
148 theMap[materialName].push_back(ele);
149 theMap[materialName].push_back(oth);
150 theMap[materialName].push_back(air);
152 <<
"MaterialBudgetCategorizer: Material " << materialName <<
" filled " 167 std::ifstream theMaterialFile(theMaterialFileName);
168 if (!theMaterialFile)
169 cms::Exception(
"LogicError") <<
" File not found " << theMaterialFileName;
172 float Air,Cables,Copper,H_Scintillator,Lead,M_NEMA_FR4_plate,Silicon,StainlessSteel,WCu, oth;
173 Air=Cables=Copper=H_Scintillator=Lead=M_NEMA_FR4_plate=Silicon=StainlessSteel=WCu=0.;
176 while(theMaterialFile) {
177 theMaterialFile >> materialName;
178 theMaterialFile >> Air >> Cables >> Copper >> H_Scintillator >> Lead >> M_NEMA_FR4_plate >> Silicon >> StainlessSteel >> WCu;
180 if (materialName[0] ==
'#')
183 std::replace(materialName.begin(), materialName.end(),
'*',
' ');
185 theMap[materialName].clear();
186 theMap[materialName].push_back(Air );
187 theMap[materialName].push_back(Cables );
188 theMap[materialName].push_back(Copper );
189 theMap[materialName].push_back(H_Scintillator );
190 theMap[materialName].push_back(Lead );
191 theMap[materialName].push_back(M_NEMA_FR4_plate);
192 theMap[materialName].push_back(Silicon );
193 theMap[materialName].push_back(StainlessSteel );
194 theMap[materialName].push_back(WCu );
195 theMap[materialName].push_back(oth );
197 <<
"MaterialBudgetCategorizer: material " << materialName <<
" filled " 199 <<
"\tAir " << Air << std::endl
200 <<
"\tCables " << Cables << std::endl
201 <<
"\tCopper " << Copper << std::endl
202 <<
"\tH_Scintillator " << H_Scintillator << std::endl
203 <<
"\tLead " << Lead << std::endl
204 <<
"\tM_NEMA_FR4_plate " << M_NEMA_FR4_plate << std::endl
205 <<
"\tSilicon " << Silicon << std::endl
206 <<
"\tStainlessSteel " << StainlessSteel << std::endl
207 <<
"\tWCu " << WCu << std::endl
std::map< std::string, int > theVolumeMap
def replace(string, replacements)
std::map< std::string, std::vector< float > > theX0Map
std::map< std::string, std::vector< float > > theHGCalL0Map
void buildCategoryMap(std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)
MaterialBudgetCategorizer()
std::map< std::string, std::vector< float > > theL0Map
std::map< std::string, std::vector< float > > theHGCalX0Map
std::string fullPath() const
std::map< std::string, int > theMaterialMap
void buildHGCalCategoryMap(std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)