CMS 3D CMS Logo

ME0DetId.cc
Go to the documentation of this file.
1 
7 
9 
10 ME0DetId::ME0DetId(uint32_t id) : DetId(id) {
11  if (det() != DetId::Muon || subdetId() != MuonSubdetId::ME0) {
12  throw cms::Exception("InvalidDetId") << "ME0DetId ctor:"
13  << " det: " << det() << " subdet: " << subdetId() << " is not a valid ME0 id";
14  }
15 }
16 
18  if (det() != DetId::Muon || subdetId() != MuonSubdetId::ME0) {
19  throw cms::Exception("InvalidDetId") << "ME0DetId ctor:"
20  << " det: " << det() << " subdet: " << subdetId() << " is not a valid ME0 id";
21  }
22 }
23 
25  this->init(region, layer, chamber, roll);
26 }
27 
28 void ME0DetId::init(int region, int layer, int chamber, int roll) {
29  if (region < minRegionId || region > maxRegionId || layer < minLayerId || layer > maxLayerId ||
30  chamber < minChamberId || chamber > maxChamberId || roll < minRollId || roll > maxRollId) {
31  throw cms::Exception("InvalidDetId") << "ME0DetId ctor:"
32  << " Invalid parameters: "
33  << " region " << region << " layer " << layer << " chamber " << chamber
34  << " etaPartition " << roll << std::endl;
35  }
36  int regionInBits = region - minRegionId;
37  int layerInBits = layer - minLayerId;
38  int chamberInBits = chamber - minChamberId;
39  int rollInBits = roll - minRollId;
40 
41  id_ |= (regionInBits & RegionMask_) << RegionStartBit_ | (layerInBits & LayerMask_) << LayerStartBit_ |
42  (chamberInBits & ChamberMask_) << ChamberStartBit_ | (rollInBits & RollMask_) << RollStartBit_;
43 }
44 
45 std::ostream& operator<<(std::ostream& os, const ME0DetId& id) {
46  os << " Region " << id.region() << " Layer " << id.layer() << " Chamber " << id.chamber() << " EtaPartition "
47  << id.roll() << " ";
48 
49  return os;
50 }
static constexpr int maxChamberId
Definition: ME0DetId.h:67
static constexpr int minRegionId
Definition: ME0DetId.h:63
static constexpr int RollStartBit_
Definition: ME0DetId.h:89
static constexpr int LayerStartBit_
Definition: ME0DetId.h:85
ME0DetId()
Definition: ME0DetId.cc:8
static constexpr unsigned int LayerMask_
Definition: ME0DetId.h:86
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
constexpr std::array< uint8_t, layerIndexSize > layer
static constexpr unsigned int RollMask_
Definition: ME0DetId.h:90
static constexpr int minRollId
Definition: ME0DetId.h:72
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
Definition: Muon.py:1
static constexpr int minChamberId
Definition: ME0DetId.h:66
static constexpr int minLayerId
Definition: ME0DetId.h:69
static constexpr int ME0
Definition: MuonSubdetId.h:15
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
Definition: DetId.h:17
std::ostream & operator<<(std::ostream &os, const ME0DetId &id)
Definition: ME0DetId.cc:45
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
uint32_t id_
Definition: DetId.h:69
static constexpr int maxRollId
Definition: ME0DetId.h:73
void init(int region, int layer, int chamber, int roll)
Definition: ME0DetId.cc:28
static constexpr int ChamberStartBit_
Definition: ME0DetId.h:81
ME0 Data Record : block->header().getID() = 6.
Definition: Block.h:23
static constexpr int RegionMask_
Definition: ME0DetId.h:78
int roll() const
Definition: ME0DetId.h:48
static constexpr int maxRegionId
Definition: ME0DetId.h:64
static constexpr int maxLayerId
Definition: ME0DetId.h:70
static constexpr int RegionStartBit_
Definition: ME0DetId.h:77
static constexpr unsigned int ChamberMask_
Definition: ME0DetId.h:82