CMS 3D CMS Logo

SiPixelRecHitCUDA.cc
Go to the documentation of this file.
1 #include <cuda_runtime.h>
2 
24 
25 #include "PixelRecHitGPUKernel.h"
26 
27 template <typename TrackerTraits>
29 public:
30  explicit SiPixelRecHitCUDAT(const edm::ParameterSet& iConfig);
31  ~SiPixelRecHitCUDAT() override = default;
32 
33  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
34 
35 private:
36  void produce(edm::StreamID streamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
37 
43 
45 };
46 
47 template <typename TrackerTraits>
49  : cpeToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("CPE")))),
50  tBeamSpot(consumes<cms::cuda::Product<BeamSpotCUDA>>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
51  token_(consumes<cms::cuda::Product<SiPixelClustersCUDA>>(iConfig.getParameter<edm::InputTag>("src"))),
52  tokenDigi_(consumes<cms::cuda::Product<SiPixelDigisCUDA>>(iConfig.getParameter<edm::InputTag>("src"))),
53  tokenHit_(produces<cms::cuda::Product<TrackingRecHitSoADevice<TrackerTraits>>>()) {}
54 
55 template <typename TrackerTraits>
58 
59  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpotCUDA"));
60  desc.add<edm::InputTag>("src", edm::InputTag("siPixelClustersPreSplittingCUDA"));
61 
62  std::string cpe = "PixelCPEFast";
63  cpe += TrackerTraits::nameModifier;
64  desc.add<std::string>("CPE", cpe);
65 
66  descriptions.addWithDefaultLabel(desc);
67 }
68 
69 template <typename TrackerTraits>
72  const edm::EventSetup& es) const {
73  PixelCPEFast<TrackerTraits> const* fcpe = dynamic_cast<const PixelCPEFast<TrackerTraits>*>(&es.getData(cpeToken_));
74  if (not fcpe) {
75  throw cms::Exception("Configuration") << "SiPixelRecHitCUDA can only use a CPE of type PixelCPEFast";
76  }
77 
79  iEvent.getByToken(token_, hclusters);
80 
81  cms::cuda::ScopedContextProduce ctx{*hclusters};
82  auto const& clusters = ctx.get(*hclusters);
83 
85  iEvent.getByToken(tokenDigi_, hdigis);
86  auto const& digis = ctx.get(*hdigis);
87 
89  iEvent.getByToken(tBeamSpot, hbs);
90  auto const& bs = ctx.get(*hbs);
91 
92  ctx.emplace(iEvent,
93  tokenHit_,
94  gpuAlgo_.makeHitsAsync(digis, clusters, bs, fcpe->getGPUProductAsync(ctx.stream()), ctx.stream()));
95 }
96 
99 
102 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const edm::EDGetTokenT< cms::cuda::Product< SiPixelClustersCUDA > > token_
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
const edm::EDGetTokenT< cms::cuda::Product< BeamSpotCUDA > > tBeamSpot
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > cpeToken_
~SiPixelRecHitCUDAT() override=default
const edm::EDPutTokenT< cms::cuda::Product< TrackingRecHitSoADevice< TrackerTraits > > > tokenHit_
int iEvent
Definition: GenABIO.cc:224
const pixelgpudetails::PixelRecHitGPUKernel< TrackerTraits > gpuAlgo_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Namespace of DDCMS conversion namespace.
SiPixelRecHitCUDAT(const edm::ParameterSet &iConfig)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
HLT enums.
const edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > tokenDigi_