CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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{
54  return int((id_>>RegionStartBit_) & RegionMask_) + minRegionId;
55  }
56 
59  int ring() const{
60  return int((id_>>RingStartBit_) & RingMask_) + minRingId;
61  }
62 
64  int station() const{
65  return int((id_>>StationStartBit_) & StationMask_) + minStationId;
66  }
67 
69  int layer() const{
70  return int((id_>>LayerStartBit_) & LayerMask_) + minLayerId;
71  }
72 
74  int chamber() const{
75  return int((id_>>ChamberStartBit_) & ChamberMask_) + (minChamberId+1);
76  }
77 
80  int roll() const{
81  return int((id_>>RollStartBit_) & RollMask_); // value 0 is used as wild card
82  }
83 
84 
86  GEMDetId chamberId() const {
87  return GEMDetId(id_ & chamberIdMask_);
88  }
89 
90  static const int minRegionId= -1;
91  static const int maxRegionId= 1;
92 
93  static const int minRingId= 1;
94  static const int maxRingId= 3;
95 
96  static const int minStationId= 1;
97  static const int maxStationId= 4;
98 
99  static const int minChamberId= 0;
100  static const int maxChamberId= 36;
101 
102  static const int minLayerId= 1;
103  static const int maxLayerId= 2;
104 
105  static const int minRollId= 0;
106  static const int maxRollId= 15;
107 
108  private:
109  static const int RegionNumBits_ = 2;
110  static const int RegionStartBit_ = 0;
111  static const int RegionMask_ = 0X3;
112 
113  static const int RingNumBits_ = 3;
115  static const unsigned int RingMask_ = 0X7;
116 
117  static const int StationNumBits_ = 3;
119  static const unsigned int StationMask_ = 0X7;
120 
121 
122  static const int ChamberNumBits_ = 6;
124  static const unsigned int ChamberMask_ = 0X3F;
125 
126  static const int LayerNumBits_ = 1;
128  static const unsigned int LayerMask_ = 0X1;
129 
130  static const int RollNumBits_ = 5;
132  static const unsigned int RollMask_ = 0X1F;
133 
134  static const uint32_t chamberIdMask_ = ~(RollMask_<<RollStartBit_);
135 
136  private:
137  void init(int region,
138  int ring,
139  int station,
140  int layer,
141  int chamber,
142  int roll);
143 
144  int trind;
145 }; // GEMDetId
146 
147 std::ostream& operator<<( std::ostream& os, const GEMDetId& id );
148 
149 #endif
static const int ChamberNumBits_
Definition: GEMDetId.h:122
static const int RollStartBit_
Definition: GEMDetId.h:131
static const int StationNumBits_
Definition: GEMDetId.h:117
static const int minRingId
Definition: GEMDetId.h:93
static const int minChamberId
Definition: GEMDetId.h:99
int roll() const
Definition: GEMDetId.h:80
static const int maxRollId
Definition: GEMDetId.h:106
int ring() const
Definition: GEMDetId.h:59
static const uint32_t chamberIdMask_
Definition: GEMDetId.h:134
static const int minRegionId
Definition: GEMDetId.h:90
GEMDetId()
Definition: GEMDetId.cc:8
static const unsigned int StationMask_
Definition: GEMDetId.h:119
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:110
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const int maxChamberId
Definition: GEMDetId.h:100
static const int RegionNumBits_
Definition: GEMDetId.h:109
static const int maxLayerId
Definition: GEMDetId.h:103
GEMDetId chamberId() const
Return the corresponding ChamberId.
Definition: GEMDetId.h:86
static const int StationStartBit_
Definition: GEMDetId.h:118
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const unsigned int RollMask_
Definition: GEMDetId.h:132
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:105
static const int ChamberStartBit_
Definition: GEMDetId.h:123
static const int LayerStartBit_
Definition: GEMDetId.h:127
static const int maxStationId
Definition: GEMDetId.h:97
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:115
Definition: DetId.h:18
static const int minStationId
Definition: GEMDetId.h:96
uint32_t id_
Definition: DetId.h:55
static const int LayerNumBits_
Definition: GEMDetId.h:126
static const unsigned int ChamberMask_
Definition: GEMDetId.h:124
static const int RegionMask_
Definition: GEMDetId.h:111
static const int RingNumBits_
Definition: GEMDetId.h:113
static const int maxRingId
Definition: GEMDetId.h:94
static const int minLayerId
Definition: GEMDetId.h:102
int trind
Definition: GEMDetId.h:144
static const int maxRegionId
Definition: GEMDetId.h:91
static const unsigned int LayerMask_
Definition: GEMDetId.h:128
static const int RollNumBits_
Definition: GEMDetId.h:130
static const int RingStartBit_
Definition: GEMDetId.h:114