CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
23 DTChamberId::DTChamberId(int wheel, int station, int sector) : DetId(DetId::Muon, MuonSubdetId::DT) {
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 }
static const int sectorStartBit_
Definition: DTChamberId.h:87
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
static const int wheelStartBit_
Definition: DTChamberId.h:85
static const uint32_t stationMask_
Definition: DTChamberId.h:93
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
static const uint32_t wheelMask_
Definition: DTChamberId.h:92
static constexpr int DT
Definition: MuonSubdetId.h:11
static const int stationStartBit_
Definition: DTChamberId.h:90
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