CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackingRecHit2DSOAView.h
Go to the documentation of this file.
1 #ifndef CUDADataFormats_TrackingRecHit_interface_TrackingRecHit2DSOAView_h
2 #define CUDADataFormats_TrackingRecHit_interface_TrackingRecHit2DSOAView_h
3 
4 #include <cuda_runtime.h>
5 
11 
12 namespace pixelCPEforGPU {
13  struct ParamsOnGPU;
14 }
15 
17 public:
19  static_assert(sizeof(Status) == sizeof(uint8_t));
20 
21  using hindex_type = uint32_t; // if above is <=2^32
22 
23  using PhiBinner = cms::cuda::HistoContainer<int16_t, 128, -1, 8 * sizeof(int16_t), hindex_type, 10>;
24 
26 
27  template <typename>
30 
31  __device__ __forceinline__ uint32_t nHits() const { return m_nHits; }
32 
33  __device__ __forceinline__ float& xLocal(int i) { return m_xl[i]; }
34  __device__ __forceinline__ float xLocal(int i) const { return __ldg(m_xl + i); }
35  __device__ __forceinline__ float& yLocal(int i) { return m_yl[i]; }
36  __device__ __forceinline__ float yLocal(int i) const { return __ldg(m_yl + i); }
37 
38  __device__ __forceinline__ float& xerrLocal(int i) { return m_xerr[i]; }
39  __device__ __forceinline__ float xerrLocal(int i) const { return __ldg(m_xerr + i); }
40  __device__ __forceinline__ float& yerrLocal(int i) { return m_yerr[i]; }
41  __device__ __forceinline__ float yerrLocal(int i) const { return __ldg(m_yerr + i); }
42 
43  __device__ __forceinline__ float& xGlobal(int i) { return m_xg[i]; }
44  __device__ __forceinline__ float xGlobal(int i) const { return __ldg(m_xg + i); }
45  __device__ __forceinline__ float& yGlobal(int i) { return m_yg[i]; }
46  __device__ __forceinline__ float yGlobal(int i) const { return __ldg(m_yg + i); }
47  __device__ __forceinline__ float& zGlobal(int i) { return m_zg[i]; }
48  __device__ __forceinline__ float zGlobal(int i) const { return __ldg(m_zg + i); }
49  __device__ __forceinline__ float& rGlobal(int i) { return m_rg[i]; }
50  __device__ __forceinline__ float rGlobal(int i) const { return __ldg(m_rg + i); }
51 
52  __device__ __forceinline__ int16_t& iphi(int i) { return m_iphi[i]; }
53  __device__ __forceinline__ int16_t iphi(int i) const { return __ldg(m_iphi + i); }
54 
55  __device__ __forceinline__ void setChargeAndStatus(int i, uint32_t ich, Status is) {
56  ich = std::min(ich, chargeMask());
57  uint32_t w = *reinterpret_cast<uint8_t*>(&is);
58  ich |= (w << 24);
60  }
61 
62  __device__ __forceinline__ uint32_t charge(int i) const { return __ldg(m_chargeAndStatus + i) & 0xFFFFFF; }
63 
65  uint8_t w = __ldg(m_chargeAndStatus + i) >> 24;
66  return *reinterpret_cast<Status*>(&w);
67  }
68 
69  __device__ __forceinline__ int16_t& clusterSizeX(int i) { return m_xsize[i]; }
70  __device__ __forceinline__ int16_t clusterSizeX(int i) const { return __ldg(m_xsize + i); }
71  __device__ __forceinline__ int16_t& clusterSizeY(int i) { return m_ysize[i]; }
72  __device__ __forceinline__ int16_t clusterSizeY(int i) const { return __ldg(m_ysize + i); }
73  __device__ __forceinline__ uint16_t& detectorIndex(int i) { return m_detInd[i]; }
74  __device__ __forceinline__ uint16_t detectorIndex(int i) const { return __ldg(m_detInd + i); }
75 
76  __device__ __forceinline__ pixelCPEforGPU::ParamsOnGPU const& cpeParams() const { return *m_cpeParams; }
77 
78  __device__ __forceinline__ uint32_t hitsModuleStart(int i) const { return __ldg(m_hitsModuleStart + i); }
79 
80  __device__ __forceinline__ uint32_t* hitsLayerStart() { return m_hitsLayerStart; }
81  __device__ __forceinline__ uint32_t const* hitsLayerStart() const { return m_hitsLayerStart; }
82 
85 
87  __device__ __forceinline__ AverageGeometry const& averageGeometry() const { return *m_averageGeometry; }
88 
89 private:
90  // local coord
91  float *m_xl, *m_yl;
92  float *m_xerr, *m_yerr;
93 
94  // global coord
95  float *m_xg, *m_yg, *m_zg, *m_rg;
96  int16_t* m_iphi;
97 
98  // cluster properties
99  static constexpr uint32_t chargeMask() { return (1 << 24) - 1; }
100  uint32_t* m_chargeAndStatus;
101  int16_t* m_xsize;
102  int16_t* m_ysize;
103  uint16_t* m_detInd;
104 
105  // supporting objects
106  // m_averageGeometry is corrected for beam spot, not sure where to host it otherwise
107  AverageGeometry* m_averageGeometry; // owned by TrackingRecHit2DHeterogeneous
108  pixelCPEforGPU::ParamsOnGPU const* m_cpeParams; // forwarded from setup, NOT owned
109  uint32_t const* m_hitsModuleStart; // forwarded from clusters
110 
111  uint32_t* m_hitsLayerStart;
112 
115 
116  uint32_t m_nHits;
117 };
118 
119 #endif // CUDADataFormats_TrackingRecHit_interface_TrackingRecHit2DSOAView_h
__device__ uint32_t Status is
#define __forceinline__
Definition: cudaCompat.h:22
static constexpr uint32_t chargeMask()
list status
Definition: mps_update.py:107
typename Base::index_type index_type
auto const &__restrict__ phiBinner
T min(T a, T b)
Definition: MathUtil.h:58
PhiBinner::index_type * m_phiBinnerStorage
T __ldg(T const *x)
Definition: cudaCompat.h:113
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
pixelCPEforGPU::ParamsOnGPU const * m_cpeParams
#define __device__