CMS 3D CMS Logo

ME0DetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_MuonDetId_ME0DetId_h
2 #define DataFormats_MuonDetId_ME0DetId_h
3 
12 
13 #include <iosfwd>
14 #include <iostream>
15 
16 class ME0DetId : public DetId {
17 public:
18  ME0DetId();
19 
22  ME0DetId(uint32_t id);
23  ME0DetId(DetId id);
24 
26  ME0DetId(int region, int layer, int chamber, int roll);
27 
29  bool operator<(const ME0DetId& r) const {
30  if (this->layer() == r.layer()) {
31  return this->rawId() < r.rawId();
32  } else {
33  return (this->layer() > r.layer());
34  }
35  }
36 
38  int region() const { return int((id_ >> RegionStartBit_) & RegionMask_) + minRegionId; }
39 
41  int chamber() const { return int((id_ >> ChamberStartBit_) & ChamberMask_) + minChamberId; }
42 
44  int layer() const { return int((id_ >> LayerStartBit_) & LayerMask_) + minLayerId; }
45 
48  int roll() const {
49  return int((id_ >> RollStartBit_) & RollMask_) + minRollId; // value 0 is used as wild card
50  }
51 
53  ME0DetId chamberId() const { return ME0DetId(id_ & chamberIdMask_); }
55  ME0DetId layerId() const { return ME0DetId(id_ & layerIdMask_); }
56 
57  //Return the stationId, always 1 for now
58  int station() const { return 1; }
59 
61  int nlayers() const { return int(maxLayerId); }
62 
63  static constexpr int minRegionId = -1;
64  static constexpr int maxRegionId = 1;
65 
66  static constexpr int minChamberId = 0;
67  static constexpr int maxChamberId = 18; // ME0 ring consists of 18 chambers spanning 20 degrees
68 
69  static constexpr int minLayerId = 0;
70  static constexpr int maxLayerId = 6;
71 
72  static constexpr int minRollId = 0;
73  static constexpr int maxRollId = 10; // ME0 layer consists of 10 etapartitions
74 
75 private:
76  static constexpr int RegionNumBits_ = 2;
77  static constexpr int RegionStartBit_ = 0;
78  static constexpr int RegionMask_ = 0X3;
79 
80  static constexpr int ChamberNumBits_ = 6;
82  static constexpr unsigned int ChamberMask_ = 0X3F;
83 
84  static constexpr int LayerNumBits_ = 5;
86  static constexpr unsigned int LayerMask_ = 0X1F;
87 
88  static constexpr int RollNumBits_ = 5;
90  static constexpr unsigned int RollMask_ = 0X1F;
91 
92 public:
94  static constexpr uint32_t layerIdMask_ = ~(RollMask_ << RollStartBit_);
95 
96 private:
97  void init(int region, int layer, int chamber, int roll);
98 
99  int trind;
100 }; // ME0DetId
101 
102 std::ostream& operator<<(std::ostream& os, const ME0DetId& id);
103 
104 #endif
int trind
Definition: ME0DetId.h:99
static constexpr int maxChamberId
Definition: ME0DetId.h:67
static constexpr int minRegionId
Definition: ME0DetId.h:63
static constexpr int LayerNumBits_
Definition: ME0DetId.h:84
static constexpr int RollStartBit_
Definition: ME0DetId.h:89
static constexpr int LayerStartBit_
Definition: ME0DetId.h:85
std::ostream & operator<<(std::ostream &os, const ME0DetId &id)
Definition: ME0DetId.cc:45
ME0DetId()
Definition: ME0DetId.cc:8
static constexpr unsigned int LayerMask_
Definition: ME0DetId.h:86
static constexpr uint32_t chamberIdMask_
Definition: ME0DetId.h:93
int station() const
Definition: ME0DetId.h:58
static constexpr int RollNumBits_
Definition: ME0DetId.h:88
static constexpr unsigned int RollMask_
Definition: ME0DetId.h:90
static constexpr int minRollId
Definition: ME0DetId.h:72
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
Definition: ME0DetId.h:44
ME0DetId chamberId() const
Return the corresponding ChamberId (mask layers)
Definition: ME0DetId.h:53
static constexpr int minChamberId
Definition: ME0DetId.h:66
static constexpr int minLayerId
Definition: ME0DetId.h:69
static constexpr int ChamberNumBits_
Definition: ME0DetId.h:80
static constexpr int RegionNumBits_
Definition: ME0DetId.h:76
int nlayers() const
For future modifications (implement more layers)
Definition: ME0DetId.h:61
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
ME0DetId layerId() const
Return the corresponding LayerId (mask eta partition)
Definition: ME0DetId.h:55
Definition: DetId.h:17
static constexpr uint32_t layerIdMask_
Definition: ME0DetId.h:94
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static constexpr int maxRollId
Definition: ME0DetId.h:73
uint32_t id_
Definition: DetId.h:69
void init(int region, int layer, int chamber, int roll)
Definition: ME0DetId.cc:28
static constexpr int ChamberStartBit_
Definition: ME0DetId.h:81
static constexpr int RegionMask_
Definition: ME0DetId.h:78
int roll() const
Definition: ME0DetId.h:48
static constexpr int maxRegionId
Definition: ME0DetId.h:64
static constexpr int maxLayerId
Definition: ME0DetId.h:70
static constexpr int RegionStartBit_
Definition: ME0DetId.h:77
static constexpr unsigned int ChamberMask_
Definition: ME0DetId.h:82
bool operator<(const ME0DetId &r) const
Sort Operator based on the raw detector id.
Definition: ME0DetId.h:29