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 
36  static constexpr auto UNKNOWN = SiStripSubdetector::UNKNOWN;
37  static constexpr auto TIB = SiStripSubdetector::TIB;
38  static constexpr auto TID = SiStripSubdetector::TID;
39  static constexpr auto TOB = SiStripSubdetector::TOB;
40  static constexpr auto TEC = SiStripSubdetector::TEC;
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
SiStripModuleGeometry::W4
SiStripDetId::ringMaskTID_
static const unsigned ringMaskTID_
Definition: SiStripDetId.h:98
SiStripDetId::UNKNOWN
static constexpr auto UNKNOWN
Definition: SiStripDetId.h:36
geometry
ESHandle< TrackerGeometry > geometry
Definition: TkLasBeamFitter.cc:200
SiStripDetId::moduleGeometry
SiStripModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:109
SiStripModuleGeometry::W7
SiStripDetId::layerMask_
static const unsigned layerMask_
Definition: SiStripDetId.h:96
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
geometry
Definition: geometry.py:1
SiStripDetId::sterStartBit_
static const uint32_t sterStartBit_
Definition: SiStripDetId.h:87
SiStripModuleGeometry::W3B
SiStripModuleGeometry::IB1
SiStripModuleGeometry::W3A
SiStripSubdetector::TEC
Definition: SiStripEnums.h:5
SiStripModuleGeometry::W6
SiStripModuleGeometry::OB1
SiStripDetId::ringStartBitTEC_
static const unsigned ringStartBitTEC_
Definition: SiStripDetId.h:99
SiStripSubdetector::TOB
Definition: SiStripEnums.h:5
SiStripDetId::layerStartBit_
static const unsigned layerStartBit_
Definition: SiStripDetId.h:95
DetId
Definition: DetId.h:17
SiStripDetId::reservedStartBit_
static const uint16_t reservedStartBit_
Definition: SiStripDetId.h:84
SiStripModuleGeometry::W5
SiStripDetId::reservedMask_
static const uint16_t reservedMask_
Definition: SiStripDetId.h:90
SiStripModuleGeometry::W1B
SiStripDetId::TEC
static constexpr auto TEC
Definition: SiStripDetId.h:40
SiStripDetId::SiStripDetId
SiStripDetId(Detector det, int subdet)
Definition: SiStripDetId.h:32
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
SiStripModuleGeometry::IB2
SiStripModuleGeometry::W1A
SiStripDetId::ringStartBitTID_
static const unsigned ringStartBitTID_
Definition: SiStripDetId.h:97
DetId::id_
uint32_t id_
Definition: DetId.h:69
SiStripDetId::SiStripDetId
SiStripDetId()
Definition: SiStripDetId.h:23
SiStripModuleGeometry::W2A
operator<<
std::ostream & operator<<(std::ostream &, const SiStripDetId &)
Definition: SiStripDetId.cc:4
createfilelist.int
int
Definition: createfilelist.py:10
SiStripDetId::SiStripDetId
SiStripDetId(const uint32_t &raw_id)
Definition: SiStripDetId.h:26
SiStripModuleGeometry::W2B
SiStripDetId::TOB
static constexpr auto TOB
Definition: SiStripDetId.h:39
DetId::Detector
Detector
Definition: DetId.h:24
SiStripSubdetector::TIB
Definition: SiStripEnums.h:5
SiStripModuleGeometry::UNKNOWNGEOMETRY
SiStripDetId::glued
uint32_t glued() const
Definition: SiStripDetId.h:163
SiStripDetId::SiStripDetId
SiStripDetId(const uint32_t &raw_id, const uint16_t &reserved)
Definition: SiStripDetId.h:65
SiStripDetId::TID
static constexpr auto TID
Definition: SiStripDetId.h:38
SiStripDetId::SiStripDetId
SiStripDetId(const DetId &det_id, const uint16_t &reserved)
Definition: SiStripDetId.h:74
SiStripSubdetector::UNKNOWN
Definition: SiStripEnums.h:5
SiStripEnums.h
SiStripDetId::stripLength
double stripLength() const
Definition: SiStripDetId.h:182
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
SiStripDetId::sterMask_
static const uint32_t sterMask_
Definition: SiStripDetId.h:93
DetId.h
SiStripDetId::subDetector
SubDetector subDetector() const
Definition: SiStripDetId.h:105
SiStripDetId::TIB
static constexpr auto TIB
Definition: SiStripDetId.h:37
SiStripDetId::SiStripDetId
SiStripDetId(const DetId &det_id)
Definition: SiStripDetId.h:29
SiStripModuleGeometry::OB2
SiStripDetId::ringMaskTEC_
static const unsigned ringMaskTEC_
Definition: SiStripDetId.h:100
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
SiStripDetId::reserved
uint16_t reserved() const
Definition: SiStripDetId.h:184
SiStripModuleGeometry
SiStripModuleGeometry
Definition: SiStripEnums.h:8
SiStripDetId::partnerDetId
uint32_t partnerDetId() const
Definition: SiStripDetId.h:170
SiStripSubdetector::Subdetector
Subdetector
Definition: SiStripEnums.h:5
SiStripSubdetector::TID
Definition: SiStripEnums.h:5
SiStripDetId::stereo
uint32_t stereo() const
Definition: SiStripDetId.h:168