ATLAS Offline Software
Loading...
Searching...
No Matches
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
10class 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
51class RpcIdHelper : public MuonIdHelper {
52public:
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
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
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
176private:
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
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
245CLASS_DEF(RpcIdHelper, 4172, 1)
246
247// Construct ID from components
248
249#endif // MUONIDHELPERS_RPCIDHELPER_H
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
RpcIdHelper RPC_ID
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
This is a "hash" representation of an Identifier.
int stationEta(const Identifier &id) const
int stationPhi(const Identifier &id) const
int stationName(const Identifier &id) const
Identifier::size_type size_type
MuonIdHelper(const std::string &logName, const std::string &group)
Identifier padID(const Identifier &elementID, int doubletZ, int doubletPhi) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
void idChannels(const Identifier &id, std::vector< Identifier > &vect) const
size_type m_DOUBLETPHI_INDEX
int init_id_to_hashes()
bool validPad(const Identifier &id) const
size_type m_GASGAP_INDEX
static int doubletRMin()
int gasGap(const Identifier &id) const override
get the hashes
int gasGapMax() const
static int measuresPhiMax()
IdDictFieldImplementation m_mea_impl
static int doubletZMax()
size_type m_DOUBLETZ_INDEX
Identifier panelID(const Identifier &padID, int gasGap, int measuresPhi) const
Identifier parentID(const Identifier &id) const
std::unordered_map< Identifier, unsigned int > m_detectorElement_hashes
bool validElement(const Identifier &id) const
virtual ~RpcIdHelper()=default
static int gasGapMin()
IdDictFieldImplementation m_dbr_impl
bool isExtraDetElId(const Identifier &id) const
virtual int init_detectorElement_hashes() override
Identifier elementID(int stationName, int stationEta, int stationPhi, int doubletR) const
int channel(const Identifier &id) const override
IdDictFieldImplementation m_dbz_impl
Identifier gapID(const Identifier &padID, int gasGap) const
std::unordered_map< Identifier, unsigned int > m_module_hashes
unsigned int m_gasGapMax
static int doubletRMax()
static int stationPhiMin()
int doubletPhi(const Identifier &id) const
virtual int initialize_from_dictionary(const IdDictMgr &dict_mgr) override
Initialization from the identifier dictionary.
int rpcTechnology() const
Utility methods.
static int doubletPhiMax()
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
static int stationPhiMax()
int doubletR(const Identifier &id) const
static int stripMax()
bool valid(const Identifier &id) const
int strip(const Identifier &id) const
static int doubletZMin()
bool measuresPhi(const Identifier &id) const override
static int stationEtaMin()
static int measuresPhiMin()
static int doubletPhiMin()
size_type m_DOUBLETR_INDEX
bool isStNameInTech(const std::string &stationName) const override
The valid element checks converted the identifier to a stationName string in order to assess whether ...
static int stationEtaMax()
virtual int get_module_hash(const Identifier &id, IdentifierHash &hash_id) const override
Identifier doubletZID(const Identifier &id) const
int doubletZ(const Identifier &id) const
size_type m_MEASURESPHI_INDEX
bool validChannel(const Identifier &id, int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
IdDictFieldImplementation m_gap_impl
static int stripMin()
IdDictFieldImplementation m_dbp_impl
IdDictFieldImplementation m_str_impl