Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-08 23:11:01

0001 #ifndef CUDADataFormats_TrackingRecHit_interface_TrackingRecHit2DReduced_h
0002 #define CUDADataFormats_TrackingRecHit_interface_TrackingRecHit2DReduced_h
0003 
0004 #include "CUDADataFormats/TrackingRecHit/interface/TrackingRecHit2DSOAView.h"
0005 #include "CUDADataFormats/Common/interface/HostProduct.h"
0006 
0007 // a reduced (in content and therefore in size) version to be used on CPU for Legacy reconstruction
0008 class TrackingRecHit2DReduced {
0009 public:
0010   using HLPstorage = HostProduct<float[]>;
0011   using HIDstorage = HostProduct<uint16_t[]>;
0012 
0013   template <typename UP32, typename UP16>
0014   TrackingRecHit2DReduced(UP32&& istore32, UP16&& istore16, int nhits)
0015       : m_store32(std::move(istore32)), m_store16(std::move(istore16)), m_nHits(nhits) {
0016     auto get32 = [&](int i) { return const_cast<float*>(m_store32.get()) + i * nhits; };
0017 
0018     // copy all the pointers (better be in sync with the producer store)
0019 
0020     m_view.m_xl = get32(0);
0021     m_view.m_yl = get32(1);
0022     m_view.m_xerr = get32(2);
0023     m_view.m_yerr = get32(3);
0024     m_view.m_chargeAndStatus = reinterpret_cast<uint32_t*>(get32(4));
0025     m_view.m_detInd = const_cast<uint16_t*>(m_store16.get());
0026   }
0027 
0028   // view only!
0029   TrackingRecHit2DReduced(TrackingRecHit2DSOAView const& iview, int nhits) : m_view(iview), m_nHits(nhits) {}
0030 
0031   TrackingRecHit2DReduced() = default;
0032   ~TrackingRecHit2DReduced() = default;
0033 
0034   TrackingRecHit2DReduced(const TrackingRecHit2DReduced&) = delete;
0035   TrackingRecHit2DReduced& operator=(const TrackingRecHit2DReduced&) = delete;
0036   TrackingRecHit2DReduced(TrackingRecHit2DReduced&&) = default;
0037   TrackingRecHit2DReduced& operator=(TrackingRecHit2DReduced&&) = default;
0038 
0039   TrackingRecHit2DSOAView& view() { return m_view; }
0040   TrackingRecHit2DSOAView const& view() const { return m_view; }
0041 
0042   auto nHits() const { return m_nHits; }
0043 
0044 private:
0045   TrackingRecHit2DSOAView m_view;
0046 
0047   HLPstorage m_store32;
0048   HIDstorage m_store16;
0049 
0050   int m_nHits;
0051 };
0052 
0053 #endif