3 #include "G4LogicalVolumeStore.hh"
4 #include "G4Material.hh"
5 #include "G4UnitsTable.hh"
6 #include "G4EmCalculator.hh"
7 #include "G4UnitsTable.hh"
27 G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
28 G4LogicalVolumeStore::iterator ite;
30 for (ite = lvs->begin(); ite != lvs->end(); ite++) {
31 theVolumeMap[(*ite)->GetName()] = ii++;
35 const G4MaterialTable* matTable = G4Material::GetMaterialTable();
36 G4int matSize = matTable->size();
37 for( ii = 0; ii < matSize; ii++ ) {
38 theMaterialMap[ (*matTable)[
ii]->GetName()] = ii+1;
44 for(
int ii = 0; ii < matSize; ii++ ) {
45 float sup,sen,cab,
col,ele,oth,air;
46 sup=sen=cab=col=ele=0.;
49 cout <<
" material " << (*matTable)[
ii]->GetName() <<
" prepared"
51 if((*matTable)[ii]->GetName()==
"Air"
53 (*matTable)[ii]->GetName()==
"Vacuum"
59 if((*matTable)[ii]->GetName()==
"Carbon fibre str.") {
64 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(sup);
65 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(sen);
66 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(cab);
67 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(col);
68 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(ele);
69 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(oth);
70 theX0Map[ (*matTable)[
ii]->GetName() ].push_back(air);
72 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(sup);
73 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(sen);
74 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(cab);
75 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(col);
76 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(ele);
77 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(oth);
78 theL0Map[ (*matTable)[
ii]->GetName() ].push_back(air);
83 cout << endl << endl <<
"MaterialBudgetCategorizer::Fill X0 Map" << endl;
85 buildCategoryMap(theMaterialX0FileName, theX0Map);
87 cout << endl << endl <<
"MaterialBudgetCategorizer::Fill L0 Map" << endl;
89 buildCategoryMap(theMaterialL0FileName, theL0Map);
91 cout << endl << endl <<
"MaterialBudgetCategorizer::Material Summary --------" << endl;
93 for( ii = 0; ii < matSize; ii++ ) {
95 cout <<
" material " << (*matTable)[
ii]->GetName()
97 <<
"\t density = " << G4BestUnit((*matTable)[ii]->GetDensity(),
"Volumic Mass")
99 <<
"\t X0 = " << (*matTable)[
ii]->GetRadlen() <<
" mm"
101 <<
"\t Energy threshold for photons for 100 mm range = "
102 << G4BestUnit(calc.ComputeEnergyCutFromRangeCut(100, G4String(
"gamma"), (*matTable)[ii]->GetName()) ,
"Energy")
104 <<
" SUP " << theX0Map[ (*matTable)[
ii]->GetName() ][0]
105 <<
" SEN " << theX0Map[ (*matTable)[
ii]->GetName() ][1]
106 <<
" CAB " << theX0Map[ (*matTable)[
ii]->GetName() ][2]
107 <<
" COL " << theX0Map[ (*matTable)[
ii]->GetName() ][3]
108 <<
" ELE " << theX0Map[ (*matTable)[
ii]->GetName() ][4]
109 <<
" OTH " << theX0Map[ (*matTable)[
ii]->GetName() ][5]
110 <<
" AIR " << theX0Map[ (*matTable)[
ii]->GetName() ][6]
112 <<
"\t Lambda0 = " << (*matTable)[
ii]->GetNuclearInterLength() <<
" mm"
114 <<
" SUP " << theL0Map[ (*matTable)[
ii]->GetName() ][0]
115 <<
" SEN " << theL0Map[ (*matTable)[
ii]->GetName() ][1]
116 <<
" CAB " << theL0Map[ (*matTable)[
ii]->GetName() ][2]
117 <<
" COL " << theL0Map[ (*matTable)[
ii]->GetName() ][3]
118 <<
" ELE " << theL0Map[ (*matTable)[
ii]->GetName() ][4]
119 <<
" OTH " << theL0Map[ (*matTable)[
ii]->GetName() ][5]
120 <<
" AIR " << theL0Map[ (*matTable)[
ii]->GetName() ][6]
122 if( theX0Map[ (*matTable)[ii]->GetName() ][5] == 1 || theL0Map[ (*matTable)[ii]->GetName() ][5] == 1 )
123 std::cout <<
"WARNING: material with no category: " << (*matTable)[
ii]->GetName() << std::endl;
134 std::ifstream theMaterialFile(theMaterialFileName.c_str());
135 if (!theMaterialFile)
136 cms::Exception(
"LogicError") <<
" File not found " << theMaterialFile;
139 float sup,sen,cab,
col,ele,oth,air;
140 sup=sen=cab=col=ele=0.;
146 while(theMaterialFile) {
147 theMaterialFile >> materialName;
148 theMaterialFile >> sup >> sen >> cab >> col >> ele;
151 theMap[materialName].clear();
152 theMap[materialName].push_back(sup);
153 theMap[materialName].push_back(sen);
154 theMap[materialName].push_back(cab);
155 theMap[materialName].push_back(col);
156 theMap[materialName].push_back(ele);
157 theMap[materialName].push_back(oth);
158 theMap[materialName].push_back(air);
159 cout <<
" material " << materialName <<
" filled "
void buildCategoryMap(std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)
MaterialBudgetCategorizer()
std::string fullPath() const