Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:23

0001 #ifndef DataFormats_Track_TracksHost_H
0002 #define DataFormats_Track_TracksHost_H
0003 
0004 #include <cstdint>
0005 #include <alpaka/alpaka.hpp>
0006 #include "Geometry/CommonTopologies/interface/SimplePixelTopology.h"
0007 #include "DataFormats/TrackSoA/interface/TracksSoA.h"
0008 #include "DataFormats/TrackSoA/interface/TrackDefinitions.h"
0009 #include "DataFormats/Portable/interface/PortableHostCollection.h"
0010 
0011 // TODO: The class is created via inheritance of the PortableHostCollection.
0012 // This is generally discouraged, and should be done via composition.
0013 // See: https://github.com/cms-sw/cmssw/pull/40465#discussion_r1067364306
0014 template <typename TrackerTraits>
0015 class TracksHost : public PortableHostCollection<reco::TrackLayout<TrackerTraits>> {
0016 public:
0017   static constexpr int32_t S = TrackerTraits::maxNumberOfTuples;  //TODO: this could be made configurable at runtime
0018   TracksHost() = default;  // Needed for the dictionary; not sure if line above is needed anymore
0019 
0020   using PortableHostCollection<reco::TrackLayout<TrackerTraits>>::view;
0021   using PortableHostCollection<reco::TrackLayout<TrackerTraits>>::const_view;
0022   using PortableHostCollection<reco::TrackLayout<TrackerTraits>>::buffer;
0023 
0024   // Constructor which specifies the SoA size
0025   template <typename TQueue>
0026   explicit TracksHost<TrackerTraits>(TQueue& queue)
0027       : PortableHostCollection<reco::TrackLayout<TrackerTraits>>(S, queue) {}
0028 
0029   // Constructor which specifies the DevHost
0030   explicit TracksHost(alpaka_common::DevHost const& host)
0031       : PortableHostCollection<reco::TrackLayout<TrackerTraits>>(S, host) {}
0032 };
0033 
0034 namespace pixelTrack {
0035 
0036   using TracksHostPhase1 = TracksHost<pixelTopology::Phase1>;
0037   using TracksHostPhase2 = TracksHost<pixelTopology::Phase2>;
0038   using TracksHostHIonPhase1 = TracksHost<pixelTopology::HIonPhase1>;
0039 
0040 }  // namespace pixelTrack
0041 
0042 #endif  // DataFormats_Track_TracksHost_H