File indexing completed on 2024-04-06 12:03:45
0001 #ifndef CUDADAtaFormats_HGCal_HGCUncalibRecHitDevice_H
0002 #define CUDADAtaFormats_HGCal_HGCUncalibRecHitDevice_H
0003
0004 #include <cassert>
0005 #include <numeric>
0006
0007 #include "HeterogeneousCore/CUDAUtilities/interface/device_unique_ptr.h"
0008 #include "CUDADataFormats/HGCal/interface/HGCRecHitSoA.h"
0009 #include "CUDADataFormats/HGCal/interface/HGCUncalibRecHitSoA.h"
0010
0011 class HGCUncalibRecHitDevice {
0012 public:
0013 HGCUncalibRecHitDevice() = default;
0014 explicit HGCUncalibRecHitDevice(uint32_t nhits, const cudaStream_t &stream);
0015 ~HGCUncalibRecHitDevice() = default;
0016
0017 HGCUncalibRecHitDevice(const HGCUncalibRecHitDevice &) = delete;
0018 HGCUncalibRecHitDevice &operator=(const HGCUncalibRecHitDevice &) = delete;
0019 HGCUncalibRecHitDevice(HGCUncalibRecHitDevice &&) = default;
0020 HGCUncalibRecHitDevice &operator=(HGCUncalibRecHitDevice &&) = default;
0021
0022 void defineSoAMemoryLayout_();
0023 HGCUncalibRecHitSoA get() const { return soa_; }
0024 uint32_t nHits() const { return nhits_; }
0025 uint32_t pad() const { return pad_; }
0026 uint32_t nBytes() const { return size_tot_; }
0027
0028 private:
0029 cms::cuda::device::unique_ptr<std::byte[]> ptr_;
0030 HGCUncalibRecHitSoA soa_;
0031 static constexpr std::array<int, memory::npointers::ntypes_hgcuncalibrechits_soa> sizes_ = {
0032 {memory::npointers::float_hgcuncalibrechits_soa * sizeof(float),
0033 memory::npointers::uint32_hgcuncalibrechits_soa * sizeof(uint32_t)}};
0034
0035 uint32_t pad_;
0036 uint32_t nhits_;
0037 uint32_t size_tot_;
0038 };
0039
0040 #endif