CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerTopology.h
Go to the documentation of this file.
1 #ifndef TRACKERTOPOLOGY_H
2 #define TRACKERTOPOLOGY_H
3 
8 
9 #include <vector>
10 #include <string>
11 
12 //knower of all things tracker geometry
13 //flexible replacement for PXBDetId and friends
14 //to implement
15 // endcap pixel
16 
17 
19 
20  public:
21 
23  unsigned int layerStartBit_;
24  unsigned int ladderStartBit_;
25  unsigned int moduleStartBit_;
26  unsigned int layerMask_;
27  unsigned int ladderMask_;
28  unsigned int moduleMask_;
29  };
30 
32  unsigned int sideStartBit_;
33  unsigned int diskStartBit_;
34  unsigned int bladeStartBit_;
35  unsigned int panelStartBit_;
36  unsigned int moduleStartBit_;
37  unsigned int sideMask_;
38  unsigned int diskMask_;
39  unsigned int bladeMask_;
40  unsigned int panelMask_;
41  unsigned int moduleMask_;
42  };
43 
44  struct TECValues {
45  unsigned int sideStartBit_;
46  unsigned int wheelStartBit_;
47  unsigned int petal_fw_bwStartBit_;
48  unsigned int petalStartBit_;
49  unsigned int ringStartBit_;
50  unsigned int moduleStartBit_;
51  unsigned int sterStartBit_;
52  unsigned int sideMask_;
53  unsigned int wheelMask_;
54  unsigned int petal_fw_bwMask_;
55  unsigned int petalMask_;
56  unsigned int ringMask_;
57  unsigned int moduleMask_;
58  unsigned int sterMask_;
59  };
60 
61  struct TIBValues {
62  unsigned int layerStartBit_;
63  unsigned int str_fw_bwStartBit_;
64  unsigned int str_int_extStartBit_;
65  unsigned int strStartBit_;
66  unsigned int moduleStartBit_;
67  unsigned int sterStartBit_;
68 
69  unsigned int layerMask_;
70  unsigned int str_fw_bwMask_;
71  unsigned int str_int_extMask_;
72  unsigned int strMask_;
73  unsigned int moduleMask_;
74  unsigned int sterMask_;
75  };
76 
77  struct TIDValues {
78  unsigned int sideStartBit_;
79  unsigned int wheelStartBit_;
80  unsigned int ringStartBit_;
81  unsigned int module_fw_bwStartBit_;
82  unsigned int moduleStartBit_;
83  unsigned int sterStartBit_;
84  unsigned int sideMask_;
85  unsigned int wheelMask_;
86  unsigned int ringMask_;
87  unsigned int module_fw_bwMask_;
88  unsigned int moduleMask_;
89  unsigned int sterMask_;
90  };
91 
92  struct TOBValues {
93  unsigned int layerStartBit_;
94  unsigned int rod_fw_bwStartBit_;
95  unsigned int rodStartBit_;
96  unsigned int moduleStartBit_;
97  unsigned int sterStartBit_;
98  unsigned int layerMask_;
99  unsigned int rod_fw_bwMask_;
100  unsigned int rodMask_;
101  unsigned int moduleMask_;
102  unsigned int sterMask_;
103  };
104 
105 
106 
107  TrackerTopology( const PixelBarrelValues& pxb, const PixelEndcapValues& pxf,
108  const TECValues& tecv, const TIBValues& tibv,
109  const TIDValues& tidv, const TOBValues& tobv);
110 
111  unsigned int layer(const DetId &id) const;
112  unsigned int module(const DetId &id) const;
113 
114  // layer numbers
115  unsigned int pxbLayer(const DetId &id) const {
116  return int((id.rawId()>>pbVals_.layerStartBit_) & pbVals_.layerMask_);
117  }
118  unsigned int tobLayer(const DetId &id) const {
119  return int((id.rawId()>>tobVals_.layerStartBit_) & tobVals_.layerMask_);
120  }
121  unsigned int tibLayer(const DetId &id) const {
122  return int((id.rawId()>>tibVals_.layerStartBit_) & tibVals_.layerMask_);
123  }
124 
125 
126  //ladder
127  unsigned int pxbLadder(const DetId &id) const {
128  return ((id.rawId()>>pbVals_.ladderStartBit_) & pbVals_.ladderMask_) ;
129  }
130 
131  //module
132  unsigned int pxbModule(const DetId &id) const {
133  return ((id.rawId()>>pbVals_.moduleStartBit_)& pbVals_.moduleMask_);
134  }
135  unsigned int pxfModule(const DetId &id) const {
136  return int((id.rawId()>>pfVals_.moduleStartBit_) & pfVals_.moduleMask_);
137  }
138  unsigned int tobModule(const DetId &id) const {
139  return ((id.rawId()>>tobVals_.moduleStartBit_)& tobVals_.moduleMask_);
140  }
141  unsigned int tecModule(const DetId &id) const {
142  return ((id.rawId()>>tecVals_.moduleStartBit_) & tecVals_.moduleMask_);
143  }
144  unsigned int tibModule(const DetId &id) const {
145  return ((id.rawId()>>tibVals_.moduleStartBit_)& tibVals_.moduleMask_);
146  }
147  unsigned int tidModule(const DetId &id) const {
148  return ((id.rawId()>>tidVals_.moduleStartBit_)& tidVals_.moduleMask_);
149  }
150 
151 
152  //side
153  unsigned int tobSide(const DetId &id) const {
154  return ((id.rawId()>>tobVals_.rod_fw_bwStartBit_) & tobVals_.rod_fw_bwMask_);
155  }
156 
157  unsigned int tecSide(const DetId &id) const {
158  return ((id.rawId()>>tecVals_.sideStartBit_)&tecVals_.sideMask_);
159  }
160 
161  unsigned int tibSide(const DetId &id) const {
162  return ((id.rawId()>>tibVals_.str_fw_bwStartBit_) & tibVals_.str_fw_bwMask_);
163  }
164 
165  unsigned int tidSide(const DetId &id) const {
166  return ((id.rawId()>>tidVals_.sideStartBit_)&tidVals_.sideMask_);
167  }
168 
169  unsigned int pxfSide(const DetId &id) const {
170  return ((id.rawId()>>pfVals_.sideStartBit_)&pfVals_.sideMask_);
171  }
172 
173  //rod
174  unsigned int tobRod(const DetId &id) const {
175  return ((id.rawId()>>tobVals_.rodStartBit_) & tobVals_.rodMask_);
176  }
177 
178  //wheel
179  unsigned int tecWheel(const DetId &id) const {
180  return ((id.rawId()>>tecVals_.wheelStartBit_) & tecVals_.wheelMask_) ;
181  }
182  unsigned int tidWheel(const DetId &id) const {
183  return ((id.rawId()>>tidVals_.wheelStartBit_) & tidVals_.wheelMask_) ;
184  }
185 
186  //order
187  unsigned int tecOrder(const DetId &id) const {
188  return ((id.rawId()>>tecVals_.petal_fw_bwStartBit_) & tecVals_.petal_fw_bwMask_);
189  }
190  unsigned int tibOrder(const DetId &id) const {
191  return ((id.rawId()>>tibVals_.str_int_extStartBit_) & tibVals_.str_int_extMask_);
192  }
193  unsigned int tidOrder(const DetId &id) const {
194  return ((id.rawId()>>tidVals_.module_fw_bwStartBit_) & tidVals_.module_fw_bwMask_);
195  }
196 
197 
199  unsigned int tecRing(const DetId &id) const {
200  return ((id.rawId()>>tecVals_.ringStartBit_) & tecVals_.ringMask_) ;
201  }
202  unsigned int tidRing(const DetId &id) const {
203  return ((id.rawId()>>tidVals_.ringStartBit_) & tidVals_.ringMask_) ;
204  }
205 
206 
207  //petal
208  unsigned int tecPetalNumber(const DetId &id) const
209  { return ((id.rawId()>>tecVals_.petalStartBit_) & tecVals_.petalMask_);}
210 
211 
212 
213 
214  //misc tob
215  std::vector<unsigned int> tobRodInfo(const DetId &id) const {
216  std::vector<unsigned int> num;
217  num.push_back( tobSide(id) );
218  num.push_back( tobRod(id) );
219  return num ;
220  }
221 
222  bool tobIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tobLayer(id)==1 || tobLayer(id)==2);}
223  bool tecIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tecRing(id)==1 || tecRing(id)==2 || tecRing(id)==5);}
224  bool tibIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tibLayer(id)==1 || tibLayer(id)==2);}
225  bool tidIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tidRing(id)==1 || tidRing(id)==2);}
226 
227  bool tobIsZPlusSide(const DetId &id) const {return !tobIsZMinusSide(id);}
228  bool tobIsZMinusSide(const DetId &id) const { return tobSide(id)==1;}
229 
230  bool tibIsZPlusSide(const DetId &id) const {return !tibIsZMinusSide(id);}
231  bool tibIsZMinusSide(const DetId &id) const { return tibSide(id)==1;}
232 
233  bool tidIsZPlusSide(const DetId &id) const {return !tidIsZMinusSide(id);}
234  bool tidIsZMinusSide(const DetId &id) const { return tidSide(id)==1;}
235 
236  bool tecIsZPlusSide(const DetId &id) const {return !tecIsZMinusSide(id);}
237  bool tecIsZMinusSide(const DetId &id) const { return tecSide(id)==1;}
238 
239  //these are from the old TOB/TEC/TID/TIB DetId
240  bool tobIsStereo(const DetId &id) const {return tobStereo(id)!=0 && !tobIsDoubleSide(id);}
241  bool tecIsStereo(const DetId &id) const {return tecStereo(id)!=0 && !tecIsDoubleSide(id);}
242  bool tibIsStereo(const DetId &id) const {return tibStereo(id)!=0 && !tibIsDoubleSide(id);}
243  bool tidIsStereo(const DetId &id) const {return tidStereo(id)!=0 && !tidIsDoubleSide(id);}
244 
245  //these are clones of the old SiStripDetId
246  uint32_t tobStereo(const DetId &id) const {
247  if ( ((id.rawId() >>tobVals_.sterStartBit_ ) & tobVals_.sterMask_ ) == 1 ) {
248  return ( (id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ );
249  } else { return 0; }
250  }
251 
252  uint32_t tibStereo(const DetId &id) const {
253  if ( ((id.rawId() >>tibVals_.sterStartBit_ ) & tibVals_.sterMask_ ) == 1 ) {
254  return ( (id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ );
255  } else { return 0; }
256  }
257 
258  uint32_t tidStereo(const DetId &id) const {
259  if ( ((id.rawId() >>tidVals_.sterStartBit_ ) & tidVals_.sterMask_ ) == 1 ) {
260  return ( (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ );
261  } else { return 0; }
262  }
263 
264  uint32_t tecStereo(const DetId &id) const {
265  if ( ((id.rawId() >>tecVals_.sterStartBit_ ) & tecVals_.sterMask_ ) == 1 ) {
266  return ( (id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ );
267  } else { return 0; }
268  }
269 
270  uint32_t tibGlued(const DetId &id) const {
271  if ( ((id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ ) == 1 ) {
272  return ( id.rawId() - 1 );
273  } else if ( ((id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ ) == 2 ) {
274  return ( id.rawId() - 2 );
275  } else { return 0; }
276  }
277 
278  uint32_t tecGlued(const DetId &id) const {
279  if ( ((id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ ) == 1 ) {
280  return ( id.rawId() - 1 );
281  } else if ( ((id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ ) == 2 ) {
282  return ( id.rawId() - 2 );
283  } else { return 0; }
284  }
285 
286  uint32_t tobGlued(const DetId &id) const {
287  if ( ((id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ ) == 1 ) {
288  return ( id.rawId() - 1 );
289  } else if ( ((id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ ) == 2 ) {
290  return ( id.rawId() - 2 );
291  } else { return 0; }
292  }
293 
294  uint32_t tidGlued(const DetId &id) const {
295  if ( ((id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ ) == 1 ) {
296  return ( id.rawId() - 1 );
297  } else if ( ((id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ ) == 2 ) {
298  return ( id.rawId() - 2 );
299  } else { return 0; }
300  }
301 
302  bool tobIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tobIsDoubleSide(id);}
303  bool tecIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tecIsDoubleSide(id);}
304  bool tibIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tibIsDoubleSide(id);}
305  bool tidIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tidIsDoubleSide(id);}
306 
307 
308  //misc tec
309  std::vector<unsigned int> tecPetalInfo(const DetId &id) const {
310  std::vector<unsigned int> num;
311  num.push_back(tecOrder(id));
312  num.push_back(tecPetalNumber(id));
313  return num ;
314  }
315 
316  bool tecIsBackPetal(const DetId &id) const {
317  return (tecOrder(id)==1);
318  }
319 
320  bool tecIsFrontPetal(const DetId &id) const {return !tecIsBackPetal(id);}
321 
322  //misc tib
323  unsigned int tibString(const DetId &id) const {
324  return (id.rawId()>>tibVals_.strStartBit_)&tibVals_.strMask_;
325  }
326 
327  std::vector<unsigned int> tibStringInfo(const DetId &id) const
328  { std::vector<unsigned int> num;
329  num.push_back( tibSide(id) );
330  num.push_back( tibOrder(id) );
331  num.push_back(tibString(id));
332  return num ;
333  }
334 
335  bool tibIsInternalString(const DetId &id) const {
336  return (tibOrder(id)==1);
337  }
338 
339  bool tibIsExternalString(const DetId &id) const {
340  return !tibIsInternalString(id);
341  }
342 
343  //misc tid
344  std::vector<unsigned int> tidModuleInfo(const DetId &id) const {
345  std::vector<unsigned int> num;
346  num.push_back( tidOrder(id) );
347  num.push_back( tidModule(id) );
348  return num ;
349  }
350 
351  bool tidIsBackRing(const DetId &id) const {
352  return (tidOrder(id)==1);
353  }
354 
355  bool tidIsFrontRing(const DetId &id) const {return !tidIsBackRing(id);}
356 
357 
358  //misc pf
359  unsigned int pxfDisk(const DetId &id) const {
360  return int((id.rawId()>>pfVals_.diskStartBit_) & pfVals_.diskMask_);
361  }
362  unsigned int pxfBlade(const DetId &id) const {
363  return int((id.rawId()>>pfVals_.bladeStartBit_) & pfVals_.bladeMask_);
364  }
365  unsigned int pxfPanel(const DetId &id) const {
366  return int((id.rawId()>>pfVals_.panelStartBit_) & pfVals_.panelMask_);
367  }
368 
369  //old constructors, now return DetId
370  DetId pxbDetId(uint32_t layer,
371  uint32_t ladder,
372  uint32_t module) const {
373  //uply
375  uint32_t rawid=id.rawId();
376  rawid |= (layer& pbVals_.layerMask_) << pbVals_.layerStartBit_ |
379  return DetId(rawid);
380  }
381 
382  DetId pxfDetId(uint32_t side,
383  uint32_t disk,
384  uint32_t blade,
385  uint32_t panel,
386  uint32_t module) const {
388  uint32_t rawid=id.rawId();
389  rawid |= (side& pfVals_.sideMask_) << pfVals_.sideStartBit_ |
394  return DetId(rawid);
395  }
396 
397  DetId tecDetId(uint32_t side, uint32_t wheel,
398  uint32_t petal_fw_bw, uint32_t petal,
399  uint32_t ring, uint32_t module, uint32_t ster) const {
400 
402  uint32_t rawid=id.rawId();
403 
404  rawid |= (side& tecVals_.sideMask_) << tecVals_.sideStartBit_ |
411  return DetId(rawid);
412  }
413 
414  DetId tibDetId(uint32_t layer,
415  uint32_t str_fw_bw,
416  uint32_t str_int_ext,
417  uint32_t str,
418  uint32_t module,
419  uint32_t ster) const {
421  uint32_t rawid=id.rawId();
422  rawid |= (layer& tibVals_.layerMask_) << tibVals_.layerStartBit_ |
428  return DetId(rawid);
429  }
430 
431  DetId tidDetId(uint32_t side,
432  uint32_t wheel,
433  uint32_t ring,
434  uint32_t module_fw_bw,
435  uint32_t module,
436  uint32_t ster) const {
438  uint32_t rawid=id.rawId();
439  rawid |= (side& tidVals_.sideMask_) << tidVals_.sideStartBit_ |
445  return DetId(rawid);
446  }
447 
448  DetId tobDetId(uint32_t layer,
449  uint32_t rod_fw_bw,
450  uint32_t rod,
451  uint32_t module,
452  uint32_t ster) const {
454  uint32_t rawid=id.rawId();
455  rawid |= (layer& tobVals_.layerMask_) << tobVals_.layerStartBit_ |
460  return DetId(rawid);
461  }
462 
463  std::string print(DetId detid) const;
464 
466 
467  private:
468 
471 
476 
477 };
478 
479 #endif
480 
bool tecIsDoubleSide(const DetId &id) const
bool tobIsDoubleSide(const DetId &id) const
uint32_t tobGlued(const DetId &id) const
bool tibIsDoubleSide(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
unsigned int tibString(const DetId &id) const
unsigned int tidRing(const DetId &id) const
uint32_t stereo() const
Definition: SiStripDetId.h:162
bool tobIsStereo(const DetId &id) const
std::vector< unsigned int > tidModuleInfo(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tecRing(const DetId &id) const
ring id
uint32_t tobStereo(const DetId &id) const
unsigned int pxbLadder(const DetId &id) const
uint32_t tecGlued(const DetId &id) const
bool tidIsFrontRing(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
SiStripDetId::ModuleGeometry moduleGeometry(const DetId &id) const
std::vector< unsigned int > tibStringInfo(const DetId &id) const
bool tobIsRPhi(const DetId &id) const
std::string print(DetId detid) const
DetId pxfDetId(uint32_t side, uint32_t disk, uint32_t blade, uint32_t panel, uint32_t module) const
bool tecIsZMinusSide(const DetId &id) const
PixelEndcapValues pfVals_
bool tidIsStereo(const DetId &id) const
bool tidIsZMinusSide(const DetId &id) const
bool tibIsZPlusSide(const DetId &id) const
unsigned int module(const DetId &id) const
bool tecIsStereo(const DetId &id) const
unsigned int tibSide(const DetId &id) const
bool tibIsExternalString(const DetId &id) const
std::vector< unsigned int > tecPetalInfo(const DetId &id) const
bool tibIsRPhi(const DetId &id) const
unsigned int tidSide(const DetId &id) const
PixelBarrelValues pbVals_
uint32_t tidStereo(const DetId &id) const
bool tibIsZMinusSide(const DetId &id) const
std::vector< unsigned int > tobRodInfo(const DetId &id) const
unsigned int tidModule(const DetId &id) const
bool tidIsBackRing(const DetId &id) const
bool tobIsZPlusSide(const DetId &id) const
DetId tobDetId(uint32_t layer, uint32_t rod_fw_bw, uint32_t rod, uint32_t module, uint32_t ster) const
unsigned int tobSide(const DetId &id) const
DetId tidDetId(uint32_t side, uint32_t wheel, uint32_t ring, uint32_t module_fw_bw, uint32_t module, uint32_t ster) const
bool tobIsZMinusSide(const DetId &id) const
bool tecIsRPhi(const DetId &id) const
unsigned int tibModule(const DetId &id) const
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tecModule(const DetId &id) const
bool tecIsFrontPetal(const DetId &id) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
bool tecIsBackPetal(const DetId &id) const
Definition: DetId.h:18
uint32_t glued() const
Definition: SiStripDetId.h:154
bool tidIsRPhi(const DetId &id) const
uint32_t tibGlued(const DetId &id) const
bool tidIsZPlusSide(const DetId &id) const
unsigned int module_fw_bwStartBit_
DetId tibDetId(uint32_t layer, uint32_t str_fw_bw, uint32_t str_int_ext, uint32_t str, uint32_t module, uint32_t ster) const
bool tibIsStereo(const DetId &id) const
bool tidIsDoubleSide(const DetId &id) const
unsigned int tecOrder(const DetId &id) const
unsigned int tobModule(const DetId &id) const
unsigned int layer(const DetId &id) const
bool tecIsZPlusSide(const DetId &id) const
unsigned int tidOrder(const DetId &id) const
uint32_t tecStereo(const DetId &id) const
unsigned int pxfSide(const DetId &id) const
unsigned int tecPetalNumber(const DetId &id) const
DetId pxbDetId(uint32_t layer, uint32_t ladder, uint32_t module) const
unsigned int tobRod(const DetId &id) const
uint32_t tibStereo(const DetId &id) const
bool tibIsInternalString(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
DetId tecDetId(uint32_t side, uint32_t wheel, uint32_t petal_fw_bw, uint32_t petal, uint32_t ring, uint32_t module, uint32_t ster) const
Definition: vlib.h:208
TrackerTopology(const PixelBarrelValues &pxb, const PixelEndcapValues &pxf, const TECValues &tecv, const TIBValues &tibv, const TIDValues &tidv, const TOBValues &tobv)
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const
unsigned int tibOrder(const DetId &id) const
uint32_t tidGlued(const DetId &id) const