CMS 3D CMS Logo

PixelVertexProducerAlpaka.cc
Go to the documentation of this file.
1 #include <alpaka/alpaka.hpp>
2 
16 
22 
23 #include "vertexFinder.h"
24 
26 
27  using namespace cms::alpakatools;
28 
29  template <typename TrackerTraits>
33 
34  public:
35  explicit PixelVertexProducerAlpaka(const edm::ParameterSet& iConfig);
36  ~PixelVertexProducerAlpaka() override = default;
37 
38  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
39 
40  private:
41  void produce(edm::StreamID streamID, device::Event& iEvent, const device::EventSetup& iSetup) const override;
42 
43  const Algo algo_;
44 
45  // Tracking cuts before sending tracks to vertex algo
46  const float ptMin_;
47  const float ptMax_;
48 
51  };
52 
53  template <typename TrackerTraits>
55  : algo_(conf.getParameter<bool>("oneKernel"),
56  conf.getParameter<bool>("useDensity"),
57  conf.getParameter<bool>("useDBSCAN"),
58  conf.getParameter<bool>("useIterative"),
59  conf.getParameter<bool>("doSplitting"),
60  conf.getParameter<int>("minT"),
61  conf.getParameter<double>("eps"),
62  conf.getParameter<double>("errmax"),
63  conf.getParameter<double>("chi2max")),
64  ptMin_(conf.getParameter<double>("PtMin")), // 0.5 GeV
65  ptMax_(conf.getParameter<double>("PtMax")), // 75. Onsumes
66  tokenDeviceTrack_(consumes(conf.getParameter<edm::InputTag>("pixelTrackSrc"))),
67  tokenDeviceVertex_(produces()) {
68  // Workaround until the ProductID problem in issue https://github.com/cms-sw/cmssw/issues/44643 is fixed
69 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
70  producesTemporarily("edm::DeviceProduct<alpaka_cuda_async::ZVertexSoACollection>");
71 #endif
72  }
73 
74  template <typename TrackerTraits>
77 
78  // Only one of these three algos can be used at once.
79  // Maybe this should become a Plugin Factory
80  desc.add<bool>("oneKernel", true);
81  desc.add<bool>("useDensity", true);
82  desc.add<bool>("useDBSCAN", false);
83  desc.add<bool>("useIterative", false);
84  desc.add<bool>("doSplitting", true);
85 
86  desc.add<int>("minT", 2); // min number of neighbours to be "core"
87  desc.add<double>("eps", 0.07); // max absolute distance to cluster
88  desc.add<double>("errmax", 0.01); // max error to be "seed"
89  desc.add<double>("chi2max", 9.); // max normalized distance to cluster
90 
91  desc.add<double>("PtMin", 0.5);
92  desc.add<double>("PtMax", 75.);
93  desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("pixelTracksAlpaka"));
94 
95  descriptions.addWithDefaultLabel(desc);
96  }
97 
98  template <typename TrackerTraits>
101  const device::EventSetup& iSetup) const {
102  auto const& hTracks = iEvent.get(tokenDeviceTrack_);
103 
104  iEvent.emplace(tokenDeviceVertex_, algo_.makeAsync(iEvent.queue(), hTracks.view(), ptMin_, ptMax_));
105  }
106 
110 
111 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
112 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
device::EDPutToken< ZVertexSoACollection > tokenDeviceVertex_
PixelVertexProducerAlpaka< pixelTopology::HIonPhase1 > PixelVertexProducerAlpakaHIonPhase1
PixelVertexProducerAlpaka< pixelTopology::Phase1 > PixelVertexProducerAlpakaPhase1
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:224
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::conditional_t< std::is_same_v< Device, alpaka::DevCpu >, TracksHost< TrackerTraits >, TracksDevice< TrackerTraits, Device > > TracksSoACollection
HLT enums.
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:16
void produce(edm::StreamID streamID, device::Event &iEvent, const device::EventSetup &iSetup) const override
PixelVertexProducerAlpaka< pixelTopology::Phase2 > PixelVertexProducerAlpakaPhase2