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 const int minRegionId = -1;
102  static const int maxRegionId = 1;
103 
104  static const int minRingForwardId = 1;
105  static const int maxRingForwardId = 3;
106  static const int minRingBarrelId = -2;
107  static const int maxRingBarrelId = 2;
108  static const int RingBarrelOffSet = 3;
109 
110  static const int minStationId = 1;
111  static const int maxStationId = 4;
112 
113  static const int minSectorId = 0;
114  static const int maxSectorId = 12;
115  static const int minSectorBarrelId = 1;
116  static const int maxSectorBarrelId = 12;
117  static const int minSectorForwardId = 1;
118  static const int maxSectorForwardId = 6;
119 
120  static const int minLayerId = 1;
121  static const int maxLayerId = 2;
122 
123  static const int minSubSectorId = 0;
124  static const int maxSubSectorId = 6;
125  static const int minSubSectorBarrelId = 1;
126  static const int maxSubSectorBarrelId = 4;
127  static const int minSubSectorForwardId = 1;
128  static const int maxSubSectorForwardId = 6;
129 
130  static const int minRollId = 0;
131  static const 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 const int RegionNumBits_ = 2;
137  static const int RegionStartBit_ = 0;
138  static const int RegionMask_ = 0X3;
139 
140  static const int RingNumBits_ = 3;
142  static const unsigned int RingMask_ = 0X7;
143 
144  static const int StationNumBits_ = 2;
146  static const unsigned int StationMask_ = 0X3;
147 
148  static const int SectorNumBits_ = 4;
150  static const unsigned int SectorMask_ = 0XF;
151 
152  static const int LayerNumBits_ = 1;
154  static const unsigned int LayerMask_ = 0X1;
155 
156  static const int SubSectorNumBits_ = 3;
158  static const unsigned int SubSectorMask_ = 0X7;
159 
160  static const int RollNumBits_ = 3;
162  static const unsigned int RollMask_ = 0X7;
163 
164  static const uint32_t chamberIdMask_ = ~(RollMask_ << RollStartBit_);
165 
166 private:
167  void init(int region, int ring, int station, int sector, int layer, int subsector, int roll);
168 
169  int trind;
170 }; // RPCDetId
171 
172 std::ostream& operator<<(std::ostream& os, const RPCDetId& id);
173 
174 #endif
RPCDetId::maxSectorForwardId
static const int maxSectorForwardId
Definition: RPCDetId.h:118
RPCDetId::SubSectorNumBits_
static const int SubSectorNumBits_
Definition: RPCDetId.h:156
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::minSectorBarrelId
static const int minSectorBarrelId
Definition: RPCDetId.h:115
RPCDetId::RingMask_
static const unsigned int RingMask_
Definition: RPCDetId.h:142
RPCDetId
Definition: RPCDetId.h:16
RPCDetId::maxSubSectorBarrelId
static const int maxSubSectorBarrelId
Definition: RPCDetId.h:126
RPCDetId::minRingBarrelId
static const int minRingBarrelId
Definition: RPCDetId.h:106
RPCDetId::minRollId
static const int minRollId
Definition: RPCDetId.h:130
RPCDetId::RingBarrelOffSet
static const int RingBarrelOffSet
Definition: RPCDetId.h:108
RPCDetId::maxRollId
static const int maxRollId
Definition: RPCDetId.h:131
RPCDetId::maxSubSectorForwardId
static const int maxSubSectorForwardId
Definition: RPCDetId.h:128
RPCDetId::RingNumBits_
static const int RingNumBits_
Definition: RPCDetId.h:140
RPCDetId::StationNumBits_
static const int StationNumBits_
Definition: RPCDetId.h:144
RPCDetId::operator<
bool operator<(const RPCDetId &r) const
Sort Operator based on the raw detector id.
Definition: RPCDetId.h:29
RPCDetId::maxSectorBarrelId
static const int maxSectorBarrelId
Definition: RPCDetId.h:116
RPCDetId::maxRegionId
static const int maxRegionId
Definition: RPCDetId.h:102
RPCDetId::minSectorForwardId
static const int minSectorForwardId
Definition: RPCDetId.h:117
DetId
Definition: DetId.h:17
RPCDetId::RollNumBits_
static const int RollNumBits_
Definition: RPCDetId.h:160
RPCDetId::RollMask_
static const unsigned int RollMask_
Definition: RPCDetId.h:162
RPCDetId::maxSubSectorId
static const int maxSubSectorId
Definition: RPCDetId.h:124
RPCDetId::minLayerId
static const int minLayerId
Definition: RPCDetId.h:120
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::minSubSectorId
static const int minSubSectorId
Definition: RPCDetId.h:123
RPCDetId::minSectorId
static const int minSectorId
Definition: RPCDetId.h:113
RPCDetId::SectorNumBits_
static const int SectorNumBits_
Definition: RPCDetId.h:148
RPCDetId::SubSectorStartBit_
static const int SubSectorStartBit_
Definition: RPCDetId.h:157
RPCDetId::buildfromTrIndex
void buildfromTrIndex(int trIndex)
Built from the trigger det Index.
Definition: RPCDetId.cc:139
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDetId::minRingForwardId
static const int minRingForwardId
Definition: RPCDetId.h:104
RPCDetId::maxRingBarrelId
static const int maxRingBarrelId
Definition: RPCDetId.h:107
RPCDetId::roll
int roll() const
Definition: RPCDetId.h:92
RPCDetId::SubSectorMask_
static const unsigned int SubSectorMask_
Definition: RPCDetId.h:158
DetId::id_
uint32_t id_
Definition: DetId.h:69
RPCDetId::minStationId
static const int minStationId
Definition: RPCDetId.h:110
RPCDetId::minSubSectorBarrelId
static const int minSubSectorBarrelId
Definition: RPCDetId.h:125
createfilelist.int
int
Definition: createfilelist.py:10
RPCDetId::LayerStartBit_
static const int LayerStartBit_
Definition: RPCDetId.h:153
RPCDetId::init
void init(int region, int ring, int station, int sector, int layer, int subsector, int roll)
Definition: RPCDetId.cc:219
RPCDetId::StationStartBit_
static const int StationStartBit_
Definition: RPCDetId.h:145
RPCDetId::SectorMask_
static const unsigned int SectorMask_
Definition: RPCDetId.h:150
RPCDetId::RingStartBit_
static const int RingStartBit_
Definition: RPCDetId.h:141
RPCDetId::LayerNumBits_
static const int LayerNumBits_
Definition: RPCDetId.h:152
RPCDetId::StationMask_
static const unsigned int StationMask_
Definition: RPCDetId.h:146
RPCDetId::LayerMask_
static const unsigned int LayerMask_
Definition: RPCDetId.h:154
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::maxRingForwardId
static const int maxRingForwardId
Definition: RPCDetId.h:105
RPCDetId::SectorStartBit_
static const int SectorStartBit_
Definition: RPCDetId.h:149
RPCDetId::chamberIdMask_
static const uint32_t chamberIdMask_
Definition: RPCDetId.h:164
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
RPCDetId::minRegionId
static const int minRegionId
Definition: RPCDetId.h:101
DetId.h
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
RPCDetId::minSubSectorForwardId
static const int minSubSectorForwardId
Definition: RPCDetId.h:127
operator<<
std::ostream & operator<<(std::ostream &os, const RPCDetId &id)
Definition: RPCDetId.cc:257
Exception.h
RPCDetId::RegionStartBit_
static const int RegionStartBit_
Definition: RPCDetId.h:137
RPCDetId::RollStartBit_
static const int RollStartBit_
Definition: RPCDetId.h:161
RPCDetId::maxStationId
static const int maxStationId
Definition: RPCDetId.h:111
RPCDetId::maxLayerId
static const int maxLayerId
Definition: RPCDetId.h:121
RPCDetId::RegionMask_
static const int RegionMask_
Definition: RPCDetId.h:138
RPCDetId::layer
int layer() const
Definition: RPCDetId.h:85
RPCDetId::trind
int trind
Definition: RPCDetId.h:169
RPCDetId::RegionNumBits_
static const int RegionNumBits_
Definition: RPCDetId.h:136
RPCDetId::maxSectorId
static const int maxSectorId
Definition: RPCDetId.h:114