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 public:
18  RPCDetId();
19 
22  RPCDetId(uint32_t id);
23  RPCDetId(DetId id);
24 
26  RPCDetId(int region, int ring, int station, int sector, int layer, int subsector, int roll);
27 
29  bool operator<(const RPCDetId& r) const {
30  if (r.station() == this->station()) {
31  if (this->layer() == r.layer()) {
32  return this->rawId() < r.rawId();
33  } else {
34  return (this->layer() < r.layer());
35  }
36  } else {
37  return this->station() < r.station();
38  }
39  }
40 
41  void buildfromDB(int region,
42  int ring,
43  int layer,
44  int sector,
45  const std::string& subsector,
46  const std::string& roll,
47  const std::string& dbname);
48 
50  void buildfromTrIndex(int trIndex);
51 
53  int region() const { return int((id_ >> RegionStartBit_) & RegionMask_) + minRegionId; }
54 
59  int ring() const {
60  int ring_ = (id_ >> RingStartBit_) & RingMask_;
61 
62  if (ring_ < RingBarrelOffSet) {
63  if (this->region() == 0) {
64  throw cms::Exception("InvalidDetId") << "RPCDetId ctor:"
65  << " Ring - Region Inconsistency, "
66  << " region " << this->region() << " ring " << ring_ << std::endl;
67  }
68 
69  return int(ring_ + minRingForwardId);
70 
71  } else { // if(ring_ >= RingBarrelOffSet)
73  }
74  }
75 
78  int station() const { return int((id_ >> StationStartBit_) & StationMask_) + minStationId; }
79 
81  int sector() const { return int((id_ >> SectorStartBit_) & SectorMask_) + (minSectorId + 1); }
82 
85  int layer() const { return int((id_ >> LayerStartBit_) & LayerMask_) + minLayerId; }
86 
88  int subsector() const { return int((id_ >> SubSectorStartBit_) & SubSectorMask_) + (minSubSectorId + 1); }
89 
92  int roll() const {
93  return int((id_ >> RollStartBit_) & RollMask_); // value 0 is used as wild card
94  }
95 
96  int trIndex() const { return trind; }
97 
99  RPCDetId chamberId() const { return RPCDetId(id_ & chamberIdMask_); }
100 
101  static constexpr int minRegionId = -1;
102  static constexpr int maxRegionId = 1;
103 
104  static constexpr int minRingForwardId = 1;
105  static constexpr int maxRingForwardId = 3;
106  static constexpr int minRingBarrelId = -2;
107  static constexpr int maxRingBarrelId = 2;
108  static constexpr int RingBarrelOffSet = 3;
109 
110  static constexpr int minStationId = 1;
111  static constexpr int maxStationId = 4;
112 
113  static constexpr int minSectorId = 0;
114  static constexpr int maxSectorId = 12;
115  static constexpr int minSectorBarrelId = 1;
116  static constexpr int maxSectorBarrelId = 12;
117  static constexpr int minSectorForwardId = 1;
118  static constexpr int maxSectorForwardId = 6;
119 
120  static constexpr int minLayerId = 1;
121  static constexpr int maxLayerId = 2;
122 
123  static constexpr int minSubSectorId = 0;
124  static constexpr int maxSubSectorId = 6;
125  static constexpr int minSubSectorBarrelId = 1;
126  static constexpr int maxSubSectorBarrelId = 4;
127  static constexpr int minSubSectorForwardId = 1;
128  static constexpr int maxSubSectorForwardId = 6;
129 
130  static constexpr int minRollId = 0;
131  static constexpr int maxRollId = 5; // used to be 4 ... need 5 for upgrade
132  // if we decide to divide the upgrade RE3/1 and RE4/1 up to eta=2.4
133  // and we want basically to have 0.10 eta / roll ...
134 
135 private:
136  static constexpr int RegionNumBits_ = 2;
137  static constexpr int RegionStartBit_ = 0;
138  static constexpr int RegionMask_ = 0X3;
139 
140  static constexpr int RingNumBits_ = 3;
141  static constexpr int RingStartBit_ = RegionStartBit_ + RegionNumBits_;
142  static constexpr unsigned int RingMask_ = 0X7;
143 
144  static constexpr int StationNumBits_ = 2;
145  static constexpr int StationStartBit_ = RingStartBit_ + RingNumBits_;
146  static constexpr unsigned int StationMask_ = 0X3;
147 
148  static constexpr int SectorNumBits_ = 4;
150  static constexpr unsigned int SectorMask_ = 0XF;
151 
152  static constexpr int LayerNumBits_ = 1;
154  static constexpr unsigned int LayerMask_ = 0X1;
155 
156  static constexpr int SubSectorNumBits_ = 3;
158  static constexpr unsigned int SubSectorMask_ = 0X7;
159 
160  static constexpr int RollNumBits_ = 3;
162  static constexpr unsigned int RollMask_ = 0X7;
163 
164 public:
165  static constexpr uint32_t chamberIdMask_ = ~(RollMask_ << RollStartBit_);
166 
167 private:
168  void init(int region, int ring, int station, int sector, int layer, int subsector, int roll);
169 
170  int trind;
171 }; // RPCDetId
172 
173 std::ostream& operator<<(std::ostream& os, const RPCDetId& id);
174 
175 #endif
RPCDetId::maxLayerId
static constexpr int maxLayerId
Definition: RPCDetId.h:121
RPCDetId::RingBarrelOffSet
static constexpr int RingBarrelOffSet
Definition: RPCDetId.h:108
RPCDetId::chamberIdMask_
static constexpr uint32_t chamberIdMask_
Definition: RPCDetId.h:165
RPCDetId::station
int station() const
Definition: RPCDetId.h:78
RPCDetId::region
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
RPCDetId::subsector
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel,...
Definition: RPCDetId.h:88
RPCDetId
Definition: RPCDetId.h:16
RPCDetId::minStationId
static constexpr int minStationId
Definition: RPCDetId.h:110
RPCDetId::SectorStartBit_
static constexpr int SectorStartBit_
Definition: RPCDetId.h:149
RPCDetId::SubSectorStartBit_
static constexpr int SubSectorStartBit_
Definition: RPCDetId.h:157
RPCDetId::RegionNumBits_
static constexpr int RegionNumBits_
Definition: RPCDetId.h:136
RPCDetId::LayerNumBits_
static constexpr int LayerNumBits_
Definition: RPCDetId.h:152
RPCDetId::operator<
bool operator<(const RPCDetId &r) const
Sort Operator based on the raw detector id.
Definition: RPCDetId.h:29
RPCDetId::maxSectorForwardId
static constexpr int maxSectorForwardId
Definition: RPCDetId.h:118
RPCDetId::StationMask_
static constexpr unsigned int StationMask_
Definition: RPCDetId.h:146
RPCDetId::RegionStartBit_
static constexpr int RegionStartBit_
Definition: RPCDetId.h:137
DetId
Definition: DetId.h:17
RPCDetId::RingMask_
static constexpr unsigned int RingMask_
Definition: RPCDetId.h:142
RPCDetId::maxRingForwardId
static constexpr int maxRingForwardId
Definition: RPCDetId.h:105
RPCDetId::maxRegionId
static constexpr int maxRegionId
Definition: RPCDetId.h:102
RPCDetId::maxSectorBarrelId
static constexpr int maxSectorBarrelId
Definition: RPCDetId.h:116
RPCDetId::minSubSectorBarrelId
static constexpr int minSubSectorBarrelId
Definition: RPCDetId.h:125
RPCDetId::maxRollId
static constexpr int maxRollId
Definition: RPCDetId.h:131
RPCDetId::LayerMask_
static constexpr unsigned int LayerMask_
Definition: RPCDetId.h:154
RPCDetId::SectorNumBits_
static constexpr int SectorNumBits_
Definition: RPCDetId.h:148
RPCDetId::buildfromDB
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:35
sistrip::ring_
static const char ring_[]
Definition: ConstantsForGranularity.h:35
RPCDetId::RingNumBits_
static constexpr int RingNumBits_
Definition: RPCDetId.h:140
RPCDetId::minRingForwardId
static constexpr int minRingForwardId
Definition: RPCDetId.h:104
RPCDetId::minRingBarrelId
static constexpr int minRingBarrelId
Definition: RPCDetId.h:106
RPCDetId::SectorMask_
static constexpr unsigned int SectorMask_
Definition: RPCDetId.h:150
RPCDetId::maxRingBarrelId
static constexpr int maxRingBarrelId
Definition: RPCDetId.h:107
RPCDetId::buildfromTrIndex
void buildfromTrIndex(int trIndex)
Built from the trigger det Index.
Definition: RPCDetId.cc:139
RPCDetId::minSubSectorForwardId
static constexpr int minSubSectorForwardId
Definition: RPCDetId.h:127
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDetId::SubSectorNumBits_
static constexpr int SubSectorNumBits_
Definition: RPCDetId.h:156
RPCDetId::SubSectorMask_
static constexpr unsigned int SubSectorMask_
Definition: RPCDetId.h:158
RPCDetId::StationNumBits_
static constexpr int StationNumBits_
Definition: RPCDetId.h:144
RPCDetId::roll
int roll() const
Definition: RPCDetId.h:92
RPCDetId::maxSubSectorForwardId
static constexpr int maxSubSectorForwardId
Definition: RPCDetId.h:128
RPCDetId::minSectorId
static constexpr int minSectorId
Definition: RPCDetId.h:113
DetId::id_
uint32_t id_
Definition: DetId.h:69
RPCDetId::RingStartBit_
static constexpr int RingStartBit_
Definition: RPCDetId.h:141
RPCDetId::LayerStartBit_
static constexpr int LayerStartBit_
Definition: RPCDetId.h:153
RPCDetId::StationStartBit_
static constexpr int StationStartBit_
Definition: RPCDetId.h:145
RPCDetId::maxSubSectorId
static constexpr int maxSubSectorId
Definition: RPCDetId.h:124
createfilelist.int
int
Definition: createfilelist.py:10
RPCDetId::init
void init(int region, int ring, int station, int sector, int layer, int subsector, int roll)
Definition: RPCDetId.cc:219
RPCDetId::RegionMask_
static constexpr int RegionMask_
Definition: RPCDetId.h:138
RPCDetId::RollStartBit_
static constexpr int RollStartBit_
Definition: RPCDetId.h:161
RPCDetId::minRollId
static constexpr int minRollId
Definition: RPCDetId.h:130
RPCDetId::minSubSectorId
static constexpr int minSubSectorId
Definition: RPCDetId.h:123
RPCDetId::trIndex
int trIndex() const
Definition: RPCDetId.h:96
RPCDetId::ring
int ring() const
Definition: RPCDetId.h:59
alignCSCRings.r
r
Definition: alignCSCRings.py:93
RPCDetId::maxSubSectorBarrelId
static constexpr int maxSubSectorBarrelId
Definition: RPCDetId.h:126
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RPCDetId::chamberId
RPCDetId chamberId() const
Return the corresponding ChamberId.
Definition: RPCDetId.h:99
DetId.h
RPCDetId::maxStationId
static constexpr int maxStationId
Definition: RPCDetId.h:111
RPCDetId::minLayerId
static constexpr int minLayerId
Definition: RPCDetId.h:120
RPCDetId::RPCDetId
RPCDetId()
Definition: RPCDetId.cc:13
Exception
Definition: hltDiff.cc:246
RPCDetId::sector
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
operator<<
std::ostream & operator<<(std::ostream &os, const RPCDetId &id)
Definition: RPCDetId.cc:257
Exception.h
RPCDetId::RollMask_
static constexpr unsigned int RollMask_
Definition: RPCDetId.h:162
RPCDetId::maxSectorId
static constexpr int maxSectorId
Definition: RPCDetId.h:114
RPCDetId::minSectorBarrelId
static constexpr int minSectorBarrelId
Definition: RPCDetId.h:115
RPCDetId::minRegionId
static constexpr int minRegionId
Definition: RPCDetId.h:101
RPCDetId::layer
int layer() const
Definition: RPCDetId.h:85
RPCDetId::minSectorForwardId
static constexpr int minSectorForwardId
Definition: RPCDetId.h:117
RPCDetId::trind
int trind
Definition: RPCDetId.h:170
RPCDetId::RollNumBits_
static constexpr int RollNumBits_
Definition: RPCDetId.h:160