CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripDetId.h
Go to the documentation of this file.
1 #ifndef DataFormats_SiStripDetId_SiStripDetId_h
2 #define DataFormats_SiStripDetId_SiStripDetId_h
3 
5 #include <ostream>
6 
7 class SiStripDetId;
8 
10 std::ostream& operator<< ( std::ostream&, const SiStripDetId& );
11 
17 class SiStripDetId : public DetId {
18 
19  public:
20 
21  // ---------- Constructors, enumerated types ----------
22 
24  SiStripDetId();
25 
27  SiStripDetId( const uint32_t& raw_id );
28 
30  SiStripDetId( const DetId& );
31 
33  SiStripDetId( Detector det, int subdet );
34 
36  enum SubDetector { UNKNOWN=0, TIB=3, TID=4, TOB=5, TEC=6 };
37 
40 
41  // ---------- Common methods ----------
42 
44  inline SubDetector subDetector() const;
45 
47  inline ModuleGeometry moduleGeometry() const;
48 
50  inline virtual uint32_t glued() const;
51 
53  inline virtual uint32_t stereo() const;
54 
56  inline virtual uint32_t partnerDetId() const;
57 
59  inline virtual double stripLength() const;
60 
62  // inline virtual bool isDoubleSide() const;
63 
64  // ---------- Constructors that set "reserved" field ----------
65 
67  SiStripDetId( const uint32_t& raw_id,
68  const uint16_t& reserved );
69 
71  SiStripDetId( const DetId& det_id,
72  const uint16_t& reserved );
73 
75  inline uint16_t reserved() const;
76 
77  private:
78 
80  static const uint16_t reservedStartBit_ = 20;
81 
83  static const uint32_t sterStartBit_ = 0;
84 
86  static const uint16_t reservedMask_ = 0x7;
87 
89  static const uint32_t sterMask_ = 0x3;
90 
91  static const unsigned layerStartBit_ = 14;
92  static const unsigned layerMask_ = 0x7;
93  static const unsigned ringStartBitTID_= 9;
94  static const unsigned ringMaskTID_= 0x3;
95  static const unsigned ringStartBitTEC_= 5;
96  static const unsigned ringMaskTEC_= 0x7;
97 
98 };
99 
100 // ---------- inline methods ----------
101 
103  if( det() == DetId::Tracker &&
104  subdetId() == static_cast<int>(SiStripDetId::TIB) ) {
105  return SiStripDetId::TIB;
106  } else if ( det() == DetId::Tracker &&
107  subdetId() == static_cast<int>(SiStripDetId::TID) ) {
108  return SiStripDetId::TID;
109  } else if ( det() == DetId::Tracker &&
110  subdetId() == static_cast<int>(SiStripDetId::TOB) ) {
111  return SiStripDetId::TOB;
112  } else if ( det() == DetId::Tracker &&
113  subdetId() == static_cast<int>(SiStripDetId::TEC) ) {
114  return SiStripDetId::TEC;
115  } else {
116  return SiStripDetId::UNKNOWN;
117  }
118 }
119 
121  switch(subDetector()) {
122  case TIB: return int((id_>>layerStartBit_) & layerMask_)<3? IB1 : IB2;
123  case TOB: return int((id_>>layerStartBit_) & layerMask_)<5? OB2 : OB1;
124  case TID: switch ((id_>>ringStartBitTID_) & ringMaskTID_) {
125  case 1: return W1A;
126  case 2: return W2A;
127  case 3: return W3A;
128  }
129  case TEC: switch ((id_>>ringStartBitTEC_) & ringMaskTEC_) {
130  case 1: return W1B;
131  case 2: return W2B;
132  case 3: return W3B;
133  case 4: return W4;
134  case 5: return W5;
135  case 6: return W6;
136  case 7: return W7;
137  }
138  case UNKNOWN: default: return UNKNOWNGEOMETRY;
139  }
140 }
141 
142 uint32_t SiStripDetId::glued() const {
143  if ( ((id_>>sterStartBit_) & sterMask_ ) == 1 ) {
144  return ( id_ - 1 );
145  } else if ( ((id_>>sterStartBit_) & sterMask_ ) == 2 ) {
146  return ( id_ - 2 );
147  } else { return 0; }
148 }
149 
150 uint32_t SiStripDetId::stereo() const {
151  if ( ((id_>>sterStartBit_ ) & sterMask_ ) == 1 ) {
152  return ( (id_>>sterStartBit_) & sterMask_ );
153  } else { return 0; }
154 }
155 
156 uint32_t SiStripDetId::partnerDetId() const {
157  if ( ((id_>>sterStartBit_) & sterMask_ ) == 1 ) {
158  return ( id_ + 1 );
159  } else if ( ((id_>>sterStartBit_) & sterMask_ ) == 2 ) {
160  return ( id_ - 1 );
161  } else { return 0; }
162 }
163 
165  return 0.;
166 }
167 
168 //bool SiStripDetId::isDoubleSide() const {
169 // return false;
170 //}
171 
172 uint16_t SiStripDetId::reserved() const {
173  return static_cast<uint16_t>( (id_>>reservedStartBit_) & reservedMask_ );
174 }
175 
176 #endif // DataFormats_SiStripDetId_SiStripDetId_h
177 
static const unsigned ringStartBitTID_
Definition: SiStripDetId.h:93
static const uint32_t sterStartBit_
Definition: SiStripDetId.h:83
virtual uint32_t stereo() const
Definition: SiStripDetId.h:150
static const uint32_t sterMask_
Definition: SiStripDetId.h:89
static const unsigned layerStartBit_
Definition: SiStripDetId.h:91
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
virtual uint32_t partnerDetId() const
Definition: SiStripDetId.h:156
static const uint16_t reservedMask_
Definition: SiStripDetId.h:86
static const unsigned layerMask_
Definition: SiStripDetId.h:92
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
uint16_t reserved() const
Definition: SiStripDetId.h:172
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:102
Definition: DetId.h:20
virtual uint32_t glued() const
Definition: SiStripDetId.h:142
Detector
Definition: DetId.h:26
uint32_t id_
Definition: DetId.h:57
static const unsigned ringMaskTEC_
Definition: SiStripDetId.h:96
virtual double stripLength() const
Definition: SiStripDetId.h:164
static const unsigned ringStartBitTEC_
Definition: SiStripDetId.h:95
ModuleGeometry moduleGeometry() const
Definition: SiStripDetId.h:120
static const unsigned ringMaskTID_
Definition: SiStripDetId.h:94
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
static const uint16_t reservedStartBit_
Definition: SiStripDetId.h:80