ATLAS Offline Software
AGDDMaterialStore.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 
9 #include <iostream>
10 
11 AGDDMaterialStore::AGDDMaterialStore():m_nrOfMaterials(0),m_nrOfElements(0)
12 {
13  m_theMaterials.clear();
14  m_theElements.clear();
15 }
16 
18 {
19  if (m_theElements.find(el->GetName()) != m_theElements.end())
20  {
21  std::cout<<"Element "<<el->GetName()<<" already defined:skipping"<<std::endl;
22  }
23  else
24  {
26  m_theElements[el->GetName()]=el;
27  }
28 }
30 {
31  if (m_theMaterials.find(mat->GetName()) != m_theMaterials.end())
32  {
33  std::cout<<"Material "<<mat->GetName()<<" already defined:skipping"<<std::endl;
34  }
35  else
36  {
38  m_theMaterials[mat->GetName()]=mat;
39  }
40 }
42 {
43  if (m_theMaterials.find(mat) != m_theMaterials.end())
44  return m_theMaterials[mat];
45  else
46  {
47  std::cout<<" Material "<<mat<<" not found!"<<std::endl;
48  return 0;
49  }
50 }
52 {
53  if (m_theElements.find(el) != m_theElements.end())
54  return m_theElements[el];
55  else
56  {
57  std::cout<<" Element "<<el<<" not found!"<<std::endl;
58  return 0;
59  }
60 }
61 
63 {
64  std::cout<<"List of elements so far defined: "<<
65  std::endl<<"-----> ";
66  AGDDElementMap::const_iterator it;
67  int i=0;
68  for (it=m_theElements.begin();it!=m_theElements.end();++it)
69  {
70  i++;
71  if (!(i%5)) std::cout<<std::endl<<"-----> ";
72  std::cout<<(*it).first<<",";
73  }
74 }
75 
77 {
78  std::cout<<"List of materials so far defined: "<<
79  std::endl<<"-----> ";
80  AGDDMaterialMap::const_iterator it;
81  int i=0;
82  for (it=m_theMaterials.begin();it!=m_theMaterials.end();++it)
83  {
84  i++;
85  if (!(i%5)) std::cout<<std::endl<<"-----> ";
86  std::cout<<(*it).first<<",";
87  }
88 }
89 
90 void AGDDMaterialStore::PrintElement(const std::string& n)
91 {
92  if (m_theElements.find(n)!=m_theElements.end())
93  std::cout<<*(m_theElements[n]);
94  else
95  std::cout<<"Element "<<n<<" not found!"<<std::endl;
96 }
97 
98 void AGDDMaterialStore::PrintMaterial(const std::string& n)
99 {
100  if (m_theMaterials.find(n)!=m_theMaterials.end())
101  std::cout<<*(m_theMaterials[n]);
102  else
103  std::cout<<"Material "<<n<<" not found!"<<std::endl;
104 }
AGDDMaterialStore::m_theMaterials
AGDDMaterialMap m_theMaterials
Definition: AGDDMaterialStore.h:46
AGDDMaterialStore::PrintElement
void PrintElement(const std::string &n)
Definition: AGDDMaterialStore.cxx:90
AGDDMaterialStore::m_theElements
AGDDElementMap m_theElements
Definition: AGDDMaterialStore.h:47
AGDDMaterialStore::RegisterElement
void RegisterElement(AGDDElement *)
Definition: AGDDMaterialStore.cxx:17
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:53
skel.it
it
Definition: skel.GENtoEVGEN.py:423
AGDDMaterialStore::m_nrOfElements
int m_nrOfElements
Definition: AGDDMaterialStore.h:50
AGDDMaterialStore::GetMaterial
AGDDSimpleMaterial * GetMaterial(std::string)
Definition: AGDDMaterialStore.cxx:41
AGDDMaterialStore.h
AGDDMaterialStore::AGDDMaterialStore
AGDDMaterialStore()
Definition: AGDDMaterialStore.cxx:11
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
AGDDMaterialStore::RegisterMaterial
void RegisterMaterial(AGDDSimpleMaterial *)
Definition: AGDDMaterialStore.cxx:29
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
AGDDSimpleMaterial
Definition: AGDDSimpleMaterial.h:14
AGDDMaterialStore::PrintElementNames
void PrintElementNames()
Definition: AGDDMaterialStore.cxx:62
AGDDSimpleMaterial.h
AGDDElement.h
AGDDElement
Definition: AGDDElement.h:11
AGDDMaterialStore::PrintMaterial
void PrintMaterial(const std::string &n)
Definition: AGDDMaterialStore.cxx:98
AGDDMaterialStore::GetElement
AGDDElement * GetElement(std::string)
Definition: AGDDMaterialStore.cxx:51
AGDDMaterialStore::m_nrOfMaterials
int m_nrOfMaterials
Definition: AGDDMaterialStore.h:49
AGDDMaterialStore::PrintMaterialNames
void PrintMaterialNames()
Definition: AGDDMaterialStore.cxx:76