ATLAS Offline Software
Loading...
Searching...
No Matches
MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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 std::vector<const MuonReadoutElement*> getAllReadoutElements() const;
99
100 inline unsigned int nMuonStation() const;
101
102 inline unsigned int nMdtRE() const;
103 inline unsigned int nsTgcRE() const;
104 inline unsigned int nMMRE() const;
105 inline unsigned int nCscRE() const;
106 inline unsigned int nRpcRE() const;
107 inline unsigned int nTgcRE() const;
108
109 inline unsigned int nMdtDE() const;
110 inline unsigned int nCscDE() const;
111 inline unsigned int nRpcDE() const;
112 inline unsigned int nTgcDE() const;
113
114 // Geometry versioning
115 inline const std::string& geometryVersion() const;
116 void setGeometryVersion(const std::string& version);
117 inline const std::string& get_DBMuonVersion() const;
118 void set_DBMuonVersion(const std::string& version);
119
120 // Access to identifier helpers
121 inline const MdtIdHelper* mdtIdHelper() const;
122 inline const CscIdHelper* cscIdHelper() const;
123 inline const RpcIdHelper* rpcIdHelper() const;
124 inline const TgcIdHelper* tgcIdHelper() const;
125 inline const sTgcIdHelper* stgcIdHelper() const;
126 inline const MmIdHelper* mmIdHelper() const;
127
128
129 void setMinimalGeoFlag(int flag);
130 inline int MinimalGeoFlag() const;
131 void setCutoutsFlag(int flag);
132 inline int IncludeCutoutsFlag() const;
133 void setCutoutsBogFlag(int flag);
134 inline int IncludeCutoutsBogFlag() const;
135
136 // Add a MuonStation to the list
137 void addMuonStation(std::unique_ptr<MuonStation>&& mst);
138 const MuonStation* getMuonStation(const std::string& stName, int eta, int phi) const;
139 MuonStation* getMuonStation(const std::string& stName, int eta, int phi);
140 //<! access to the MuonStation by StationName, Jzz, Jff (amdb indices!!!! not stationPhi and Eta)
141 static std::string muonStationKey(const std::string& stName, int statEtaIndex, int statPhiIndex) ;
142
143 void clearCache();
144 void fillCache();
145
146 StatusCode updateAlignment(const ALineContainer& a);
147 StatusCode updateDeformations(const BLineContainer& a);
149 StatusCode updateCSCInternalAlignmentMap(const ALineContainer& cscIntAline);
150
151 void setNswAsBuilt(const NswAsBuiltDbData* nswAsBuiltData);
152 void setsTGCAsBuilt(const sTGCAsBuiltData* stgcAsBuilt);
153 void setMmAsBuilt2(const sTGCAsBuiltData* mmAsBuilt2);
154
155#ifndef SIMULATIONBASE
157 return m_nswAsBuilt ? m_nswAsBuilt->microMegaData.get() : nullptr;
158 }
159#endif
163 static constexpr int NCscStEtaOffset = 1;
164 static constexpr int NTgcStatTypeOff = -41;
165 static constexpr int NTgcStEtaOffset = 5;
166
168 return m_stgcAsBuildData;
169 }
171 return m_mmAsBuilt2;
172 }
174 return m_idHelperSvc.get();
175 }
176
178 return m_mmPassivation;
179 }
180 void setMMPassivation(const NswPassivationDbData* passiv);
181 // map the RPC station indices (0-NRpcStatType) back to the RpcIdHelper stationNames
182 int rpcStationName(const int stationIndex) const;
183
184 private:
185 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{"Muon::MuonIdHelperSvc/MuonIdHelperSvc", "MuonDetectorManager"};
186 void loadStationIndices();
187 unsigned int rpcStationTypeIdx(const int stationName) const; // map the RPC stationNames from the RpcIdHelper to 0-NRpcStatType
188 enum RpcStatType { BML = 0, BMS, BOL, BOS, BMF, BOF, BOG, BME, BIR, BIM, BIL, BIS, UNKNOWN };
190 int rpcIdentToArrayIdx(const Identifier& id) const;
191 int tgcIdentToArrayIdx(const Identifier& id) const;
192 int cscIdentToArrayIdx(const Identifier& id) const;
193 int stgcIdentToArrayIdx(const Identifier& id) const;
194 int mmIdenToArrayIdx(const Identifier& id) const;
195 int mdtIdentToArrayIdx(const Identifier& id) const;
196
200
201 std::vector<PVLink> m_envelope; // Tree-top...
202
203
204 // Geometry versioning
205 std::string m_geometryVersion{}; // generic name of the Layout
206 std::string m_DBMuonVersion{}; // name of the MuonVersion table-collection in Oracle
207
208 // 115.6 kBytes.
209 std::vector<std::unique_ptr<MdtReadoutElement>> m_mdtArray;
210 std::vector<std::unique_ptr<CscReadoutElement>> m_cscArray;
211 std::vector<std::unique_ptr<TgcReadoutElement>> m_tgcArray;
212
213 std::vector<std::unique_ptr<RpcReadoutElement>> m_rpcArray;
214 std::vector<std::unique_ptr<sTgcReadoutElement>> m_stgArray;
215 std::vector<std::unique_ptr<MMReadoutElement>> m_mmcArray;
216 std::map<std::string, std::unique_ptr<MuonStation> > m_MuonStationMap;
217
218 unsigned int m_n_mdtRE{0};
219 unsigned int m_n_cscRE{0};
220 unsigned int m_n_rpcRE{0};
221 unsigned int m_n_tgcRE{0};
222 unsigned int m_n_stgRE{0};
223 unsigned int m_n_mmcRE{0};
224
225 unsigned int m_n_mdtDE{0};
226 unsigned int m_n_cscDE{0};
227 unsigned int m_n_rpcDE{0};
228 unsigned int m_n_tgcDE{0};
229
230
235
237 std::map<int, int> m_rpcStatToIdx;
238 std::map<int, int> m_rpcIdxToStat;
239
240
241 };
242
244 return m_idHelperSvc->hasMDT() ? &(m_idHelperSvc->mdtIdHelper()) : nullptr;
245 }
247 return m_idHelperSvc->hasCSC() ? &(m_idHelperSvc->cscIdHelper()) : nullptr;
248 }
250 return m_idHelperSvc->hasRPC() ? &(m_idHelperSvc->rpcIdHelper()): nullptr;
251 }
253 return m_idHelperSvc->hasTGC() ? &(m_idHelperSvc->tgcIdHelper()) : nullptr;
254 }
256 return m_idHelperSvc->hasSTGC() ? &(m_idHelperSvc->stgcIdHelper()) : nullptr;
257 }
259 return m_idHelperSvc->hasMM() ? &(m_idHelperSvc->mmIdHelper()) : nullptr;
260 }
261
262
263
267
268 const std::string& MuonDetectorManager::geometryVersion() const { return m_geometryVersion; }
269 const std::string& MuonDetectorManager::get_DBMuonVersion() const { return m_DBMuonVersion; }
270
271
272 unsigned int MuonDetectorManager::nMuonStation() const { return m_MuonStationMap.size(); }
273 unsigned int MuonDetectorManager::nMdtRE() const { return m_n_mdtRE; }
274 unsigned int MuonDetectorManager::nCscRE() const { return m_n_cscRE; }
275 unsigned int MuonDetectorManager::nRpcRE() const { return m_n_rpcRE; }
276 unsigned int MuonDetectorManager::nTgcRE() const { return m_n_tgcRE; }
277 unsigned int MuonDetectorManager::nsTgcRE() const { return m_n_stgRE; }
278 unsigned int MuonDetectorManager::nMMRE() const { return m_n_mmcRE; }
279
280 unsigned int MuonDetectorManager::nMdtDE() const { return m_n_mdtDE; }
281 unsigned int MuonDetectorManager::nCscDE() const { return m_n_cscDE; }
282 unsigned int MuonDetectorManager::nRpcDE() const { return m_n_rpcDE; }
283 unsigned int MuonDetectorManager::nTgcDE() const { return m_n_tgcDE; }
284
285} // namespace MuonGM
286
287#ifndef GAUDI_NEUTRAL
288namespace MuonGM {
289 class MuonDetectorManager;
290}
293#endif
294
295#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
std::vector< const MuonReadoutElement * > getAllReadoutElements() const
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...
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Class holding the sTGC as built conditions data and applying it.
Ensure that the Athena extensions are properly loaded.
Definition GeoMuonHits.h:27