CMS 3D CMS Logo

RPCDetId.h
Go to the documentation of this file.
1 #ifndef MuonDetId_RPCDetId_h
2 #define MuonDetId_RPCDetId_h
3 
13 
14 #include <iosfwd>
15 
16 class RPCDetId :public DetId {
17 
18  public:
19 
20  RPCDetId();
21 
24  RPCDetId(uint32_t id);
25  RPCDetId(DetId id);
26 
27 
29  RPCDetId(int region,
30  int ring,
31  int station,
32  int sector,
33  int layer,
34  int subsector,
35  int roll);
36 
37 
39  bool operator < (const RPCDetId& r) const{
40  if (r.station() == this->station() ){
41  if (this->layer() == r.layer() ){
42 
43  return this->rawId()<r.rawId();
44  }
45  else{
46  return (this->layer() < r.layer());
47  }
48  }
49  else {
50  return this->station() < r.station();
51  }
52  }
53 
54  void buildfromDB(int region, int ring, int layer, int sector,
55  const std::string& subsector,
56  const std::string& roll,
57  const std::string& dbname);
58 
60  void buildfromTrIndex(int trIndex);
61 
63  int region() const{
65  }
66 
67 
72  int ring() const{
73 
74  int ring_= (id_>>RingStartBit_) & RingMask_;
75 
76  if(ring_ <RingBarrelOffSet){
77 
78  if(this->region() == 0)
79  {
80  throw cms::Exception("InvalidDetId") << "RPCDetId ctor:"
81  << " Ring - Region Inconsistency, "
82  << " region "<< this->region()
83  << " ring "<<ring_
84  << std::endl;
85  }
86 
87  return int(ring_ + minRingForwardId);
88 
89  } else { // if(ring_ >= RingBarrelOffSet)
90  return int(ring_ - RingBarrelOffSet + minRingBarrelId);
91  }
92  }
93 
96  int station() const{
98  }
99 
100 
102  int sector() const{
103  return int((id_>>SectorStartBit_) & SectorMask_) + (minSectorId+1);
104  }
105 
108  int layer() const{
109  return int((id_>>LayerStartBit_) & LayerMask_) + minLayerId;
110  }
111 
112 
114  int subsector() const{
116  }
117 
120  int roll() const{
121  return int((id_>>RollStartBit_) & RollMask_); // value 0 is used as wild card
122  }
123 
124 
125  int trIndex() const{
126  return trind;
127  }
128 
130  RPCDetId chamberId() const {
131  return RPCDetId(id_ & chamberIdMask_);
132  }
133 
134 
135  static const int minRegionId= -1;
136  static const int maxRegionId= 1;
137 
138  static const int minRingForwardId= 1;
139  static const int maxRingForwardId= 3;
140  static const int minRingBarrelId= -2;
141  static const int maxRingBarrelId= 2;
142  static const int RingBarrelOffSet= 3;
143 
144  static const int minStationId= 1;
145  static const int maxStationId= 4;
146 
147  static const int minSectorId= 0;
148  static const int maxSectorId= 12;
149  static const int minSectorBarrelId= 1;
150  static const int maxSectorBarrelId= 12;
151  static const int minSectorForwardId= 1;
152  static const int maxSectorForwardId= 6;
153 
154  static const int minLayerId= 1;
155  static const int maxLayerId= 2;
156 
157  static const int minSubSectorId= 0;
158  static const int maxSubSectorId= 6;
159  static const int minSubSectorBarrelId= 1;
160  static const int maxSubSectorBarrelId= 4;
161  static const int minSubSectorForwardId= 1;
162  static const int maxSubSectorForwardId= 6;
163 
164  static const int minRollId= 0;
165  static const int maxRollId= 5; // used to be 4 ... need 5 for upgrade
166  // if we decide to divide the upgrade RE3/1 and RE4/1 up to eta=2.4
167  // and we want basically to have 0.10 eta / roll ...
168 
169 
170  private:
171  static const int RegionNumBits_ = 2;
172  static const int RegionStartBit_ = 0;
173  static const int RegionMask_ = 0X3;
174 
175  static const int RingNumBits_ = 3;
176  static const int RingStartBit_ = RegionStartBit_+RegionNumBits_;
177  static const unsigned int RingMask_ = 0X7;
178 
179  static const int StationNumBits_ = 2;
180  static const int StationStartBit_ = RingStartBit_+RingNumBits_;
181  static const unsigned int StationMask_ = 0X3;
182 
183 
184  static const int SectorNumBits_ = 4;
185  static const int SectorStartBit_ = StationStartBit_+StationNumBits_;
186  static const unsigned int SectorMask_ = 0XF;
187 
188  static const int LayerNumBits_ = 1;
189  static const int LayerStartBit_ = SectorStartBit_+SectorNumBits_;
190  static const unsigned int LayerMask_ = 0X1;
191 
192  static const int SubSectorNumBits_ = 3;
193  static const int SubSectorStartBit_ = LayerStartBit_+LayerNumBits_;
194  static const unsigned int SubSectorMask_ = 0X7;
195 
196  static const int RollNumBits_ = 3;
197  static const int RollStartBit_ = SubSectorStartBit_+SubSectorNumBits_;
198  static const unsigned int RollMask_ = 0X7;
199 
200  static const uint32_t chamberIdMask_ = ~(RollMask_<<RollStartBit_);
201 
202  private:
203  void init(int region,
204  int ring,
205  int station,
206  int sector,
207  int layer,
208  int subsector,
209  int roll);
210 
211  int trind;
212 }; // RPCDetId
213 
214 std::ostream& operator<<( std::ostream& os, const RPCDetId& id );
215 
216 #endif
static const int maxStationId
Definition: RPCDetId.h:145
RPCDetId()
Definition: RPCDetId.cc:13
static const unsigned int RingMask_
Definition: RPCDetId.h:177
static const int SubSectorStartBit_
Definition: RPCDetId.h:193
static const int minSectorBarrelId
Definition: RPCDetId.h:149
void buildfromDB(int region, int ring, int layer, int sector, const std::string &subsector, const std::string &roll, const std::string &dbname)
Definition: RPCDetId.cc:45
static const int RegionNumBits_
Definition: RPCDetId.h:171
static const int maxSubSectorBarrelId
Definition: RPCDetId.h:160
void buildfromTrIndex(int trIndex)
Built from the trigger det Index.
Definition: RPCDetId.cc:138
void init(int region, int ring, int station, int sector, int layer, int subsector, int roll)
Definition: RPCDetId.cc:226
static const int maxLayerId
Definition: RPCDetId.h:155
int trind
Definition: RPCDetId.h:211
static const int maxRingForwardId
Definition: RPCDetId.h:139
static const int minRingBarrelId
Definition: RPCDetId.h:140
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
static const int RollNumBits_
Definition: RPCDetId.h:196
static const int minSubSectorId
Definition: RPCDetId.h:157
static const int LayerStartBit_
Definition: RPCDetId.h:189
static const int minRollId
Definition: RPCDetId.h:164
static const int minSectorId
Definition: RPCDetId.h:147
static const int RingNumBits_
Definition: RPCDetId.h:175
RPCDetId chamberId() const
Return the corresponding ChamberId.
Definition: RPCDetId.h:130
static const int StationStartBit_
Definition: RPCDetId.h:180
int roll() const
Definition: RPCDetId.h:120
static const int minSubSectorForwardId
Definition: RPCDetId.h:161
static const unsigned int SectorMask_
Definition: RPCDetId.h:186
static const int minRegionId
Definition: RPCDetId.h:135
static const unsigned int LayerMask_
Definition: RPCDetId.h:190
std::ostream & operator<<(std::ostream &os, const RPCDetId &id)
Definition: RPCDetId.cc:280
int ring() const
Definition: RPCDetId.h:72
static const int maxSubSectorId
Definition: RPCDetId.h:158
static const int StationNumBits_
Definition: RPCDetId.h:179
static const int maxSectorBarrelId
Definition: RPCDetId.h:150
static const char ring_[]
static const int minSectorForwardId
Definition: RPCDetId.h:151
static const int RingStartBit_
Definition: RPCDetId.h:176
static const int LayerNumBits_
Definition: RPCDetId.h:188
static const int RegionStartBit_
Definition: RPCDetId.h:172
static const int RegionMask_
Definition: RPCDetId.h:173
static const unsigned int SubSectorMask_
Definition: RPCDetId.h:194
static const int maxRollId
Definition: RPCDetId.h:165
static const int SectorStartBit_
Definition: RPCDetId.h:185
static const int RingBarrelOffSet
Definition: RPCDetId.h:142
static const int maxRegionId
Definition: RPCDetId.h:136
static const int minStationId
Definition: RPCDetId.h:144
static const int RollStartBit_
Definition: RPCDetId.h:197
bool operator<(const RPCDetId &r) const
Sort Operator based on the raw detector id.
Definition: RPCDetId.h:39
static const unsigned int StationMask_
Definition: RPCDetId.h:181
int layer() const
Definition: RPCDetId.h:108
Definition: DetId.h:18
int trIndex() const
Definition: RPCDetId.h:125
static const int SectorNumBits_
Definition: RPCDetId.h:184
uint32_t id_
Definition: DetId.h:62
static const int maxRingBarrelId
Definition: RPCDetId.h:141
static const int SubSectorNumBits_
Definition: RPCDetId.h:192
static const int maxSectorId
Definition: RPCDetId.h:148
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Definition: RPCDetId.h:114
static const int minRingForwardId
Definition: RPCDetId.h:138
static const unsigned int RollMask_
Definition: RPCDetId.h:198
static const int minSubSectorBarrelId
Definition: RPCDetId.h:159
static const int maxSectorForwardId
Definition: RPCDetId.h:152
static const int minLayerId
Definition: RPCDetId.h:154
static const int maxSubSectorForwardId
Definition: RPCDetId.h:162
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
static const uint32_t chamberIdMask_
Definition: RPCDetId.h:200