CMS 3D CMS Logo

GEMDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_MuonDetId_GEMDetId_h
2 #define DataFormats_MuonDetId_GEMDetId_h
3 
12 
13 #include <iosfwd>
14 #include <iostream>
15 
16 class GEMDetId :public DetId {
17 
18  public:
19 
20  GEMDetId();
21 
24  GEMDetId(uint32_t id);
25  GEMDetId(DetId id);
26 
27 
29  GEMDetId(int region,
30  int ring,
31  int station,
32  int layer,
33  int chamber,
34  int roll);
35 
36 
38  bool operator < (const GEMDetId& r) const{
39  if (r.station() == this->station() ){
40  if (this->layer() == r.layer() ){
41  return this->rawId()<r.rawId();
42  }
43  else{
44  return (this->layer() < r.layer());
45  }
46  }
47  else {
48  return this->station() < r.station();
49  }
50  }
51 
53  int region() const{
55  }
56 
59  int ring() const{
60  return int((id_>>RingStartBit_) & RingMask_) + minRingId;
61  }
62 
64  int station() const{
66  }
67 
69  int layer() const{
71  }
72 
74  int chamber() const{
76  }
77 
80  int roll() const{
81  return int((id_>>RollStartBit_) & RollMask_); // value 0 is used as wild card
82  }
83 
85  GEMDetId chamberId() const {
86  return GEMDetId(id_ & chamberIdMask_);
87  }
88 
92  }
93 
94  static const int minRegionId= -1;
95  static const int maxRegionId= 1;
96 
97  static const int minRingId= 1;
98  static const int maxRingId= 3;
99 
100  static const int minStationId= 1;
101  static const int maxStationId= 2; // in the detId there is space to go up to 4 stations. Only 2 implemented now
102 
103  static const int minChamberId= 0;
104  static const int maxChamberId= 36;
105 
106  // LayerId = 0 is superChamber
107  static const int minLayerId= 0;
108  static const int maxLayerId= 2;
109 
110  static const int minRollId= 0;
111  static const int maxRollId= 15;
112 
113  private:
114  static const int RegionNumBits_ = 2;
115  static const int RegionStartBit_ = 0;
116  static const int RegionMask_ = 0X3;
117 
118  static const int RingNumBits_ = 3;
119  static const int RingStartBit_ = RegionStartBit_+RegionNumBits_;
120  static const unsigned int RingMask_ = 0X7;
121 
122  static const int StationNumBits_ = 3;
123  static const int StationStartBit_ = RingStartBit_+RingNumBits_;
124  static const unsigned int StationMask_ = 0X7;
125 
126 
127  static const int ChamberNumBits_ = 6;
128  static const int ChamberStartBit_ = StationStartBit_+StationNumBits_;
129  static const unsigned int ChamberMask_ = 0X3F;
130 
131  static const int LayerNumBits_ = 2;
132  static const int LayerStartBit_ = ChamberStartBit_+ChamberNumBits_;
133  static const unsigned int LayerMask_ = 0X3;
134 
135  static const int RollNumBits_ = 5;
136  static const int RollStartBit_ = LayerStartBit_+LayerNumBits_;
137  static const unsigned int RollMask_ = 0X1F;
138 
139  static const uint32_t chamberIdMask_ = ~(RollMask_<<RollStartBit_);
140 
141  static const uint32_t superChamberIdMask_ = chamberIdMask_ + ~(LayerMask_<<LayerStartBit_);
142 
143  private:
144  void init(int region,
145  int ring,
146  int station,
147  int layer,
148  int chamber,
149  int roll);
150 
151  int trind;
152 }; // GEMDetId
153 
154 std::ostream& operator<<( std::ostream& os, const GEMDetId& id );
155 
156 #endif
std::ostream & operator<<(std::ostream &os, const GEMDetId &id)
Definition: GEMDetId.cc:73
static const int ChamberNumBits_
Definition: GEMDetId.h:127
static const int RollStartBit_
Definition: GEMDetId.h:136
static const int StationNumBits_
Definition: GEMDetId.h:122
static const int minRingId
Definition: GEMDetId.h:97
static const int minChamberId
Definition: GEMDetId.h:103
int roll() const
Definition: GEMDetId.h:80
static const int maxRollId
Definition: GEMDetId.h:111
int ring() const
Definition: GEMDetId.h:59
static const uint32_t chamberIdMask_
Definition: GEMDetId.h:139
static const int minRegionId
Definition: GEMDetId.h:94
GEMDetId()
Definition: GEMDetId.cc:8
static const unsigned int StationMask_
Definition: GEMDetId.h:124
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
static const int RegionStartBit_
Definition: GEMDetId.h:115
GEMDetId superChamberId() const
Return the corresponding superChamberId.
Definition: GEMDetId.h:90
static const int maxChamberId
Definition: GEMDetId.h:104
static const int RegionNumBits_
Definition: GEMDetId.h:114
static const int maxLayerId
Definition: GEMDetId.h:108
GEMDetId chamberId() const
Return the corresponding ChamberId.
Definition: GEMDetId.h:85
static const int StationStartBit_
Definition: GEMDetId.h:123
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
static const unsigned int RollMask_
Definition: GEMDetId.h:137
bool operator<(const GEMDetId &r) const
Sort Operator based on the raw detector id.
Definition: GEMDetId.h:38
void init(int region, int ring, int station, int layer, int chamber, int roll)
Definition: GEMDetId.cc:36
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
Definition: GEMDetId.h:69
int station() const
Station id : the station is the pair of chambers at same disk.
Definition: GEMDetId.h:64
static const int minRollId
Definition: GEMDetId.h:110
static const int ChamberStartBit_
Definition: GEMDetId.h:128
static const int LayerStartBit_
Definition: GEMDetId.h:132
static const int maxStationId
Definition: GEMDetId.h:101
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: GEMDetId.h:53
static const unsigned int RingMask_
Definition: GEMDetId.h:120
Definition: DetId.h:18
static const int minStationId
Definition: GEMDetId.h:100
uint32_t id_
Definition: DetId.h:56
static const int LayerNumBits_
Definition: GEMDetId.h:131
static const unsigned int ChamberMask_
Definition: GEMDetId.h:129
static const int RegionMask_
Definition: GEMDetId.h:116
static const uint32_t superChamberIdMask_
Definition: GEMDetId.h:141
static const int RingNumBits_
Definition: GEMDetId.h:118
static const int maxRingId
Definition: GEMDetId.h:98
static const int minLayerId
Definition: GEMDetId.h:107
int trind
Definition: GEMDetId.h:151
static const int maxRegionId
Definition: GEMDetId.h:95
static const unsigned int LayerMask_
Definition: GEMDetId.h:133
static const int RollNumBits_
Definition: GEMDetId.h:135
static const int RingStartBit_
Definition: GEMDetId.h:119