Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-13 22:52:46

0001 #ifndef RecoVertex_PixelVertexFinding_plugins_alpaka_vertexFinder_h
0002 #define RecoVertex_PixelVertexFinding_plugins_alpaka_vertexFinder_h
0003 
0004 #include <cstddef>
0005 #include <cstdint>
0006 
0007 #include <alpaka/alpaka.hpp>
0008 
0009 #include "DataFormats/TrackSoA/interface/alpaka/TrackUtilities.h"
0010 #include "DataFormats/VertexSoA/interface/ZVertexDevice.h"
0011 #include "DataFormats/VertexSoA/interface/ZVertexHost.h"
0012 #include "DataFormats/VertexSoA/interface/ZVertexSoA.h"
0013 #include "DataFormats/VertexSoA/interface/alpaka/ZVertexSoACollection.h"
0014 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0015 #include "RecoVertex/PixelVertexFinding/interface/PixelVertexWorkSpaceLayout.h"
0016 #include "RecoVertex/PixelVertexFinding/plugins/alpaka/PixelVertexWorkSpaceSoADeviceAlpaka.h"
0017 
0018 namespace ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder {
0019 
0020   using namespace cms::alpakatools;
0021   using VtxSoAView = ::reco::ZVertexSoAView;
0022   using TrkSoAView = ::reco::ZVertexTracksSoAView;
0023   using WsSoAView = ::vertexFinder::PixelVertexWorkSpaceSoAView;
0024 
0025   class Init {
0026   public:
0027     ALPAKA_FN_ACC void operator()(Acc1D const &acc, VtxSoAView data, WsSoAView ws) const {
0028       data.nvFinal() = 0;  // initialization
0029       ::vertexFinder::init(ws);
0030     }
0031   };
0032 
0033   template <typename TrackerTraits>
0034   class Producer {
0035     using TkSoAConstView = reco::TrackSoAConstView<TrackerTraits>;
0036 
0037   public:
0038     Producer(bool oneKernel,
0039              bool useDensity,
0040              bool useDBSCAN,
0041              bool useIterative,
0042              bool doSplitting,
0043              int iminT,      // min number of neighbours to be "core"
0044              float ieps,     // max absolute distance to cluster
0045              float ierrmax,  // max error to be "seed"
0046              float ichi2max  // max normalized distance to cluster
0047              )
0048         : oneKernel_(oneKernel && !(useDBSCAN || useIterative)),
0049           useDensity_(useDensity),
0050           useDBSCAN_(useDBSCAN),
0051           useIterative_(useIterative),
0052           doSplitting_(doSplitting),
0053           minT(iminT),
0054           eps(ieps),
0055           errmax(ierrmax),
0056           chi2max(ichi2max) {}
0057 
0058     ~Producer() = default;
0059 
0060     ZVertexSoACollection makeAsync(
0061         Queue &queue, TkSoAConstView const &tracks_view, int maxVertices, float ptMin, float ptMax) const;
0062 
0063   private:
0064     const bool oneKernel_;     // run everything (cluster,fit,split,sort) in one kernel. Uses only density clusterizer
0065     const bool useDensity_;    // use density clusterizer
0066     const bool useDBSCAN_;     // use DBScan clusterizer
0067     const bool useIterative_;  // use iterative clusterizer
0068     const bool doSplitting_;   //run vertex splitting
0069 
0070     int minT;       // min number of neighbours to be "core"
0071     float eps;      // max absolute distance to cluster
0072     float errmax;   // max error to be "seed"
0073     float chi2max;  // max normalized distance to cluster
0074   };
0075 
0076 }  // namespace ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder
0077 
0078 #endif  // RecoVertex_PixelVertexFinding_plugins_alpaka_vertexFinder_h