ATLAS Offline Software
Loading...
Searching...
No Matches
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}
std::vector< TBElement > m_TBElementVec
unsigned int m_elements
@ CombinedScintillator
Definition TBElementID.h:32

◆ ~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}
value_type push_back(value_type pElem)
Add an element to the end of the collection.

◆ 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}
std::vector< size_t > vec

◆ 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
106}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
void initialize()

◆ 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}
#define endmsg

◆ 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}
TBElementID::TBElementID id() const
Definition TBElement.h:33

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: