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 uint16_t divu52(uint16_t n) {
25  n = n >> 2;
26  uint16_t q = (n >> 1) + (n >> 4);
27  q = q + (q >> 4) + (q >> 5);
28  q = q >> 3;
29  uint16_t r = n - q * 13;
30  return q + ((r + 3) >> 4);
31  }
32 
33  constexpr inline bool isEdgeX(uint16_t px) { return (px == 0) | (px == lastRowInModule); }
34  constexpr inline bool isEdgeY(uint16_t py) { return (py == 0) | (py == lastColInModule); }
35 
36  constexpr inline uint16_t toRocX(uint16_t px) { return (px < numRowsInRoc) ? px : px - numRowsInRoc; }
37  constexpr inline uint16_t toRocY(uint16_t py) {
38  auto roc = divu52(py);
39  return py - 52 * roc;
40  }
41 
42  constexpr inline bool isBigPixX(uint16_t px) { return (px == 79) | (px == 80); }
43 
44  constexpr inline bool isBigPixY(uint16_t py) {
45  auto ly = toRocY(py);
46  return (ly == 0) | (ly == lastColInRoc);
47  }
48 
49  constexpr inline uint16_t localX(uint16_t px) {
50  auto shift = 0;
51  if (px > lastRowInRoc)
52  shift += 1;
53  if (px > numRowsInRoc)
54  shift += 1;
55  return px + shift;
56  }
57 
58  constexpr inline uint16_t localY(uint16_t py) {
59  auto roc = divu52(py);
60  auto shift = 2 * roc;
61  auto yInRoc = py - 52 * roc;
62  if (yInRoc > 0)
63  shift += 1;
64  return py + shift;
65  }
66 
67 } // namespace phase1PixelTopology
68 
69 #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
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)
#define constexpr
constexpr uint16_t toRocY(uint16_t py)