-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathTrackingRecHit2DSOAView.h
101 lines (75 loc) · 4.3 KB
/
TrackingRecHit2DSOAView.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef CUDADataFormats_TrackingRecHit_interface_TrackingRecHit2DSOAView_h
#define CUDADataFormats_TrackingRecHit_interface_TrackingRecHit2DSOAView_h
#include <cuda_runtime.h>
#include "CUDADataFormats/gpuClusteringConstants.h"
#include "CUDACore/HistoContainer.h"
#include "CUDACore/cudaCompat.h"
#include "Geometry/phase1PixelTopology.h"
namespace pixelCPEforGPU {
struct ParamsOnGPU;
}
class TrackingRecHit2DSOAView {
public:
static constexpr uint32_t maxHits() { return gpuClustering::MaxNumClusters; }
using hindex_type = uint16_t; // if above is <=2^16
using Hist =
cms::cuda::HistoContainer<int16_t, 128, gpuClustering::MaxNumClusters, 8 * sizeof(int16_t), uint16_t, 10>;
using AverageGeometry = phase1PixelTopology::AverageGeometry;
template <typename>
friend class TrackingRecHit2DHeterogeneous;
__device__ __forceinline__ uint32_t nHits() const { return m_nHits; }
__device__ __forceinline__ float& xLocal(int i) { return m_xl[i]; }
__device__ __forceinline__ float xLocal(int i) const { return __ldg(m_xl + i); }
__device__ __forceinline__ float& yLocal(int i) { return m_yl[i]; }
__device__ __forceinline__ float yLocal(int i) const { return __ldg(m_yl + i); }
__device__ __forceinline__ float& xerrLocal(int i) { return m_xerr[i]; }
__device__ __forceinline__ float xerrLocal(int i) const { return __ldg(m_xerr + i); }
__device__ __forceinline__ float& yerrLocal(int i) { return m_yerr[i]; }
__device__ __forceinline__ float yerrLocal(int i) const { return __ldg(m_yerr + i); }
__device__ __forceinline__ float& xGlobal(int i) { return m_xg[i]; }
__device__ __forceinline__ float xGlobal(int i) const { return __ldg(m_xg + i); }
__device__ __forceinline__ float& yGlobal(int i) { return m_yg[i]; }
__device__ __forceinline__ float yGlobal(int i) const { return __ldg(m_yg + i); }
__device__ __forceinline__ float& zGlobal(int i) { return m_zg[i]; }
__device__ __forceinline__ float zGlobal(int i) const { return __ldg(m_zg + i); }
__device__ __forceinline__ float& rGlobal(int i) { return m_rg[i]; }
__device__ __forceinline__ float rGlobal(int i) const { return __ldg(m_rg + i); }
__device__ __forceinline__ int16_t& iphi(int i) { return m_iphi[i]; }
__device__ __forceinline__ int16_t iphi(int i) const { return __ldg(m_iphi + i); }
__device__ __forceinline__ int32_t& charge(int i) { return m_charge[i]; }
__device__ __forceinline__ int32_t charge(int i) const { return __ldg(m_charge + i); }
__device__ __forceinline__ int16_t& clusterSizeX(int i) { return m_xsize[i]; }
__device__ __forceinline__ int16_t clusterSizeX(int i) const { return __ldg(m_xsize + i); }
__device__ __forceinline__ int16_t& clusterSizeY(int i) { return m_ysize[i]; }
__device__ __forceinline__ int16_t clusterSizeY(int i) const { return __ldg(m_ysize + i); }
__device__ __forceinline__ uint16_t& detectorIndex(int i) { return m_detInd[i]; }
__device__ __forceinline__ uint16_t detectorIndex(int i) const { return __ldg(m_detInd + i); }
__device__ __forceinline__ pixelCPEforGPU::ParamsOnGPU const& cpeParams() const { return *m_cpeParams; }
__device__ __forceinline__ uint32_t hitsModuleStart(int i) const { return __ldg(m_hitsModuleStart + i); }
__device__ __forceinline__ uint32_t* hitsLayerStart() { return m_hitsLayerStart; }
__device__ __forceinline__ uint32_t const* hitsLayerStart() const { return m_hitsLayerStart; }
__device__ __forceinline__ Hist& phiBinner() { return *m_hist; }
__device__ __forceinline__ Hist const& phiBinner() const { return *m_hist; }
__device__ __forceinline__ AverageGeometry& averageGeometry() { return *m_averageGeometry; }
__device__ __forceinline__ AverageGeometry const& averageGeometry() const { return *m_averageGeometry; }
private:
// local coord
float *m_xl, *m_yl;
float *m_xerr, *m_yerr;
// global coord
float *m_xg, *m_yg, *m_zg, *m_rg;
int16_t* m_iphi;
// cluster properties
int32_t* m_charge;
int16_t* m_xsize;
int16_t* m_ysize;
uint16_t* m_detInd;
// supporting objects
AverageGeometry* m_averageGeometry; // owned (corrected for beam spot: not sure where to host it otherwise)
pixelCPEforGPU::ParamsOnGPU const* m_cpeParams; // forwarded from setup, NOT owned
uint32_t const* m_hitsModuleStart; // forwarded from clusters
uint32_t* m_hitsLayerStart;
Hist* m_hist;
uint32_t m_nHits;
};
#endif