CMS 3D CMS Logo

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