ATLAS Offline Software
Loading...
Searching...
No Matches
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) {
30 m_elementCollection.resize(m_idHelper->wafer_hash_max());
31 }
32}
33
35
37{
38 return m_volume.size();
39}
40
41PVConstLink HGTD_DetectorManager::getTreeTop(unsigned int i) const
42{
43 return m_volume[i];
44}
45
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
66
67const 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
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{
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
108void HGTD_DetectorManager::setCommonItems(std::unique_ptr<const SiCommonItems>&& commonItems)
109{
110 m_commonItems = std::move(commonItems);
111}
#define ATH_MSG_ERROR(x)
static Double_t sc
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
virtual unsigned int getNumTreeTops() const override
Access to raw geometry:
void addTreeTop(PVConstLink treeTop)
Add a Tree top:
const InDetDD::HGTD_DetectorElement * getDetectorElement(const Identifier &id) const
access to individual elements : via Identifier
const InDetDD::HGTD_DetectorElementCollection * getDetectorElementCollection() const
Get the collection of element that is held.
void invalidateAll()
Invalidate cache for all detector elements.
void updateAll() const
Update all caches.
~HGTD_DetectorManager()
Destructor.
std::vector< PVConstLink > m_volume
HGTD_DetectorManager(StoreGateSvc *detStore)
Constructor.
std::unique_ptr< const InDetDD::SiCommonItems > m_commonItems
void addDetectorElement(InDetDD::HGTD_DetectorElement *element)
Add elememts.
const HGTD_ID * getIdHelper() const
virtual PVConstLink getTreeTop(unsigned int i) const override
void setCommonItems(std::unique_ptr< const InDetDD::SiCommonItems > &&commonItems)
Set SiCommonItems.
InDetDD::HGTD_DetectorElementCollection m_elementCollection
This is an Identifier helper class for the HGTD subdetector.
Definition HGTD_ID.h:47
This is a "hash" representation of an Identifier.
bool is_valid() const
Check if id is in a valid state.
Class to hold geometrical description of an HGTD detector element.
Helper class to concentrate common items, such as the pointer to the IdHelper, the lorentzAngle tool ...
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
The Athena Transient Store API.
DataVector< HGTD_DetectorElement > HGTD_DetectorElementCollection