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 
37 {
38  return m_volume.size();
39 }
40 
41 PVConstLink HGTD_DetectorManager::getTreeTop(unsigned int i) const
42 {
43  return m_volume[i];
44 }
45 
46 void HGTD_DetectorManager::addTreeTop(PVConstLink vol){
47  m_volume.push_back(vol);
48 }
49 
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 }
61 
63 {
64  return m_elementCollection[idHash];
65 }
66 
67 const HGTD_DetectorElement* HGTD_DetectorManager::getDetectorElement(int endcap, int layer, int phi_module, int eta_module) const
68 {
69  return getDetectorElement(m_idHelper->wafer_id(endcap, layer, phi_module, eta_module));
70 }
71 
73 {
74  return &m_elementCollection;
75 }
76 
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 }
84 
86 {
87  return m_idHelper;
88 }
89 
91 {
92  for (HGTD_DetectorElement* element : m_elementCollection) {
93  if (element) {
94  element->invalidate();
95  }
96  }
97 }
98 
100 {
101  for (const HGTD_DetectorElement* element : m_elementCollection) {
102  if (element) {
103  element->updateCache();
104  }
105  }
106 }
107 
108 void HGTD_DetectorManager::setCommonItems(std::unique_ptr<const SiCommonItems>&& commonItems)
109 {
110  m_commonItems = std::move(commonItems);
111 }
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:94
HGTD_DetectorManager::updateAll
void updateAll() const
Update all caches.
Definition: HGTD_DetectorManager.cxx:99
HGTD_DetectorManager::m_idHelper
const HGTD_ID * m_idHelper
Definition: HGTD_DetectorManager.h:92
InDetDD::HGTD_DetectorElement
Definition: HGTD_DetectorElement.h:40
HGTD_DetectorManager::getDetectorElementCollection
const InDetDD::HGTD_DetectorElementCollection * getDetectorElementCollection() const
Get the collection of element that is held.
Definition: HGTD_DetectorManager.cxx:72
HGTD_DetectorManager.h
InDetDD::SolidStateDetectorElementBase::identifyHash
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
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:120
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HGTD_DetectorManager::getDetectorElement
const InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier
Definition: HGTD_DetectorManager.cxx:50
lumiFormat.i
int i
Definition: lumiFormat.py:85
HGTD_DetectorManager::getNumTreeTops
virtual unsigned int getNumTreeTops() const override
Access to raw geometry:
Definition: HGTD_DetectorManager.cxx:36
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::addTreeTop
void addTreeTop(PVConstLink treeTop)
Add a Tree top:
Definition: HGTD_DetectorManager.cxx:46
HGTD_DetectorManager::~HGTD_DetectorManager
~HGTD_DetectorManager()
Destructor.
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
HGTD_ID
Definition: HGTD_ID.h:47
HGTD_DetectorManager::invalidateAll
void invalidateAll()
Invalidate cache for all detector elements.
Definition: HGTD_DetectorManager.cxx:90
HGTD_DetectorManager::m_volume
std::vector< PVConstLink > m_volume
Definition: HGTD_DetectorManager.h:89
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::getTreeTop
virtual PVConstLink getTreeTop(unsigned int i) const override
Definition: HGTD_DetectorManager.cxx:41
HGTD_DetectorManager::HGTD_DetectorManager
HGTD_DetectorManager(StoreGateSvc *detStore)
Constructor.
Definition: HGTD_DetectorManager.cxx:14
DataVector::resize
void resize(size_type sz)
Resizes the collection to the specified number of elements.
InDetDD::SiCommonItems
Definition: SiCommonItems.h:45
HGTD_DetectorManager::addDetectorElement
void addDetectorElement(InDetDD::HGTD_DetectorElement *element)
Add elememts.
Definition: HGTD_DetectorManager.cxx:77
HGTD_DetectorManager::getIdHelper
const HGTD_ID * getIdHelper() const
Definition: HGTD_DetectorManager.cxx:85
HGTD_DetectorManager::setCommonItems
void setCommonItems(std::unique_ptr< const InDetDD::SiCommonItems > &&commonItems)
Set SiCommonItems.
Definition: HGTD_DetectorManager.cxx:108
HGTD_DetectorManager::m_elementCollection
InDetDD::HGTD_DetectorElementCollection m_elementCollection
Definition: HGTD_DetectorManager.h:91
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
StoreGateSvc.h
InDetDD::HGTD_DetectorElementCollection
DataVector< HGTD_DetectorElement > HGTD_DetectorElementCollection
Definition: HGTD_DetectorElementCollection.h:20
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
Identifier
Definition: IdentifierFieldParser.cxx:14