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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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 >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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.

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")} {}

References edm::ParameterSet::getParameter().

◆ ~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.

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  // ./CUDADataFormats/EcalRecHitSoA/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 }

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().

◆ fillDescriptions()

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

Definition at line 44 of file EcalCPURecHitProducer.cc.

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 }

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

◆ produce()

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

Definition at line 162 of file EcalCPURecHitProducer.cc.

162  {
163  // put into event
164  event.emplace(recHitsOutEBToken_, std::move(recHitsEB_));
165  event.emplace(recHitsOutEEToken_, std::move(recHitsEE_));
166 }

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

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().

EcalCPURecHitProducer::recHitsEB_
OutputProduct recHitsEB_
Definition: EcalCPURecHitProducer.cc:40
ecal::reco::StorageScalarType
float StorageScalarType
Definition: RecoTypes.h:8
EcalCPURecHitProducer::recHitsInEBToken_
edm::EDGetTokenT< InputProduct > recHitsInEBToken_
Definition: EcalCPURecHitProducer.cc:36
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ecal::RecHit::chi2
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type chi2
Definition: EcalRecHit.h:25
EcalCPURecHitProducer::recHitsEE_
OutputProduct recHitsEE_
Definition: EcalCPURecHitProducer.cc:40
ecal::RecHit::flagBits
StoragePolicy::template StorageSelector< uint32_t >::type flagBits
Definition: EcalRecHit.h:29
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ecal::RecHit::energy
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type energy
Definition: EcalRecHit.h:22
EcalCPURecHitProducer::recHitsOutEEToken_
edm::EDPutTokenT< OutputProduct > recHitsOutEEToken_
Definition: EcalCPURecHitProducer.cc:38
cms::cuda::ScopedContextAcquire
Definition: ScopedContext.h:101
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
ecal::RecHit::extra
StoragePolicy::template StorageSelector< uint32_t >::type extra
Definition: EcalRecHit.h:27
eostools.move
def move(src, dest)
Definition: eostools.py:511
cudaCheck
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:62
EcalCPURecHitProducer::recHitsInEEToken_
edm::EDGetTokenT< InputProduct > recHitsInEEToken_
Definition: EcalCPURecHitProducer.cc:36
ecal::RecHit::resize
std::enable_if< std::is_same< U, ::calo::common::tags::Vec >::value, void >::type resize(size_t size)
Definition: EcalRecHit.h:33
EcalCPURecHitProducer::containsTimingInformation_
bool containsTimingInformation_
Definition: EcalCPURecHitProducer.cc:41
EcalCPURecHitProducer::recHitsOutEBToken_
edm::EDPutTokenT< OutputProduct > recHitsOutEBToken_
Definition: EcalCPURecHitProducer.cc:38
edm::InputTag
Definition: InputTag.h:15
ecal::RecHit::did
StoragePolicy::template StorageSelector< uint32_t >::type did
Definition: EcalRecHit.h:30
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87