CMS 3D CMS Logo

HGCConditions.h
Go to the documentation of this file.
1 #ifndef CUDADataFormats_HGCal_HGCConditions_h
2 #define CUDADataFormats_HGCal_HGCConditions_h
3 
4 #include <cstdint>
5 #include <cstddef>
6 #include <array>
7 #include <vector>
8 
10 public:
12  constexpr std::int32_t type() { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
13  constexpr std::int32_t zside() { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
14  constexpr std::int32_t layer() { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
15  constexpr std::int32_t waferUAbs() { return (id_ >> kHGCalWaferUOffset) & kHGCalWaferUMask; }
16  constexpr std::int32_t waferVAbs() { return (id_ >> kHGCalWaferVOffset) & kHGCalWaferVMask; }
17  constexpr std::int32_t waferU() {
19  }
20  constexpr std::int32_t waferV() {
22  }
23  constexpr std::int32_t waferX() { return (-2 * waferU() + waferV()); }
24  constexpr std::int32_t waferY() { return (2 * waferV()); }
25  constexpr std::int32_t cellU() { return (id_ >> kHGCalCellUOffset) & kHGCalCellUMask; }
26  constexpr std::int32_t cellV() { return (id_ >> kHGCalCellVOffset) & kHGCalCellVMask; }
27  constexpr std::int32_t nCellsSide() { return (type() == HGCalFine) ? HGCalFineN : HGCalCoarseN; }
28  constexpr std::int32_t cellX() {
29  const std::int32_t N = nCellsSide();
30  return (3 * (cellV() - N) + 2);
31  }
32  constexpr std::int32_t cellY() {
33  const std::int32_t N = nCellsSide();
34  return (2 * cellU() - (N + cellV()));
35  }
36 
37 private:
38  std::uint32_t id_;
40  static constexpr std::int32_t HGCalFineN = 12;
41  static constexpr std::int32_t HGCalCoarseN = 8;
42  static constexpr std::int32_t kHGCalCellUOffset = 0;
43  static constexpr std::int32_t kHGCalCellUMask = 0x1F;
44  static constexpr std::int32_t kHGCalCellVOffset = 5;
45  static constexpr std::int32_t kHGCalCellVMask = 0x1F;
46  static constexpr std::int32_t kHGCalWaferUOffset = 10;
47  static constexpr std::int32_t kHGCalWaferUMask = 0xF;
48  static constexpr std::int32_t kHGCalWaferUSignOffset = 14;
49  static constexpr std::int32_t kHGCalWaferUSignMask = 0x1;
50  static constexpr std::int32_t kHGCalWaferVOffset = 15;
51  static constexpr std::int32_t kHGCalWaferVMask = 0xF;
52  static constexpr std::int32_t kHGCalWaferVSignOffset = 19;
53  static constexpr std::int32_t kHGCalWaferVSignMask = 0x1;
54  static constexpr std::int32_t kHGCalLayerOffset = 20;
55  static constexpr std::int32_t kHGCalLayerMask = 0x1F;
56  static constexpr std::int32_t kHGCalZsideOffset = 25;
57  static constexpr std::int32_t kHGCalZsideMask = 0x1;
58  static constexpr std::int32_t kHGCalTypeOffset = 26;
59  static constexpr std::int32_t kHGCalTypeMask = 0x3;
60 };
61 
63 public:
65  constexpr std::int32_t type() { return (id_ >> kHGCalTypeOffset) & kHGCalTypeMask; }
66  constexpr std::int32_t zside() const { return (((id_ >> kHGCalZsideOffset) & kHGCalZsideMask) ? -1 : 1); }
67  constexpr std::int32_t layer() const { return (id_ >> kHGCalLayerOffset) & kHGCalLayerMask; }
68 
69 private:
70  std::uint32_t id_;
71  static constexpr std::uint32_t kHGCalPhiOffset = 0;
72  static constexpr std::uint32_t kHGCalPhiMask = 0x1FF;
73  static constexpr std::uint32_t kHGCalRadiusOffset = 9;
74  static constexpr std::uint32_t kHGCalRadiusMask = 0xFF;
75  static constexpr std::uint32_t kHGCalLayerOffset = 17;
76  static constexpr std::uint32_t kHGCalLayerMask = 0x1F;
77  static constexpr std::uint32_t kHGCalTriggerOffset = 22;
78  static constexpr std::uint32_t kHGCalTriggerMask = 0x1;
79  static constexpr std::uint32_t kHGCalZsideOffset = 25;
80  static constexpr std::uint32_t kHGCalZsideMask = 0x1;
81  static constexpr std::uint32_t kHGCalTypeOffset = 26;
82  static constexpr std::uint32_t kHGCalTypeMask = 0x3;
83 };
84 
85 namespace hgcal_conditions {
86  namespace parameters {
90 
91  const std::array<HeterogeneousHGCalEEParametersType, 5> typesEE = {{HeterogeneousHGCalEEParametersType::Double,
96 
97  const std::array<HeterogeneousHGCalHEFParametersType, 5> typesHEF = {
103 
104  const std::array<HeterogeneousHGCalHEBParametersType, 2> typesHEB = {
106 
108  public:
109  //indexed by cell number
110  double *cellFineX_;
111  double *cellFineY_;
112  double *cellCoarseX_;
113  double *cellCoarseY_;
114  //index by wafer number
115  std::int32_t *waferTypeL_;
116  };
118  public:
119  //indexed by cell number
120  double *cellFineX_;
121  double *cellFineY_;
122  double *cellCoarseX_;
123  double *cellCoarseY_;
124  //index by wafer number
125  std::int32_t *waferTypeL_;
126  };
128  public:
129  double *testD_;
130  std::int32_t *testI_;
131  };
132 
133  } //namespace parameters
134 
135  namespace positions {
136 
138 
139  const std::vector<HeterogeneousHGCalPositionsType> types = {HeterogeneousHGCalPositionsType::Float,
146 
148  std::vector<float> zLayer; //z position per layer
149  std::vector<std::int32_t> nCellsLayer; //#cells per layer
150  std::vector<std::int32_t> nCellsWaferUChunk; //#cells per U wafer (each in turn including all V wafers)
151  std::vector<std::int32_t> nCellsHexagon; //#cells per V wafer
152  std::vector<std::uint32_t> detid;
153  //variables required for calculating the positions (x,y) from the detid in the GPU
154  float waferSize;
156  //variables required for the mapping of detid -> cell in the geometry
157  std::int32_t firstLayer;
158  std::int32_t lastLayer;
159  std::int32_t waferMax;
160  std::int32_t waferMin;
161  };
162 
164  //the x, y and z positions will not be filled in the CPU
165  float *x;
166  float *y;
167  float *zLayer;
168  std::int32_t *nCellsLayer;
169  std::int32_t *nCellsWaferUChunk;
170  std::int32_t *nCellsHexagon;
171  std::uint32_t *detid;
172  //variables required for calculating the positions (x,y) from the detid in the GPU
173  float waferSize;
175  //variables required for the mapping of detid -> cell in the geometry
176  std::int32_t firstLayer;
177  std::int32_t lastLayer;
178  std::int32_t waferMax;
179  std::int32_t waferMin;
180  };
181 
182  } //namespace positions
183 
186  };
189  //positions::HeterogeneousHGCalPositionsMapping posmap;
190  //size_t nelems_posmap;
191  };
194  };
195 
198  std::size_t nelems_posmap;
199  };
200 
201 } // namespace hgcal_conditions
202 
203 #endif //CUDADataFormats_HGCal_HGCConditions_h
static constexpr std::int32_t kHGCalCellUOffset
Definition: HGCConditions.h:42
positions::HeterogeneousHGCalPositionsMapping posmap
static constexpr std::uint32_t kHGCalRadiusOffset
Definition: HGCConditions.h:73
constexpr std::int32_t cellV()
Definition: HGCConditions.h:26
static constexpr std::int32_t kHGCalTypeMask
Definition: HGCConditions.h:59
static constexpr std::uint32_t kHGCalZsideOffset
Definition: HGCConditions.h:79
constexpr std::int32_t waferX()
Definition: HGCConditions.h:23
static constexpr std::uint32_t kHGCalPhiMask
Definition: HGCConditions.h:72
static constexpr std::int32_t kHGCalCellVMask
Definition: HGCConditions.h:45
constexpr std::int32_t waferU()
Definition: HGCConditions.h:17
constexpr std::int32_t zside()
Definition: HGCConditions.h:13
const std::array< HeterogeneousHGCalHEFParametersType, 5 > typesHEF
Definition: HGCConditions.h:97
constexpr std::int32_t cellX()
Definition: HGCConditions.h:28
static constexpr std::uint32_t kHGCalZsideMask
Definition: HGCConditions.h:80
static constexpr std::uint32_t kHGCalLayerMask
Definition: HGCConditions.h:76
static constexpr std::int32_t kHGCalWaferUOffset
Definition: HGCConditions.h:46
parameters::HeterogeneousHGCalEEParameters params
parameters::HeterogeneousHGCalHEBParameters params
static constexpr std::int32_t kHGCalWaferVMask
Definition: HGCConditions.h:51
static constexpr std::int32_t kHGCalWaferUMask
Definition: HGCConditions.h:47
static constexpr std::int32_t HGCalCoarseN
Definition: HGCConditions.h:41
constexpr HeterogeneousHGCScintillatorDetId(uint32_t id)
Definition: HGCConditions.h:64
static constexpr std::int32_t kHGCalZsideOffset
Definition: HGCConditions.h:56
static constexpr std::int32_t kHGCalLayerMask
Definition: HGCConditions.h:55
static constexpr std::int32_t kHGCalZsideMask
Definition: HGCConditions.h:57
constexpr std::int32_t cellY()
Definition: HGCConditions.h:32
constexpr std::int32_t cellU()
Definition: HGCConditions.h:25
constexpr std::int32_t layer() const
Definition: HGCConditions.h:67
static constexpr std::uint32_t kHGCalTriggerOffset
Definition: HGCConditions.h:77
const std::array< HeterogeneousHGCalEEParametersType, 5 > typesEE
Definition: HGCConditions.h:91
static constexpr std::int32_t HGCalFineN
Definition: HGCConditions.h:40
static constexpr std::int32_t kHGCalWaferUSignOffset
Definition: HGCConditions.h:48
constexpr HeterogeneousHGCSiliconDetId(uint32_t id)
Definition: HGCConditions.h:11
constexpr std::int32_t waferUAbs()
Definition: HGCConditions.h:15
static constexpr std::int32_t kHGCalWaferVSignOffset
Definition: HGCConditions.h:52
parameters::HeterogeneousHGCalHEFParameters params
static constexpr std::uint32_t kHGCalRadiusMask
Definition: HGCConditions.h:74
constexpr std::int32_t zside() const
Definition: HGCConditions.h:66
static constexpr std::uint32_t kHGCalTypeMask
Definition: HGCConditions.h:82
constexpr std::int32_t waferV()
Definition: HGCConditions.h:20
static constexpr std::int32_t kHGCalLayerOffset
Definition: HGCConditions.h:54
const std::vector< HeterogeneousHGCalPositionsType > types
#define N
Definition: blowfish.cc:9
static constexpr std::uint32_t kHGCalLayerOffset
Definition: HGCConditions.h:75
static constexpr std::uint32_t kHGCalTypeOffset
Definition: HGCConditions.h:81
static constexpr std::int32_t kHGCalCellVOffset
Definition: HGCConditions.h:44
const std::array< HeterogeneousHGCalHEBParametersType, 2 > typesHEB
static constexpr std::int32_t kHGCalWaferVSignMask
Definition: HGCConditions.h:53
constexpr std::int32_t waferY()
Definition: HGCConditions.h:24
constexpr std::int32_t waferVAbs()
Definition: HGCConditions.h:16
static constexpr std::uint32_t kHGCalTriggerMask
Definition: HGCConditions.h:78
static constexpr std::int32_t kHGCalTypeOffset
Definition: HGCConditions.h:58
static constexpr std::uint32_t kHGCalPhiOffset
Definition: HGCConditions.h:71
static constexpr std::int32_t kHGCalWaferUSignMask
Definition: HGCConditions.h:49
static constexpr std::int32_t kHGCalCellUMask
Definition: HGCConditions.h:43
constexpr std::int32_t layer()
Definition: HGCConditions.h:14
constexpr std::int32_t nCellsSide()
Definition: HGCConditions.h:27
constexpr std::int32_t type()
Definition: HGCConditions.h:65
static constexpr std::int32_t kHGCalWaferVOffset
Definition: HGCConditions.h:50
constexpr std::int32_t type()
Definition: HGCConditions.h:12