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 }
DTSuperLayerId
Definition: DTSuperLayerId.h:12
DTLayerId.h
relativeConstraints.station
station
Definition: relativeConstraints.py:67
DTChamberId::layerIdMask_
static const uint32_t layerIdMask_
Definition: DTChamberId.h:99
DTSuperLayerId::superlayer
int superlayer() const
Return the superlayer number (deprecated method name)
Definition: DTSuperLayerId.h:42
DTLayerId
Definition: DTLayerId.h:12
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
DTChamberId::checkMuonId
void checkMuonId()
Definition: DTChamberId.cc:41
DetId::id_
uint32_t id_
Definition: DetId.h:69
DTLayerId::DTLayerId
DTLayerId()
Definition: DTLayerId.cc:12
DTChamberId::lMask_
static const uint32_t lMask_
Definition: DTChamberId.h:96
DTChamberId::maxLayerId
static const int maxLayerId
highest layer id
Definition: DTChamberId.h:70
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
DTChamberId::layerStartBit_
static const int layerStartBit_
Definition: DTChamberId.h:81
operator<<
std::ostream & operator<<(std::ostream &os, const DTLayerId &id)
Definition: DTLayerId.cc:60
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Exception
Definition: hltDiff.cc:245
Exception.h
DTChamberId
Definition: DTChamberId.h:14
DTLayerId::layer
int layer() const
Return the layer number.
Definition: DTLayerId.h:42
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42