ATLAS Offline Software
RpcIdHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONIDHELPERS_RPCIDHELPER_H
6 #define MUONIDHELPERS_RPCIDHELPER_H
7 
9 
10 class MsgStream;
11 // ******************************************************************************
12 // class RpcIdHelper
13 // ******************************************************************************
14 //
15 // Description
16 // -----------
17 // This factory class constructs RPC identifiers and ranges and provides access
18 // to the levels. ATLAS note ATL-MUON-2002-??? (https://cds.cern.ch/record/681542?ln=de)
19 // provides a complete description of the hierarchical identifier scheme.
20 // RpcIdHelper provides an interface to the following fields of the identifier.
21 //
22 // Field Range Notes
23 // ==============================================================================
24 // StationName unsigned integer maps to "BIL","BMS",etc.
25 // StationEta [-8,8] increases with Z
26 // StationPhi [1,8] increases with phi
27 // Technology [2] maps to "RPC"
28 // DoubletR [1,2] increases with R
29 // DoubletZ [1,3] increases with |Z|
30 // DoubletPhi [1,2] increases with phi
31 // GasGap [1,2] increases with R
32 // MeasuresPhi [0,1] 0 if measures Z, 1 if measures phi
33 // Strip [1,n] increases with Z for MeasuresPhi=0
34 // increases with phi for MeasuresPhi=1
35 // ==============================================================================
36 //
37 // Inheritance
38 // -----------
39 // Inherits from MuonIdHelpers/MuonIdHelper.
40 //
41 // Author
42 // ------
43 // Steven Goldfarb <Steven.Goldfarb@cern.ch>
44 //
45 // Compact ID implementation by
46 // Ketevi A. Assamagan <ketevi@bnl.gov>
47 // BNL, March 11th, 2003
48 //
49 // ******************************************************************************
50 
51 class RpcIdHelper : public MuonIdHelper {
52 public:
53  RpcIdHelper();
54  virtual ~RpcIdHelper() = default;
55 
57 
59  virtual int initialize_from_dictionary(const IdDictMgr& dict_mgr) override;
60  virtual int get_module_hash(const Identifier& id, IdentifierHash& hash_id) const override;
61  virtual int get_detectorElement_hash(const Identifier& id, IdentifierHash& hash_id) const override;
62 
64 
65  // Identifier builders
66 
68  Identifier elementID(int stationName, int stationEta, int stationPhi, int doubletR, bool& isValid) const;
69 
70  Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi, int doubletR) const;
71  Identifier elementID(const std::string& stationNameStr, int stationEta, int stationPhi, int doubletR, bool& isValid) const;
72 
74  Identifier elementID(const Identifier& elementID, int doubletR, bool& isValid) const;
75 
77 
79  int measuresPhi, int strip) const;
81  int measuresPhi, int strip, bool& isValid) const;
82 
83  Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi,
84  int gasGap, int measuresPhi, int strip) const;
85  Identifier channelID(const std::string& stationNameStr, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi,
86  int gasGap, int measuresPhi, int strip, bool& isValid) const;
87 
88  Identifier channelID(const Identifier& id, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const;
89  Identifier channelID(const Identifier& id, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip, bool& isValid) const;
90 
91  Identifier parentID(const Identifier& id) const;
92  Identifier doubletZID(const Identifier& id) const;
93 
94  Identifier padID(const Identifier& elementID, int doubletZ, int doubletPhi) const;
95  Identifier padID(const Identifier& elementID, int doubletZ, int doubletPhi, bool& isValid) const;
96 
97  Identifier padID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi) const;
98  Identifier padID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, bool& isValid) const;
99 
100  Identifier panelID(const Identifier& padID, int gasGap, int measuresPhi) const;
101  Identifier panelID(const Identifier& padID, int gasGap, int measuresPhi, bool& isValid) const;
102 
103  Identifier panelID(const Identifier& channelID) const;
105  int measuresPhi) const;
107  int measuresPhi, bool& isValid) const;
108 
109  Identifier gapID(const Identifier& padID, int gasGap) const;
110  Identifier gapID(const Identifier& padID, int gasGap, bool& isValid) const;
111 
112  Identifier gapID(const Identifier& panelID) const;
113  Identifier gapID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap) const;
115  bool& isValid) const;
116 
117  // for an Identifier id, get the list of the daughter detector channel ids
118  void idChannels(const Identifier& id, std::vector<Identifier>& vect) const;
119 
120  // Access to levels: missing field returns 0
121 
122  int channel(const Identifier& id) const override;
123 
124  int doubletR(const Identifier& id) const;
125  int doubletZ(const Identifier& id) const;
126  int doubletPhi(const Identifier& id) const;
127 
128  int gasGap(const Identifier& id) const override;
129  bool measuresPhi(const Identifier& id) const override;
130  int strip(const Identifier& id) const;
131 
132  // Access to min and max of level ranges
133 
134  static int stationEtaMin() ;
135  static int stationEtaMax() ;
136  static int stationPhiMin() ;
137  static int stationPhiMax() ;
138  static int doubletRMin() ;
139  static int doubletRMax() ;
140  static int doubletZMin() ;
141  static int doubletZMax() ;
142  static int doubletPhiMin() ;
143  static int doubletPhiMax() ;
144  static int gasGapMin() ;
145  int gasGapMax() const;
146  static int measuresPhiMin() ;
147  static int measuresPhiMax() ;
148  static int stripMin() ;
149  static int stripMax() ;
150 
151  // Access to min and max of level ranges
152 
153  int stationEtaMin(const Identifier& id) const;
154  int stationEtaMax(const Identifier& id) const;
155  int stationPhiMin(const Identifier& id) const;
156  int stationPhiMax(const Identifier& id) const;
157  int doubletRMin(const Identifier& id) const;
158  int doubletRMax(const Identifier& id) const;
159  int doubletZMin(const Identifier& id) const;
160  int doubletZMax(const Identifier& id) const;
161  int doubletPhiMin(const Identifier& id) const;
162  int doubletPhiMax(const Identifier& id) const;
163  int gasGapMin(const Identifier& id) const;
164  int gasGapMax(const Identifier& id) const;
165  int measuresPhiMin(const Identifier& id) const;
166  int measuresPhiMax(const Identifier& id) const;
167  int stripMin(const Identifier& id) const;
168  int stripMax(const Identifier& id) const;
169 
170  // Public validation of levels
171 
172  bool valid(const Identifier& id) const;
173  bool validElement(const Identifier& id) const;
174  bool validPad(const Identifier& id) const;
175 
176 private:
177  bool isStNameInTech(const std::string& stationName) const override;
178 
179  virtual int init_detectorElement_hashes() override;
180  int init_id_to_hashes();
181 
182  bool isExtraDetElId(const Identifier& id) const;
183 
184  std::unordered_map<Identifier, unsigned int> m_module_hashes{};
185  std::unordered_map<Identifier, unsigned int > m_detectorElement_hashes{};
186 
187  // compact id indices
193 
200 
201  // Private validation of levels
202 
203  bool validElement(const Identifier& id, int stationName, int stationEta, int stationPhi, int doubletR) const;
204  bool validChannel(const Identifier& id, int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi,
205  int gasGap, int measuresPhi, int strip) const;
206  bool validPad(const Identifier& id, int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi) const;
207 
208  // Utility methods
209 
210  int rpcTechnology() const;
211 
212  // Level indices
213 
215 
216  // Level ranges
217 
218  enum RpcRanges {
233  StripMin = 1,
234  StripMax = 99
235  };
236  unsigned int m_gasGapMax{UINT_MAX}; // maximum number of gas gaps
237  int m_st_BMS{-1};
238  int m_st_BIL{-1};
239 };
240 
241 // For backwards compatibility
242 
244 
245 CLASS_DEF(RpcIdHelper, 4172, 1)
246 
247 // Construct ID from components
248 
249 #endif // MUONIDHELPERS_RPCIDHELPER_H
RpcIdHelper::m_mea_impl
IdDictFieldImplementation m_mea_impl
Definition: RpcIdHelper.h:198
RpcIdHelper::m_gasGapMax
unsigned int m_gasGapMax
Definition: RpcIdHelper.h:236
RpcIdHelper::parentID
Identifier parentID(const Identifier &id) const
Definition: RpcIdHelper.cxx:998
MuonIdHelper.h
RpcIdHelper::elementID
Identifier elementID(int stationName, int stationEta, int stationPhi, int doubletR) const
Definition: RpcIdHelper.cxx:802
RpcIdHelper::doubletRMin
static int doubletRMin()
Definition: RpcIdHelper.cxx:1084
RpcIdHelper::validChannel
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
Definition: RpcIdHelper.cxx:714
RpcIdHelper::doubletZ
int doubletZ(const Identifier &id) const
Definition: RpcIdHelper.cxx:1062
RpcIdHelper::stripMax
static int stripMax()
Definition: RpcIdHelper.cxx:1106
RpcIdHelper::m_dbr_impl
IdDictFieldImplementation m_dbr_impl
Definition: RpcIdHelper.h:194
RpcIdHelper::DoubletZMin
@ DoubletZMin
Definition: RpcIdHelper.h:225
RpcIdHelper::~RpcIdHelper
virtual ~RpcIdHelper()=default
RpcIdHelper::stationPhiMin
static int stationPhiMin()
Definition: RpcIdHelper.cxx:1080
RpcIdHelper::measuresPhi
bool measuresPhi(const Identifier &id) const override
Definition: RpcIdHelper.cxx:1068
RpcIdHelper::isExtraDetElId
bool isExtraDetElId(const Identifier &id) const
Definition: RpcIdHelper.cxx:1117
RpcIdHelper::doubletPhiMax
static int doubletPhiMax()
Definition: RpcIdHelper.cxx:1094
RpcIdHelper::m_dbp_impl
IdDictFieldImplementation m_dbp_impl
Definition: RpcIdHelper.h:196
RpcIdHelper::padID
Identifier padID(const Identifier &elementID, int doubletZ, int doubletPhi) const
Definition: RpcIdHelper.cxx:1043
MuonIdHelper::stationName
int stationName(const Identifier &id) const
Definition: MuonIdHelper.cxx:804
isValid
bool isValid(const T &p)
Definition: AtlasPID.h:214
RpcIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
Definition: RpcIdHelper.cxx:940
RpcIdHelper::m_gap_impl
IdDictFieldImplementation m_gap_impl
Definition: RpcIdHelper.h:197
RpcIdHelper::GasGapMin
@ GasGapMin
Definition: RpcIdHelper.h:229
RpcIdHelper::StationEtaMax
@ StationEtaMax
Definition: RpcIdHelper.h:220
RpcIdHelper
Definition: RpcIdHelper.h:51
RpcIdHelper::DoubletRMin
@ DoubletRMin
Definition: RpcIdHelper.h:223
RpcIdHelper::doubletPhiMin
static int doubletPhiMin()
Definition: RpcIdHelper.cxx:1092
RpcIdHelper::DoubletRMax
@ DoubletRMax
Definition: RpcIdHelper.h:224
RpcIdHelper::RpcIdHelper
RpcIdHelper()
Definition: RpcIdHelper.cxx:7
RpcIdHelper::gasGapMin
static int gasGapMin()
Definition: RpcIdHelper.cxx:1096
RpcIdHelper::gasGap
int gasGap(const Identifier &id) const override
get the hashes
Definition: RpcIdHelper.cxx:1066
AtlasDetectorID::size_type
Identifier::size_type size_type
Definition: AtlasDetectorID.h:384
RpcIdHelper::stationPhiMax
static int stationPhiMax()
Definition: RpcIdHelper.cxx:1082
RpcIdHelper::get_detectorElement_hash
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: RpcIdHelper.cxx:298
RpcIdHelper::DoubletRIndex
@ DoubletRIndex
Definition: RpcIdHelper.h:214
IdDictMgr
Definition: IdDictDefs.h:32
RpcIdHelper::m_DOUBLETR_INDEX
size_type m_DOUBLETR_INDEX
Definition: RpcIdHelper.h:188
MuonIdHelper
Definition: MuonIdHelper.h:80
RpcIdHelper::doubletZMax
static int doubletZMax()
Definition: RpcIdHelper.cxx:1090
RpcIdHelper::m_MEASURESPHI_INDEX
size_type m_MEASURESPHI_INDEX
Definition: RpcIdHelper.h:192
RpcIdHelper::doubletR
int doubletR(const Identifier &id) const
Definition: RpcIdHelper.cxx:1060
RpcIdHelper::DoubletPhiMax
@ DoubletPhiMax
Definition: RpcIdHelper.h:228
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
RpcIdHelper::m_detectorElement_hashes
std::unordered_map< Identifier, unsigned int > m_detectorElement_hashes
Definition: RpcIdHelper.h:185
RpcIdHelper::m_module_hashes
std::unordered_map< Identifier, unsigned int > m_module_hashes
Definition: RpcIdHelper.h:184
RpcIdHelper::measuresPhiMin
static int measuresPhiMin()
Definition: RpcIdHelper.cxx:1100
RpcIdHelper::panelID
Identifier panelID(const Identifier &padID, int gasGap, int measuresPhi) const
Definition: RpcIdHelper.cxx:879
RpcIdHelper::StationEtaMin
@ StationEtaMin
Definition: RpcIdHelper.h:219
RpcIdHelper::StripMax
@ StripMax
Definition: RpcIdHelper.h:234
RpcIdHelper::strip
int strip(const Identifier &id) const
Definition: RpcIdHelper.cxx:1070
RpcIdHelper::doubletZMin
static int doubletZMin()
Definition: RpcIdHelper.cxx:1088
RpcIdHelper::doubletRMax
static int doubletRMax()
Definition: RpcIdHelper.cxx:1086
RpcIdHelper::StripMin
@ StripMin
Definition: RpcIdHelper.h:233
RpcIdHelper::m_dbz_impl
IdDictFieldImplementation m_dbz_impl
Definition: RpcIdHelper.h:195
RpcIdHelper::measuresPhiMax
static int measuresPhiMax()
Definition: RpcIdHelper.cxx:1102
RpcIdHelper::DoubletPhiMin
@ DoubletPhiMin
Definition: RpcIdHelper.h:227
RpcIdHelper::StationPhiMin
@ StationPhiMin
Definition: RpcIdHelper.h:221
RpcIdHelper::idChannels
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
Definition: RpcIdHelper.cxx:317
RpcIdHelper::m_DOUBLETPHI_INDEX
size_type m_DOUBLETPHI_INDEX
Definition: RpcIdHelper.h:190
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:814
RpcIdHelper::DoubletZIndex
@ DoubletZIndex
Definition: RpcIdHelper.h:214
RpcIdHelper::channel
int channel(const Identifier &id) const override
Definition: RpcIdHelper.cxx:1072
RpcIdHelper::stripMin
static int stripMin()
Definition: RpcIdHelper.cxx:1104
RpcIdHelper::m_GASGAP_INDEX
size_type m_GASGAP_INDEX
Definition: RpcIdHelper.h:191
RpcIdHelper::gasGapMax
int gasGapMax() const
Definition: RpcIdHelper.cxx:1098
RpcIdHelper::DoubletPhiIndex
@ DoubletPhiIndex
Definition: RpcIdHelper.h:214
RpcIdHelper::gapID
Identifier gapID(const Identifier &padID, int gasGap) const
Definition: RpcIdHelper.cxx:926
RpcIdHelper::valid
bool valid(const Identifier &id) const
Definition: RpcIdHelper.cxx:604
RpcIdHelper::stationEtaMax
static int stationEtaMax()
Definition: RpcIdHelper.cxx:1078
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:809
RpcIdHelper::init_detectorElement_hashes
virtual int init_detectorElement_hashes() override
Definition: RpcIdHelper.cxx:761
RpcIdHelper::StationPhiMax
@ StationPhiMax
Definition: RpcIdHelper.h:222
RpcIdHelper::RpcRanges
RpcRanges
Definition: RpcIdHelper.h:218
RpcIdHelper::validElement
bool validElement(const Identifier &id) const
Definition: RpcIdHelper.cxx:640
RPC_ID
RpcIdHelper RPC_ID
Definition: RpcIdHelper.h:243
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
RpcIdHelper::init_id_to_hashes
int init_id_to_hashes()
Definition: RpcIdHelper.cxx:273
RpcIdHelper::GasGapIndex
@ GasGapIndex
Definition: RpcIdHelper.h:214
RpcIdHelper::MeasuresPhiMin
@ MeasuresPhiMin
Definition: RpcIdHelper.h:231
RpcIdHelper::MeasuresPhiMax
@ MeasuresPhiMax
Definition: RpcIdHelper.h:232
RpcIdHelper::doubletZID
Identifier doubletZID(const Identifier &id) const
Definition: RpcIdHelper.cxx:1010
RpcIdHelper::m_st_BMS
int m_st_BMS
Definition: RpcIdHelper.h:237
RpcIdHelper::StripIndex
@ StripIndex
Definition: RpcIdHelper.h:214
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
IdentifierHash
Definition: IdentifierHash.h:38
RpcIdHelper::m_str_impl
IdDictFieldImplementation m_str_impl
Definition: RpcIdHelper.h:199
RpcIdHelper::initialize_from_dictionary
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
Definition: RpcIdHelper.cxx:10
RpcIdHelper::MeasuresPhiIndex
@ MeasuresPhiIndex
Definition: RpcIdHelper.h:214
RpcIdHelper::stationEtaMin
static int stationEtaMin()
Definition: RpcIdHelper.cxx:1076
RpcIdHelper::RpcIndices
RpcIndices
Definition: RpcIdHelper.h:214
RpcIdHelper::m_DOUBLETZ_INDEX
size_type m_DOUBLETZ_INDEX
Definition: RpcIdHelper.h:189
RpcIdHelper::validPad
bool validPad(const Identifier &id) const
Definition: RpcIdHelper.cxx:670
RpcIdHelper::GasGapMax
@ GasGapMax
Definition: RpcIdHelper.h:230
RpcIdHelper::rpcTechnology
int rpcTechnology() const
Utility methods.
Definition: RpcIdHelper.cxx:1110
RpcIdHelper::DoubletZMax
@ DoubletZMax
Definition: RpcIdHelper.h:226
RpcIdHelper::doubletPhi
int doubletPhi(const Identifier &id) const
Definition: RpcIdHelper.cxx:1064
RpcIdHelper::get_module_hash
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
Definition: RpcIdHelper.cxx:288
RpcIdHelper::m_st_BIL
int m_st_BIL
Definition: RpcIdHelper.h:238
RpcIdHelper::isStNameInTech
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...
Definition: RpcIdHelper.cxx:639