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;
89  static constexpr int RollStartBit_ = LayerStartBit_ + LayerNumBits_;
90  static constexpr unsigned int RollMask_ = 0X1F;
91 
92 public:
93  static constexpr uint32_t chamberIdMask_ = ~((LayerMask_ << LayerStartBit_) | (RollMask_ << RollStartBit_));
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
ME0DetId::ChamberNumBits_
static constexpr int ChamberNumBits_
Definition: ME0DetId.h:80
ME0DetId::layerIdMask_
static constexpr uint32_t layerIdMask_
Definition: ME0DetId.h:94
ME0DetId::RegionNumBits_
static constexpr int RegionNumBits_
Definition: ME0DetId.h:76
ME0DetId::operator<
bool operator<(const ME0DetId &r) const
Sort Operator based on the raw detector id.
Definition: ME0DetId.h:29
ME0DetId::ME0DetId
ME0DetId()
Definition: ME0DetId.cc:8
ME0DetId::RollStartBit_
static constexpr int RollStartBit_
Definition: ME0DetId.h:89
ME0DetId::RollNumBits_
static constexpr int RollNumBits_
Definition: ME0DetId.h:88
ME0DetId::layerId
ME0DetId layerId() const
Return the corresponding LayerId (mask eta partition)
Definition: ME0DetId.h:55
ME0DetId::maxChamberId
static constexpr int maxChamberId
Definition: ME0DetId.h:67
DetId
Definition: DetId.h:17
ME0DetId::ChamberMask_
static constexpr unsigned int ChamberMask_
Definition: ME0DetId.h:82
ME0DetId::roll
int roll() const
Definition: ME0DetId.h:48
ME0DetId::maxRollId
static constexpr int maxRollId
Definition: ME0DetId.h:73
ME0DetId::minRollId
static constexpr int minRollId
Definition: ME0DetId.h:72
ME0DetId::minChamberId
static constexpr int minChamberId
Definition: ME0DetId.h:66
ME0DetId::RegionStartBit_
static constexpr int RegionStartBit_
Definition: ME0DetId.h:77
ME0DetId::LayerMask_
static constexpr unsigned int LayerMask_
Definition: ME0DetId.h:86
ME0DetId::init
void init(int region, int layer, int chamber, int roll)
Definition: ME0DetId.cc:28
ME0DetId::nlayers
int nlayers() const
For future modifications (implement more layers)
Definition: ME0DetId.h:61
ME0DetId::maxLayerId
static constexpr int maxLayerId
Definition: ME0DetId.h:70
ME0DetId::minLayerId
static constexpr int minLayerId
Definition: ME0DetId.h:69
ME0DetId::LayerStartBit_
static constexpr int LayerStartBit_
Definition: ME0DetId.h:85
DetId::id_
uint32_t id_
Definition: DetId.h:69
ME0DetId::RollMask_
static constexpr unsigned int RollMask_
Definition: ME0DetId.h:90
createfilelist.int
int
Definition: createfilelist.py:10
ME0DetId::station
int station() const
Definition: ME0DetId.h:58
ME0DetId::trind
int trind
Definition: ME0DetId.h:99
ME0DetId
Definition: ME0DetId.h:16
ME0DetId::ChamberStartBit_
static constexpr int ChamberStartBit_
Definition: ME0DetId.h:81
alignCSCRings.r
r
Definition: alignCSCRings.py:93
ME0DetId::chamberId
ME0DetId chamberId() const
Return the corresponding ChamberId (mask layers)
Definition: ME0DetId.h:53
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
DetId.h
operator<<
std::ostream & operator<<(std::ostream &os, const ME0DetId &id)
Definition: ME0DetId.cc:45
ME0DetId::minRegionId
static constexpr int minRegionId
Definition: ME0DetId.h:63
ME0DetId::chamber
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
Exception.h
ME0DetId::region
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
ME0DetId::chamberIdMask_
static constexpr uint32_t chamberIdMask_
Definition: ME0DetId.h:93
ME0DetId::LayerNumBits_
static constexpr int LayerNumBits_
Definition: ME0DetId.h:84
ME0DetId::layer
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::maxRegionId
static constexpr int maxRegionId
Definition: ME0DetId.h:64
ME0DetId::RegionMask_
static constexpr int RegionMask_
Definition: ME0DetId.h:78