ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MuonDetectorManager_H
6#define MuonDetectorManager_H
7
10#include <iostream>
11#include <map>
12#include <sstream>
13#include <vector>
15#include "GaudiKernel/StatusCode.h"
16#include "GeoModelKernel/GeoAlignableTransform.h"
17#include "GeoModelKernel/GeoVDetectorManager.h"
23
24
25#ifndef SIMULATIONBASE
28#endif
29
30namespace MuonGM {
31
32
39 class MMReadoutElement;
41 class MuonStation;
42
50
51 class MuonDetectorManager : public GeoVDetectorManager, public AthMessaging {
52 public:
53 // Constructor:
55
56 // Destructor:
58
59 // Gets the number of tree tops: required:
60 virtual unsigned int getNumTreeTops() const;
61
62 // Gets the ith tree top: required:
63 virtual PVConstLink getTreeTop(unsigned int i) const;
64 PVLink getTreeTop(unsigned int i);
65
66 // Add a tree top:
67 void addTreeTop(PVLink);
68
69 // Add a XxxReadoutElement to the Collection
70 void addMdtReadoutElement(std::unique_ptr<MdtReadoutElement>&& reEle);
71 void addRpcReadoutElement(std::unique_ptr<RpcReadoutElement>&& reEle);
72 void addTgcReadoutElement(std::unique_ptr<TgcReadoutElement>&& reEle);
73 void addCscReadoutElement(std::unique_ptr<CscReadoutElement>&& reEle);
74 void addsTgcReadoutElement(std::unique_ptr<sTgcReadoutElement>&& reEle);
75 void addMMReadoutElement(std::unique_ptr<MMReadoutElement>&& reEle);
76
77
78 // access to Readout Elements
79 const MdtReadoutElement* getMdtReadoutElement(const Identifier& id) const;
80 const RpcReadoutElement* getRpcReadoutElement(const Identifier& id) const;
81 const TgcReadoutElement* getTgcReadoutElement(const Identifier& id) const;
82 const CscReadoutElement* getCscReadoutElement(const Identifier& id) const;
83 const MMReadoutElement* getMMReadoutElement(const Identifier& id) const;
86 const MuonReadoutElement* getReadoutElement(const Identifier& id) const;
91
92
97
98 inline unsigned int nMuonStation() const;
99
100 inline unsigned int nMdtRE() const;
101 inline unsigned int nsTgcRE() const;
102 inline unsigned int nMMRE() const;
103 inline unsigned int nCscRE() const;
104 inline unsigned int nRpcRE() const;
105 inline unsigned int nTgcRE() const;
106
107 inline unsigned int nMdtDE() const;
108 inline unsigned int nCscDE() const;
109 inline unsigned int nRpcDE() const;
110 inline unsigned int nTgcDE() const;
111
112 // Geometry versioning
113 inline const std::string& geometryVersion() const;
114 void setGeometryVersion(const std::string& version);
115 inline const std::string& get_DBMuonVersion() const;
116 void set_DBMuonVersion(const std::string& version);
117
118 // Access to identifier helpers
119 inline const MdtIdHelper* mdtIdHelper() const;
120 inline const CscIdHelper* cscIdHelper() const;
121 inline const RpcIdHelper* rpcIdHelper() const;
122 inline const TgcIdHelper* tgcIdHelper() const;
123 inline const sTgcIdHelper* stgcIdHelper() const;
124 inline const MmIdHelper* mmIdHelper() const;
125
126
127 void setMinimalGeoFlag(int flag);
128 inline int MinimalGeoFlag() const;
129 void setCutoutsFlag(int flag);
130 inline int IncludeCutoutsFlag() const;
131 void setCutoutsBogFlag(int flag);
132 inline int IncludeCutoutsBogFlag() const;
133
134 // Add a MuonStation to the list
135 void addMuonStation(std::unique_ptr<MuonStation>&& mst);
136 const MuonStation* getMuonStation(const std::string& stName, int eta, int phi) const;
137 MuonStation* getMuonStation(const std::string& stName, int eta, int phi);
138 //<! access to the MuonStation by StationName, Jzz, Jff (amdb indices!!!! not stationPhi and Eta)
139 static std::string muonStationKey(const std::string& stName, int statEtaIndex, int statPhiIndex) ;
140
141 void clearCache();
142 void fillCache();
143
144 StatusCode updateAlignment(const ALineContainer& a);
145 StatusCode updateDeformations(const BLineContainer& a);
147 StatusCode updateCSCInternalAlignmentMap(const ALineContainer& cscIntAline);
148
149 void setNswAsBuilt(const NswAsBuiltDbData* nswAsBuiltData);
150 void setsTGCAsBuilt(const sTGCAsBuiltData* stgcAsBuilt);
151#ifndef SIMULATIONBASE
153 return m_nswAsBuilt ? m_nswAsBuilt->microMegaData.get() : nullptr;
154 }
155#endif
159 static constexpr int NCscStEtaOffset = 1;
160 static constexpr int NTgcStatTypeOff = -41;
161 static constexpr int NTgcStEtaOffset = 5;
162
164 return m_stgcAsBuildData;
165 }
166
168 return m_mmPassivation;
169 }
170 void setMMPassivation(const NswPassivationDbData* passiv);
171 // map the RPC station indices (0-NRpcStatType) back to the RpcIdHelper stationNames
172 int rpcStationName(const int stationIndex) const;
173
174 private:
175 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{"Muon::MuonIdHelperSvc/MuonIdHelperSvc", "MuonDetectorManager"};
176 void loadStationIndices();
177 unsigned int rpcStationTypeIdx(const int stationName) const; // map the RPC stationNames from the RpcIdHelper to 0-NRpcStatType
178 enum RpcStatType { BML = 0, BMS, BOL, BOS, BMF, BOF, BOG, BME, BIR, BIM, BIL, BIS, UNKNOWN };
180 int rpcIdentToArrayIdx(const Identifier& id) const;
181 int tgcIdentToArrayIdx(const Identifier& id) const;
182 int cscIdentToArrayIdx(const Identifier& id) const;
183 int stgcIdentToArrayIdx(const Identifier& id) const;
184 int mmIdenToArrayIdx(const Identifier& id) const;
185 int mdtIdentToArrayIdx(const Identifier& id) const;
186
190
191 std::vector<PVLink> m_envelope; // Tree-top...
192
193
194 // Geometry versioning
195 std::string m_geometryVersion{}; // generic name of the Layout
196 std::string m_DBMuonVersion{}; // name of the MuonVersion table-collection in Oracle
197
198 // 115.6 kBytes.
199 std::vector<std::unique_ptr<MdtReadoutElement>> m_mdtArray;
200 std::vector<std::unique_ptr<CscReadoutElement>> m_cscArray;
201 std::vector<std::unique_ptr<TgcReadoutElement>> m_tgcArray;
202
203 std::vector<std::unique_ptr<RpcReadoutElement>> m_rpcArray;
204 std::vector<std::unique_ptr<sTgcReadoutElement>> m_stgArray;
205 std::vector<std::unique_ptr<MMReadoutElement>> m_mmcArray;
206 std::map<std::string, std::unique_ptr<MuonStation> > m_MuonStationMap;
207
208 unsigned int m_n_mdtRE{0};
209 unsigned int m_n_cscRE{0};
210 unsigned int m_n_rpcRE{0};
211 unsigned int m_n_tgcRE{0};
212 unsigned int m_n_stgRE{0};
213 unsigned int m_n_mmcRE{0};
214
215 unsigned int m_n_mdtDE{0};
216 unsigned int m_n_cscDE{0};
217 unsigned int m_n_rpcDE{0};
218 unsigned int m_n_tgcDE{0};
219
220
224
226 std::map<int, int> m_rpcStatToIdx;
227 std::map<int, int> m_rpcIdxToStat;
228
229
230 };
231
233 return m_idHelperSvc->hasMDT() ? &(m_idHelperSvc->mdtIdHelper()) : nullptr;
234 }
236 return m_idHelperSvc->hasCSC() ? &(m_idHelperSvc->cscIdHelper()) : nullptr;
237 }
239 return m_idHelperSvc->hasRPC() ? &(m_idHelperSvc->rpcIdHelper()): nullptr;
240 }
242 return m_idHelperSvc->hasTGC() ? &(m_idHelperSvc->tgcIdHelper()) : nullptr;
243 }
245 return m_idHelperSvc->hasSTGC() ? &(m_idHelperSvc->stgcIdHelper()) : nullptr;
246 }
248 return m_idHelperSvc->hasMM() ? &(m_idHelperSvc->mmIdHelper()) : nullptr;
249 }
250
251
252
256
257 const std::string& MuonDetectorManager::geometryVersion() const { return m_geometryVersion; }
258 const std::string& MuonDetectorManager::get_DBMuonVersion() const { return m_DBMuonVersion; }
259
260
261 unsigned int MuonDetectorManager::nMuonStation() const { return m_MuonStationMap.size(); }
262 unsigned int MuonDetectorManager::nMdtRE() const { return m_n_mdtRE; }
263 unsigned int MuonDetectorManager::nCscRE() const { return m_n_cscRE; }
264 unsigned int MuonDetectorManager::nRpcRE() const { return m_n_rpcRE; }
265 unsigned int MuonDetectorManager::nTgcRE() const { return m_n_tgcRE; }
266 unsigned int MuonDetectorManager::nsTgcRE() const { return m_n_stgRE; }
267 unsigned int MuonDetectorManager::nMMRE() const { return m_n_mmcRE; }
268
269 unsigned int MuonDetectorManager::nMdtDE() const { return m_n_mdtDE; }
270 unsigned int MuonDetectorManager::nCscDE() const { return m_n_cscDE; }
271 unsigned int MuonDetectorManager::nRpcDE() const { return m_n_rpcDE; }
272 unsigned int MuonDetectorManager::nTgcDE() const { return m_n_tgcDE; }
273
274} // namespace MuonGM
275
276#ifndef GAUDI_NEUTRAL
277namespace MuonGM {
278 class MuonDetectorManager;
279}
282#endif
283
284#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define CONDCONT_MIXED_DEF(...)
Definition CondCont.h:1446
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
std::set< ALinePar, std::less<> > ALineContainer
std::set< MdtAsBuiltPar, std::less<> > MdtAsBuiltContainer
std::set< BLinePar, std::less<> > BLineContainer
static Double_t a
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This is a "hash" representation of an Identifier.
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
StatusCode updateCSCInternalAlignmentMap(const ALineContainer &cscIntAline)
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const MuonReadoutElement * getReadoutElement(const Identifier &id) const
Get any read out element.
static constexpr int NCscStEtaOffset
Identifier <-> AMDB conversion constants in use.
void addsTgcReadoutElement(std::unique_ptr< sTgcReadoutElement > &&reEle)
store the sTGCReadoutElement using as "key" the identifier
void addRpcReadoutElement(std::unique_ptr< RpcReadoutElement > &&reEle)
store the RpcReadoutElement using as "key" the identifier
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const std::string & get_DBMuonVersion() const
the name of the MuonSpectrometer tag (in the geometry DB) actually accessed
const std::string & geometryVersion() const
it can be Rome-Initial or P03, or ... it's the name of the layout
int rpcIdentToArrayIdx(const Identifier &id) const
Helper method to convert the Identifier into the corresponding index accessing the array.
static std::string muonStationKey(const std::string &stName, int statEtaIndex, int statPhiIndex)
const MuonStation * getMuonStation(const std::string &stName, int eta, int phi) const
std::map< std::string, std::unique_ptr< MuonStation > > m_MuonStationMap
void addCscReadoutElement(std::unique_ptr< CscReadoutElement > &&reEle)
store the CscReadoutElement using as "key" the identifier
void addMdtReadoutElement(std::unique_ptr< MdtReadoutElement > &&reEle)
store the MdtReadoutElement using as "key" the identifier
void addTgcReadoutElement(std::unique_ptr< TgcReadoutElement > &&reEle)
store the TgcReadoutElement using as "key" the identifier
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
void addMMReadoutElement(std::unique_ptr< MMReadoutElement > &&reEle)
store the MMReadoutElement using as "key" the identifier
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Base class for the XxxReadoutElement, with Xxx = Mdt, Rpc, Tgc, Csc.
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Class holding the sTGC as built conditions data and applying it.
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27