CMS 3D CMS Logo

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