CMS 3D CMS Logo

phase1PixelTopology.h
Go to the documentation of this file.
1 #ifndef Geometry_TrackerGeometryBuilder_phase1PixelTopology_h
2 #define Geometry_TrackerGeometryBuilder_phase1PixelTopology_h
3 
4 #include <cstdint>
5 
6 namespace phase1PixelTopology {
7 
8  constexpr uint16_t numRowsInRoc = 80;
9  constexpr uint16_t numColsInRoc = 52;
10  constexpr uint16_t lastRowInRoc = numRowsInRoc - 1;
11  constexpr uint16_t lastColInRoc = numColsInRoc - 1;
12 
15  constexpr uint16_t lastRowInModule = numRowsInModule - 1;
16  constexpr uint16_t lastColInModule = numColsInModule - 1;
17 
18  constexpr int16_t xOffset = -81;
19  constexpr int16_t yOffset = -54*4;
20 
21  constexpr uint32_t numPixsInModule = uint32_t(numRowsInModule)* uint32_t(numColsInModule);
22 
23  // this is for the ROC n<512 (upgrade 1024)
24  constexpr inline
25  uint16_t divu52(uint16_t n) {
26  n = n>>2;
27  uint16_t q = (n>>1) + (n>>4);
28  q = q + (q>>4) + (q>>5); q = q >> 3;
29  uint16_t r = n - q*13;
30  return q + ((r + 3) >> 4);
31  }
32 
33  constexpr inline
34  bool isEdgeX(uint16_t px) { return (px==0) | (px==lastRowInModule);}
35  constexpr inline
36  bool isEdgeY(uint16_t py) { return (py==0) | (py==lastColInModule);}
37 
38 
39  constexpr inline
40  uint16_t toRocX(uint16_t px) { return (px<numRowsInRoc) ? px : px-numRowsInRoc; }
41  constexpr inline
42  uint16_t toRocY(uint16_t py) {
43  auto roc = divu52(py);
44  return py - 52*roc;
45  }
46 
47  constexpr inline
48  bool isBigPixX(uint16_t px) {
49  return (px==79) | (px==80);
50  }
51 
52  constexpr inline
53  bool isBigPixY(uint16_t py) {
54  auto ly=toRocY(py);
55  return (ly==0) | (ly==lastColInRoc);
56  }
57 
58  constexpr inline
59  uint16_t localX(uint16_t px) {
60  auto shift = 0;
61  if (px>lastRowInRoc) shift+=1;
62  if (px>numRowsInRoc) shift+=1;
63  return px+shift;
64  }
65 
66  constexpr inline
67  uint16_t localY(uint16_t py) {
68  auto roc = divu52(py);
69  auto shift = 2*roc;
70  auto yInRoc = py - 52*roc;
71  if (yInRoc>0) shift+=1;
72  return py+shift;
73  }
74 
75 }
76 
77 #endif // Geometry_TrackerGeometryBuilder_phase1PixelTopology_h
constexpr uint16_t lastRowInModule
constexpr uint16_t divu52(uint16_t n)
constexpr uint16_t numRowsInRoc
constexpr uint16_t localY(uint16_t py)
constexpr uint16_t lastColInModule
constexpr uint16_t numColsInModule
#define constexpr
constexpr uint16_t numRowsInModule
constexpr uint16_t lastColInRoc
constexpr uint16_t numColsInRoc
constexpr bool isEdgeY(uint16_t py)
constexpr bool isBigPixY(uint16_t py)
constexpr bool isEdgeX(uint16_t px)
constexpr uint16_t lastRowInRoc
constexpr bool isBigPixX(uint16_t px)
constexpr int16_t xOffset
constexpr uint16_t localX(uint16_t px)
static unsigned int const shift
constexpr uint32_t numPixsInModule
constexpr int16_t yOffset
constexpr uint16_t toRocX(uint16_t px)
constexpr uint16_t toRocY(uint16_t py)