CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PixelTrackDumpCUDA.cc
Go to the documentation of this file.
1 #include <cuda_runtime.h>
2 
22 
24 public:
26  ~PixelTrackDumpCUDA() override = default;
27 
28  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
29 
30 private:
31  void analyze(edm::StreamID streamID, edm::Event const& iEvent, const edm::EventSetup& iSetup) const override;
32  const bool m_onGPU;
37 };
38 
40  : m_onGPU(iConfig.getParameter<bool>("onGPU")) {
41  if (m_onGPU) {
43  consumes<cms::cuda::Product<PixelTrackHeterogeneous>>(iConfig.getParameter<edm::InputTag>("pixelTrackSrc"));
45  consumes<cms::cuda::Product<ZVertexHeterogeneous>>(iConfig.getParameter<edm::InputTag>("pixelVertexSrc"));
46  } else {
47  tokenSoATrack_ = consumes<PixelTrackHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelTrackSrc"));
48  tokenSoAVertex_ = consumes<ZVertexHeterogeneous>(iConfig.getParameter<edm::InputTag>("pixelVertexSrc"));
49  }
50 }
51 
54 
55  desc.add<bool>("onGPU", true);
56  desc.add<edm::InputTag>("pixelTrackSrc", edm::InputTag("pixelTracksCUDA"));
57  desc.add<edm::InputTag>("pixelVertexSrc", edm::InputTag("pixelVerticesCUDA"));
58  descriptions.add("pixelTrackDumpCUDA", desc);
59 }
60 
62  edm::Event const& iEvent,
63  const edm::EventSetup& iSetup) const {
64  if (m_onGPU) {
65  auto const& hTracks = iEvent.get(tokenGPUTrack_);
67 
68  auto const& tracks = ctx.get(hTracks);
69  auto const* tsoa = tracks.get();
70  assert(tsoa);
71 
72  auto const& vertices = ctx.get(iEvent.get(tokenGPUVertex_));
73  auto const* vsoa = vertices.get();
74  assert(vsoa);
75 
76  } else {
77  auto const* tsoa = iEvent.get(tokenSoATrack_).get();
78  assert(tsoa);
79 
80  auto const* vsoa = iEvent.get(tokenSoAVertex_).get();
81  assert(vsoa);
82  }
83 }
84 
edm::EDGetTokenT< cms::cuda::Product< ZVertexHeterogeneous > > tokenGPUVertex_
void analyze(edm::StreamID streamID, edm::Event const &iEvent, const edm::EventSetup &iSetup) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
auto const & tracks
cannot be loose
assert(be >=bs)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
PixelTrackDumpCUDA(const edm::ParameterSet &iConfig)
int iEvent
Definition: GenABIO.cc:224
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
edm::EDGetTokenT< ZVertexHeterogeneous > tokenSoAVertex_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< PixelTrackHeterogeneous > tokenSoATrack_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< cms::cuda::Product< PixelTrackHeterogeneous > > tokenGPUTrack_
~PixelTrackDumpCUDA() override=default