4 #include "G4LogicalVolumeStore.hh"
5 #include "G4Material.hh"
6 #include "G4UnitsTable.hh"
7 #include "G4EmCalculator.hh"
8 #include "G4UnitsTable.hh"
28 G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
29 G4LogicalVolumeStore::iterator ite;
31 for (ite = lvs->begin(); ite != lvs->end(); ite++) {
32 theVolumeMap[(*ite)->GetName()] = ii++;
36 const G4MaterialTable* matTable = G4Material::GetMaterialTable();
37 G4int matSize = matTable->size();
38 for( ii = 0; ii < matSize; ii++ ) {
39 theMaterialMap[ (*matTable)[ii]->GetName()] = ii+1;
45 for(
int ii = 0; ii < matSize; ii++ ) {
46 float sup,sen,cab,col,ele,oth,air;
47 sup=sen=cab=col=ele=0.;
50 cout <<
" material " << (*matTable)[ii]->GetName() <<
" prepared"
52 if((*matTable)[ii]->GetName()==
"Air"
54 (*matTable)[ii]->GetName()==
"Vacuum"
60 if((*matTable)[ii]->GetName()==
"Carbon fibre str.") {
65 theX0Map[ (*matTable)[ii]->GetName() ].push_back(sup);
66 theX0Map[ (*matTable)[ii]->GetName() ].push_back(sen);
67 theX0Map[ (*matTable)[ii]->GetName() ].push_back(cab);
68 theX0Map[ (*matTable)[ii]->GetName() ].push_back(col);
69 theX0Map[ (*matTable)[ii]->GetName() ].push_back(ele);
70 theX0Map[ (*matTable)[ii]->GetName() ].push_back(oth);
71 theX0Map[ (*matTable)[ii]->GetName() ].push_back(air);
73 theL0Map[ (*matTable)[ii]->GetName() ].push_back(sup);
74 theL0Map[ (*matTable)[ii]->GetName() ].push_back(sen);
75 theL0Map[ (*matTable)[ii]->GetName() ].push_back(cab);
76 theL0Map[ (*matTable)[ii]->GetName() ].push_back(col);
77 theL0Map[ (*matTable)[ii]->GetName() ].push_back(ele);
78 theL0Map[ (*matTable)[ii]->GetName() ].push_back(oth);
79 theL0Map[ (*matTable)[ii]->GetName() ].push_back(air);
84 cout << endl << endl <<
"MaterialBudgetCategorizer::Fill X0 Map" << endl;
86 buildCategoryMap(theMaterialX0FileName, theX0Map);
88 cout << endl << endl <<
"MaterialBudgetCategorizer::Fill L0 Map" << endl;
90 buildCategoryMap(theMaterialL0FileName, theL0Map);
92 cout << endl << endl <<
"MaterialBudgetCategorizer::Material Summary --------" << endl;
94 for( ii = 0; ii < matSize; ii++ ) {
96 cout <<
" material " << (*matTable)[ii]->GetName()
98 <<
"\t density = " << G4BestUnit((*matTable)[ii]->GetDensity(),
"Volumic Mass")
100 <<
"\t X0 = " << (*matTable)[ii]->GetRadlen() <<
" mm"
102 <<
"\t Energy threshold for photons for 100 mm range = "
103 << G4BestUnit(calc.ComputeEnergyCutFromRangeCut(100, G4String(
"gamma"), (*matTable)[ii]->GetName()) ,
"Energy")
105 <<
" SUP " << theX0Map[ (*matTable)[ii]->GetName() ][0]
106 <<
" SEN " << theX0Map[ (*matTable)[ii]->GetName() ][1]
107 <<
" CAB " << theX0Map[ (*matTable)[ii]->GetName() ][2]
108 <<
" COL " << theX0Map[ (*matTable)[ii]->GetName() ][3]
109 <<
" ELE " << theX0Map[ (*matTable)[ii]->GetName() ][4]
110 <<
" OTH " << theX0Map[ (*matTable)[ii]->GetName() ][5]
111 <<
" AIR " << theX0Map[ (*matTable)[ii]->GetName() ][6]
113 <<
"\t Lambda0 = " << (*matTable)[ii]->GetNuclearInterLength() <<
" mm"
115 <<
" SUP " << theL0Map[ (*matTable)[ii]->GetName() ][0]
116 <<
" SEN " << theL0Map[ (*matTable)[ii]->GetName() ][1]
117 <<
" CAB " << theL0Map[ (*matTable)[ii]->GetName() ][2]
118 <<
" COL " << theL0Map[ (*matTable)[ii]->GetName() ][3]
119 <<
" ELE " << theL0Map[ (*matTable)[ii]->GetName() ][4]
120 <<
" OTH " << theL0Map[ (*matTable)[ii]->GetName() ][5]
121 <<
" AIR " << theL0Map[ (*matTable)[ii]->GetName() ][6]
123 if( theX0Map[ (*matTable)[ii]->GetName() ][5] == 1 || theL0Map[ (*matTable)[ii]->GetName() ][5] == 1 )
124 std::cout <<
"WARNING: material with no category: " << (*matTable)[ii]->GetName() << std::endl;
135 std::ifstream theMaterialFile(theMaterialFileName.c_str());
136 if (!theMaterialFile)
137 cms::Exception(
"LogicError") <<
" File not found " << theMaterialFile;
140 float sup,sen,cab,col,ele,oth,air;
141 sup=sen=cab=col=ele=0.;
146 std::string materialName;
147 while(theMaterialFile) {
148 theMaterialFile >> materialName;
149 theMaterialFile >> sup >> sen >> cab >> col >> ele;
152 theMap[materialName].clear();
153 theMap[materialName].push_back(sup);
154 theMap[materialName].push_back(sen);
155 theMap[materialName].push_back(cab);
156 theMap[materialName].push_back(col);
157 theMap[materialName].push_back(ele);
158 theMap[materialName].push_back(oth);
159 theMap[materialName].push_back(air);
160 cout <<
" material " << materialName <<
" filled "
void buildCategoryMap(std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)
MaterialBudgetCategorizer()
std::string fullPath() const