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 const int minRegionId = -1;
64  static const int maxRegionId = 1;
65 
66  static const int minChamberId = 0;
67  static const int maxChamberId = 18; // ME0 ring consists of 18 chambers spanning 20 degrees
68 
69  static const int minLayerId = 0;
70  static const int maxLayerId = 6;
71 
72  static const int minRollId = 0;
73  static const int maxRollId = 10; // ME0 layer consists of 10 etapartitions
74 
75 private:
76  static const int RegionNumBits_ = 2;
77  static const int RegionStartBit_ = 0;
78  static const int RegionMask_ = 0X3;
79 
80  static const int ChamberNumBits_ = 6;
82  static const unsigned int ChamberMask_ = 0X3F;
83 
84  static const int LayerNumBits_ = 5;
86  static const unsigned int LayerMask_ = 0X1F;
87 
88  static const int RollNumBits_ = 5;
90  static const unsigned int RollMask_ = 0X1F;
91 
92  static const uint32_t chamberIdMask_ = ~((LayerMask_ << LayerStartBit_) | (RollMask_ << RollStartBit_));
93  static const uint32_t layerIdMask_ = ~(RollMask_ << RollStartBit_);
94 
95 private:
96  void init(int region, int layer, int chamber, int roll);
97 
98  int trind;
99 }; // ME0DetId
100 
101 std::ostream& operator<<(std::ostream& os, const ME0DetId& id);
102 
103 #endif
ME0DetId::minRegionId
static const int minRegionId
Definition: ME0DetId.h:63
ME0DetId::layerIdMask_
static const uint32_t layerIdMask_
Definition: ME0DetId.h:93
ME0DetId::RegionNumBits_
static const int RegionNumBits_
Definition: ME0DetId.h:76
ME0DetId::LayerNumBits_
static const int LayerNumBits_
Definition: ME0DetId.h:84
ME0DetId::operator<
bool operator<(const ME0DetId &r) const
Sort Operator based on the raw detector id.
Definition: ME0DetId.h:29
ME0DetId::ChamberNumBits_
static const int ChamberNumBits_
Definition: ME0DetId.h:80
ME0DetId::ME0DetId
ME0DetId()
Definition: ME0DetId.cc:8
ME0DetId::ChamberMask_
static const unsigned int ChamberMask_
Definition: ME0DetId.h:82
ME0DetId::RollMask_
static const unsigned int RollMask_
Definition: ME0DetId.h:90
ME0DetId::maxChamberId
static const int maxChamberId
Definition: ME0DetId.h:67
ME0DetId::LayerMask_
static const unsigned int LayerMask_
Definition: ME0DetId.h:86
ME0DetId::layerId
ME0DetId layerId() const
Return the corresponding LayerId (mask eta partition)
Definition: ME0DetId.h:55
ME0DetId::RollStartBit_
static const int RollStartBit_
Definition: ME0DetId.h:89
DetId
Definition: DetId.h:17
ME0DetId::minChamberId
static const int minChamberId
Definition: ME0DetId.h:66
ME0DetId::roll
int roll() const
Definition: ME0DetId.h:48
ME0DetId::maxLayerId
static const int maxLayerId
Definition: ME0DetId.h:70
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
DetId::id_
uint32_t id_
Definition: DetId.h:69
createfilelist.int
int
Definition: createfilelist.py:10
ME0DetId::station
int station() const
Definition: ME0DetId.h:58
ME0DetId::trind
int trind
Definition: ME0DetId.h:98
ME0DetId
Definition: ME0DetId.h:16
ME0DetId::maxRegionId
static const int maxRegionId
Definition: ME0DetId.h:64
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
ME0DetId::ChamberStartBit_
static const int ChamberStartBit_
Definition: ME0DetId.h:81
DetId.h
operator<<
std::ostream & operator<<(std::ostream &os, const ME0DetId &id)
Definition: ME0DetId.cc:45
ME0DetId::RegionStartBit_
static const int RegionStartBit_
Definition: ME0DetId.h:77
ME0DetId::RollNumBits_
static const int RollNumBits_
Definition: ME0DetId.h:88
ME0DetId::minLayerId
static const int minLayerId
Definition: ME0DetId.h:69
ME0DetId::chamber
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
ME0DetId::minRollId
static const int minRollId
Definition: ME0DetId.h:72
ME0DetId::RegionMask_
static const int RegionMask_
Definition: ME0DetId.h:78
Exception.h
ME0DetId::chamberIdMask_
static const uint32_t chamberIdMask_
Definition: ME0DetId.h:92
ME0DetId::region
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
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::maxRollId
static const int maxRollId
Definition: ME0DetId.h:73
ME0DetId::LayerStartBit_
static const int LayerStartBit_
Definition: ME0DetId.h:85