CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MaterialBudgetCategorizer Class Reference

#include <MaterialBudgetCategorizer.h>

Public Member Functions

const std::vector< float > & HGCall0fraction (std::string s)
 
const std::vector< float > & HGCalx0fraction (std::string s)
 
const std::vector< float > & l0fraction (std::string s)
 
int material (std::string s)
 
 MaterialBudgetCategorizer (std::string mode)
 
int volume (std::string s)
 
const std::vector< float > & x0fraction (std::string s)
 

Private Member Functions

void buildCategoryMap (std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)
 
void buildHGCalCategoryMap (std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)
 
void buildMaps ()
 

Private Attributes

std::map< std::string, std::vector< float > > theHGCalL0Map
 
std::map< std::string, std::vector< float > > theHGCalX0Map
 
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
 

Detailed Description

Definition at line 15 of file MaterialBudgetCategorizer.h.

Constructor & Destructor Documentation

MaterialBudgetCategorizer::MaterialBudgetCategorizer ( std::string  mode)

Definition at line 15 of file MaterialBudgetCategorizer.cc.

References buildCategoryMap(), buildHGCalCategoryMap(), edm::FileInPath::fullPath(), cuy::ii, AlCaHLTBitMon_QueryRunRegistry::string, theHGCalL0Map, theHGCalX0Map, theL0Map, theVolumeMap, and theX0Map.

16 {
17  //----- Build map volume name - volume index
18  G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
19  G4LogicalVolumeStore::iterator ite;
20  int ii = 0;
21  for (ite = lvs->begin(); ite != lvs->end(); ite++) {
22  theVolumeMap[(*ite)->GetName()] = ii++;
23  }
24 
25  if ( mode.compare("Tracker") == 0 ) {
26  std::string theMaterialX0FileName = edm::FileInPath("Validation/Geometry/data/trackerMaterials.x0").fullPath();
27  buildCategoryMap(theMaterialX0FileName, theX0Map);
28  std::string theMaterialL0FileName = edm::FileInPath("Validation/Geometry/data/trackerMaterials.l0").fullPath();
29  buildCategoryMap(theMaterialL0FileName, theL0Map);
30  } else if ( mode.compare("HGCal") == 0 ){
31  std::string thehgcalMaterialX0FileName = edm::FileInPath("Validation/Geometry/data/hgcalMaterials.x0").fullPath();
32  buildHGCalCategoryMap(thehgcalMaterialX0FileName, theHGCalX0Map);
33  std::string thehgcalMaterialL0FileName = edm::FileInPath("Validation/Geometry/data/hgcalMaterials.l0").fullPath();
34  buildHGCalCategoryMap(thehgcalMaterialL0FileName, theHGCalL0Map);
35  }
36 }
std::map< std::string, int > theVolumeMap
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)
ii
Definition: cuy.py:590
std::map< std::string, std::vector< float > > theL0Map
std::map< std::string, std::vector< float > > theHGCalX0Map
std::string fullPath() const
Definition: FileInPath.cc:163
void buildHGCalCategoryMap(std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)

Member Function Documentation

void MaterialBudgetCategorizer::buildCategoryMap ( std::string  theMaterialFileName,
std::map< std::string, std::vector< float > > &  theMap 
)
private

Definition at line 38 of file MaterialBudgetCategorizer.cc.

References cuy::col, Exception, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HGCall0fraction(), and MaterialBudgetCategorizer().

40 {
41 
42  std::ifstream theMaterialFile(theMaterialFileName);
43 
44  if (!theMaterialFile)
45  cms::Exception("LogicError") << " File not found " << theMaterialFileName;
46 
47  float sup,sen,cab,col,ele,oth,air;
48  sup=sen=cab=col=ele=0.;
49 
50  std::string materialName;
51 
52  while(theMaterialFile) {
53  theMaterialFile >> materialName;
54  theMaterialFile >> sup >> sen >> cab >> col >> ele;
55 
56  if (materialName[0] == '#') //Ignore comments
57  continue;
58 
59  oth = 0.000;
60  air = 0.000;
61  theMap[materialName].clear(); // clear before re-filling
62  theMap[materialName].push_back(sup); // sup
63  theMap[materialName].push_back(sen); // sen
64  theMap[materialName].push_back(cab); // cab
65  theMap[materialName].push_back(col); // col
66  theMap[materialName].push_back(ele); // ele
67  theMap[materialName].push_back(oth); // oth
68  theMap[materialName].push_back(air); // air
69  edm::LogInfo("MaterialBudget")
70  << "MaterialBudgetCategorizer: Material " << materialName << " filled: "
71  << "\n\tSUP " << sup
72  << "\n\tSEN " << sen
73  << "\n\tCAB " << cab
74  << "\n\tCOL " << col
75  << "\n\tELE " << ele
76  << "\n\tOTH " << oth
77  << "\n\tAIR " << air
78  << "\n\tAdd up to: " << sup + sen + cab + col + ele + oth + air;
79  }
80 }
col
Definition: cuy.py:1010
void MaterialBudgetCategorizer::buildHGCalCategoryMap ( std::string  theMaterialFileName,
std::map< std::string, std::vector< float > > &  theMap 
)
private

Definition at line 82 of file MaterialBudgetCategorizer.cc.

References Exception, python.rootplot.root2matplotlib::replace(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HGCall0fraction(), and MaterialBudgetCategorizer().

84 {
85 
86  std::ifstream theMaterialFile(theMaterialFileName);
87  if (!theMaterialFile)
88  cms::Exception("LogicError") <<" File not found " << theMaterialFileName;
89 
90  // fill everything as "other"
91  float air,cables,copper,h_scintillator,lead,hgc_g10_fr4,silicon,stainlesssteel,wcu,oth,epoxy,kapton,aluminium;
92  air=cables=copper=h_scintillator=lead=hgc_g10_fr4=silicon=stainlesssteel=wcu=epoxy=kapton=aluminium=0.;
93 
94  std::string materialName;
95  while(theMaterialFile) {
96  theMaterialFile >> materialName;
97  theMaterialFile >> air >> cables >> copper >> h_scintillator >> lead >> hgc_g10_fr4 >> silicon >> stainlesssteel >> wcu >> epoxy >> kapton >> aluminium;
98  // Skip comments
99  if (materialName[0] == '#')
100  continue;
101  // Substitute '*' with spaces
102  std::replace(materialName.begin(), materialName.end(), '*', ' ');
103  oth = 0.000;
104  theMap[materialName].clear(); // clear before re-filling
105  theMap[materialName].push_back(air ); // air
106  theMap[materialName].push_back(cables ); // cables
107  theMap[materialName].push_back(copper ); // copper
108  theMap[materialName].push_back(h_scintillator ); // h_scintillator
109  theMap[materialName].push_back(lead ); // lead
110  theMap[materialName].push_back(hgc_g10_fr4); // hgc_g10_fr4
111  theMap[materialName].push_back(silicon ); // silicon
112  theMap[materialName].push_back(stainlesssteel ); // stainlesssteel
113  theMap[materialName].push_back(wcu ); // wcu
114  theMap[materialName].push_back(oth ); // oth
115  theMap[materialName].push_back(epoxy ); // epoxy
116  theMap[materialName].push_back(kapton ); // kapton
117  theMap[materialName].push_back(aluminium ); // aluminium
118  edm::LogInfo("MaterialBudget")
119  << "MaterialBudgetCategorizer: material " << materialName << " filled "
120  << std::endl
121  << "\tair " << air << std::endl
122  << "\tcables " << cables << std::endl
123  << "\tcopper " << copper << std::endl
124  << "\th_scintillator " << h_scintillator << std::endl
125  << "\tlead " << lead << std::endl
126  << "\thgc_g10_fr4 " << hgc_g10_fr4 << std::endl
127  << "\tsilicon " << silicon << std::endl
128  << "\tstainlesssteel " << stainlesssteel << std::endl
129  << "\twcu " << wcu << std::endl
130  << "\tepoxy " << epoxy << std::endl
131  << "\tkapton " << kapton<< std::endl
132  << "\taluminium " << aluminium<< std::endl
133  << "\tOTH " << oth;
134  }
135 
136 }
def replace(string, replacements)
void MaterialBudgetCategorizer::buildMaps ( )
private

Referenced by HGCall0fraction().

const std::vector<float>& MaterialBudgetCategorizer::HGCall0fraction ( std::string  s)
inline
const std::vector<float>& MaterialBudgetCategorizer::HGCalx0fraction ( std::string  s)
inline

Definition at line 27 of file MaterialBudgetCategorizer.h.

References alignCSCRings::s, and theHGCalX0Map.

27 {return theHGCalX0Map[s];}
std::map< std::string, std::vector< float > > theHGCalX0Map
const std::vector<float>& MaterialBudgetCategorizer::l0fraction ( std::string  s)
inline

Definition at line 24 of file MaterialBudgetCategorizer.h.

References alignCSCRings::s, and theL0Map.

24 {return theL0Map[s];}
std::map< std::string, std::vector< float > > theL0Map
int MaterialBudgetCategorizer::material ( std::string  s)
inline

Definition at line 21 of file MaterialBudgetCategorizer.h.

References alignCSCRings::s, and theMaterialMap.

21 {return theMaterialMap[s];}
std::map< std::string, int > theMaterialMap
int MaterialBudgetCategorizer::volume ( std::string  s)
inline

Definition at line 20 of file MaterialBudgetCategorizer.h.

References alignCSCRings::s, and theVolumeMap.

20 {return theVolumeMap[s];}
std::map< std::string, int > theVolumeMap
const std::vector<float>& MaterialBudgetCategorizer::x0fraction ( std::string  s)
inline

Definition at line 23 of file MaterialBudgetCategorizer.h.

References alignCSCRings::s, and theX0Map.

23 {return theX0Map[s];}
std::map< std::string, std::vector< float > > theX0Map

Member Data Documentation

std::map<std::string,std::vector<float> > MaterialBudgetCategorizer::theHGCalL0Map
private

Definition at line 41 of file MaterialBudgetCategorizer.h.

Referenced by HGCall0fraction(), and MaterialBudgetCategorizer().

std::map<std::string,std::vector<float> > MaterialBudgetCategorizer::theHGCalX0Map
private

Definition at line 40 of file MaterialBudgetCategorizer.h.

Referenced by HGCalx0fraction(), and MaterialBudgetCategorizer().

std::map<std::string,std::vector<float> > MaterialBudgetCategorizer::theL0Map
private

Definition at line 37 of file MaterialBudgetCategorizer.h.

Referenced by l0fraction(), and MaterialBudgetCategorizer().

std::map<std::string,int> MaterialBudgetCategorizer::theMaterialMap
private

Definition at line 34 of file MaterialBudgetCategorizer.h.

Referenced by material().

std::map<std::string,int> MaterialBudgetCategorizer::theVolumeMap
private

Definition at line 34 of file MaterialBudgetCategorizer.h.

Referenced by MaterialBudgetCategorizer(), and volume().

std::map<std::string,std::vector<float> > MaterialBudgetCategorizer::theX0Map
private

Definition at line 36 of file MaterialBudgetCategorizer.h.

Referenced by MaterialBudgetCategorizer(), and x0fraction().