CMS 3D CMS Logo

SiStripDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_SiStripDetId_SiStripDetId_h
2 #define DataFormats_SiStripDetId_SiStripDetId_h
3 
6 #include <ostream>
7 
8 class SiStripDetId;
9 
11 std::ostream &operator<<(std::ostream &, const SiStripDetId &);
12 
18 class SiStripDetId : public DetId {
19 public:
20  // ---------- Constructors, enumerated types ----------
21 
23  SiStripDetId() : DetId() { ; }
24 
26  SiStripDetId(const uint32_t &raw_id) : DetId(raw_id) { ; }
27 
29  SiStripDetId(const DetId &det_id) : DetId(det_id.rawId()) { ; }
30 
32  SiStripDetId(Detector det, int subdet) : DetId(det, subdet) { ; }
33 
41 
42  // ---------- Common methods ----------
43 
45  inline SubDetector subDetector() const;
46 
49 
51  inline uint32_t glued() const;
52 
54  inline uint32_t stereo() const;
55 
57  inline uint32_t partnerDetId() const;
58 
60  inline double stripLength() const;
61 
62  // ---------- Constructors that set "reserved" field ----------
63 
65  SiStripDetId(const uint32_t &raw_id, const uint16_t &reserved) : DetId(raw_id) {
66  id_ &= (~static_cast<uint32_t>(reservedMask_ << reservedStartBit_));
68  }
69 
70  // -----------------------------------------------------------------------------
71  //
72 
74  SiStripDetId(const DetId &det_id, const uint16_t &reserved) : DetId(det_id.rawId()) {
75  id_ &= (~static_cast<uint32_t>(reservedMask_ << reservedStartBit_));
77  }
78 
80  inline uint16_t reserved() const;
81 
82 private:
84  static const uint16_t reservedStartBit_ = 20;
85 
87  static const uint32_t sterStartBit_ = 0;
88 
90  static const uint16_t reservedMask_ = 0x7;
91 
93  static const uint32_t sterMask_ = 0x3;
94 
95  static const unsigned layerStartBit_ = 14;
96  static const unsigned layerMask_ = 0x7;
97  static const unsigned ringStartBitTID_ = 9;
98  static const unsigned ringMaskTID_ = 0x3;
99  static const unsigned ringStartBitTEC_ = 5;
100  static const unsigned ringMaskTEC_ = 0x7;
101 };
102 
103 // ---------- inline methods ----------
104 
106  return static_cast<SiStripDetId::SubDetector>(subdetId());
107 }
108 
111  switch (subDetector()) {
112  case TIB:
113  geometry =
115  break;
116  case TOB:
117  geometry =
119  break;
120  case TID:
121  switch ((id_ >> ringStartBitTID_) & ringMaskTID_) {
122  case 1:
124  break;
125  case 2:
127  break;
128  case 3:
130  break;
131  }
132  break;
133  case TEC:
134  switch ((id_ >> ringStartBitTEC_) & ringMaskTEC_) {
135  case 1:
137  break;
138  case 2:
140  break;
141  case 3:
143  break;
144  case 4:
146  break;
147  case 5:
149  break;
150  case 6:
152  break;
153  case 7:
155  break;
156  }
157  case UNKNOWN:
158  default:;
159  }
160  return geometry;
161 }
162 
163 uint32_t SiStripDetId::glued() const {
164  uint32_t testId = (id_ >> sterStartBit_) & sterMask_;
165  return (testId == 0) ? 0 : (id_ - testId);
166 }
167 
168 uint32_t SiStripDetId::stereo() const { return (((id_ >> sterStartBit_) & sterMask_) == 1) ? 1 : 0; }
169 
170 uint32_t SiStripDetId::partnerDetId() const {
171  uint32_t testId = (id_ >> sterStartBit_) & sterMask_;
172  if (testId == 1) {
173  testId = id_ + 1;
174  } else if (testId == 2) {
175  testId = id_ - 1;
176  } else {
177  testId = 0;
178  }
179  return testId;
180 }
181 
182 double SiStripDetId::stripLength() const { return 0.; }
183 
184 uint16_t SiStripDetId::reserved() const { return static_cast<uint16_t>((id_ >> reservedStartBit_) & reservedMask_); }
185 
186 #endif // DataFormats_SiStripDetId_SiStripDetId_h
static const unsigned ringStartBitTID_
Definition: SiStripDetId.h:97
uint16_t reserved() const
Definition: SiStripDetId.h:184
static const uint32_t sterStartBit_
Definition: SiStripDetId.h:87
static constexpr auto TID
Definition: SiStripDetId.h:38
std::ostream & operator<<(std::ostream &, const SiStripDetId &)
Definition: SiStripDetId.cc:4
SiStripModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:109
static const uint32_t sterMask_
Definition: SiStripDetId.h:93
static const unsigned layerStartBit_
Definition: SiStripDetId.h:95
SiStripDetId(const DetId &det_id, const uint16_t &reserved)
Definition: SiStripDetId.h:74
uint32_t glued() const
Definition: SiStripDetId.h:163
SubDetector subDetector() const
Definition: SiStripDetId.h:105
double stripLength() const
Definition: SiStripDetId.h:182
SiStripDetId(const uint32_t &raw_id, const uint16_t &reserved)
Definition: SiStripDetId.h:65
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
SiStripDetId(const DetId &det_id)
Definition: SiStripDetId.h:29
SiStripDetId(Detector det, int subdet)
Definition: SiStripDetId.h:32
uint32_t stereo() const
Definition: SiStripDetId.h:168
static constexpr auto UNKNOWN
Definition: SiStripDetId.h:36
static const uint16_t reservedMask_
Definition: SiStripDetId.h:90
static const unsigned layerMask_
Definition: SiStripDetId.h:96
SiStripModuleGeometry
Definition: SiStripEnums.h:8
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
SiStripDetId(const uint32_t &raw_id)
Definition: SiStripDetId.h:26
static constexpr auto TOB
Definition: SiStripDetId.h:39
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Detector
Definition: DetId.h:24
uint32_t id_
Definition: DetId.h:69
static constexpr auto TIB
Definition: SiStripDetId.h:37
static const unsigned ringMaskTEC_
Definition: SiStripDetId.h:100
uint32_t partnerDetId() const
Definition: SiStripDetId.h:170
static const unsigned ringStartBitTEC_
Definition: SiStripDetId.h:99
static const unsigned ringMaskTID_
Definition: SiStripDetId.h:98
static const uint16_t reservedStartBit_
Definition: SiStripDetId.h:84
static constexpr auto TEC
Definition: SiStripDetId.h:40