CMS 3D CMS Logo

DTWireId.cc
Go to the documentation of this file.
1 
9 #include <iostream>
12 
13 
14 
16 
17 
18 
19 DTWireId::DTWireId(uint32_t id) {
20  id_= id;
21  checkMuonId(); // Check this is a valid id for muon DTs.
22 }
23 
24 
25 
27  int station,
28  int sector,
29  int superlayer,
30  int layer,
31  int wire) : DTLayerId(wheel, station, sector, superlayer, layer) {
32  if (wire < minWireId || wire > maxWireId) {
33  throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
34  << " Invalid parameters: "
35  << " Wh:"<< wheel
36  << " St:"<< station
37  << " Se:"<< sector
38  << " Sl:"<< superlayer
39  << " La:"<< layer
40  << " Wi:"<< wire
41  << std::endl;
42  }
43 
44  id_ |= (wire & wireMask_) << wireStartBit_;
45  }
46 
47 
48 
49 // Copy Constructor.
50 DTWireId::DTWireId(const DTWireId& wireId) {
51  id_ = wireId.rawId();
52 }
53 
54 
55 
56 // Constructor from a CamberId and SL, layer and wire numbers
57 DTWireId::DTWireId(const DTChamberId& chId, int superlayer, int layer, int wire) :
58  DTLayerId(chId, superlayer, layer) {
59  if (wire < minWireId || wire > maxWireId) {
60  throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
61  << " Invalid parameters: "
62  << " Wi:"<< wire
63  << std::endl;
64  }
65 
66  id_ |= (wire & wireMask_) << wireStartBit_;
67  }
68 
69 
70 
71 // Constructor from a SuperLayerId and layer and wire numbers
72 DTWireId::DTWireId(const DTSuperLayerId& slId, int layer, int wire) :
73  DTLayerId(slId, layer) {
74  if (wire < minWireId || wire > maxWireId) {
75  throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
76  << " Invalid parameters: "
77  << " Wi:"<< wire
78  << std::endl;
79  }
80 
81  id_ |= (wire & wireMask_) << wireStartBit_;
82  }
83 
84 
85 
86 // Constructor from a layerId and a wire number
88  if (wire < minWireId || wire > maxWireId) {
89  throw cms::Exception("InvalidDetId") << "DTWireId ctor:"
90  << " Invalid parameters: "
91  << " Wi:"<< wire
92  << std::endl;
93  }
94 
95  id_ |= (wire & wireMask_) << wireStartBit_;
96 }
97 
98 
99 
100 // Ostream operator
101 std::ostream& operator<<( std::ostream& os, const DTWireId& id ){
102 
103  os << " Wh:"<< id.wheel()
104  << " St:"<< id.station()
105  << " Se:"<< id.sector()
106  << " Sl:"<< id.superlayer()
107  << " La:"<< id.layer()
108  << " Wi:"<< id.wire()
109  <<" ";
110 
111  return os;
112 }
113 
114 
std::ostream & operator<<(std::ostream &os, const DTWireId &id)
Definition: DTWireId.cc:101
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
static const int wireStartBit_
Definition: DTChamberId.h:95
static const int maxWireId
highest wire id (chambers have 48 to 96 wires)
Definition: DTChamberId.h:89
void checkMuonId()
Definition: DTChamberId.cc:57
int wire() const
Return the wire number.
Definition: DTWireId.h:56
int superlayer() const
Return the superlayer number (deprecated method name)
uint32_t id_
Definition: DetId.h:59
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
int sector() const
Definition: DTChamberId.h:61
static const uint32_t wireMask_
Definition: DTChamberId.h:114
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
DTWireId()
Definition: DTWireId.cc:15