CMS 3D CMS Logo

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