CMS 3D CMS Logo

TrackingRecHitSoAHost.h
Go to the documentation of this file.
1 #ifndef CUDADataFormats_RecHits_TrackingRecHitsHost_h
2 #define CUDADataFormats_RecHits_TrackingRecHitsHost_h
3 
4 #include <cstdint>
5 
10 
11 template <typename TrackerTraits>
12 class TrackingRecHitSoAHost : public cms::cuda::PortableHostCollection<TrackingRecHitLayout<TrackerTraits>> {
13 public:
15  //Need to decorate the class with the inherited portable accessors being now a template
20 
21  TrackingRecHitSoAHost() = default;
22 
24  using ParamsOnGPU = typename hitSoA::ParamsOnGPU;
26  using PhiBinner = typename hitSoA::PhiBinner;
27 
28  // This SoA Host is used basically only for DQM
29  // so we just need a slim constructor
30  explicit TrackingRecHitSoAHost(uint32_t nHits)
32 
33  explicit TrackingRecHitSoAHost(uint32_t nHits, cudaStream_t stream)
35 
36  explicit TrackingRecHitSoAHost(uint32_t nHits,
37  int32_t offsetBPIX2,
38  ParamsOnGPU const* cpeParams,
39  uint32_t const* hitsModuleStart)
41  view().nHits() = nHits;
42  std::copy(hitsModuleStart, hitsModuleStart + TrackerTraits::numberOfModules + 1, view().hitsModuleStart().begin());
43  memcpy(&(view().cpeParams()), cpeParams, sizeof(ParamsOnGPU));
44  view().offsetBPIX2() = offsetBPIX2;
45  }
46 
47  explicit TrackingRecHitSoAHost(uint32_t nHits,
48  int32_t offsetBPIX2,
49  ParamsOnGPU const* cpeParams,
50  uint32_t const* hitsModuleStart,
51  cudaStream_t stream)
54  view().nHits() = nHits;
55  std::copy(hitsModuleStart, hitsModuleStart + TrackerTraits::numberOfModules + 1, view().hitsModuleStart().begin());
56  memcpy(&(view().cpeParams()), cpeParams, sizeof(ParamsOnGPU));
57  view().offsetBPIX2() = offsetBPIX2;
58  }
59 
60  uint32_t nHits() const { return view().metadata().size(); }
61  uint32_t offsetBPIX2() const {
62  return offsetBPIX2_;
63  } //offsetBPIX2 is used on host functions so is useful to have it also stored in the class and not only in the layout
64 private:
65  uint32_t offsetBPIX2_ = 0;
66 };
67 
70 
71 #endif // CUDADataFormats_Track_TrackHeterogeneousT_H
typename TrackingRecHitSoA< TrackerTraits >::template TrackingRecHitSoALayout<> TrackingRecHitLayout
typename PhiBinner::index_type PhiBinnerStorageType
TrackingRecHitSoAHost(uint32_t nHits, int32_t offsetBPIX2, ParamsOnGPU const *cpeParams, uint32_t const *hitsModuleStart, cudaStream_t stream)
TrackingRecHitSoAHost(uint32_t nHits, int32_t offsetBPIX2, ParamsOnGPU const *cpeParams, uint32_t const *hitsModuleStart)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
constexpr uint16_t numberOfModules
typename hitSoA::ParamsOnGPU ParamsOnGPU
uint32_t offsetBPIX2() const
Namespace of DDCMS conversion namespace.
typename hitSoA::AverageGeometry AverageGeometry
pixelCPEforGPU::ParamsOnGPUT< TrackerTraits > ParamsOnGPU
TrackingRecHitSoAHost()=default
TrackingRecHitSoAHost(uint32_t nHits, cudaStream_t stream)
TrackingRecHitSoAHost(uint32_t nHits)
pixelTopology::AverageGeometryT< TrackerTraits > AverageGeometry
typename hitSoA::PhiBinnerStorageType PhiBinnerStorageType
cms::cuda::HistoContainer< int16_t, 256, -1, 8 *sizeof(int16_t), hindex_type, TrackerTraits::numberOfLayers > PhiBinner
typename hitSoA::PhiBinner PhiBinner