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 side(const DetId &id) const;
112  unsigned int layer(const DetId &id) const;
113  unsigned int module(const DetId &id) const;
114 
115  // layer numbers
116  unsigned int pxbLayer(const DetId &id) const {
117  return int((id.rawId()>>pbVals_.layerStartBit_) & pbVals_.layerMask_);
118  }
119  unsigned int tobLayer(const DetId &id) const {
120  return int((id.rawId()>>tobVals_.layerStartBit_) & tobVals_.layerMask_);
121  }
122  unsigned int tibLayer(const DetId &id) const {
123  return int((id.rawId()>>tibVals_.layerStartBit_) & tibVals_.layerMask_);
124  }
125 
126 
127  //ladder
128  unsigned int pxbLadder(const DetId &id) const {
129  return ((id.rawId()>>pbVals_.ladderStartBit_) & pbVals_.ladderMask_) ;
130  }
131 
132  //module
133  unsigned int pxbModule(const DetId &id) const {
134  return ((id.rawId()>>pbVals_.moduleStartBit_)& pbVals_.moduleMask_);
135  }
136  unsigned int pxfModule(const DetId &id) const {
137  return int((id.rawId()>>pfVals_.moduleStartBit_) & pfVals_.moduleMask_);
138  }
139  unsigned int tobModule(const DetId &id) const {
140  return ((id.rawId()>>tobVals_.moduleStartBit_)& tobVals_.moduleMask_);
141  }
142  unsigned int tecModule(const DetId &id) const {
143  return ((id.rawId()>>tecVals_.moduleStartBit_) & tecVals_.moduleMask_);
144  }
145  unsigned int tibModule(const DetId &id) const {
146  return ((id.rawId()>>tibVals_.moduleStartBit_)& tibVals_.moduleMask_);
147  }
148  unsigned int tidModule(const DetId &id) const {
149  return ((id.rawId()>>tidVals_.moduleStartBit_)& tidVals_.moduleMask_);
150  }
151 
152 
153  //side
154  unsigned int tobSide(const DetId &id) const {
155  return ((id.rawId()>>tobVals_.rod_fw_bwStartBit_) & tobVals_.rod_fw_bwMask_);
156  }
157 
158  unsigned int tecSide(const DetId &id) const {
159  return ((id.rawId()>>tecVals_.sideStartBit_)&tecVals_.sideMask_);
160  }
161 
162  unsigned int tibSide(const DetId &id) const {
163  return ((id.rawId()>>tibVals_.str_fw_bwStartBit_) & tibVals_.str_fw_bwMask_);
164  }
165 
166  unsigned int tidSide(const DetId &id) const {
167  return ((id.rawId()>>tidVals_.sideStartBit_)&tidVals_.sideMask_);
168  }
169 
170  unsigned int pxfSide(const DetId &id) const {
171  return ((id.rawId()>>pfVals_.sideStartBit_)&pfVals_.sideMask_);
172  }
173 
174  //rod
175  unsigned int tobRod(const DetId &id) const {
176  return ((id.rawId()>>tobVals_.rodStartBit_) & tobVals_.rodMask_);
177  }
178 
179  //wheel
180  unsigned int tecWheel(const DetId &id) const {
181  return ((id.rawId()>>tecVals_.wheelStartBit_) & tecVals_.wheelMask_) ;
182  }
183  unsigned int tidWheel(const DetId &id) const {
184  return ((id.rawId()>>tidVals_.wheelStartBit_) & tidVals_.wheelMask_) ;
185  }
186 
187  //order
188  unsigned int tecOrder(const DetId &id) const {
189  return ((id.rawId()>>tecVals_.petal_fw_bwStartBit_) & tecVals_.petal_fw_bwMask_);
190  }
191  unsigned int tibOrder(const DetId &id) const {
192  return ((id.rawId()>>tibVals_.str_int_extStartBit_) & tibVals_.str_int_extMask_);
193  }
194  unsigned int tidOrder(const DetId &id) const {
195  return ((id.rawId()>>tidVals_.module_fw_bwStartBit_) & tidVals_.module_fw_bwMask_);
196  }
197 
198 
200  unsigned int tecRing(const DetId &id) const {
201  return ((id.rawId()>>tecVals_.ringStartBit_) & tecVals_.ringMask_) ;
202  }
203  unsigned int tidRing(const DetId &id) const {
204  return ((id.rawId()>>tidVals_.ringStartBit_) & tidVals_.ringMask_) ;
205  }
206 
207 
208  //petal
209  unsigned int tecPetalNumber(const DetId &id) const
210  { return ((id.rawId()>>tecVals_.petalStartBit_) & tecVals_.petalMask_);}
211 
212 
213 
214 
215  //misc tob
216  std::vector<unsigned int> tobRodInfo(const DetId &id) const {
217  std::vector<unsigned int> num;
218  num.push_back( tobSide(id) );
219  num.push_back( tobRod(id) );
220  return num ;
221  }
222 
223  bool tobIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tobLayer(id)==1 || tobLayer(id)==2);}
224  bool tecIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tecRing(id)==1 || tecRing(id)==2 || tecRing(id)==5);}
225  bool tibIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tibLayer(id)==1 || tibLayer(id)==2);}
226  bool tidIsDoubleSide(const DetId &id) const { return SiStripDetId(id).glued()==0 && (tidRing(id)==1 || tidRing(id)==2);}
227 
228  bool tobIsZPlusSide(const DetId &id) const {return !tobIsZMinusSide(id);}
229  bool tobIsZMinusSide(const DetId &id) const { return tobSide(id)==1;}
230 
231  bool tibIsZPlusSide(const DetId &id) const {return !tibIsZMinusSide(id);}
232  bool tibIsZMinusSide(const DetId &id) const { return tibSide(id)==1;}
233 
234  bool tidIsZPlusSide(const DetId &id) const {return !tidIsZMinusSide(id);}
235  bool tidIsZMinusSide(const DetId &id) const { return tidSide(id)==1;}
236 
237  bool tecIsZPlusSide(const DetId &id) const {return !tecIsZMinusSide(id);}
238  bool tecIsZMinusSide(const DetId &id) const { return tecSide(id)==1;}
239 
240  //these are from the old TOB/TEC/TID/TIB DetId
241  bool tobIsStereo(const DetId &id) const {return tobStereo(id)!=0 && !tobIsDoubleSide(id);}
242  bool tecIsStereo(const DetId &id) const {return tecStereo(id)!=0 && !tecIsDoubleSide(id);}
243  bool tibIsStereo(const DetId &id) const {return tibStereo(id)!=0 && !tibIsDoubleSide(id);}
244  bool tidIsStereo(const DetId &id) const {return tidStereo(id)!=0 && !tidIsDoubleSide(id);}
245 
246  //these are clones of the old SiStripDetId
247  uint32_t tobStereo(const DetId &id) const {
248  if ( ((id.rawId() >>tobVals_.sterStartBit_ ) & tobVals_.sterMask_ ) == 1 ) {
249  return ( (id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ );
250  } else { return 0; }
251  }
252 
253  uint32_t tibStereo(const DetId &id) const {
254  if ( ((id.rawId() >>tibVals_.sterStartBit_ ) & tibVals_.sterMask_ ) == 1 ) {
255  return ( (id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ );
256  } else { return 0; }
257  }
258 
259  uint32_t tidStereo(const DetId &id) const {
260  if ( ((id.rawId() >>tidVals_.sterStartBit_ ) & tidVals_.sterMask_ ) == 1 ) {
261  return ( (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ );
262  } else { return 0; }
263  }
264 
265  uint32_t tecStereo(const DetId &id) const {
266  if ( ((id.rawId() >>tecVals_.sterStartBit_ ) & tecVals_.sterMask_ ) == 1 ) {
267  return ( (id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ );
268  } else { return 0; }
269  }
270 
271  uint32_t tibGlued(const DetId &id) const {
272  if ( ((id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ ) == 1 ) {
273  return ( id.rawId() - 1 );
274  } else if ( ((id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ ) == 2 ) {
275  return ( id.rawId() - 2 );
276  } else { return 0; }
277  }
278 
279  uint32_t tecGlued(const DetId &id) const {
280  if ( ((id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ ) == 1 ) {
281  return ( id.rawId() - 1 );
282  } else if ( ((id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ ) == 2 ) {
283  return ( id.rawId() - 2 );
284  } else { return 0; }
285  }
286 
287  uint32_t tobGlued(const DetId &id) const {
288  if ( ((id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ ) == 1 ) {
289  return ( id.rawId() - 1 );
290  } else if ( ((id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ ) == 2 ) {
291  return ( id.rawId() - 2 );
292  } else { return 0; }
293  }
294 
295  uint32_t tidGlued(const DetId &id) const {
296  if ( ((id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ ) == 1 ) {
297  return ( id.rawId() - 1 );
298  } else if ( ((id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ ) == 2 ) {
299  return ( id.rawId() - 2 );
300  } else { return 0; }
301  }
302 
303  bool tobIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tobIsDoubleSide(id);}
304  bool tecIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tecIsDoubleSide(id);}
305  bool tibIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tibIsDoubleSide(id);}
306  bool tidIsRPhi(const DetId &id) const { return SiStripDetId(id).stereo()==0 && !tidIsDoubleSide(id);}
307 
308 
309  //misc tec
310  std::vector<unsigned int> tecPetalInfo(const DetId &id) const {
311  std::vector<unsigned int> num;
312  num.push_back(tecOrder(id));
313  num.push_back(tecPetalNumber(id));
314  return num ;
315  }
316 
317  bool tecIsBackPetal(const DetId &id) const {
318  return (tecOrder(id)==1);
319  }
320 
321  bool tecIsFrontPetal(const DetId &id) const {return !tecIsBackPetal(id);}
322 
323  //misc tib
324  unsigned int tibString(const DetId &id) const {
325  return (id.rawId()>>tibVals_.strStartBit_)&tibVals_.strMask_;
326  }
327 
328  std::vector<unsigned int> tibStringInfo(const DetId &id) const
329  { std::vector<unsigned int> num;
330  num.push_back( tibSide(id) );
331  num.push_back( tibOrder(id) );
332  num.push_back(tibString(id));
333  return num ;
334  }
335 
336  bool tibIsInternalString(const DetId &id) const {
337  return (tibOrder(id)==1);
338  }
339 
340  bool tibIsExternalString(const DetId &id) const {
341  return !tibIsInternalString(id);
342  }
343 
344  //misc tid
345  std::vector<unsigned int> tidModuleInfo(const DetId &id) const {
346  std::vector<unsigned int> num;
347  num.push_back( tidOrder(id) );
348  num.push_back( tidModule(id) );
349  return num ;
350  }
351 
352  bool tidIsBackRing(const DetId &id) const {
353  return (tidOrder(id)==1);
354  }
355 
356  bool tidIsFrontRing(const DetId &id) const {return !tidIsBackRing(id);}
357 
358 
359  //misc pf
360  unsigned int pxfDisk(const DetId &id) const {
361  return int((id.rawId()>>pfVals_.diskStartBit_) & pfVals_.diskMask_);
362  }
363  unsigned int pxfBlade(const DetId &id) const {
364  return int((id.rawId()>>pfVals_.bladeStartBit_) & pfVals_.bladeMask_);
365  }
366  unsigned int pxfPanel(const DetId &id) const {
367  return int((id.rawId()>>pfVals_.panelStartBit_) & pfVals_.panelMask_);
368  }
369 
370  //old constructors, now return DetId
371  DetId pxbDetId(uint32_t layer,
372  uint32_t ladder,
373  uint32_t module) const {
374  //uply
376  uint32_t rawid=id.rawId();
377  rawid |= (layer& pbVals_.layerMask_) << pbVals_.layerStartBit_ |
380  return DetId(rawid);
381  }
382 
383  DetId pxfDetId(uint32_t side,
384  uint32_t disk,
385  uint32_t blade,
386  uint32_t panel,
387  uint32_t module) const {
389  uint32_t rawid=id.rawId();
390  rawid |= (side& pfVals_.sideMask_) << pfVals_.sideStartBit_ |
395  return DetId(rawid);
396  }
397 
398  DetId tecDetId(uint32_t side, uint32_t wheel,
399  uint32_t petal_fw_bw, uint32_t petal,
400  uint32_t ring, uint32_t module, uint32_t ster) const {
401 
403  uint32_t rawid=id.rawId();
404 
405  rawid |= (side& tecVals_.sideMask_) << tecVals_.sideStartBit_ |
412  return DetId(rawid);
413  }
414 
415  DetId tibDetId(uint32_t layer,
416  uint32_t str_fw_bw,
417  uint32_t str_int_ext,
418  uint32_t str,
419  uint32_t module,
420  uint32_t ster) const {
422  uint32_t rawid=id.rawId();
423  rawid |= (layer& tibVals_.layerMask_) << tibVals_.layerStartBit_ |
429  return DetId(rawid);
430  }
431 
432  DetId tidDetId(uint32_t side,
433  uint32_t wheel,
434  uint32_t ring,
435  uint32_t module_fw_bw,
436  uint32_t module,
437  uint32_t ster) const {
439  uint32_t rawid=id.rawId();
440  rawid |= (side& tidVals_.sideMask_) << tidVals_.sideStartBit_ |
446  return DetId(rawid);
447  }
448 
449  DetId tobDetId(uint32_t layer,
450  uint32_t rod_fw_bw,
451  uint32_t rod,
452  uint32_t module,
453  uint32_t ster) const {
455  uint32_t rawid=id.rawId();
456  rawid |= (layer& tobVals_.layerMask_) << tobVals_.layerStartBit_ |
461  return DetId(rawid);
462  }
463 
464  std::string print(DetId detid) const;
465 
467 
468  private:
469 
472 
477 
478 };
479 
480 #endif
481 
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
unsigned int side(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