CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiPixelRecHitCUDA.cc
Go to the documentation of this file.
1 #include <cuda_runtime.h>
2 
23 
24 #include "PixelRecHitGPUKernel.h"
25 
27 public:
29  ~SiPixelRecHitCUDA() override = default;
30 
31  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
32 
33 private:
34  void produce(edm::StreamID streamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
35 
41 
43 };
44 
46  : cpeToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("CPE")))),
47  tBeamSpot(consumes<cms::cuda::Product<BeamSpotCUDA>>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
48  token_(consumes<cms::cuda::Product<SiPixelClustersCUDA>>(iConfig.getParameter<edm::InputTag>("src"))),
49  tokenDigi_(consumes<cms::cuda::Product<SiPixelDigisCUDA>>(iConfig.getParameter<edm::InputTag>("src"))),
50  tokenHit_(produces<cms::cuda::Product<TrackingRecHit2DGPU>>()) {}
51 
54 
55  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpotCUDA"));
56  desc.add<edm::InputTag>("src", edm::InputTag("siPixelClustersPreSplittingCUDA"));
57  desc.add<std::string>("CPE", "PixelCPEFast");
58  descriptions.add("siPixelRecHitCUDA", desc);
59 }
60 
62  PixelCPEFast const* fcpe = dynamic_cast<const PixelCPEFast*>(&es.getData(cpeToken_));
63  if (not fcpe) {
64  throw cms::Exception("Configuration") << "SiPixelRecHitSoAFromLegacy can only use a CPE of type PixelCPEFast";
65  }
66 
68  iEvent.getByToken(token_, hclusters);
69 
70  cms::cuda::ScopedContextProduce ctx{*hclusters};
71  auto const& clusters = ctx.get(*hclusters);
72 
74  iEvent.getByToken(tokenDigi_, hdigis);
75  auto const& digis = ctx.get(*hdigis);
76 
78  iEvent.getByToken(tBeamSpot, hbs);
79  auto const& bs = ctx.get(*hbs);
80 
81  ctx.emplace(iEvent,
82  tokenHit_,
83  gpuAlgo_.makeHitsAsync(digis, clusters, bs, fcpe->getGPUProductAsync(ctx.stream()), ctx.stream()));
84 }
85 
const edm::EDGetTokenT< cms::cuda::Product< BeamSpotCUDA > > tBeamSpot
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const edm::EDGetTokenT< cms::cuda::Product< SiPixelDigisCUDA > > tokenDigi_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDPutTokenT< cms::cuda::Product< TrackingRecHit2DGPU > > tokenHit_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
int iEvent
Definition: GenABIO.cc:224
const pixelgpudetails::PixelRecHitGPUKernel gpuAlgo_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
SiPixelRecHitCUDA(const edm::ParameterSet &iConfig)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< cms::cuda::Product< SiPixelClustersCUDA > > token_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void produce(edm::StreamID streamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
TrackingRecHit2DGPU makeHitsAsync(SiPixelDigisCUDA const &digis_d, SiPixelClustersCUDA const &clusters_d, BeamSpotCUDA const &bs_d, pixelCPEforGPU::ParamsOnGPU const *cpeParams, cudaStream_t stream) const
~SiPixelRecHitCUDA() override=default
const edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > cpeToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283