ATLAS Offline Software
MuonIdHelperSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUON_MUONIDHELPERSVC_H
6 #define MUON_MUONIDHELPERSVC_H
7 
10 
11 namespace Muon {
16  class MuonIdHelperSvc : public extends<AthService, IMuonIdHelperSvc> {
17  public:
19  MuonIdHelperSvc(const std::string& name, ISvcLocator* svc);
20 
22  virtual ~MuonIdHelperSvc() override = default;
23 
25  virtual StatusCode initialize() override;
26 
28  virtual std::string toString(const Identifier& id) const override;
29 
31  virtual std::string toStringTech(const Identifier& id) const override;
32 
34  virtual std::string toStringStation(const Identifier& id) const override;
35 
37  virtual std::string toStringChamber(const Identifier& id) const override;
38 
40  virtual std::string toStringDetEl(const Identifier& id) const override;
41 
43  virtual std::string toStringGasGap(const Identifier& id) const override;
44 
46  virtual std::string chamberNameString(const Identifier& id) const override;
47 
49  virtual bool isMuon(const Identifier& id) const override;
50 
52  virtual bool isMdt(const Identifier& id) const override;
53 
55  virtual bool isMM(const Identifier& id) const override;
56 
58  virtual bool isCsc(const Identifier& id) const override;
59 
61  virtual bool isRpc(const Identifier& id) const override;
62 
64  virtual bool isTgc(const Identifier& id) const override;
65 
67  virtual bool issTgc(const Identifier& id) const override;
68 
70  virtual bool issMdt(const Identifier& id) const override;
71 
75  virtual bool hasHPTDC(const Identifier& id) const override;
76 
78  virtual bool measuresPhi(const Identifier& id) const override;
79 
81  virtual bool isEndcap(const Identifier& id) const override;
82 
84  virtual bool isTrigger(const Identifier& id) const override;
85 
87  virtual bool isSmallChamber(const Identifier& id) const override;
88 
90  virtual int gasGap(const Identifier& id) const override;
91 
93  virtual Identifier chamberId(const Identifier& id) const override;
94 
96  virtual Identifier detElId(const Identifier& id) const override;
97 
99  virtual Identifier gasGapId(const Identifier& id) const override;
100 
102  virtual Identifier layerId(const Identifier& id) const override;
103 
105  virtual const MdtIdHelper& mdtIdHelper() const override { return *m_mdtIdHelper; }
106 
108  virtual const RpcIdHelper& rpcIdHelper() const override { return *m_rpcIdHelper; }
109 
111  virtual const TgcIdHelper& tgcIdHelper() const override { return *m_tgcIdHelper; }
112 
114  virtual const CscIdHelper& cscIdHelper() const override { return *m_cscIdHelper; }
115 
117  virtual const sTgcIdHelper& stgcIdHelper() const override { return *m_stgcIdHelper; }
118 
120  virtual const MmIdHelper& mmIdHelper() const override { return *m_mmIdHelper; }
121 
123  virtual MuonStationIndex::ChIndex chamberIndex(const Identifier& id) const override;
124 
126  virtual MuonStationIndex::StIndex stationIndex(const Identifier& id) const override;
127 
129  virtual MuonStationIndex::PhiIndex phiIndex(const Identifier& id) const override;
130 
132  virtual MuonStationIndex::DetectorRegionIndex regionIndex(const Identifier& id) const override;
133 
135  virtual MuonStationIndex::LayerIndex layerIndex(const Identifier& id) const override;
136 
138  virtual MuonStationIndex::TechnologyIndex technologyIndex(const Identifier& id) const override;
139 
141  virtual int stationPhi(const Identifier& id) const override;
142 
144  virtual int stationEta(const Identifier& id) const override;
145 
147  virtual std::string stationNameString(const Identifier& id) const override;
148 
150  virtual int stationName(const Identifier& id) const override;
151 
153  virtual int stationRegion(const Identifier& id) const override;
154 
156  virtual int sector(const Identifier& id) const override;
157 
158  bool hasRPC() const override;
159  bool hasTGC() const override;
160  bool hasMDT() const override;
161 
162  bool hasCSC() const override;
163  bool hasSTGC() const override;
164  bool hasMM() const override;
165 
167  virtual IdentifierHash moduleHash(const Identifier& id) const override;
169  virtual IdentifierHash detElementHash(const Identifier& id) const override;
170 
171 
172  private:
173  IdentifierHash moduleHash(const MuonIdHelper& idHelper, const Identifier& id) const;
174  IdentifierHash detElementHash(const MuonIdHelper& idHelper, const Identifier& id) const;
175 
177  const RpcIdHelper* m_rpcIdHelper{nullptr};
178  const TgcIdHelper* m_tgcIdHelper{nullptr};
179  const CscIdHelper* m_cscIdHelper{nullptr};
180  const MdtIdHelper* m_mdtIdHelper{nullptr};
181  const MmIdHelper* m_mmIdHelper{nullptr};
182  const sTgcIdHelper* m_stgcIdHelper{nullptr};
183 
184  const MuonIdHelper* m_primaryHelper{nullptr};
185 
186  Gaudi::Property<bool> m_hasMDT{this, "HasMDT", true, "Specify whether the current detector layour contains MDT chambers"};
187  Gaudi::Property<bool> m_hasRPC{this, "HasRPC", true, "Specify whether the current detector layour contains RPC chambers"};
188  Gaudi::Property<bool> m_hasTGC{this, "HasTGC", true, "Specify whether the current detector layour contains TGC chambers"};
189  Gaudi::Property<bool> m_hasCSC{this, "HasCSC", true, "Specify whether current detector layout contains CSC chambers"};
190  Gaudi::Property<bool> m_hasSTGC{this, "HasSTGC", true, "Specify whether current detector layout contains STGC chambers"};
191  Gaudi::Property<bool> m_hasMM{this, "HasMM", true, "Specify whether current detector layout contains MicroMegas chambers"};
192 
193  ServiceHandle<StoreGateSvc> m_detStore{this, "DetectorStore", "DetectorStore"};
194 
196  std::string stationName{};
197  bool isEndcap{false};
198  bool isSmall{false};
201  };
202  std::vector<StationNameData> m_stationNameData;
203  std::vector<MuonStationIndex::TechnologyIndex> m_technologies;
204 
205  int m_BIS_stat{-1};
206  std::set<Identifier> m_smdt_stat{};
207  };
208 
209 } // namespace Muon
210 
211 #endif // MUON_MUONIDHELPERSVC_H
Muon::MuonIdHelperSvc::m_mmIdHelper
const MmIdHelper * m_mmIdHelper
Definition: MuonIdHelperSvc.h:181
Muon::MuonIdHelperSvc::initialize
virtual StatusCode initialize() override
AlgTool initilize.
Definition: MuonIdHelperSvc.cxx:16
Muon::MuonIdHelperSvc::isTgc
virtual bool isTgc(const Identifier &id) const override
returns whether this is a TGC Identifier or not
Definition: MuonIdHelperSvc.cxx:209
Muon::MuonIdHelperSvc::tgcIdHelper
virtual const TgcIdHelper & tgcIdHelper() const override
access to TgcIdHelper
Definition: MuonIdHelperSvc.h:111
Muon::MuonIdHelperSvc::StationNameData::stationName
std::string stationName
Definition: MuonIdHelperSvc.h:196
Muon::MuonIdHelperSvc::m_hasSTGC
Gaudi::Property< bool > m_hasSTGC
Definition: MuonIdHelperSvc.h:190
Muon::MuonIdHelperSvc::m_hasMDT
Gaudi::Property< bool > m_hasMDT
Definition: MuonIdHelperSvc.h:186
Muon::MuonIdHelperSvc::StationNameData::stIndex
MuonStationIndex::StIndex stIndex
Definition: MuonIdHelperSvc.h:200
Muon::MuonIdHelperSvc::m_rpcIdHelper
const RpcIdHelper * m_rpcIdHelper
Sub detector specific IdHelpers.
Definition: MuonIdHelperSvc.h:177
Muon::MuonIdHelperSvc::StationNameData::isSmall
bool isSmall
Definition: MuonIdHelperSvc.h:198
Muon::MuonIdHelperSvc::stationName
virtual int stationName(const Identifier &id) const override
Return stationName for all technologies.
Definition: MuonIdHelperSvc.cxx:668
Muon::MuonIdHelperSvc::layerIndex
virtual MuonStationIndex::LayerIndex layerIndex(const Identifier &id) const override
calculate layer index from Identifier
Definition: MuonIdHelperSvc.cxx:324
Muon::MuonIdHelperSvc::toString
virtual std::string toString(const Identifier &id) const override
print all fields to string
Definition: MuonIdHelperSvc.cxx:338
TgcIdHelper
Definition: TgcIdHelper.h:50
Muon::MuonIdHelperSvc::isCsc
virtual bool isCsc(const Identifier &id) const override
returns whether this is a CSC Identifier or not
Definition: MuonIdHelperSvc.cxx:202
Muon::MuonIdHelperSvc::m_primaryHelper
const MuonIdHelper * m_primaryHelper
Definition: MuonIdHelperSvc.h:184
Muon::MuonIdHelperSvc::m_hasRPC
Gaudi::Property< bool > m_hasRPC
Definition: MuonIdHelperSvc.h:187
Muon::MuonIdHelperSvc::chamberIndex
virtual MuonStationIndex::ChIndex chamberIndex(const Identifier &id) const override
calculate chamber index from Identifier
Definition: MuonIdHelperSvc.cxx:256
Muon::MuonStationIndex::LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:38
Muon::MuonIdHelperSvc::stationNameString
virtual std::string stationNameString(const Identifier &id) const override
Return the station name string for all technologies.
Definition: MuonIdHelperSvc.cxx:745
Muon::MuonIdHelperSvc::isEndcap
virtual bool isEndcap(const Identifier &id) const override
returns whether this is an endcap Identifier or not
Definition: MuonIdHelperSvc.cxx:252
Muon::MuonIdHelperSvc::isSmallChamber
virtual bool isSmallChamber(const Identifier &id) const override
returns whether this is a small chamber, always returns true for TGCs
Definition: MuonIdHelperSvc.cxx:254
Muon::MuonIdHelperSvc::m_BIS_stat
int m_BIS_stat
Definition: MuonIdHelperSvc.h:205
Muon::MuonIdHelperSvc::sector
virtual int sector(const Identifier &id) const override
return sector number 1-16, odd=large, even=small
Definition: MuonIdHelperSvc.cxx:710
Muon::MuonIdHelperSvc::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: MuonIdHelperSvc.h:193
Muon::MuonIdHelperSvc::m_stgcIdHelper
const sTgcIdHelper * m_stgcIdHelper
Definition: MuonIdHelperSvc.h:182
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Muon::MuonIdHelperSvc::m_technologies
std::vector< MuonStationIndex::TechnologyIndex > m_technologies
Definition: MuonIdHelperSvc.h:203
Muon::MuonStationIndex::PhiIndex
PhiIndex
enum to classify the different phi layers in the muon spectrometer
Definition: MuonStationIndex.h:31
RpcIdHelper
Definition: RpcIdHelper.h:51
Muon::MuonIdHelperSvc::m_stationNameData
std::vector< StationNameData > m_stationNameData
Definition: MuonIdHelperSvc.h:202
Muon::MuonIdHelperSvc::m_hasMM
Gaudi::Property< bool > m_hasMM
Definition: MuonIdHelperSvc.h:191
Muon::MuonIdHelperSvc::isMM
virtual bool isMM(const Identifier &id) const override
returns whether this is a MM Identifier or not
Definition: MuonIdHelperSvc.cxx:199
Muon::MuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const override
access to CscIdHelper
Definition: MuonIdHelperSvc.h:120
Muon::MuonIdHelperSvc::stationPhi
virtual int stationPhi(const Identifier &id) const override
Return stationPhi for all technologies.
Definition: MuonIdHelperSvc.cxx:626
Muon::MuonIdHelperSvc::chamberId
virtual Identifier chamberId(const Identifier &id) const override
create a chamber ID
Definition: MuonIdHelperSvc.cxx:487
Muon::MuonIdHelperSvc::regionIndex
virtual MuonStationIndex::DetectorRegionIndex regionIndex(const Identifier &id) const override
calculate detector region index from Identifier
Definition: MuonIdHelperSvc.cxx:319
Muon::MuonIdHelperSvc::m_mdtIdHelper
const MdtIdHelper * m_mdtIdHelper
Definition: MuonIdHelperSvc.h:180
Muon::MuonIdHelperSvc::issTgc
virtual bool issTgc(const Identifier &id) const override
returns whether this is a sTGC Identifier or not
Definition: MuonIdHelperSvc.cxx:213
Muon::MuonIdHelperSvc::toStringGasGap
virtual std::string toStringGasGap(const Identifier &id) const override
print all fields up to gas gap to string
Definition: MuonIdHelperSvc.cxx:468
MuonIdHelper
Definition: MuonIdHelper.h:80
Muon::MuonIdHelperSvc::m_hasCSC
Gaudi::Property< bool > m_hasCSC
Definition: MuonIdHelperSvc.h:189
Muon::MuonIdHelperSvc::m_smdt_stat
std::set< Identifier > m_smdt_stat
Definition: MuonIdHelperSvc.h:206
Muon::MuonIdHelperSvc::layerId
virtual Identifier layerId(const Identifier &id) const override
create a layer ID, returns tube id for the MDTs
Definition: MuonIdHelperSvc.cxx:543
Muon::MuonIdHelperSvc::MuonIdHelperSvc
MuonIdHelperSvc(const std::string &name, ISvcLocator *svc)
default AlgService constructor
Definition: MuonIdHelperSvc.cxx:13
Muon::MuonIdHelperSvc::hasHPTDC
virtual bool hasHPTDC(const Identifier &id) const override
returns whether this Identifier belongs to an MDT with HPTDC or not NOTE that in Run4,...
Definition: MuonIdHelperSvc.cxx:226
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::MuonIdHelperSvc::isMdt
virtual bool isMdt(const Identifier &id) const override
returns whether this is a MDT Identifier or not
Definition: MuonIdHelperSvc.cxx:196
Muon::MuonIdHelperSvc::detElId
virtual Identifier detElId(const Identifier &id) const override
create a detector element ID
Definition: MuonIdHelperSvc.cxx:512
Muon::MuonIdHelperSvc::isTrigger
virtual bool isTrigger(const Identifier &id) const override
returns whether trigger chamber id or not
Definition: MuonIdHelperSvc.cxx:248
MdtIdHelper
Definition: MdtIdHelper.h:61
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
Muon::MuonIdHelperSvc::hasCSC
bool hasCSC() const override
Definition: MuonIdHelperSvc.cxx:741
Muon::MuonIdHelperSvc::m_tgcIdHelper
const TgcIdHelper * m_tgcIdHelper
Definition: MuonIdHelperSvc.h:178
Muon::MuonIdHelperSvc::hasTGC
bool hasTGC() const override
Definition: MuonIdHelperSvc.cxx:739
Muon::MuonIdHelperSvc::isRpc
virtual bool isRpc(const Identifier &id) const override
returns whether this is a RPC Identifier or not
Definition: MuonIdHelperSvc.cxx:205
Muon::MuonStationIndex::DetectorRegionIndex
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:47
Muon::MuonIdHelperSvc::m_hasTGC
Gaudi::Property< bool > m_hasTGC
Definition: MuonIdHelperSvc.h:188
Muon::MuonIdHelperSvc::stationEta
virtual int stationEta(const Identifier &id) const override
Return stationEta for all technologies.
Definition: MuonIdHelperSvc.cxx:647
Muon::MuonIdHelperSvc::gasGapId
virtual Identifier gasGapId(const Identifier &id) const override
create a gasGap ID (will return layer Id for MDTs)
Definition: MuonIdHelperSvc.cxx:585
Muon::MuonIdHelperSvc::detElementHash
virtual IdentifierHash detElementHash(const Identifier &id) const override
Returns the detector element hash associated to an Identifier.
Definition: MuonIdHelperSvc.cxx:781
Muon::MuonIdHelperSvc::toStringTech
virtual std::string toStringTech(const Identifier &id) const override
print all fields up to technology to string
Definition: MuonIdHelperSvc.cxx:363
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Muon::MuonIdHelperSvc::stgcIdHelper
virtual const sTgcIdHelper & stgcIdHelper() const override
access to TgcIdHelper
Definition: MuonIdHelperSvc.h:117
Muon::MuonIdHelperSvc::stationIndex
virtual MuonStationIndex::StIndex stationIndex(const Identifier &id) const override
calculate station index from Identifier
Definition: MuonIdHelperSvc.cxx:264
Muon::MuonIdHelperSvc::chamberNameString
virtual std::string chamberNameString(const Identifier &id) const override
print chamber name to string
Definition: MuonIdHelperSvc.cxx:382
Muon::MuonIdHelperSvc::rpcIdHelper
virtual const RpcIdHelper & rpcIdHelper() const override
access to RpcIdHelper
Definition: MuonIdHelperSvc.h:108
Muon::MuonIdHelperSvc::stationRegion
virtual int stationRegion(const Identifier &id) const override
Return stationRegion for all technologies.
Definition: MuonIdHelperSvc.cxx:689
Muon::MuonIdHelperSvc::measuresPhi
virtual bool measuresPhi(const Identifier &id) const override
returns whether channel measures phi or not
Definition: MuonIdHelperSvc.cxx:234
sTgcIdHelper
Definition: sTgcIdHelper.h:55
Muon::MuonIdHelperSvc::isMuon
virtual bool isMuon(const Identifier &id) const override
returns whether this is a Muon Identifier or not
Definition: MuonIdHelperSvc.cxx:193
Muon::MuonIdHelperSvc::technologyIndex
virtual MuonStationIndex::TechnologyIndex technologyIndex(const Identifier &id) const override
calculate layer index from Identifier
Definition: MuonIdHelperSvc.cxx:328
Muon::MuonIdHelperSvc::issMdt
virtual bool issMdt(const Identifier &id) const override
returns whether this is a sMDT Identifier or not
Definition: MuonIdHelperSvc.cxx:217
Muon::MuonIdHelperSvc::toStringDetEl
virtual std::string toStringDetEl(const Identifier &id) const override
print all fields up to detector element to string
Definition: MuonIdHelperSvc.cxx:449
Muon::MuonIdHelperSvc::hasMDT
bool hasMDT() const override
Definition: MuonIdHelperSvc.cxx:740
MmIdHelper
Definition: MmIdHelper.h:54
CscIdHelper
Definition: CscIdHelper.h:52
Muon::MuonIdHelperSvc::m_cscIdHelper
const CscIdHelper * m_cscIdHelper
Definition: MuonIdHelperSvc.h:179
Muon::MuonStationIndex::ChIndex
ChIndex
enum to classify the different chamber layers in the muon spectrometer
Definition: MuonStationIndex.h:15
AthService.h
Muon::MuonIdHelperSvc::moduleHash
virtual IdentifierHash moduleHash(const Identifier &id) const override
Returns the module hash associated to an Identifier.
Definition: MuonIdHelperSvc.cxx:771
Muon::MuonIdHelperSvc::hasSTGC
bool hasSTGC() const override
Definition: MuonIdHelperSvc.cxx:742
Muon::MuonIdHelperSvc::toStringStation
virtual std::string toStringStation(const Identifier &id) const override
print all fields up to stationName to string
Definition: MuonIdHelperSvc.cxx:386
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
Muon::MuonIdHelperSvc::~MuonIdHelperSvc
virtual ~MuonIdHelperSvc() override=default
destructor
Muon::MuonIdHelperSvc::hasRPC
bool hasRPC() const override
Definition: MuonIdHelperSvc.cxx:738
Muon::MuonIdHelperSvc::phiIndex
virtual MuonStationIndex::PhiIndex phiIndex(const Identifier &id) const override
calculate phi index from Identifier (not supported for MDT hits)
Definition: MuonIdHelperSvc.cxx:272
Muon::MuonIdHelperSvc::mdtIdHelper
virtual const MdtIdHelper & mdtIdHelper() const override
access to MdtIdHelper
Definition: MuonIdHelperSvc.h:105
Muon::MuonIdHelperSvc::toStringChamber
virtual std::string toStringChamber(const Identifier &id) const override
print all fields up to chamber to string
Definition: MuonIdHelperSvc.cxx:417
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
Muon::MuonIdHelperSvc::hasMM
bool hasMM() const override
Definition: MuonIdHelperSvc.cxx:743
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
Muon::MuonIdHelperSvc::StationNameData::chIndex
MuonStationIndex::ChIndex chIndex
Definition: MuonIdHelperSvc.h:199
Muon::MuonIdHelperSvc::StationNameData
Definition: MuonIdHelperSvc.h:195
IMuonIdHelperSvc.h
Muon::MuonIdHelperSvc::cscIdHelper
virtual const CscIdHelper & cscIdHelper() const override
access to CscIdHelper
Definition: MuonIdHelperSvc.h:114
Muon::MuonIdHelperSvc::gasGap
virtual int gasGap(const Identifier &id) const override
returns gas gap: gasGap for RPC + TGC, wireLayer for CSC, tube for MDT
Definition: MuonIdHelperSvc.cxx:173
Muon::MuonIdHelperSvc::StationNameData::isEndcap
bool isEndcap
Definition: MuonIdHelperSvc.h:197
Muon::MuonIdHelperSvc
Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: MuonIdHelperSvc.h:16
ServiceHandle< StoreGateSvc >
Identifier
Definition: IdentifierFieldParser.cxx:14