ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TBDetDescrManager Class Reference

#include <TBDetDescrManager.h>

Collaboration diagram for TBDetDescrManager:

Public Member Functions

 TBDetDescrManager ()
 
virtual ~TBDetDescrManager ()
 
void initialize (const std::vector< TBElement > &vec)
 
void initialize (const TBElementContainer *pTBElementContainer)
 
void getAll (TBElementContainer *pTBElementContainer) const
 
const TBElementgetElement (TBElementID::TBElementID id) const
 
void setElement (const TBElement &element)
 
bool is_initialized (void) const
 
int n_elements (void) const
 
int max_size (void) const
 
void print (MsgStream &log) const
 

Private Attributes

unsigned int m_elements
 
std::vector< TBElementm_TBElementVec
 

Detailed Description

Definition at line 20 of file TBDetDescrManager.h.

Constructor & Destructor Documentation

◆ TBDetDescrManager()

TBDetDescrManager::TBDetDescrManager ( )

Definition at line 16 of file TBDetDescrManager.cxx.

17  : m_elements(0)
18 {
20 
21  // instead of creating yet another vector with all the names
22  // for all elements in CTB simulation, let's keep them in the same vector
23  // these names are needed only when we initialize manager from FADS
24 
26  m_TBElementVec[TBElementID::BEAMPIPE1 ].m_name = "BEAMPIPE1";
27  m_TBElementVec[TBElementID::BEAMPIPE2 ].m_name = "BEAMPIPE2";
28  m_TBElementVec[TBElementID::SMV ].m_name = "SMV";
29  m_TBElementVec[TBElementID::S1 ].m_name = "S1";
30  m_TBElementVec[TBElementID::S3 ].m_name = "S3";
31  m_TBElementVec[TBElementID::S2 ].m_name = "S2";
32  m_TBElementVec[TBElementID::SH ].m_name = "SH";
33  m_TBElementVec[TBElementID::SNEW ].m_name = "SNEW";
34  m_TBElementVec[TBElementID::MBPSID ].m_name = "MBPSID";
35  m_TBElementVec[TBElementID::IDET ].m_name = "IDET";
36  m_TBElementVec[TBElementID::Pixel ].m_name = "Pixel";
37  m_TBElementVec[TBElementID::SCT ].m_name = "SCT";
38  m_TBElementVec[TBElementID::CTBTRT ].m_name = "CTBTRT";
39  m_TBElementVec[TBElementID::TRT ].m_name = "TRT";
40  m_TBElementVec[TBElementID::CALO ].m_name = "CALO";
41  m_TBElementVec[TBElementID::LArTBBarrel ].m_name = "LArTBBarrel";
42  m_TBElementVec[TBElementID::Tile ].m_name = "Tile";
43  m_TBElementVec[TBElementID::MuonWall ].m_name = "MuonWall";
44  m_TBElementVec[TBElementID::PhantomBarrel ].m_name = "PhantomBarrel";
45  m_TBElementVec[TBElementID::CombinedScintillator ].m_name = "CombinedScintillator";
46  m_TBElementVec[TBElementID::DeadMaterial ].m_name = "DeadMaterial";
47  m_TBElementVec[TBElementID::LArCrate ].m_name = "LArCrate";
48  m_TBElementVec[TBElementID::MUON ].m_name = "MUON";
49  m_TBElementVec[TBElementID::Muon ].m_name = "Muon";
50  m_TBElementVec[TBElementID::DUMPIRON ].m_name = "DUMPIRON";
51  m_TBElementVec[TBElementID::MBPL ].m_name = "MBPL";
52  m_TBElementVec[TBElementID::MBPS2 ].m_name = "MBPS2";
53  m_TBElementVec[TBElementID::SCDUMP ].m_name = "SCDUMP";
54  m_TBElementVec[TBElementID::SMT ].m_name = "SMT";
55  m_TBElementVec[TBElementID::MUON10x10A ].m_name = "MUON10x10A";
56  m_TBElementVec[TBElementID::MUON10x10B ].m_name = "MUON10x10B";
57  m_TBElementVec[TBElementID::MUON10x10C ].m_name = "MUON10x10C";
58  m_TBElementVec[TBElementID::MUON10x10D ].m_name = "MUON10x10D";
59  m_TBElementVec[TBElementID::MUONHODOSELECTOR ].m_name = "MUONHODOSELECTOR";
60  m_TBElementVec[TBElementID::MUONHODOPLANE11 ].m_name = "MUONHODOPLANE11";
61  m_TBElementVec[TBElementID::MUONHODOPLANE12 ].m_name = "MUONHODOPLANE12";
62  m_TBElementVec[TBElementID::MUONHODOPLANE13 ].m_name = "MUONHODOPLANE13";
63  m_TBElementVec[TBElementID::MUONHODOPLANE14 ].m_name = "MUONHODOPLANE14";
64  m_TBElementVec[TBElementID::MUONHODOPLANE15 ].m_name = "MUONHODOPLANE15";
65  m_TBElementVec[TBElementID::MUONHODOPLANE16 ].m_name = "MUONHODOPLANE16";
66  m_TBElementVec[TBElementID::MUONHODOPLANE21 ].m_name = "MUONHODOPLANE21";
67  m_TBElementVec[TBElementID::MUONHODOPLANE22 ].m_name = "MUONHODOPLANE22";
68  m_TBElementVec[TBElementID::MUONHODOPLANE23 ].m_name = "MUONHODOPLANE23";
69  m_TBElementVec[TBElementID::MUONHODOPLANE24 ].m_name = "MUONHODOPLANE24";
70  m_TBElementVec[TBElementID::MUONHODOPLANE25 ].m_name = "MUONHODOPLANE25";
71  m_TBElementVec[TBElementID::MUONHODOPLANE26 ].m_name = "MUONHODOPLANE26";
72 }

◆ ~TBDetDescrManager()

virtual TBDetDescrManager::~TBDetDescrManager ( )
inlinevirtual

Definition at line 25 of file TBDetDescrManager.h.

25 { }

Member Function Documentation

◆ getAll()

void TBDetDescrManager::getAll ( TBElementContainer pTBElementContainer) const

Definition at line 108 of file TBDetDescrManager.cxx.

109 {
110  std::vector<TBElement>::const_iterator itr=m_TBElementVec.begin();
111  std::vector<TBElement>::const_iterator end=m_TBElementVec.end();
112 
113  for ( ; itr!=end; ++itr) {
114  if (itr->id() != TBElementID::Unknown) {
115  TBElement* pTBElement = new TBElement(*itr);
116  pTBElementContainer->push_back(pTBElement);
117  }
118  }
119 }

◆ getElement()

const TBElement & TBDetDescrManager::getElement ( TBElementID::TBElementID  id) const

Definition at line 121 of file TBDetDescrManager.cxx.

122 {
123  // no check here if element is initialized or not
124  // all the checks should be done by caller (element.id() != TBElementID::Unknown)
125  return m_TBElementVec[id];
126 }

◆ initialize() [1/2]

void TBDetDescrManager::initialize ( const std::vector< TBElement > &  vec)

Definition at line 74 of file TBDetDescrManager.cxx.

75 {
76  if (m_elements>0)
77  m_TBElementVec.clear();
78 
79  m_elements = 0;
81 
82  std::vector<TBElement>::const_iterator itr=vec.begin();
83  std::vector<TBElement>::const_iterator end=vec.end();
84 
85  for ( ; itr!=end; ++itr) {
86  unsigned int iid = itr->id();
87  if ( iid >= m_TBElementVec.size() )
88  m_TBElementVec.resize(iid+1);
89  m_TBElementVec[iid] = (*itr);
90  if ( m_TBElementVec[iid].id() != TBElementID::Unknown )
91  ++m_elements;
92  }
93 }

◆ initialize() [2/2]

void TBDetDescrManager::initialize ( const TBElementContainer pTBElementContainer)

Definition at line 95 of file TBDetDescrManager.cxx.

96 {
97  TBElementContainer::const_iterator itr = pTBElementContainer->begin();
98  TBElementContainer::const_iterator end = pTBElementContainer->end();
99 
100  std::vector<TBElement> vec;
101 
102  for (; itr!=end; ++itr)
103  vec.push_back(*(*itr));
104 
105  initialize(vec);
106 }

◆ is_initialized()

bool TBDetDescrManager::is_initialized ( void  ) const
inline

Definition at line 42 of file TBDetDescrManager.h.

42 {return (m_elements>0);}

◆ max_size()

int TBDetDescrManager::max_size ( void  ) const
inline

Definition at line 44 of file TBDetDescrManager.h.

44 {return m_TBElementVec.size(); }

◆ n_elements()

int TBDetDescrManager::n_elements ( void  ) const
inline

Definition at line 43 of file TBDetDescrManager.h.

43 {return m_elements; }

◆ print()

void TBDetDescrManager::print ( MsgStream &  log) const

Definition at line 146 of file TBDetDescrManager.cxx.

147 {
148  std::vector<TBElement>::const_iterator itr=m_TBElementVec.begin();
149  std::vector<TBElement>::const_iterator end=m_TBElementVec.end();
150 
151  log << MSG::DEBUG
152  << "Total number of TBElements in TBDetDescrManager = "
153  << m_elements
154  << endmsg;
155 
156  for ( ; itr!=end; ++itr) {
157  if (itr->id() != TBElementID::Unknown) {
158  log << MSG::DEBUG
159  << (std::string) (*itr)
160  << endmsg;
161  }
162  }
163 }

◆ setElement()

void TBDetDescrManager::setElement ( const TBElement element)

Definition at line 128 of file TBDetDescrManager.cxx.

129 {
130  unsigned int iid = element.id();
131 
132  if ( iid >= m_TBElementVec.size())
133  m_TBElementVec.resize(iid+1);
134 
135  // we clear old element, so number of elements decreased
136  if ( m_TBElementVec[iid].id() != TBElementID::Unknown )
137  --m_elements;
138 
139  m_TBElementVec[iid] = element;
140 
141  // we probably created new element, so number of elements increased
142  if ( m_TBElementVec[iid].id() != TBElementID::Unknown )
143  ++m_elements;
144 }

Member Data Documentation

◆ m_elements

unsigned int TBDetDescrManager::m_elements
private

Definition at line 50 of file TBDetDescrManager.h.

◆ m_TBElementVec

std::vector<TBElement> TBDetDescrManager::m_TBElementVec
private

Definition at line 51 of file TBDetDescrManager.h.


The documentation for this class was generated from the following files:
TBElementID::MUONHODOPLANE15
@ MUONHODOPLANE15
Definition: TBElementID.h:51
TBElementID::DeadMaterial
@ DeadMaterial
Definition: TBElementID.h:33
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
TBElementID::LArCrate
@ LArCrate
Definition: TBElementID.h:34
TBElementID::TRT
@ TRT
Definition: TBElementID.h:26
TBElementID::MuonWall
@ MuonWall
Definition: TBElementID.h:30
TBElementID::MUON10x10A
@ MUON10x10A
Definition: TBElementID.h:42
TBElementID::MUONHODOSELECTOR
@ MUONHODOSELECTOR
Definition: TBElementID.h:46
TBElementID::MUONHODOPLANE23
@ MUONHODOPLANE23
Definition: TBElementID.h:55
TBElementID::MUONHODOPLANE12
@ MUONHODOPLANE12
Definition: TBElementID.h:48
TBElementID::MUON10x10C
@ MUON10x10C
Definition: TBElementID.h:44
TBElementID::CombinedScintillator
@ CombinedScintillator
Definition: TBElementID.h:32
TBElementID::Tile
@ Tile
Definition: TBElementID.h:29
TBElementID::MUONHODOPLANE24
@ MUONHODOPLANE24
Definition: TBElementID.h:56
TBElementID::MBPS2
@ MBPS2
Definition: TBElementID.h:39
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
TBElementID::SMV
@ SMV
Definition: TBElementID.h:15
TBDetDescrManager::initialize
void initialize(const std::vector< TBElement > &vec)
Definition: TBDetDescrManager.cxx:74
TBElementID::MBPSID
@ MBPSID
Definition: TBElementID.h:21
TBElementID::CTBTRT
@ CTBTRT
Definition: TBElementID.h:25
TBElementID::IDET
@ IDET
Definition: TBElementID.h:22
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
TBDetDescrManager::m_TBElementVec
std::vector< TBElement > m_TBElementVec
Definition: TBDetDescrManager.h:51
TBElementID::MUON10x10D
@ MUON10x10D
Definition: TBElementID.h:45
TBElementID::MUON
@ MUON
Definition: TBElementID.h:35
TBElementID::Unknown
@ Unknown
Definition: TBElementID.h:12
TBDetDescrManager::m_elements
unsigned int m_elements
Definition: TBDetDescrManager.h:50
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TBElementID::MUONHODOPLANE25
@ MUONHODOPLANE25
Definition: TBElementID.h:57
TBElementID::BEAMPIPE1
@ BEAMPIPE1
Definition: TBElementID.h:13
TBElementID::SNEW
@ SNEW
Definition: TBElementID.h:20
TBElementID::PhantomBarrel
@ PhantomBarrel
Definition: TBElementID.h:31
TBElementID::MBPL
@ MBPL
Definition: TBElementID.h:38
TBElementID::MUONHODOPLANE26
@ MUONHODOPLANE26
Definition: TBElementID.h:58
TBElementID::Pixel
@ Pixel
Definition: TBElementID.h:23
TBElementID::Muon
@ Muon
Definition: TBElementID.h:36
TBElementID::MUONHODOPLANE22
@ MUONHODOPLANE22
Definition: TBElementID.h:54
TBElementID::S2
@ S2
Definition: TBElementID.h:17
TBElementID::DUMPIRON
@ DUMPIRON
Definition: TBElementID.h:37
TBElementID::SCT
@ SCT
Definition: TBElementID.h:24
TBElementID::BEAMPIPE2
@ BEAMPIPE2
Definition: TBElementID.h:14
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
TBElementID::S1
@ S1
Definition: TBElementID.h:16
TBElementID::MUONHODOPLANE13
@ MUONHODOPLANE13
Definition: TBElementID.h:49
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TBElementID::MUONHODOPLANE14
@ MUONHODOPLANE14
Definition: TBElementID.h:50
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TBElementID::CALO
@ CALO
Definition: TBElementID.h:27
TBElementID::LArTBBarrel
@ LArTBBarrel
Definition: TBElementID.h:28
TBElementID::SMT
@ SMT
Definition: TBElementID.h:41
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TBElement
Definition: TBElement.h:20
TBElementID::TotalSize
@ TotalSize
Definition: TBElementID.h:59
TBElementID::MUONHODOPLANE11
@ MUONHODOPLANE11
Definition: TBElementID.h:47
TBElementID::SH
@ SH
Definition: TBElementID.h:19
TBElementID::MUONHODOPLANE16
@ MUONHODOPLANE16
Definition: TBElementID.h:52
TBElementID::MUON10x10B
@ MUON10x10B
Definition: TBElementID.h:43
TBElementID::S3
@ S3
Definition: TBElementID.h:18
TBElement::id
TBElementID::TBElementID id() const
Definition: TBElement.h:33
TBElementID::SCDUMP
@ SCDUMP
Definition: TBElementID.h:40
TBElementID::MUONHODOPLANE21
@ MUONHODOPLANE21
Definition: TBElementID.h:53
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.