CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
18  public:
19 
20  ME0DetId();
21 
24  ME0DetId(uint32_t id);
25  ME0DetId(DetId id);
26 
27 
29  ME0DetId(int region,
30  int layer,
31  int chamber,
32  int roll);
33 
34 
36  bool operator < (const ME0DetId& r) const{
37  if (this->layer() == r.layer() ){
38  return this->rawId()<r.rawId();
39  }
40  else{
41  return (this->layer() > r.layer());
42  }
43  }
44 
46  int region() const{
47  return int((id_>>RegionStartBit_) & RegionMask_) + minRegionId;
48  }
49 
51  int layer() const{
52  return int((id_>>LayerStartBit_) & LayerMask_) + minLayerId;
53  }
54 
56  int chamber() const{
57  return int((id_>>ChamberStartBit_) & ChamberMask_) + minChamberId;
58  }
59 
62  int roll() const{
63  return int((id_>>RollStartBit_) & RollMask_) + minRollId; // value 0 is used as wild card
64  }
65 
66 
68  ME0DetId chamberId() const {
69  return ME0DetId(id_ & chamberIdMask_);
70  }
71 
72  static const int minRegionId= -1;
73  static const int maxRegionId= 1;
74 
75  static const int minChamberId= 0;
76  static const int maxChamberId= 36;
77 
78  static const int minLayerId= 0;
79  static const int maxLayerId= 31;
80 
81  static const int minRollId= 0;
82  static const int maxRollId= 31;
83 
84  private:
85  static const int RegionNumBits_ = 2;
86  static const int RegionStartBit_ = 0;
87  static const int RegionMask_ = 0X3;
88 
89  static const int ChamberNumBits_ = 6;
91  static const unsigned int ChamberMask_ = 0X3F;
92 
93  static const int LayerNumBits_ = 5;
95  static const unsigned int LayerMask_ = 0X1F;
96 
97  static const int RollNumBits_ = 5;
99  static const unsigned int RollMask_ = 0X1F;
100 
101  static const uint32_t chamberIdMask_ = ~(RollMask_<<RollStartBit_);
102 
103  private:
104  void init(int region,
105  int layer,
106  int chamber,
107  int roll);
108 
109  int trind;
110 }; // ME0DetId
111 
112 std::ostream& operator<<( std::ostream& os, const ME0DetId& id );
113 
114 #endif
static const int minChamberId
Definition: ME0DetId.h:75
int trind
Definition: ME0DetId.h:109
static const int maxChamberId
Definition: ME0DetId.h:76
static const int maxRollId
Definition: ME0DetId.h:82
static const int minLayerId
Definition: ME0DetId.h:78
ME0DetId chamberId() const
Return the corresponding ChamberId.
Definition: ME0DetId.h:68
static const int LayerNumBits_
Definition: ME0DetId.h:93
static const unsigned int LayerMask_
Definition: ME0DetId.h:95
ME0DetId()
Definition: ME0DetId.cc:8
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const int ChamberNumBits_
Definition: ME0DetId.h:89
static const int maxRegionId
Definition: ME0DetId.h:73
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
static const int minRegionId
Definition: ME0DetId.h:72
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:56
bool operator<(const ME0DetId &r) const
Sort Operator based on the raw detector id.
Definition: ME0DetId.h:36
static const uint32_t chamberIdMask_
Definition: ME0DetId.h:101
static const int RollNumBits_
Definition: ME0DetId.h:97
static const int LayerStartBit_
Definition: ME0DetId.h:94
Definition: DetId.h:18
static const int ChamberStartBit_
Definition: ME0DetId.h:90
static const unsigned int ChamberMask_
Definition: ME0DetId.h:91
uint32_t id_
Definition: DetId.h:55
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:46
static const int RegionMask_
Definition: ME0DetId.h:87
void init(int region, int layer, int chamber, int roll)
Definition: ME0DetId.cc:36
int roll() const
Definition: ME0DetId.h:62
static const int RegionNumBits_
Definition: ME0DetId.h:85
static const int RegionStartBit_
Definition: ME0DetId.h:86
static const int maxLayerId
Definition: ME0DetId.h:79
static const unsigned int RollMask_
Definition: ME0DetId.h:99
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 6 is the o...
Definition: ME0DetId.h:51
static const int minRollId
Definition: ME0DetId.h:81
static const int RollStartBit_
Definition: ME0DetId.h:98