ATLAS Offline Software
Loading...
Searching...
No Matches
HGTD_DetectorManager Class Reference

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

#include <HGTD_DetectorManager.h>

Inheritance diagram for HGTD_DetectorManager:
Collaboration diagram for HGTD_DetectorManager:

Public Member Functions

 HGTD_DetectorManager (StoreGateSvc *detStore)
 Constructor.
 ~HGTD_DetectorManager ()
 Destructor.
virtual unsigned int getNumTreeTops () const override
 Access to raw geometry:
virtual PVConstLink getTreeTop (unsigned int i) const override
void addTreeTop (PVConstLink treeTop)
 Add a Tree top:
const InDetDD::HGTD_DetectorElementgetDetectorElement (const Identifier &id) const
 access to individual elements : via Identifier
const InDetDD::HGTD_DetectorElementgetDetectorElement (const IdentifierHash &idHash) const
 access to individual elements : via IdentifierHash
const InDetDD::HGTD_DetectorElementgetDetectorElement (int endcap, int layer, int phi_module, int eta_module) const
 access to individual elements : via element identification
const InDetDD::HGTD_DetectorElementCollectiongetDetectorElementCollection () const
 Get the collection of element that is held.
void addDetectorElement (InDetDD::HGTD_DetectorElement *element)
 Add elememts.
void invalidateAll ()
 Invalidate cache for all detector elements.
void updateAll () const
 Update all caches.
void setCommonItems (std::unique_ptr< const InDetDD::SiCommonItems > &&commonItems)
 Set SiCommonItems.
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 Member Functions

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

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.
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

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) {
30 m_elementCollection.resize(m_idHelper->wafer_hash_max());
31 }
32}
#define ATH_MSG_ERROR(x)
static Double_t sc
AthMessaging()
Default constructor:
InDetDD::HGTD_DetectorElementCollection m_elementCollection
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ ~HGTD_DetectorManager()

HGTD_DetectorManager::~HGTD_DetectorManager ( )
default

Destructor.

◆ 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 77 of file HGTD_DetectorManager.cxx.

78{
79 IdentifierHash idHash = element->identifyHash();
80 if (idHash >= m_elementCollection.size())
81 ATH_MSG_ERROR ("HGTD_DetectorManager: Error adding detector element.");
82 m_elementCollection[idHash] = element;
83}
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)

◆ addTreeTop()

void HGTD_DetectorManager::addTreeTop ( PVConstLink treeTop)

Add a Tree top:

Definition at line 46 of file HGTD_DetectorManager.cxx.

46 {
47 m_volume.push_back(vol);
48}
std::vector< PVConstLink > m_volume

◆ getDetectorElement() [1/3]

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

access to individual elements : via Identifier

Definition at line 50 of file HGTD_DetectorManager.cxx.

51{
52 // Make sure it is a wafer Id
53 Identifier waferId = m_idHelper->wafer_id(id);
54 IdentifierHash idHash = m_idHelper->wafer_hash(waferId);
55 if (idHash.is_valid()) {
56 return m_elementCollection[idHash];
57 } else {
58 return 0;
59 }
60}
bool is_valid() const
Check if id is in a valid state.

◆ getDetectorElement() [2/3]

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

access to individual elements : via IdentifierHash

Definition at line 62 of file HGTD_DetectorManager.cxx.

63{
64 return m_elementCollection[idHash];
65}

◆ getDetectorElement() [3/3]

const 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 67 of file HGTD_DetectorManager.cxx.

68{
69 return getDetectorElement(m_idHelper->wafer_id(endcap, layer, phi_module, eta_module));
70}
const InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier

◆ getDetectorElementCollection()

const HGTD_DetectorElementCollection * HGTD_DetectorManager::getDetectorElementCollection ( ) const

Get the collection of element that is held.

Definition at line 72 of file HGTD_DetectorManager.cxx.

73{
74 return &m_elementCollection;
75}

◆ getIdHelper()

const HGTD_ID * HGTD_DetectorManager::getIdHelper ( ) const
private

Definition at line 85 of file HGTD_DetectorManager.cxx.

86{
87 return m_idHelper;
88}

◆ getNumTreeTops()

unsigned int HGTD_DetectorManager::getNumTreeTops ( ) const
overridevirtual

Access to raw geometry:

Definition at line 36 of file HGTD_DetectorManager.cxx.

37{
38 return m_volume.size();
39}

◆ getTreeTop()

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

Definition at line 41 of file HGTD_DetectorManager.cxx.

42{
43 return m_volume[i];
44}

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

◆ invalidateAll()

void HGTD_DetectorManager::invalidateAll ( )

Invalidate cache for all detector elements.

Definition at line 90 of file HGTD_DetectorManager.cxx.

91{
92 for (HGTD_DetectorElement* element : m_elementCollection) {
93 if (element) {
94 element->invalidate();
95 }
96 }
97}

◆ 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=()

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 108 of file HGTD_DetectorManager.cxx.

109{
110 m_commonItems = std::move(commonItems);
111}
std::unique_ptr< const InDetDD::SiCommonItems > m_commonItems

◆ 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 99 of file HGTD_DetectorManager.cxx.

100{
101 for (const HGTD_DetectorElement* element : m_elementCollection) {
102 if (element) {
103 element->updateCache();
104 }
105 }
106}

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 94 of file HGTD_DetectorManager.h.

◆ m_elementCollection

InDetDD::HGTD_DetectorElementCollection HGTD_DetectorManager::m_elementCollection
private

Definition at line 91 of file HGTD_DetectorManager.h.

◆ m_idHelper

const HGTD_ID* HGTD_DetectorManager::m_idHelper
private

Definition at line 92 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.

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_volume

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

Definition at line 89 of file HGTD_DetectorManager.h.


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