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::MaterialBudgetCategorizer ( std::string  mode)

Definition at line 15 of file MaterialBudgetCategorizer.cc.

15  {
16  //----- Build map volume name - volume index
17  G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
18  G4LogicalVolumeStore::iterator ite;
19  int ii = 0;
20  for (ite = lvs->begin(); ite != lvs->end(); ite++) {
21  theVolumeMap[(*ite)->GetName()] = ii++;
22  }
23 
24  if (mode.compare("Tracker") == 0) {
25  std::string theMaterialX0FileName = edm::FileInPath("Validation/Geometry/data/trackerMaterials.x0").fullPath();
26  buildCategoryMap(theMaterialX0FileName, theX0Map);
27  std::string theMaterialL0FileName = edm::FileInPath("Validation/Geometry/data/trackerMaterials.l0").fullPath();
28  buildCategoryMap(theMaterialL0FileName, theL0Map);
29  } else if (mode.compare("Mtd") == 0) {
30  std::string theMaterialX0FileName = edm::FileInPath("Validation/Geometry/data/mtdMaterials.x0").fullPath();
31  buildCategoryMap(theMaterialX0FileName, theX0Map);
32  std::string theMaterialL0FileName = edm::FileInPath("Validation/Geometry/data/mtdMaterials.l0").fullPath();
33  buildCategoryMap(theMaterialL0FileName, theL0Map);
34  } else if (mode.compare("HGCal") == 0) {
35  std::string thehgcalMaterialX0FileName = edm::FileInPath("Validation/Geometry/data/hgcalMaterials.x0").fullPath();
36  buildHGCalCategoryMap(thehgcalMaterialX0FileName, theHGCalX0Map);
37  std::string thehgcalMaterialL0FileName = edm::FileInPath("Validation/Geometry/data/hgcalMaterials.l0").fullPath();
38  buildHGCalCategoryMap(thehgcalMaterialL0FileName, theHGCalL0Map);
39  }
40 }

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

Member Function Documentation

◆ buildCategoryMap()

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

Definition at line 42 of file MaterialBudgetCategorizer.cc.

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

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

Referenced by MaterialBudgetCategorizer().

◆ buildHGCalCategoryMap()

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

Definition at line 78 of file MaterialBudgetCategorizer.cc.

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

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

Referenced by MaterialBudgetCategorizer().

◆ buildMaps()

void MaterialBudgetCategorizer::buildMaps ( )
private

◆ HGCall0fraction()

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

Definition at line 27 of file MaterialBudgetCategorizer.h.

27 { return theHGCalL0Map[s]; }

References alignCSCRings::s, and theHGCalL0Map.

◆ HGCalx0fraction()

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

Definition at line 26 of file MaterialBudgetCategorizer.h.

26 { return theHGCalX0Map[s]; }

References alignCSCRings::s, and theHGCalX0Map.

◆ l0fraction()

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

Definition at line 23 of file MaterialBudgetCategorizer.h.

23 { return theL0Map[s]; }

References alignCSCRings::s, and theL0Map.

◆ material()

int MaterialBudgetCategorizer::material ( std::string  s)
inline

Definition at line 20 of file MaterialBudgetCategorizer.h.

20 { return theMaterialMap[s]; }

References alignCSCRings::s, and theMaterialMap.

◆ volume()

int MaterialBudgetCategorizer::volume ( std::string  s)
inline

Definition at line 19 of file MaterialBudgetCategorizer.h.

19 { return theVolumeMap[s]; }

References alignCSCRings::s, and theVolumeMap.

◆ x0fraction()

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

Definition at line 22 of file MaterialBudgetCategorizer.h.

22 { return theX0Map[s]; }

References alignCSCRings::s, and theX0Map.

Member Data Documentation

◆ theHGCalL0Map

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

Definition at line 40 of file MaterialBudgetCategorizer.h.

Referenced by HGCall0fraction(), and MaterialBudgetCategorizer().

◆ theHGCalX0Map

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

Definition at line 39 of file MaterialBudgetCategorizer.h.

Referenced by HGCalx0fraction(), and MaterialBudgetCategorizer().

◆ theL0Map

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

Definition at line 36 of file MaterialBudgetCategorizer.h.

Referenced by l0fraction(), and MaterialBudgetCategorizer().

◆ theMaterialMap

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

Definition at line 33 of file MaterialBudgetCategorizer.h.

Referenced by material().

◆ theVolumeMap

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

Definition at line 33 of file MaterialBudgetCategorizer.h.

Referenced by MaterialBudgetCategorizer(), and volume().

◆ theX0Map

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

Definition at line 35 of file MaterialBudgetCategorizer.h.

Referenced by MaterialBudgetCategorizer(), and x0fraction().

MaterialBudgetCategorizer::theHGCalL0Map
std::map< std::string, std::vector< float > > theHGCalL0Map
Definition: MaterialBudgetCategorizer.h:40
cuy.col
col
Definition: cuy.py:1010
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
edm::LogInfo
Definition: MessageLogger.h:254
edm::FileInPath
Definition: FileInPath.h:64
alignCSCRings.s
s
Definition: alignCSCRings.py:92
MaterialBudgetCategorizer::theHGCalX0Map
std::map< std::string, std::vector< float > > theHGCalX0Map
Definition: MaterialBudgetCategorizer.h:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MaterialBudgetCategorizer::theX0Map
std::map< std::string, std::vector< float > > theX0Map
Definition: MaterialBudgetCategorizer.h:35
MaterialBudgetCategorizer::buildHGCalCategoryMap
void buildHGCalCategoryMap(std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)
Definition: MaterialBudgetCategorizer.cc:78
MaterialBudgetCategorizer::buildCategoryMap
void buildCategoryMap(std::string theMaterialFileName, std::map< std::string, std::vector< float > > &theMap)
Definition: MaterialBudgetCategorizer.cc:42
MaterialBudgetCategorizer::theL0Map
std::map< std::string, std::vector< float > > theL0Map
Definition: MaterialBudgetCategorizer.h:36
MaterialBudgetCategorizer::theVolumeMap
std::map< std::string, int > theVolumeMap
Definition: MaterialBudgetCategorizer.h:33
Exception
Definition: hltDiff.cc:246
MaterialBudgetCategorizer::theMaterialMap
std::map< std::string, int > theMaterialMap
Definition: MaterialBudgetCategorizer.h:33
cuy.ii
ii
Definition: cuy.py:590
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444