ATLAS Offline Software
Loading...
Searching...
No Matches
MuonIdHelperSvc.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 MUON_MUONIDHELPERSVC_H
6#define MUON_MUONIDHELPERSVC_H
7
10
11
12#include <unordered_set>
13#include <array>
14#include <cassert>
15namespace Muon {
20 class MuonIdHelperSvc : public extends<AthService, IMuonIdHelperSvc> {
21 public:
23 using base_class::base_class;
24
26 virtual ~MuonIdHelperSvc() override = default;
27
29 virtual StatusCode initialize() override;
30
32 virtual std::string toString(const Identifier& id) const override;
33
35 virtual std::string toStringTech(const Identifier& id) const override;
36
38 virtual std::string toStringStation(const Identifier& id) const override;
39
41 virtual std::string toStringChamber(const Identifier& id) const override;
42
44 virtual std::string toStringDetEl(const Identifier& id) const override;
45
47 virtual std::string toStringGasGap(const Identifier& id) const override;
48
50 virtual std::string chamberNameString(const Identifier& id) const override;
51
53 virtual bool isMuon(const Identifier& id) const override;
54
56 virtual bool isMdt(const Identifier& id) const override;
57
59 virtual bool isMM(const Identifier& id) const override;
60
62 virtual bool isCsc(const Identifier& id) const override;
63
65 virtual bool isRpc(const Identifier& id) const override;
66
68 virtual bool isTgc(const Identifier& id) const override;
69
71 virtual bool issTgc(const Identifier& id) const override;
72
74 virtual bool issMdt(const Identifier& id) const override;
75
79 virtual bool hasHPTDC(const Identifier& id) const override;
80
82 virtual bool measuresPhi(const Identifier& id) const override;
83
85 virtual bool isEndcap(const Identifier& id) const override;
86
88 virtual bool isTrigger(const Identifier& id) const override;
89
91 virtual bool isSmallChamber(const Identifier& id) const override;
92
94 virtual int gasGap(const Identifier& id) const override;
95
97 virtual Identifier chamberId(const Identifier& id) const override;
98
100 virtual Identifier detElId(const Identifier& id) const override;
101
103 virtual Identifier gasGapId(const Identifier& id) const override;
104
106 virtual Identifier layerId(const Identifier& id) const override;
107
109 virtual const MdtIdHelper& mdtIdHelper() const override {
110 assert(m_mdtIdHelper != nullptr);
111 return *m_mdtIdHelper;
112 }
113
115 virtual const RpcIdHelper& rpcIdHelper() const override {
116 assert(m_rpcIdHelper != nullptr);
117 return *m_rpcIdHelper;
118 }
119
121 virtual const TgcIdHelper& tgcIdHelper() const override {
122 assert(m_tgcIdHelper != nullptr);
123 return *m_tgcIdHelper;
124 }
125
127 virtual const CscIdHelper& cscIdHelper() const override {
128 assert(m_cscIdHelper != nullptr);
129 return *m_cscIdHelper;
130 }
131
133 virtual const sTgcIdHelper& stgcIdHelper() const override {
134 assert(m_stgcIdHelper != nullptr);
135 return *m_stgcIdHelper;
136 }
137
139 virtual const MmIdHelper& mmIdHelper() const override {
140 assert(m_mmIdHelper != nullptr);
141 return *m_mmIdHelper;
142 }
143
145 virtual MuonStationIndex::ChIndex chamberIndex(const Identifier& id) const override;
146
148 virtual MuonStationIndex::StIndex stationIndex(const Identifier& id) const override;
149
151 virtual MuonStationIndex::PhiIndex phiIndex(const Identifier& id) const override;
152
154 virtual MuonStationIndex::DetectorRegionIndex regionIndex(const Identifier& id) const override;
155
157 virtual MuonStationIndex::LayerIndex layerIndex(const Identifier& id) const override;
158
160 virtual MuonStationIndex::TechnologyIndex technologyIndex(const Identifier& id) const override;
161
163 virtual int stationPhi(const Identifier& id) const override;
164
166 virtual int stationEta(const Identifier& id) const override;
167
169 virtual std::string stationNameString(const Identifier& id) const override;
170
172 virtual int stationName(const Identifier& id) const override;
173
175 virtual int stationRegion(const Identifier& id) const override;
176
178 virtual int sector(const Identifier& id) const override;
180 virtual const std::set<MuonStationIndex::TechnologyIndex>&
181 technologiesInStation(MuonStationIndex::StIndex stIndex) const override;
182
183 bool hasRPC() const override;
184 bool hasTGC() const override;
185 bool hasMDT() const override;
186
187 bool hasCSC() const override;
188 bool hasSTGC() const override;
189 bool hasMM() const override;
190
192 virtual IdentifierHash moduleHash(const Identifier& id) const override;
194 virtual IdentifierHash detElementHash(const Identifier& id) const override;
195
196
197 private:
198 IdentifierHash moduleHash(const MuonIdHelper& idHelper, const Identifier& id) const;
199 IdentifierHash detElementHash(const MuonIdHelper& idHelper, const Identifier& id) const;
200
202 const RpcIdHelper* m_rpcIdHelper{nullptr};
203 const TgcIdHelper* m_tgcIdHelper{nullptr};
204 const CscIdHelper* m_cscIdHelper{nullptr};
205 const MdtIdHelper* m_mdtIdHelper{nullptr};
206 const MmIdHelper* m_mmIdHelper{nullptr};
208
210
211 Gaudi::Property<bool> m_hasMDT{this, "HasMDT", true, "Specify whether the current detector layour contains MDT chambers"};
212 Gaudi::Property<bool> m_hasRPC{this, "HasRPC", true, "Specify whether the current detector layour contains RPC chambers"};
213 Gaudi::Property<bool> m_hasTGC{this, "HasTGC", true, "Specify whether the current detector layour contains TGC chambers"};
214 Gaudi::Property<bool> m_hasCSC{this, "HasCSC", true, "Specify whether current detector layout contains CSC chambers"};
215 Gaudi::Property<bool> m_hasSTGC{this, "HasSTGC", true, "Specify whether current detector layout contains STGC chambers"};
216 Gaudi::Property<bool> m_hasMM{this, "HasMM", true, "Specify whether current detector layout contains MicroMegas chambers"};
217
218 ServiceHandle<StoreGateSvc> m_detStore{this, "DetectorStore", "DetectorStore"};
219
225 std::string stationName{};
226 bool isEndcap{false};
227 bool isSmall{false};
228 ChIdx chIndex{ChIdx::ChUnknown};
229 StIdx stIndex{StIdx::StUnknown};
230 };
231 std::vector<StationNameData> m_stationNameData{};
232 std::vector<TechIdx> m_technologies{};
233
234 int m_BIS_stat{-1};
235 std::unordered_set<Identifier> m_smdt_stat{};
237 std::array<std::set<TechIdx>, static_cast<int>(StIdx::StIndexMax)> m_techPerStation{};
238 };
239
240} // namespace Muon
241
242#endif // MUON_MUONIDHELPERSVC_H
This is a "hash" representation of an Identifier.
Helper service that creates muon Identifiers and can be used to print Identifiers.
virtual const MdtIdHelper & mdtIdHelper() const override
access to MdtIdHelper
MuonStationIndex::PhiIndex PhiIdx
virtual StatusCode initialize() override
AlgTool initilize.
virtual bool isMM(const Identifier &id) const override
returns whether this is a MM Identifier or not
MuonStationIndex::ChIndex ChIdx
virtual int stationName(const Identifier &id) const override
Return stationName for all technologies.
const TgcIdHelper * m_tgcIdHelper
virtual std::string chamberNameString(const Identifier &id) const override
print chamber name to string
const MdtIdHelper * m_mdtIdHelper
virtual Identifier detElId(const Identifier &id) const override
create a detector element ID
virtual bool isTgc(const Identifier &id) const override
returns whether this is a TGC Identifier or not
virtual MuonStationIndex::TechnologyIndex technologyIndex(const Identifier &id) const override
calculate layer index from Identifier
virtual IdentifierHash detElementHash(const Identifier &id) const override
Returns the detector element hash associated to an Identifier.
virtual bool isMdt(const Identifier &id) const override
returns whether this is a MDT Identifier or not
ServiceHandle< StoreGateSvc > m_detStore
bool hasCSC() const override
virtual int gasGap(const Identifier &id) const override
returns gas gap: gasGap for RPC + TGC, wireLayer for CSC, tube for MDT
virtual MuonStationIndex::DetectorRegionIndex regionIndex(const Identifier &id) const override
calculate detector region index from Identifier
Gaudi::Property< bool > m_hasMDT
virtual const TgcIdHelper & tgcIdHelper() const override
access to TgcIdHelper
virtual const RpcIdHelper & rpcIdHelper() const override
access to RpcIdHelper
virtual std::string toStringGasGap(const Identifier &id) const override
print all fields up to gas gap to string
virtual bool measuresPhi(const Identifier &id) const override
returns whether channel measures phi or not
virtual const CscIdHelper & cscIdHelper() const override
access to CscIdHelper
std::unordered_set< Identifier > m_smdt_stat
virtual bool issTgc(const Identifier &id) const override
returns whether this is a sTGC Identifier or not
virtual bool issMdt(const Identifier &id) const override
returns whether this is a sMDT Identifier or not
virtual int stationRegion(const Identifier &id) const override
Return stationRegion for all technologies.
bool hasMDT() const override
virtual std::string toStringDetEl(const Identifier &id) const override
print all fields up to detector element to string
Gaudi::Property< bool > m_hasMM
MuonStationIndex::StIndex StIdx
std::vector< TechIdx > m_technologies
virtual std::string toStringChamber(const Identifier &id) const override
print all fields up to chamber to string
virtual bool isSmallChamber(const Identifier &id) const override
returns whether this is a small chamber, always returns true for TGCs
MuonStationIndex::TechnologyIndex TechIdx
virtual int stationEta(const Identifier &id) const override
Return stationEta for all technologies.
const RpcIdHelper * m_rpcIdHelper
Sub detector specific IdHelpers.
virtual std::string toString(const Identifier &id) const override
print all fields to string
virtual ~MuonIdHelperSvc() override=default
destructor
virtual int stationPhi(const Identifier &id) const override
Return stationPhi for all technologies.
const sTgcIdHelper * m_stgcIdHelper
virtual const sTgcIdHelper & stgcIdHelper() const override
access to TgcIdHelper
virtual MuonStationIndex::ChIndex chamberIndex(const Identifier &id) const override
calculate chamber index from Identifier
virtual const std::set< MuonStationIndex::TechnologyIndex > & technologiesInStation(MuonStationIndex::StIndex stIndex) const override
Recieve all technologies in a station.
bool hasSTGC() const override
virtual MuonStationIndex::PhiIndex phiIndex(const Identifier &id) const override
calculate phi index from Identifier (not supported for MDT hits)
virtual std::string toStringTech(const Identifier &id) const override
print all fields up to technology to string
const MmIdHelper * m_mmIdHelper
virtual const MmIdHelper & mmIdHelper() const override
access to CscIdHelper
const MuonIdHelper * m_primaryHelper
std::array< std::set< TechIdx >, static_cast< int >(StIdx::StIndexMax)> m_techPerStation
Array holding which technologies are there per station.
Gaudi::Property< bool > m_hasRPC
virtual bool isTrigger(const Identifier &id) const override
returns whether trigger chamber id or not
std::vector< StationNameData > m_stationNameData
bool hasMM() const override
virtual Identifier gasGapId(const Identifier &id) const override
create a gasGap ID (will return layer Id for MDTs)
virtual bool isRpc(const Identifier &id) const override
returns whether this is a RPC Identifier or not
Gaudi::Property< bool > m_hasSTGC
Gaudi::Property< bool > m_hasTGC
bool hasRPC() const override
virtual bool isEndcap(const Identifier &id) const override
returns whether this is an endcap Identifier or not
const CscIdHelper * m_cscIdHelper
virtual MuonStationIndex::StIndex stationIndex(const Identifier &id) const override
calculate station index from Identifier
virtual bool isCsc(const Identifier &id) const override
returns whether this is a CSC Identifier or not
virtual std::string toStringStation(const Identifier &id) const override
print all fields up to stationName to string
virtual std::string stationNameString(const Identifier &id) const override
Return the station name string for all technologies.
Gaudi::Property< bool > m_hasCSC
virtual bool isMuon(const Identifier &id) const override
returns whether this is a Muon Identifier or not
virtual MuonStationIndex::LayerIndex layerIndex(const Identifier &id) const override
calculate layer index from Identifier
virtual Identifier layerId(const Identifier &id) const override
create a layer ID, returns tube id for the MDTs
virtual bool hasHPTDC(const Identifier &id) const override
returns whether this Identifier belongs to an MDT with HPTDC or not NOTE that in Run4,...
virtual int sector(const Identifier &id) const override
return sector number 1-16, odd=large, even=small
virtual Identifier chamberId(const Identifier &id) const override
create a chamber ID
virtual IdentifierHash moduleHash(const Identifier &id) const override
Returns the module hash associated to an Identifier.
bool hasTGC() const override
StIndex
enum to classify the different station layers in the muon spectrometer
TechnologyIndex
enum to classify the different layers in the muon spectrometer
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
PhiIndex
enum to classify the different phi layers in the muon spectrometer
LayerIndex
enum to classify the different layers in the muon spectrometer
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.