CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ME0DetId.cc
Go to the documentation of this file.
1 
7 
9 
10 
11 ME0DetId::ME0DetId(uint32_t id):DetId(id){
13  throw cms::Exception("InvalidDetId") << "ME0DetId ctor:"
14  << " det: " << det()
15  << " subdet: " << subdetId()
16  << " is not a valid ME0 id";
17  }
18 }
19 
22  throw cms::Exception("InvalidDetId") << "ME0DetId ctor:"
23  << " det: " << det()
24  << " subdet: " << subdetId()
25  << " is not a valid ME0 id";
26  }
27 }
28 
29 ME0DetId::ME0DetId(int region, int layer,int chamber, int roll):
31 {
32  this->init(region,layer,chamber,roll);
33 }
34 
35 void
36 ME0DetId::init(int region,int layer,int chamber,int roll)
37 {
38  if ( region < minRegionId || region > maxRegionId ||
39  layer < minLayerId || layer > maxLayerId ||
40  chamber < minChamberId || chamber > maxChamberId ||
41  roll < minRollId || roll > maxRollId) {
42  throw cms::Exception("InvalidDetId") << "ME0DetId ctor:"
43  << " Invalid parameters: "
44  << " region "<<region
45  << " layer "<<layer
46  << " chamber "<<chamber
47  << " etaPartition "<<roll
48  << std::endl;
49  }
50  int regionInBits=region-minRegionId;
51  int layerInBits=layer-minLayerId;
52  int chamberInBits=chamber-minChamberId;
53  int rollInBits=roll-minRollId;
54 
55  id_ |= ( regionInBits & RegionMask_) << RegionStartBit_ |
56  ( layerInBits & LayerMask_) << LayerStartBit_ |
57  ( chamberInBits & ChamberMask_) << ChamberStartBit_ |
58  ( rollInBits & RollMask_) << RollStartBit_ ;
59 
60 }
61 
62 
63 
64 std::ostream& operator<<( std::ostream& os, const ME0DetId& id ){
65 
66 
67  os << " Region "<<id.region()
68  << " Layer "<<id.layer()
69  << " Chamber "<<id.chamber()
70  << " EtaPartition "<<id.roll()
71  <<" ";
72 
73  return os;
74 }
75 
76 
static const int minChamberId
Definition: ME0DetId.h:89
static const int maxChamberId
Definition: ME0DetId.h:90
static const int maxRollId
Definition: ME0DetId.h:96
static const int minLayerId
Definition: ME0DetId.h:92
static const unsigned int LayerMask_
Definition: ME0DetId.h:109
ME0DetId()
Definition: ME0DetId.cc:8
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
static const int maxRegionId
Definition: ME0DetId.h:87
static const int ME0
Definition: MuonSubdetId.h:16
static const int minRegionId
Definition: ME0DetId.h:86
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
static const int LayerStartBit_
Definition: ME0DetId.h:108
Definition: DetId.h:18
static const int ChamberStartBit_
Definition: ME0DetId.h:104
static const unsigned int ChamberMask_
Definition: ME0DetId.h:105
uint32_t id_
Definition: DetId.h:55
static const int RegionMask_
Definition: ME0DetId.h:101
void init(int region, int layer, int chamber, int roll)
Definition: ME0DetId.cc:36
static const int RegionStartBit_
Definition: ME0DetId.h:100
static const int maxLayerId
Definition: ME0DetId.h:93
static const unsigned int RollMask_
Definition: ME0DetId.h:113
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
static const int minRollId
Definition: ME0DetId.h:95
static const int RollStartBit_
Definition: ME0DetId.h:112