CMS 3D CMS Logo

DTChamberId.cc
Go to the documentation of this file.
1 
10 #include <ostream>
11 
12 using namespace std;
13 
15 
16 DTChamberId::DTChamberId(uint32_t id) : DetId(id & chamberIdMask_) { // Mask the bits outside DTChamberId fields
17  checkMuonId(); // Check this is a valid id for muon DTs.
18 }
19 DTChamberId::DTChamberId(DetId id) : DetId(id.rawId() & chamberIdMask_) { // Mask the bits outside DTChamberId fields
20  checkMuonId(); // Check this is a valid id for muon DTs.
21 }
22 
24  // Check that arguments are within the range
25  if (wheel < minWheelId || wheel > maxWheelId || station < minStationId || station > maxStationId ||
26  sector < minSectorId || sector > maxSectorId) {
27  throw cms::Exception("InvalidDetId") << "DTChamberId ctor:"
28  << " Invalid parameters: "
29  << " Wh:" << wheel << " St:" << station << " Se:" << sector << std::endl;
30  }
31 
32  int tmpwheelid = wheel - minWheelId + 1;
33  id_ |= (tmpwheelid & wheelMask_) << wheelStartBit_ | (station & stationMask_) << stationStartBit_ |
34  (sector & sectorMask_) << sectorStartBit_;
35 }
36 
38  // The mask is required for proper slicing, i.e. if chId is actually a derived class.
39  : DetId(chId.rawId() & chamberIdMask_) {}
40 
42  if (det() != DetId::Muon || subdetId() != MuonSubdetId::DT) {
43  throw cms::Exception("InvalidDetId") << "DTChamberId ctor:"
44  << " det: " << det() << " subdet: " << subdetId() << " is not a valid DT id";
45  }
46 }
47 
48 std::ostream& operator<<(std::ostream& os, const DTChamberId& id) {
49  os << " Wh:" << id.wheel() << " St:" << id.station() << " Se:" << id.sector() << " ";
50 
51  return os;
52 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static const int sectorStartBit_
Definition: DTChamberId.h:87
static const int wheelStartBit_
Definition: DTChamberId.h:85
static const uint32_t stationMask_
Definition: DTChamberId.h:93
Definition: Muon.py:1
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
void checkMuonId()
Definition: DTChamberId.cc:41
static const uint32_t sectorMask_
Definition: DTChamberId.h:94
static const int maxStationId
highest station id
Definition: DTChamberId.h:54
static const int minWheelId
lowest wheel number
Definition: DTChamberId.h:60
Definition: DetId.h:17
static const int maxWheelId
highest wheel number
Definition: DTChamberId.h:62
uint32_t id_
Definition: DetId.h:69
int sector() const
Definition: DTChamberId.h:49
static const uint32_t chamberIdMask_
Definition: DTChamberId.h:101
static const uint32_t wheelMask_
Definition: DTChamberId.h:92
std::ostream & operator<<(std::ostream &os, const DTChamberId &id)
Definition: DTChamberId.cc:48
static constexpr int DT
Definition: MuonSubdetId.h:11
static const int stationStartBit_
Definition: DTChamberId.h:90
int station() const
Return the station number.
Definition: DTChamberId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
static const int maxSectorId
highest sector id.
Definition: DTChamberId.h:58
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46