ATLAS Offline Software
HGTD_DetectorManager.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 
13 
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 }
33 
35 {
36  // Clean up
38  for (iter = m_elementCollection.begin(); iter != m_elementCollection.end(); ++iter){
39  delete *iter;
40  }
41 }
42 
44 {
45  return m_volume.size();
46 }
47 
48 PVConstLink HGTD_DetectorManager::getTreeTop(unsigned int i) const
49 {
50  return m_volume[i];
51 }
52 
53 void HGTD_DetectorManager::addTreeTop(PVConstLink vol){
54  m_volume.push_back(vol);
55 }
56 
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 }
68 
70 {
71  return m_elementCollection[idHash];
72 }
73 
74 HGTD_DetectorElement* HGTD_DetectorManager::getDetectorElement(int endcap, int layer, int phi_module, int eta_module) const
75 {
76  return getDetectorElement(m_idHelper->wafer_id(endcap, layer, phi_module, eta_module));
77 }
78 
80 {
81  return &m_elementCollection;
82 }
83 
84 HGTD_DetectorElementCollection::const_iterator HGTD_DetectorManager::getDetectorElementBegin() const
85 {
86  return m_elementCollection.begin();
87 }
88 
89 HGTD_DetectorElementCollection::const_iterator HGTD_DetectorManager::getDetectorElementEnd() const
90 {
91  return m_elementCollection.end();
92 }
93 
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 }
101 
103 {
104  return m_idHelper;
105 }
106 
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 }
117 
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 }
128 
129 void HGTD_DetectorManager::setCommonItems(std::unique_ptr<const SiCommonItems>&& commonItems)
130 {
131  m_commonItems = std::move(commonItems);
132 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
HGTD_ID::wafer_hash
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
Definition: HGTD_ID.h:404
AthMsgStreamMacros.h
HGTD_DetectorManager::m_commonItems
std::unique_ptr< const InDetDD::SiCommonItems > m_commonItems
Definition: HGTD_DetectorManager.h:95
HGTD_DetectorManager::updateAll
void updateAll() const
Update all caches.
Definition: HGTD_DetectorManager.cxx:118
HGTD_DetectorManager::m_idHelper
const HGTD_ID * m_idHelper
Definition: HGTD_DetectorManager.h:93
InDetDD::HGTD_DetectorElement
Definition: HGTD_DetectorElement.h:40
HGTD_DetectorManager::getDetectorElementCollection
const InDetDD::HGTD_DetectorElementCollection * getDetectorElementCollection() const
access to whole collection via Iterators
Definition: HGTD_DetectorManager.cxx:79
HGTD_DetectorManager.h
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
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:128
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
HGTD_DetectorManager::getNumTreeTops
virtual unsigned int getNumTreeTops() const override
Access to raw geometry:
Definition: HGTD_DetectorManager.cxx:43
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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::addTreeTop
void addTreeTop(PVConstLink treeTop)
Add a Tree top:
Definition: HGTD_DetectorManager.cxx:53
HGTD_DetectorManager::~HGTD_DetectorManager
~HGTD_DetectorManager()
Destructor.
Definition: HGTD_DetectorManager.cxx:34
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
HGTD_ID
Definition: HGTD_ID.h:47
HGTD_DetectorManager::m_volume
std::vector< PVConstLink > m_volume
Definition: HGTD_DetectorManager.h:91
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:830
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
HGTD_DetectorManager::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const override
Definition: HGTD_DetectorManager.cxx:48
HGTD_DetectorManager::HGTD_DetectorManager
HGTD_DetectorManager(StoreGateSvc *detStore)
Constructor.
Definition: HGTD_DetectorManager.cxx:14
InDetDD::SiCommonItems
Definition: SiCommonItems.h:45
HGTD_DetectorManager::addDetectorElement
void addDetectorElement(InDetDD::HGTD_DetectorElement *element)
Add elememts.
Definition: HGTD_DetectorManager.cxx:94
HGTD_DetectorManager::getIdHelper
const HGTD_ID * getIdHelper() const
Definition: HGTD_DetectorManager.cxx:102
HGTD_DetectorManager::getDetectorElement
InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier
Definition: HGTD_DetectorManager.cxx:57
HGTD_DetectorManager::setCommonItems
void setCommonItems(std::unique_ptr< const InDetDD::SiCommonItems > &&commonItems)
Set SiCommonItems.
Definition: HGTD_DetectorManager.cxx:129
HGTD_DetectorManager::m_elementCollection
InDetDD::HGTD_DetectorElementCollection m_elementCollection
Definition: HGTD_DetectorManager.h:92
IdentifierHash
Definition: IdentifierHash.h:38
InDetDD::HGTD_DetectorElementCollection
Definition: HGTD_DetectorElementCollection.h:29
StoreGateSvc.h
HGTD_DetectorManager::invalidateAll
void invalidateAll() const
Invalidate cache for all detector elements.
Definition: HGTD_DetectorManager.cxx:107