CMS 3D CMS Logo

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

Public Member Functions

 EcalCPUUncalibRecHitProducer (edm::ParameterSet const &ps)
 
 ~EcalCPUUncalibRecHitProducer () override
 
- 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::UncalibratedRecHit< calo::common::DevStoragePolicy > >
 
using OutputProduct = ecal::UncalibratedRecHit< 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

const bool containsTimingInformation_
 
const bool isPhase2_
 
OutputProduct recHitsEB_
 
OutputProduct recHitsEE_
 
const edm::EDGetTokenT< InputProductrecHitsInEBToken_
 
const edm::EDGetTokenT< InputProductrecHitsInEEToken_
 
const edm::EDPutTokenT< OutputProductrecHitsOutEBToken_
 
const 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 20 of file EcalCPUUncalibRecHitProducer.cc.

Member Typedef Documentation

◆ InputProduct

Definition at line 32 of file EcalCPUUncalibRecHitProducer.cc.

◆ OutputProduct

Definition at line 34 of file EcalCPUUncalibRecHitProducer.cc.

Constructor & Destructor Documentation

◆ EcalCPUUncalibRecHitProducer()

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

Definition at line 57 of file EcalCPUUncalibRecHitProducer.cc.

References edm::ParameterSet::getParameter().

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

◆ ~EcalCPUUncalibRecHitProducer()

EcalCPUUncalibRecHitProducer::~EcalCPUUncalibRecHitProducer ( )
override

Definition at line 67 of file EcalCPUUncalibRecHitProducer.cc.

67 {}

Member Function Documentation

◆ acquire()

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

Definition at line 69 of file EcalCPUUncalibRecHitProducer.cc.

References ecal::UncalibratedRecHit< StoragePolicy >::amplitude, ecal::UncalibratedRecHit< StoragePolicy >::amplitudeError, ecal::UncalibratedRecHit< StoragePolicy >::amplitudesAll, ecal::UncalibratedRecHit< StoragePolicy >::chi2, containsTimingInformation_, cudaCheck, mps_fire::dest, ecal::UncalibratedRecHit< StoragePolicy >::did, ecal::UncalibratedRecHit< StoragePolicy >::flags, isPhase2_, ecal::UncalibratedRecHit< StoragePolicy >::jitter, ecal::UncalibratedRecHit< StoragePolicy >::jitterError, eostools::move(), ecal::UncalibratedRecHit< StoragePolicy >::pedestal, recHitsEB_, recHitsEE_, recHitsInEBToken_, recHitsInEEToken_, ecal::UncalibratedRecHit< StoragePolicy >::resize(), TrackRefitter_38T_cff::src, and relativeConstraints::value.

71  {
72  // retrieve data/ctx
73  auto const& ebRecHitsProduct = event.get(recHitsInEBToken_);
74  cms::cuda::ScopedContextAcquire ctx{ebRecHitsProduct, std::move(taskHolder)};
75  auto const& ebRecHits = ctx.get(ebRecHitsProduct);
76 
77  // resize the output buffers
78  recHitsEB_.resize(ebRecHits.size);
79 
80  auto lambdaToTransfer = [&ctx](auto& dest, auto* src) {
81  using vector_type = typename std::remove_reference<decltype(dest)>::type;
82  using type = typename vector_type::value_type;
83  using src_type = typename std::remove_pointer<decltype(src)>::type;
84  static_assert(std::is_same<src_type, type>::value && "dst and src data types do not match");
85  cudaCheck(cudaMemcpyAsync(dest.data(), src, dest.size() * sizeof(type), cudaMemcpyDeviceToHost, ctx.stream()));
86  };
87 
88  // enqeue transfers
89  lambdaToTransfer(recHitsEB_.did, ebRecHits.did.get());
90  lambdaToTransfer(recHitsEB_.amplitudesAll, ebRecHits.amplitudesAll.get());
91  lambdaToTransfer(recHitsEB_.amplitude, ebRecHits.amplitude.get());
92  lambdaToTransfer(recHitsEB_.chi2, ebRecHits.chi2.get());
93  lambdaToTransfer(recHitsEB_.pedestal, ebRecHits.pedestal.get());
94  lambdaToTransfer(recHitsEB_.flags, ebRecHits.flags.get());
96  lambdaToTransfer(recHitsEB_.jitter, ebRecHits.jitter.get());
97  lambdaToTransfer(recHitsEB_.jitterError, ebRecHits.jitterError.get());
98  }
99  if (isPhase2_) {
100  lambdaToTransfer(recHitsEB_.amplitudeError, ebRecHits.amplitudeError.get());
101 
102  } else {
103  auto const& eeRecHitsProduct = event.get(recHitsInEEToken_);
104  auto const& eeRecHits = ctx.get(eeRecHitsProduct);
105  recHitsEE_.resize(eeRecHits.size);
106  lambdaToTransfer(recHitsEE_.did, eeRecHits.did.get());
107  lambdaToTransfer(recHitsEE_.amplitudesAll, eeRecHits.amplitudesAll.get());
108  lambdaToTransfer(recHitsEE_.amplitude, eeRecHits.amplitude.get());
109  lambdaToTransfer(recHitsEE_.chi2, eeRecHits.chi2.get());
110  lambdaToTransfer(recHitsEE_.pedestal, eeRecHits.pedestal.get());
111  lambdaToTransfer(recHitsEE_.flags, eeRecHits.flags.get());
113  lambdaToTransfer(recHitsEE_.jitter, eeRecHits.jitter.get());
114  lambdaToTransfer(recHitsEE_.jitterError, eeRecHits.jitterError.get());
115  }
116  }
117 }
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type amplitudeError
const edm::EDGetTokenT< InputProduct > recHitsInEEToken_
const edm::EDGetTokenT< InputProduct > recHitsInEBToken_
std::enable_if< std::is_same< U, ::calo::common::tags::Vec >::value, void >::type resize(size_t size)
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type jitterError
StoragePolicy::template StorageSelector< uint32_t >::type flags
StoragePolicy::template StorageSelector< uint32_t >::type did
StoragePolicy::template StorageSelector< reco::ComputationScalarType >::type amplitudesAll
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type amplitude
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type jitter
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type chi2
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:69
def move(src, dest)
Definition: eostools.py:511
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type pedestal

◆ fillDescriptions()

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

Definition at line 41 of file EcalCPUUncalibRecHitProducer.cc.

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

41  {
43 
44  desc.add<edm::InputTag>("recHitsInLabelEB", edm::InputTag{"ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEB"});
45  desc.add<std::string>("recHitsOutLabelEB", "EcalUncalibRecHitsEB");
46  desc.add<bool>("containsTimingInformation", false);
47  desc.ifValue(
48  edm::ParameterDescription<bool>("isPhase2", false, true),
50  "recHitsInLabelEE", edm::InputTag{"ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEE"}, true) and
51  edm::ParameterDescription<std::string>("recHitsOutLabelEE", "EcalUncalibRecHitsEE", true)) or
52  true >> edm::EmptyGroupDescription());
53 
54  confDesc.add("ecalCPUUncalibRecHitProducer", desc);
55 }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 119 of file EcalCPUUncalibRecHitProducer.cc.

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

119  {
120  // tmp vectors
121  auto recHitsOutEB = std::make_unique<OutputProduct>(std::move(recHitsEB_));
122  // put into event
123  event.put(recHitsOutEBToken_, std::move(recHitsOutEB));
124 
125  if (!isPhase2_) {
126  auto recHitsOutEE = std::make_unique<OutputProduct>(std::move(recHitsEE_));
127  event.put(recHitsOutEEToken_, std::move(recHitsOutEE));
128  }
129 }
const edm::EDPutTokenT< OutputProduct > recHitsOutEBToken_
const edm::EDPutTokenT< OutputProduct > recHitsOutEEToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ containsTimingInformation_

const bool EcalCPUUncalibRecHitProducer::containsTimingInformation_
private

Definition at line 38 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by acquire().

◆ isPhase2_

const bool EcalCPUUncalibRecHitProducer::isPhase2_
private

Definition at line 31 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by acquire(), and produce().

◆ recHitsEB_

OutputProduct EcalCPUUncalibRecHitProducer::recHitsEB_
private

Definition at line 37 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by acquire(), and produce().

◆ recHitsEE_

OutputProduct EcalCPUUncalibRecHitProducer::recHitsEE_
private

Definition at line 37 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by acquire(), and produce().

◆ recHitsInEBToken_

const edm::EDGetTokenT<InputProduct> EcalCPUUncalibRecHitProducer::recHitsInEBToken_
private

Definition at line 33 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by acquire().

◆ recHitsInEEToken_

const edm::EDGetTokenT<InputProduct> EcalCPUUncalibRecHitProducer::recHitsInEEToken_
private

Definition at line 33 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by acquire().

◆ recHitsOutEBToken_

const edm::EDPutTokenT<OutputProduct> EcalCPUUncalibRecHitProducer::recHitsOutEBToken_
private

Definition at line 35 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by produce().

◆ recHitsOutEEToken_

const edm::EDPutTokenT<OutputProduct> EcalCPUUncalibRecHitProducer::recHitsOutEEToken_
private

Definition at line 35 of file EcalCPUUncalibRecHitProducer.cc.

Referenced by produce().