CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalCPURecHitProducer Class Reference
Inheritance diagram for EcalCPURecHitProducer:
edm::stream::EDProducer< edm::ExternalWork >

Public Member Functions

 EcalCPURecHitProducer (edm::ParameterSet const &ps)
 
 ~EcalCPURecHitProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::ExternalWork >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Types

using InputProduct = cms::cuda::Product< ecal::RecHit< calo::common::DevStoragePolicy > >
 
using OutputProduct = ecal::RecHit< calo::common::VecStoragePolicy< calo::common::CUDAHostAllocatorAlias > >
 

Private Member Functions

void acquire (edm::Event const &, edm::EventSetup const &, edm::WaitingTaskWithArenaHolder) override
 
void produce (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

bool containsTimingInformation_
 
OutputProduct recHitsEB_
 
OutputProduct recHitsEE_
 
edm::EDGetTokenT< InputProductrecHitsInEBToken_
 
edm::EDGetTokenT< InputProductrecHitsInEEToken_
 
edm::EDPutTokenT< OutputProductrecHitsOutEBToken_
 
edm::EDPutTokenT< OutputProductrecHitsOutEEToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer< edm::ExternalWork >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 24 of file EcalCPURecHitProducer.cc.

Member Typedef Documentation

◆ InputProduct

Definition at line 35 of file EcalCPURecHitProducer.cc.

◆ OutputProduct

Definition at line 37 of file EcalCPURecHitProducer.cc.

Constructor & Destructor Documentation

◆ EcalCPURecHitProducer()

EcalCPURecHitProducer::EcalCPURecHitProducer ( edm::ParameterSet const &  ps)
explicit

Definition at line 56 of file EcalCPURecHitProducer.cc.

References edm::ParameterSet::getParameter().

57  : recHitsInEBToken_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("recHitsInLabelEB"))},
58  recHitsInEEToken_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("recHitsInLabelEE"))},
59  recHitsOutEBToken_{produces<OutputProduct>(ps.getParameter<std::string>("recHitsOutLabelEB"))},
60  recHitsOutEEToken_{produces<OutputProduct>(ps.getParameter<std::string>("recHitsOutLabelEE"))},
61  containsTimingInformation_{ps.getParameter<bool>("containsTimingInformation")} {}
edm::EDGetTokenT< InputProduct > recHitsInEEToken_
edm::EDPutTokenT< OutputProduct > recHitsOutEBToken_
edm::EDPutTokenT< OutputProduct > recHitsOutEEToken_
edm::EDGetTokenT< InputProduct > recHitsInEBToken_

◆ ~EcalCPURecHitProducer()

EcalCPURecHitProducer::~EcalCPURecHitProducer ( )
overridedefault

Member Function Documentation

◆ acquire()

void EcalCPURecHitProducer::acquire ( edm::Event const &  event,
edm::EventSetup const &  setup,
edm::WaitingTaskWithArenaHolder  taskHolder 
)
overrideprivate

Definition at line 63 of file EcalCPURecHitProducer.cc.

References ecal::RecHit< StoragePolicy >::chi2, gather_cfg::cout, cudaCheck, ecal::RecHit< StoragePolicy >::did, ecal::RecHit< StoragePolicy >::energy, ecal::RecHit< StoragePolicy >::extra, ecal::RecHit< StoragePolicy >::flagBits, eostools::move(), recHitsEB_, recHitsEE_, recHitsInEBToken_, recHitsInEEToken_, and ecal::RecHit< StoragePolicy >::resize().

65  {
66  // retrieve data/ctx
67  auto const& ebRecHitsProduct = event.get(recHitsInEBToken_);
68  auto const& eeRecHitsProduct = event.get(recHitsInEEToken_);
69  cms::cuda::ScopedContextAcquire ctx{ebRecHitsProduct, std::move(taskHolder)};
70  auto const& ebRecHits = ctx.get(ebRecHitsProduct);
71  auto const& eeRecHits = ctx.get(eeRecHitsProduct);
72 
73  // resize the output buffers
74  recHitsEB_.resize(ebRecHits.size);
75  recHitsEE_.resize(eeRecHits.size);
76 
77 #ifdef ECAL_RECO_CUDA_DEBUG
78  std::cout << " [EcalCPURecHitProducer::acquire] ebRecHits.size = " << ebRecHits.size << std::endl;
79  std::cout << " [EcalCPURecHitProducer::acquire] eeRecHits.size = " << eeRecHits.size << std::endl;
80 #endif
81 
82  // enqeue transfers
83  cudaCheck(cudaMemcpyAsync(recHitsEB_.did.data(),
84  ebRecHits.did.get(),
85  recHitsEB_.did.size() * sizeof(uint32_t),
86  cudaMemcpyDeviceToHost,
87  ctx.stream()));
88  cudaCheck(cudaMemcpyAsync(recHitsEE_.did.data(),
89  eeRecHits.did.get(),
90  recHitsEE_.did.size() * sizeof(uint32_t),
91  cudaMemcpyDeviceToHost,
92  ctx.stream()));
93  //
94  // ./DataFormats/EcalRecHit/interface/RecoTypes.h:using StorageScalarType = float;
95  //
96 
97  cudaCheck(cudaMemcpyAsync(recHitsEB_.energy.data(),
98  ebRecHits.energy.get(),
100  cudaMemcpyDeviceToHost,
101  ctx.stream()));
102  cudaCheck(cudaMemcpyAsync(recHitsEE_.energy.data(),
103  eeRecHits.energy.get(),
105  cudaMemcpyDeviceToHost,
106  ctx.stream()));
107 
108  cudaCheck(cudaMemcpyAsync(recHitsEB_.chi2.data(),
109  ebRecHits.chi2.get(),
111  cudaMemcpyDeviceToHost,
112  ctx.stream()));
113  cudaCheck(cudaMemcpyAsync(recHitsEE_.chi2.data(),
114  eeRecHits.chi2.get(),
116  cudaMemcpyDeviceToHost,
117  ctx.stream()));
118 
119  cudaCheck(cudaMemcpyAsync(recHitsEB_.extra.data(),
120  ebRecHits.extra.get(),
121  recHitsEB_.extra.size() * sizeof(uint32_t),
122  cudaMemcpyDeviceToHost,
123  ctx.stream()));
124  cudaCheck(cudaMemcpyAsync(recHitsEE_.extra.data(),
125  eeRecHits.extra.get(),
126  recHitsEE_.extra.size() * sizeof(uint32_t),
127  cudaMemcpyDeviceToHost,
128  ctx.stream()));
129 
130  cudaCheck(cudaMemcpyAsync(recHitsEB_.flagBits.data(),
131  ebRecHits.flagBits.get(),
132  recHitsEB_.flagBits.size() * sizeof(uint32_t),
133  cudaMemcpyDeviceToHost,
134  ctx.stream()));
135  cudaCheck(cudaMemcpyAsync(recHitsEE_.flagBits.data(),
136  eeRecHits.flagBits.get(),
137  recHitsEE_.flagBits.size() * sizeof(uint32_t),
138  cudaMemcpyDeviceToHost,
139  ctx.stream()));
140 
141 #ifdef ECAL_RECO_CUDA_DEBUG
142  for (unsigned int ieb = 0; ieb < ebRecHits.size; ieb++) {
143  if (recHitsEB_.extra[ieb] != 0)
144  std::cout << " [ " << ieb << " :: " << ebRecHits.size << " ] [ " << recHitsEB_.did[ieb]
145  << " ] eb extra = " << recHitsEB_.extra[ieb] << std::endl;
146  }
147 
148  for (unsigned int ieb = 0; ieb < ebRecHits.size; ieb++) {
149  if (recHitsEB_.energy[ieb] != 0)
150  std::cout << " [ " << ieb << " :: " << ebRecHits.size << " ] [ " << recHitsEB_.did[ieb]
151  << " ] eb energy = " << recHitsEB_.energy[ieb] << std::endl;
152  }
153 
154  for (unsigned int iee = 0; iee < eeRecHits.size; iee++) {
155  if (recHitsEE_.energy[iee] != 0)
156  std::cout << " [ " << iee << " :: " << eeRecHits.size << " ] [ " << recHitsEE_.did[iee]
157  << " ] ee energy = " << recHitsEE_.energy[iee] << std::endl;
158  }
159 #endif
160 }
edm::EDGetTokenT< InputProduct > recHitsInEEToken_
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type chi2
Definition: EcalRecHit.h:25
StoragePolicy::template StorageSelector< uint32_t >::type did
Definition: EcalRecHit.h:30
std::enable_if< std::is_same< U, ::calo::common::tags::Vec >::value, void >::type resize(size_t size)
Definition: EcalRecHit.h:33
float StorageScalarType
Definition: RecoTypes.h:8
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type energy
Definition: EcalRecHit.h:22
edm::EDGetTokenT< InputProduct > recHitsInEBToken_
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
def move(src, dest)
Definition: eostools.py:511
StoragePolicy::template StorageSelector< uint32_t >::type extra
Definition: EcalRecHit.h:27
StoragePolicy::template StorageSelector< uint32_t >::type flagBits
Definition: EcalRecHit.h:29

◆ fillDescriptions()

void EcalCPURecHitProducer::fillDescriptions ( edm::ConfigurationDescriptions confDesc)
static

Definition at line 44 of file EcalCPURecHitProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

44  {
46 
47  desc.add<edm::InputTag>("recHitsInLabelEB", edm::InputTag{"ecalRecHitProducerGPU", "EcalRecHitsEB"});
48  desc.add<edm::InputTag>("recHitsInLabelEE", edm::InputTag{"ecalRecHitProducerGPU", "EcalRecHitsEE"});
49  desc.add<std::string>("recHitsOutLabelEB", "EcalRecHitsEB");
50  desc.add<std::string>("recHitsOutLabelEE", "EcalRecHitsEE");
51  desc.add<bool>("containsTimingInformation", false);
52 
53  confDesc.addWithDefaultLabel(desc);
54 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

void EcalCPURecHitProducer::produce ( edm::Event event,
edm::EventSetup const &  setup 
)
overrideprivate

Definition at line 162 of file EcalCPURecHitProducer.cc.

References eostools::move(), recHitsEB_, recHitsEE_, recHitsOutEBToken_, and recHitsOutEEToken_.

162  {
163  // put into event
164  event.emplace(recHitsOutEBToken_, std::move(recHitsEB_));
165  event.emplace(recHitsOutEEToken_, std::move(recHitsEE_));
166 }
edm::EDPutTokenT< OutputProduct > recHitsOutEBToken_
edm::EDPutTokenT< OutputProduct > recHitsOutEEToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ containsTimingInformation_

bool EcalCPURecHitProducer::containsTimingInformation_
private

Definition at line 41 of file EcalCPURecHitProducer.cc.

◆ recHitsEB_

OutputProduct EcalCPURecHitProducer::recHitsEB_
private

Definition at line 40 of file EcalCPURecHitProducer.cc.

Referenced by acquire(), and produce().

◆ recHitsEE_

OutputProduct EcalCPURecHitProducer::recHitsEE_
private

Definition at line 40 of file EcalCPURecHitProducer.cc.

Referenced by acquire(), and produce().

◆ recHitsInEBToken_

edm::EDGetTokenT<InputProduct> EcalCPURecHitProducer::recHitsInEBToken_
private

Definition at line 36 of file EcalCPURecHitProducer.cc.

Referenced by acquire().

◆ recHitsInEEToken_

edm::EDGetTokenT<InputProduct> EcalCPURecHitProducer::recHitsInEEToken_
private

Definition at line 36 of file EcalCPURecHitProducer.cc.

Referenced by acquire().

◆ recHitsOutEBToken_

edm::EDPutTokenT<OutputProduct> EcalCPURecHitProducer::recHitsOutEBToken_
private

Definition at line 38 of file EcalCPURecHitProducer.cc.

Referenced by produce().

◆ recHitsOutEEToken_

edm::EDPutTokenT<OutputProduct> EcalCPURecHitProducer::recHitsOutEEToken_
private

Definition at line 38 of file EcalCPURecHitProducer.cc.

Referenced by produce().