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

#include <HGTD_DetectorManager.h>

Inheritance diagram for HGTD_DetectorManager:
Collaboration diagram for HGTD_DetectorManager:

Public Member Functions

 HGTD_DetectorManager (StoreGateSvc *detStore)
 Constructor. More...
 
 ~HGTD_DetectorManager ()
 Destructor. More...
 
virtual unsigned int getNumTreeTops () const override
 Access to raw geometry: More...
 
virtual PVConstLink getTreeTop (unsigned int i) const override
 
void addTreeTop (PVConstLink treeTop)
 Add a Tree top: More...
 
InDetDD::HGTD_DetectorElementgetDetectorElement (const Identifier &id) const
 access to individual elements : via Identifier More...
 
InDetDD::HGTD_DetectorElementgetDetectorElement (const IdentifierHash &idHash) const
 access to individual elements : via IdentifierHash More...
 
InDetDD::HGTD_DetectorElementgetDetectorElement (int endcap, int layer, int phi_module, int eta_module) const
 access to individual elements : via element identification More...
 
const InDetDD::HGTD_DetectorElementCollectiongetDetectorElementCollection () const
 access to whole collection via Iterators More...
 
InDetDD::HGTD_DetectorElementCollection::const_iterator getDetectorElementBegin () const
 
InDetDD::HGTD_DetectorElementCollection::const_iterator getDetectorElementEnd () const
 
void addDetectorElement (InDetDD::HGTD_DetectorElement *element)
 Add elememts. More...
 
void invalidateAll () const
 Invalidate cache for all detector elements. More...
 
void updateAll () const
 Update all caches. More...
 
void setCommonItems (std::unique_ptr< const InDetDD::SiCommonItems > &&commonItems)
 Set SiCommonItems. More...
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

const HGTD_DetectorManageroperator= (const HGTD_DetectorManager &right)
 Prevent copy and assignment. More...
 
 HGTD_DetectorManager (const HGTD_DetectorManager &right)
 
const HGTD_IDgetIdHelper () const
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::vector< PVConstLink > m_volume
 
InDetDD::HGTD_DetectorElementCollection m_elementCollection
 
const HGTD_IDm_idHelper
 
std::unique_ptr< const InDetDD::SiCommonItemsm_commonItems
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

The Detector manager has methods to retrieve the Identifier helper and methods to retrieve the detector elements, as well as the relevant physical volumes.

Definition at line 33 of file HGTD_DetectorManager.h.

Constructor & Destructor Documentation

◆ HGTD_DetectorManager() [1/2]

HGTD_DetectorManager::HGTD_DetectorManager ( StoreGateSvc detStore)

Constructor.

Definition at line 14 of file HGTD_DetectorManager.cxx.

15  : AthMessaging("HGTD_DetectorManager"),
16  m_idHelper(0)
17 {
18  setName("HGTD");
19 
20  //
21  // Initialize the Identifier helper
22  //
23  StatusCode sc = detStore->retrieve(m_idHelper,"HGTD_ID");
24  if (sc.isFailure() ) {
25  ATH_MSG_ERROR ("Could not retrieve HGTD id helper");
26  }
27 
28  // Initialize the collections
29  if (m_idHelper) {
31  }
32 }

◆ ~HGTD_DetectorManager()

HGTD_DetectorManager::~HGTD_DetectorManager ( )

Destructor.

Definition at line 34 of file HGTD_DetectorManager.cxx.

35 {
36  // Clean up
38  for (iter = m_elementCollection.begin(); iter != m_elementCollection.end(); ++iter){
39  delete *iter;
40  }
41 }

◆ HGTD_DetectorManager() [2/2]

HGTD_DetectorManager::HGTD_DetectorManager ( const HGTD_DetectorManager right)
private

Member Function Documentation

◆ addDetectorElement()

void HGTD_DetectorManager::addDetectorElement ( InDetDD::HGTD_DetectorElement element)

Add elememts.

Definition at line 94 of file HGTD_DetectorManager.cxx.

95 {
96  IdentifierHash idHash = element->identifyHash();
97  if (idHash >= m_elementCollection.size())
98  ATH_MSG_ERROR ("HGTD_DetectorManager: Error adding detector element.");
99  m_elementCollection[idHash] = element;
100 }

◆ addTreeTop()

void HGTD_DetectorManager::addTreeTop ( PVConstLink  treeTop)

Add a Tree top:

Definition at line 53 of file HGTD_DetectorManager.cxx.

53  {
54  m_volume.push_back(vol);
55 }

◆ getDetectorElement() [1/3]

HGTD_DetectorElement * HGTD_DetectorManager::getDetectorElement ( const Identifier id) const

access to individual elements : via Identifier

Definition at line 57 of file HGTD_DetectorManager.cxx.

58 {
59  // Make sure it is a wafer Id
60  Identifier waferId = m_idHelper->wafer_id(id);
61  IdentifierHash idHash = m_idHelper->wafer_hash(waferId);
62  if (idHash.is_valid()) {
63  return m_elementCollection[idHash];
64  } else {
65  return 0;
66  }
67 }

◆ getDetectorElement() [2/3]

HGTD_DetectorElement * HGTD_DetectorManager::getDetectorElement ( const IdentifierHash idHash) const

access to individual elements : via IdentifierHash

Definition at line 69 of file HGTD_DetectorManager.cxx.

70 {
71  return m_elementCollection[idHash];
72 }

◆ getDetectorElement() [3/3]

HGTD_DetectorElement * HGTD_DetectorManager::getDetectorElement ( int  endcap,
int  layer,
int  phi_module,
int  eta_module 
) const

access to individual elements : via element identification

Definition at line 74 of file HGTD_DetectorManager.cxx.

75 {
76  return getDetectorElement(m_idHelper->wafer_id(endcap, layer, phi_module, eta_module));
77 }

◆ getDetectorElementBegin()

HGTD_DetectorElementCollection::const_iterator HGTD_DetectorManager::getDetectorElementBegin ( ) const

Definition at line 84 of file HGTD_DetectorManager.cxx.

85 {
86  return m_elementCollection.begin();
87 }

◆ getDetectorElementCollection()

const HGTD_DetectorElementCollection * HGTD_DetectorManager::getDetectorElementCollection ( ) const

access to whole collection via Iterators

Definition at line 79 of file HGTD_DetectorManager.cxx.

80 {
81  return &m_elementCollection;
82 }

◆ getDetectorElementEnd()

HGTD_DetectorElementCollection::const_iterator HGTD_DetectorManager::getDetectorElementEnd ( ) const

Definition at line 89 of file HGTD_DetectorManager.cxx.

90 {
91  return m_elementCollection.end();
92 }

◆ getIdHelper()

const HGTD_ID * HGTD_DetectorManager::getIdHelper ( ) const
private

Definition at line 102 of file HGTD_DetectorManager.cxx.

103 {
104  return m_idHelper;
105 }

◆ getNumTreeTops()

unsigned int HGTD_DetectorManager::getNumTreeTops ( ) const
overridevirtual

Access to raw geometry:

Definition at line 43 of file HGTD_DetectorManager.cxx.

44 {
45  return m_volume.size();
46 }

◆ getTreeTop()

PVConstLink HGTD_DetectorManager::getTreeTop ( unsigned int  i) const
overridevirtual

Definition at line 48 of file HGTD_DetectorManager.cxx.

49 {
50  return m_volume[i];
51 }

◆ 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  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ invalidateAll()

void HGTD_DetectorManager::invalidateAll ( ) const

Invalidate cache for all detector elements.

Definition at line 107 of file HGTD_DetectorManager.cxx.

108 {
109  for (HGTD_DetectorElementCollection::const_iterator element_iter = getDetectorElementBegin();
110  element_iter != getDetectorElementEnd();
111  ++element_iter) {
112  if (*element_iter) {
113  (*element_iter)->invalidate();
114  }
115  }
116 }

◆ 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 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ 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 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ 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_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ operator=()

const HGTD_DetectorManager& HGTD_DetectorManager::operator= ( const HGTD_DetectorManager right)
private

Prevent copy and assignment.

◆ setCommonItems()

void HGTD_DetectorManager::setCommonItems ( std::unique_ptr< const InDetDD::SiCommonItems > &&  commonItems)

Set SiCommonItems.

Definition at line 129 of file HGTD_DetectorManager.cxx.

130 {
131  m_commonItems = std::move(commonItems);
132 }

◆ 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 }

◆ updateAll()

void HGTD_DetectorManager::updateAll ( ) const

Update all caches.

Definition at line 118 of file HGTD_DetectorManager.cxx.

119 {
120  for (HGTD_DetectorElementCollection::const_iterator element_iter = getDetectorElementBegin();
121  element_iter != getDetectorElementEnd();
122  ++element_iter) {
123  if (*element_iter) {
124  (*element_iter)->setCache();
125  }
126  }
127 }

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_commonItems

std::unique_ptr<const InDetDD::SiCommonItems> HGTD_DetectorManager::m_commonItems
private

Definition at line 95 of file HGTD_DetectorManager.h.

◆ m_elementCollection

InDetDD::HGTD_DetectorElementCollection HGTD_DetectorManager::m_elementCollection
private

Definition at line 92 of file HGTD_DetectorManager.h.

◆ m_idHelper

const HGTD_ID* HGTD_DetectorManager::m_idHelper
private

Definition at line 93 of file HGTD_DetectorManager.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ 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_volume

std::vector<PVConstLink> HGTD_DetectorManager::m_volume
private

Definition at line 91 of file HGTD_DetectorManager.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
HGTD_ID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: HGTD_ID.h:404
HGTD_DetectorManager::m_commonItems
std::unique_ptr< const InDetDD::SiCommonItems > m_commonItems
Definition: HGTD_DetectorManager.h:95
HGTD_DetectorManager::m_idHelper
const HGTD_ID * m_idHelper
Definition: HGTD_DetectorManager.h:93
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
InDetDD::SolidStateDetectorElementBase::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
HGTD_DetectorManager::getDetectorElementBegin
InDetDD::HGTD_DetectorElementCollection::const_iterator getDetectorElementBegin() const
Definition: HGTD_DetectorManager.cxx:84
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
HGTD_ID::wafer_id
Identifier wafer_id(int endcap, int layer, int phi_module, int eta_module) const
For a single crystal.
Definition: HGTD_ID.h:287
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
HGTD_DetectorManager::getDetectorElementEnd
InDetDD::HGTD_DetectorElementCollection::const_iterator getDetectorElementEnd() const
Definition: HGTD_DetectorManager.cxx:89
HGTD_DetectorManager::m_volume
std::vector< PVConstLink > m_volume
Definition: HGTD_DetectorManager.h:91
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
IdentifierHash::is_valid
bool is_valid() const
Check if id is in a valid state.
HGTD_ID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: HGTD_ID.cxx:832
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
HGTD_DetectorManager::getDetectorElement
InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier
Definition: HGTD_DetectorManager.cxx:57
HGTD_DetectorManager::m_elementCollection
InDetDD::HGTD_DetectorElementCollection m_elementCollection
Definition: HGTD_DetectorManager.h:92
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
Identifier
Definition: IdentifierFieldParser.cxx:14