ATLAS Offline Software
Loading...
Searching...
No Matches
InDetDD::TRT_DetElementContainer Class Reference

Class to hold different TRT detector elements structures. More...

#include <TRT_DetElementContainer.h>

Inheritance diagram for InDetDD::TRT_DetElementContainer:
Collaboration diagram for InDetDD::TRT_DetElementContainer:

Public Member Functions

 TRT_DetElementContainer ()
 ~TRT_DetElementContainer ()
 TRT_DetElementContainer (const TRT_DetElementContainer &other)=delete
void operator= (const TRT_DetElementContainer &other)=delete
void setNumerology (const TRT_Numerology *mynum)
void addBarrelElement (TRT_BarrelElement *element)
void addEndcapElement (TRT_EndcapElement *element)
void manageBarrelElement (TRT_BarrelElement *barrel, const TRT_ID *idHelper)
void manageEndcapElement (TRT_EndcapElement *endcap, const TRT_ID *idHelper)
const TRT_DetElementCollectiongetElements () const
TRT_DetElementCollectiongetElements ()
const TRT_NumerologygetTRTNumerology () const
const TRT_BarrelElementgetBarrelDetElement (unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex) const
TRT_BarrelElementgetBarrelDetElement (unsigned int positive, unsigned int moduleIndex, unsigned int phiIndex, unsigned int strawLayerIndex)
const TRT_EndcapElementgetEndcapDetElement (unsigned int positive, unsigned int wheelIndex, unsigned int strawLayerIndex, unsigned int phiIndex) const
TRT_EndcapElementgetEndcapDetElement (unsigned int positive, unsigned int wheelIndex, unsigned int strawLayerIndex, unsigned int phiIndex)
void clear ()
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Private Types

enum  { NMODMAX =3 }
enum  { NWHEELMAX =18 }
enum  { NPHIMAX =32 }
enum  { NSTRAWLAYMAXBR =30 }
enum  { NSTRAWLAYMAXEC =16 }

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

TRT_DetElementCollection m_trtcoll
const TRT_Numerologym_trtnum
TRT_BarrelElementm_baArray [2][NMODMAX][NPHIMAX][NSTRAWLAYMAXBR] {}
TRT_EndcapElementm_ecArray [2][NWHEELMAX][NSTRAWLAYMAXEC][NPHIMAX] {}
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Class to hold different TRT detector elements structures.

Definition at line 24 of file TRT_DetElementContainer.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
NSTRAWLAYMAXBR 

Definition at line 81 of file TRT_DetElementContainer.h.

◆ anonymous enum

anonymous enum
private
Enumerator
NPHIMAX 

Definition at line 80 of file TRT_DetElementContainer.h.

◆ anonymous enum

anonymous enum
private
Enumerator
NMODMAX 

Definition at line 78 of file TRT_DetElementContainer.h.

◆ anonymous enum

anonymous enum
private
Enumerator
NWHEELMAX 

Definition at line 79 of file TRT_DetElementContainer.h.

◆ anonymous enum

anonymous enum
private
Enumerator
NSTRAWLAYMAXEC 

Definition at line 82 of file TRT_DetElementContainer.h.

Constructor & Destructor Documentation

◆ TRT_DetElementContainer() [1/2]

InDetDD::TRT_DetElementContainer::TRT_DetElementContainer ( )

Definition at line 11 of file TRT_DetElementContainer.cxx.

12 : AthMessaging("TRT_DetElementContainer")
13 , m_trtcoll()
14 , m_trtnum(nullptr)
15 {
16 clear();
17 }
AthMessaging()
Default constructor:

◆ ~TRT_DetElementContainer()

InDetDD::TRT_DetElementContainer::~TRT_DetElementContainer ( )

Definition at line 19 of file TRT_DetElementContainer.cxx.

20 {
21 clear();
22 }

◆ TRT_DetElementContainer() [2/2]

InDetDD::TRT_DetElementContainer::TRT_DetElementContainer ( const TRT_DetElementContainer & other)
delete

Member Function Documentation

◆ addBarrelElement()

void InDetDD::TRT_DetElementContainer::addBarrelElement ( TRT_BarrelElement * element)

Definition at line 89 of file TRT_DetElementContainer.cxx.

90 {
91 // check if the element has already been added
92 if (std::find(m_trtcoll.begin(), m_trtcoll.end(), barrel) != m_trtcoll.end()) return;
93 // check if something was stored at the given indices
94 TRT_BarrelElement* arrayElement = m_baArray
95 [barrel->getCode().isPosZ()]
96 [barrel->getCode().getModuleIndex()]
97 [barrel->getCode().getPhiIndex()]
98 [barrel->getCode().getStrawLayerIndex()];
99 if (arrayElement != nullptr) {
100 m_trtcoll.erase(std::remove(m_trtcoll.begin(), m_trtcoll.end(), arrayElement));
101 delete arrayElement;
102 }
103 m_baArray[barrel->getCode().isPosZ()]
104 [barrel->getCode().getModuleIndex()]
105 [barrel->getCode().getPhiIndex()]
106 [barrel->getCode().getStrawLayerIndex()] = barrel;
107 m_trtcoll.push_back(barrel);
108 }
TRT_BarrelElement * m_baArray[2][NMODMAX][NPHIMAX][NSTRAWLAYMAXBR]
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.

◆ addEndcapElement()

void InDetDD::TRT_DetElementContainer::addEndcapElement ( TRT_EndcapElement * element)

Definition at line 110 of file TRT_DetElementContainer.cxx.

111 {
112 // check if the element has already been added
113 if (std::find(m_trtcoll.begin(), m_trtcoll.end(), endcap) != m_trtcoll.end()) return;
114 // check if something was stored at the given indices
115 TRT_EndcapElement* arrayElement = m_ecArray
116 [endcap->getCode().isPosZ()]
117 [endcap->getCode().getWheelIndex()]
118 [endcap->getCode().getStrawLayerIndex()]
119 [endcap->getCode().getPhiIndex()];
120 if (arrayElement != nullptr) {
121 m_trtcoll.erase(std::remove(m_trtcoll.begin(), m_trtcoll.end(), arrayElement));
122 delete arrayElement;
123 }
124 m_ecArray[endcap->getCode().isPosZ()]
125 [endcap->getCode().getWheelIndex()]
126 [endcap->getCode().getStrawLayerIndex()]
127 [endcap->getCode().getPhiIndex()] = endcap;
128 m_trtcoll.push_back(endcap);
129 }
TRT_EndcapElement * m_ecArray[2][NWHEELMAX][NSTRAWLAYMAXEC][NPHIMAX]

◆ clear()

void InDetDD::TRT_DetElementContainer::clear ( )

Definition at line 213 of file TRT_DetElementContainer.cxx.

214 {
215 m_trtcoll.clear();
216 for (auto & ec : m_baArray) {
217 for (auto & mod : ec) {
218 for (auto & phi : mod) {
219 for (auto & sLay : phi) {
220 sLay = nullptr;
221 }
222 }
223 }
224 }
225 for (auto & ec : m_ecArray) {
226 for (auto & whe : ec) {
227 for (auto & sLay : whe) {
228 for(auto & phi : sLay) {
229 phi = nullptr;
230 }
231 }
232 }
233 }
234 }
Scalar phi() const
phi method

◆ getBarrelDetElement() [1/2]

TRT_BarrelElement * InDetDD::TRT_DetElementContainer::getBarrelDetElement ( unsigned int positive,
unsigned int moduleIndex,
unsigned int phiIndex,
unsigned int strawLayerIndex )

Definition at line 55 of file TRT_DetElementContainer.cxx.

59 {
60 if ( positive >= 2 || moduleIndex >= NMODMAX
61 || phiIndex>=NPHIMAX || strawLayerIndex >= NSTRAWLAYMAXBR) return nullptr;
62
63 return m_baArray[positive][moduleIndex][phiIndex][strawLayerIndex];
64 }
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition EtaPhiLUT.cxx:23

◆ getBarrelDetElement() [2/2]

const TRT_BarrelElement * InDetDD::TRT_DetElementContainer::getBarrelDetElement ( unsigned int positive,
unsigned int moduleIndex,
unsigned int phiIndex,
unsigned int strawLayerIndex ) const

Definition at line 44 of file TRT_DetElementContainer.cxx.

48 {
49 if ( positive >= 2 || moduleIndex >= NMODMAX
50 || phiIndex>=NPHIMAX || strawLayerIndex >= NSTRAWLAYMAXBR) return nullptr;
51
52 return m_baArray[positive][moduleIndex][phiIndex][strawLayerIndex];
53 }

◆ getElements() [1/2]

TRT_DetElementCollection * InDetDD::TRT_DetElementContainer::getElements ( )

Definition at line 34 of file TRT_DetElementContainer.cxx.

35 {
36 return &m_trtcoll;
37 }

◆ getElements() [2/2]

const TRT_DetElementCollection * InDetDD::TRT_DetElementContainer::getElements ( ) const

Definition at line 29 of file TRT_DetElementContainer.cxx.

30 {
31 return &m_trtcoll;
32 }

◆ getEndcapDetElement() [1/2]

TRT_EndcapElement * InDetDD::TRT_DetElementContainer::getEndcapDetElement ( unsigned int positive,
unsigned int wheelIndex,
unsigned int strawLayerIndex,
unsigned int phiIndex )

Definition at line 78 of file TRT_DetElementContainer.cxx.

82 {
83 if ( positive >= 2 || wheelIndex >= NWHEELMAX
84 || phiIndex>=NPHIMAX || strawLayerIndex >= NSTRAWLAYMAXEC) return nullptr;
85
86 return m_ecArray[positive][wheelIndex][strawLayerIndex][phiIndex];
87 }

◆ getEndcapDetElement() [2/2]

const TRT_EndcapElement * InDetDD::TRT_DetElementContainer::getEndcapDetElement ( unsigned int positive,
unsigned int wheelIndex,
unsigned int strawLayerIndex,
unsigned int phiIndex ) const

Definition at line 67 of file TRT_DetElementContainer.cxx.

71 {
72 if ( positive >= 2 || wheelIndex >= NWHEELMAX
73 || phiIndex>=NPHIMAX || strawLayerIndex >= NSTRAWLAYMAXEC) return nullptr;
74
75 return m_ecArray[positive][wheelIndex][strawLayerIndex][phiIndex];
76 }

◆ getTRTNumerology()

const TRT_Numerology * InDetDD::TRT_DetElementContainer::getTRTNumerology ( ) const

Definition at line 39 of file TRT_DetElementContainer.cxx.

40 {
41 return m_trtnum;
42 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ manageBarrelElement()

void InDetDD::TRT_DetElementContainer::manageBarrelElement ( TRT_BarrelElement * barrel,
const TRT_ID * idHelper )

Definition at line 131 of file TRT_DetElementContainer.cxx.

132 {
133 if (m_baArray
134 [barrel->getCode().isPosZ()]
135 [barrel->getCode().getModuleIndex()]
136 [barrel->getCode().getPhiIndex()]
137 [barrel->getCode().getStrawLayerIndex()] ) {
138
139 //Element already added - complain!
140 ATH_MSG_DEBUG("manageBarrelElement: Overriding existing element");
141 }
142
144 [barrel->getCode().isPosZ()]
145 [barrel->getCode().getModuleIndex()]
146 [barrel->getCode().getPhiIndex()]
147 [barrel->getCode().getStrawLayerIndex()]
148 =barrel;
149
150 // Add the barrel element to the hash vector:
151 if (idHelper) {
152 Identifier id = idHelper->layer_id(barrel->getCode().isPosZ() ? +1 : -1,
153 barrel->getCode().getPhiIndex(),
154 barrel->getCode().getModuleIndex(),
155 barrel->getCode().getStrawLayerIndex());
156 IdentifierHash hashId = idHelper->straw_layer_hash(id);
157 if (hashId.is_valid()) {
158 if (m_trtcoll.size() <= hashId) {
159 m_trtcoll.resize(static_cast<unsigned int>(hashId) + 1);
160 }
161 if (m_trtcoll[hashId]) {
162 //Element already added - complain!
163 ATH_MSG_DEBUG("manageBarrelElement: Overriding existing element for hashID");
164 }
165 m_trtcoll[hashId]=barrel;
166 }
167 else {
168 ATH_MSG_WARNING("manageBarrelElement: Invalid identifier");
169 }
170 }
171 }
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool is_valid() const
Check if id is in a valid state.
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition TRT_ID.h:494
IdentifierHash straw_layer_hash(Identifier straw_layer_id) const
straw_layer hash from id - optimized
Definition TRT_ID.h:687

◆ manageEndcapElement()

void InDetDD::TRT_DetElementContainer::manageEndcapElement ( TRT_EndcapElement * endcap,
const TRT_ID * idHelper )

Definition at line 173 of file TRT_DetElementContainer.cxx.

174 {
175 if (m_ecArray
176 [endcap->getCode().isPosZ()]
177 [endcap->getCode().getWheelIndex()]
178 [endcap->getCode().getStrawLayerIndex()]
179 [endcap->getCode().getPhiIndex()] ) {
180 //Element already added - complain!
181 ATH_MSG_WARNING("manageEndcapElement: Overriding existing element");
182 }
183
185 [endcap->getCode().isPosZ()]
186 [endcap->getCode().getWheelIndex()]
187 [endcap->getCode().getStrawLayerIndex()]
188 [endcap->getCode().getPhiIndex()]
189 =endcap;
190
191 if (idHelper) {
192 Identifier id = idHelper->layer_id(endcap->getCode().isPosZ() ? +2 : -2,
193 endcap->getCode().getPhiIndex(),
194 endcap->getCode().getWheelIndex(),
195 endcap->getCode().getStrawLayerIndex());
196
197 IdentifierHash hashId = idHelper->straw_layer_hash(id);
198 if (hashId.is_valid()) {
199 if (m_trtcoll.size() <= hashId) {
200 m_trtcoll.resize(static_cast<unsigned int>(hashId) + 1);
201 }
202 if (m_trtcoll[hashId]) {
203 //Element already added - complain!
204 ATH_MSG_DEBUG("manageEndcapElement: Overriding existing element for hashID");
205 }
206 m_trtcoll[hashId]=endcap;
207 } else {
208 ATH_MSG_WARNING("manageEndcapElement: Invalid identifier");
209 }
210 }
211 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 163 of file AthMessaging.h.

164{
165 MsgStream* ms = m_msg_tls.get();
166 if (!ms) {
167 if (!m_initialized.test_and_set()) initMessaging();
168 ms = new MsgStream(m_imsg,m_nm);
169 m_msg_tls.reset( ms );
170 }
171
172 ms->setLevel (m_lvl);
173 return *ms;
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 178 of file AthMessaging.h.

179{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 if (m_lvl <= lvl) {
154 msg() << lvl;
155 return true;
156 } else {
157 return false;
158 }
159}

◆ operator=()

void InDetDD::TRT_DetElementContainer::operator= ( const TRT_DetElementContainer & other)
delete

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ setNumerology()

void InDetDD::TRT_DetElementContainer::setNumerology ( const TRT_Numerology * mynum)

Definition at line 24 of file TRT_DetElementContainer.cxx.

25 {
26 m_trtnum=mynum;
27 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_baArray

TRT_BarrelElement* InDetDD::TRT_DetElementContainer::m_baArray[2][NMODMAX][NPHIMAX][NSTRAWLAYMAXBR] {}
private

Definition at line 84 of file TRT_DetElementContainer.h.

84{};

◆ m_ecArray

TRT_EndcapElement* InDetDD::TRT_DetElementContainer::m_ecArray[2][NWHEELMAX][NSTRAWLAYMAXEC][NPHIMAX] {}
private

Definition at line 85 of file TRT_DetElementContainer.h.

85{};

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_trtcoll

TRT_DetElementCollection InDetDD::TRT_DetElementContainer::m_trtcoll
private

Definition at line 75 of file TRT_DetElementContainer.h.

◆ m_trtnum

const TRT_Numerology* InDetDD::TRT_DetElementContainer::m_trtnum
private

Definition at line 76 of file TRT_DetElementContainer.h.


The documentation for this class was generated from the following files: