CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTLayerId.cc
Go to the documentation of this file.
1 
9 #include <iostream>
12 
13 
14 
16 
17 
18 DTLayerId::DTLayerId(uint32_t id) {
19  // Mask the bits outside DTLayerId fields (notably, the wire number)
20  id_ = id & layerIdMask_;
21  // Check this is a valid id for muon DTs.
22  checkMuonId();
23 }
24 
25 
26 
27 // Copy Constructor.
29  // The mask is required for proper slicing, i.e. if layerId is
30  // actually a derived class.
31  id_ = (layerId.rawId() & layerIdMask_);
32 }
33 
34 
35 
36 // Constructor from a camberId and SL and layer numbers
37 DTLayerId::DTLayerId(const DTChamberId& chId, int superlayer, int layer) : DTSuperLayerId(chId, superlayer) {
38  if (layer < minLayerId || layer > maxLayerId) {
39  throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
40  << " Invalid parameters: "
41  << " La:"<< layer
42  << std::endl;
43  }
44  id_ |= (layer & lMask_) << layerStartBit_;
45 }
46 
47 
48 
49 // Constructor from a SuperLayerId and layer number
50 DTLayerId::DTLayerId(const DTSuperLayerId& slId, int layer) : DTSuperLayerId(slId) {
51  if (layer < minLayerId || layer > maxLayerId) {
52  throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
53  << " Invalid parameters: "
54  << " La:"<< layer
55  << std::endl;
56  }
57  id_ |= (layer & lMask_) << layerStartBit_;
58 }
59 
60 
61 
62 
64  int station,
65  int sector,
66  int superlayer,
67  int layer) : DTSuperLayerId(wheel, station, sector, superlayer) {
68  if (layer < minLayerId || layer > maxLayerId) {
69  throw cms::Exception("InvalidDetId") << "DTLayerId ctor:"
70  << " Invalid parameters: "
71  << " Wh:"<< wheel
72  << " St:"<< station
73  << " Se:"<< sector
74  << " Sl:"<< superlayer
75  << " La:"<< layer
76  << std::endl;
77  }
78 
79  id_ |= (layer & lMask_) << layerStartBit_;
80  }
81 
82 
83 
84 std::ostream& operator<<( std::ostream& os, const DTLayerId& id ){
85  os << " Wh:"<< id.wheel()
86  << " St:"<< id.station()
87  << " Se:"<< id.sector()
88  << " Sl:"<< id.superlayer()
89  << " La:"<< id.layer()
90  <<" ";
91 
92  return os;
93 }
94 
95 
static const uint32_t layerIdMask_
Definition: DTChamberId.h:118
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
static const int maxLayerId
highest layer id
Definition: DTChamberId.h:87
void checkMuonId()
Definition: DTChamberId.cc:59
static const int layerStartBit_
Definition: DTChamberId.h:99
static const uint32_t lMask_
Definition: DTChamberId.h:115
uint32_t id_
Definition: DetId.h:57