CMS 3D CMS Logo

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

Public Member Functions

 EcalCPUDigisProducer (edm::ParameterSet const &ps)
 
 ~EcalCPUDigisProducer () override
 
- 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::DigisCollection< calo::common::DevStoragePolicy > >
 

Private Member Functions

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

Private Attributes

std::vector< uint16_t, cms::cuda::HostAllocator< uint16_t > > dataebtmp
 
std::vector< uint16_t, cms::cuda::HostAllocator< uint16_t > > dataeetmp
 
edm::EDGetTokenT< InputProductdigisInEBToken_
 
edm::EDGetTokenT< InputProductdigisInEEToken_
 
edm::EDPutTokenT< EBDigiCollectiondigisOutEBToken_
 
edm::EDPutTokenT< EEDigiCollectiondigisOutEEToken_
 
edm::EDPutTokenT< EBDetIdCollectionebIntegrityChIdErrorsToken_
 
edm::EDPutTokenT< EBDetIdCollectionebIntegrityGainErrorsToken_
 
edm::EDPutTokenT< EBDetIdCollectionebIntegrityGainSwitchErrorsToken_
 
edm::EDPutTokenT< EBSrFlagCollectionebSrFlagToken_
 
edm::EDPutTokenT< EEDetIdCollectioneeIntegrityChIdErrorsToken_
 
edm::EDPutTokenT< EEDetIdCollectioneeIntegrityGainErrorsToken_
 
edm::EDPutTokenT< EEDetIdCollectioneeIntegrityGainSwitchErrorsToken_
 
edm::EDPutTokenT< EESrFlagCollectioneeSrFlagToken_
 
std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > idsebtmp
 
std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > idseetmp
 
edm::EDPutTokenT< EcalElectronicsIdCollectionintegrityBlockSizeErrorsToken_
 
edm::EDPutTokenT< EcalElectronicsIdCollectionintegrityTTIdErrorsToken_
 
bool produceDummyIntegrityCollections_
 

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 23 of file EcalCPUDigisProducer.cc.

Member Typedef Documentation

◆ InputProduct

Definition at line 35 of file EcalCPUDigisProducer.cc.

Constructor & Destructor Documentation

◆ EcalCPUDigisProducer()

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

Definition at line 83 of file EcalCPUDigisProducer.cc.

84  : // input digi collections in GPU-friendly format
85  digisInEBToken_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("digisInLabelEB"))},
86  digisInEEToken_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("digisInLabelEE"))},
87  // output digi collections in legacy format
88  digisOutEBToken_{produces<EBDigiCollection>(ps.getParameter<std::string>("digisOutLabelEB"))},
89  digisOutEEToken_{produces<EEDigiCollection>(ps.getParameter<std::string>("digisOutLabelEE"))},
90  // whether to produce dummy integrity collections
91  produceDummyIntegrityCollections_{ps.getParameter<bool>("produceDummyIntegrityCollections")},
92  // dummy SRP collections
93  ebSrFlagToken_{produceDummyIntegrityCollections_ ? produces<EBSrFlagCollection>()
94  : edm::EDPutTokenT<EBSrFlagCollection>{}},
95  eeSrFlagToken_{produceDummyIntegrityCollections_ ? produces<EESrFlagCollection>()
96  : edm::EDPutTokenT<EESrFlagCollection>{}},
97  // dummy integrity for xtal data
99  ? produces<EBDetIdCollection>("EcalIntegrityGainErrors")
100  : edm::EDPutTokenT<EBDetIdCollection>{}},
102  ? produces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors")
103  : edm::EDPutTokenT<EBDetIdCollection>{}},
105  ? produces<EBDetIdCollection>("EcalIntegrityChIdErrors")
106  : edm::EDPutTokenT<EBDetIdCollection>{}},
107  // dummy integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
109  ? produces<EEDetIdCollection>("EcalIntegrityGainErrors")
110  : edm::EDPutTokenT<EEDetIdCollection>{}},
112  ? produces<EEDetIdCollection>("EcalIntegrityGainSwitchErrors")
113  : edm::EDPutTokenT<EEDetIdCollection>{}},
115  ? produces<EEDetIdCollection>("EcalIntegrityChIdErrors")
116  : edm::EDPutTokenT<EEDetIdCollection>{}},
117  // dummy integrity errors
119  ? produces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors")
120  : edm::EDPutTokenT<EcalElectronicsIdCollection>{}},
122  ? produces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors")
123  : edm::EDPutTokenT<EcalElectronicsIdCollection>{}} {}

References edm::ParameterSet::getParameter().

◆ ~EcalCPUDigisProducer()

EcalCPUDigisProducer::~EcalCPUDigisProducer ( )
override

Definition at line 125 of file EcalCPUDigisProducer.cc.

125 {}

Member Function Documentation

◆ acquire()

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

Definition at line 127 of file EcalCPUDigisProducer.cc.

129  {
130  // retrieve data/ctx
131  auto const& ebdigisProduct = event.get(digisInEBToken_);
132  auto const& eedigisProduct = event.get(digisInEEToken_);
133  cms::cuda::ScopedContextAcquire ctx{ebdigisProduct, std::move(taskHolder)};
134  auto const& ebdigis = ctx.get(ebdigisProduct);
135  auto const& eedigis = ctx.get(eedigisProduct);
136 
137  // resize tmp buffers
138  dataebtmp.resize(ebdigis.size * EcalDataFrame::MAXSAMPLES);
139  dataeetmp.resize(eedigis.size * EcalDataFrame::MAXSAMPLES);
140  idsebtmp.resize(ebdigis.size);
141  idseetmp.resize(eedigis.size);
142 
143  // enqeue transfers
144  cudaCheck(cudaMemcpyAsync(
145  dataebtmp.data(), ebdigis.data.get(), dataebtmp.size() * sizeof(uint16_t), cudaMemcpyDeviceToHost, ctx.stream()));
146  cudaCheck(cudaMemcpyAsync(
147  dataeetmp.data(), eedigis.data.get(), dataeetmp.size() * sizeof(uint16_t), cudaMemcpyDeviceToHost, ctx.stream()));
148  cudaCheck(cudaMemcpyAsync(
149  idsebtmp.data(), ebdigis.ids.get(), idsebtmp.size() * sizeof(uint32_t), cudaMemcpyDeviceToHost, ctx.stream()));
150  cudaCheck(cudaMemcpyAsync(
151  idseetmp.data(), eedigis.ids.get(), idseetmp.size() * sizeof(uint32_t), cudaMemcpyDeviceToHost, ctx.stream()));
152 }

References cudaCheck, dataebtmp, dataeetmp, digisInEBToken_, digisInEEToken_, idsebtmp, idseetmp, EcalDataFrame::MAXSAMPLES, and eostools::move().

◆ fillDescriptions()

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

Definition at line 69 of file EcalCPUDigisProducer.cc.

69  {
71 
72  desc.add<edm::InputTag>("digisInLabelEB", edm::InputTag{"ecalRawToDigiGPU", "ebDigis"});
73  desc.add<edm::InputTag>("digisInLabelEE", edm::InputTag{"ecalRawToDigiGPU", "eeDigis"});
74  desc.add<std::string>("digisOutLabelEB", "ebDigis");
75  desc.add<std::string>("digisOutLabelEE", "eeDigis");
76 
77  desc.add<bool>("produceDummyIntegrityCollections", false);
78 
79  std::string label = "ecalCPUDigisProducer";
80  confDesc.add(label, desc);
81 }

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

◆ produce()

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

Definition at line 154 of file EcalCPUDigisProducer.cc.

154  {
155  // output collections
156  auto digisEB = std::make_unique<EBDigiCollection>();
157  auto digisEE = std::make_unique<EEDigiCollection>();
158  digisEB->resize(idsebtmp.size());
159  digisEE->resize(idseetmp.size());
160 
161  // cast constness away
162  // use pointers to buffers instead of move operator= semantics
163  // cause we have different allocators in there...
164  auto* dataEB = const_cast<uint16_t*>(digisEB->data().data());
165  auto* dataEE = const_cast<uint16_t*>(digisEE->data().data());
166  auto* idsEB = const_cast<uint32_t*>(digisEB->ids().data());
167  auto* idsEE = const_cast<uint32_t*>(digisEE->ids().data());
168 
169  // copy data
170  std::memcpy(dataEB, dataebtmp.data(), dataebtmp.size() * sizeof(uint16_t));
171  std::memcpy(dataEE, dataeetmp.data(), dataeetmp.size() * sizeof(uint16_t));
172  std::memcpy(idsEB, idsebtmp.data(), idsebtmp.size() * sizeof(uint32_t));
173  std::memcpy(idsEE, idseetmp.data(), idseetmp.size() * sizeof(uint32_t));
174 
175  event.put(digisOutEBToken_, std::move(digisEB));
176  event.put(digisOutEEToken_, std::move(digisEE));
177 
179  // dummy SRP collections
180  event.emplace(ebSrFlagToken_);
181  event.emplace(eeSrFlagToken_);
182  // dummy integrity for xtal data
183  event.emplace(ebIntegrityGainErrorsToken_);
184  event.emplace(ebIntegrityGainSwitchErrorsToken_);
185  event.emplace(ebIntegrityChIdErrorsToken_);
186  // dummy integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
187  event.emplace(eeIntegrityGainErrorsToken_);
188  event.emplace(eeIntegrityGainSwitchErrorsToken_);
189  event.emplace(eeIntegrityChIdErrorsToken_);
190  // dummy integrity errors
191  event.emplace(integrityTTIdErrorsToken_);
192  event.emplace(integrityBlockSizeErrorsToken_);
193  }
194 }

References dataebtmp, dataeetmp, digisOutEBToken_, digisOutEEToken_, ebIntegrityChIdErrorsToken_, ebIntegrityGainErrorsToken_, ebIntegrityGainSwitchErrorsToken_, ebSrFlagToken_, eeIntegrityChIdErrorsToken_, eeIntegrityGainErrorsToken_, eeIntegrityGainSwitchErrorsToken_, eeSrFlagToken_, idsebtmp, idseetmp, integrityBlockSizeErrorsToken_, integrityTTIdErrorsToken_, eostools::move(), and produceDummyIntegrityCollections_.

Member Data Documentation

◆ dataebtmp

std::vector<uint16_t, cms::cuda::HostAllocator<uint16_t> > EcalCPUDigisProducer::dataebtmp
private

Definition at line 66 of file EcalCPUDigisProducer.cc.

Referenced by acquire(), and produce().

◆ dataeetmp

std::vector<uint16_t, cms::cuda::HostAllocator<uint16_t> > EcalCPUDigisProducer::dataeetmp
private

Definition at line 66 of file EcalCPUDigisProducer.cc.

Referenced by acquire(), and produce().

◆ digisInEBToken_

edm::EDGetTokenT<InputProduct> EcalCPUDigisProducer::digisInEBToken_
private

Definition at line 36 of file EcalCPUDigisProducer.cc.

Referenced by acquire().

◆ digisInEEToken_

edm::EDGetTokenT<InputProduct> EcalCPUDigisProducer::digisInEEToken_
private

Definition at line 37 of file EcalCPUDigisProducer.cc.

Referenced by acquire().

◆ digisOutEBToken_

edm::EDPutTokenT<EBDigiCollection> EcalCPUDigisProducer::digisOutEBToken_
private

Definition at line 40 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ digisOutEEToken_

edm::EDPutTokenT<EEDigiCollection> EcalCPUDigisProducer::digisOutEEToken_
private

Definition at line 41 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ ebIntegrityChIdErrorsToken_

edm::EDPutTokenT<EBDetIdCollection> EcalCPUDigisProducer::ebIntegrityChIdErrorsToken_
private

Definition at line 53 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ ebIntegrityGainErrorsToken_

edm::EDPutTokenT<EBDetIdCollection> EcalCPUDigisProducer::ebIntegrityGainErrorsToken_
private

Definition at line 51 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ ebIntegrityGainSwitchErrorsToken_

edm::EDPutTokenT<EBDetIdCollection> EcalCPUDigisProducer::ebIntegrityGainSwitchErrorsToken_
private

Definition at line 52 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ ebSrFlagToken_

edm::EDPutTokenT<EBSrFlagCollection> EcalCPUDigisProducer::ebSrFlagToken_
private

Definition at line 47 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ eeIntegrityChIdErrorsToken_

edm::EDPutTokenT<EEDetIdCollection> EcalCPUDigisProducer::eeIntegrityChIdErrorsToken_
private

Definition at line 58 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ eeIntegrityGainErrorsToken_

edm::EDPutTokenT<EEDetIdCollection> EcalCPUDigisProducer::eeIntegrityGainErrorsToken_
private

Definition at line 56 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ eeIntegrityGainSwitchErrorsToken_

edm::EDPutTokenT<EEDetIdCollection> EcalCPUDigisProducer::eeIntegrityGainSwitchErrorsToken_
private

Definition at line 57 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ eeSrFlagToken_

edm::EDPutTokenT<EESrFlagCollection> EcalCPUDigisProducer::eeSrFlagToken_
private

Definition at line 48 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ idsebtmp

std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t> > EcalCPUDigisProducer::idsebtmp
private

Definition at line 65 of file EcalCPUDigisProducer.cc.

Referenced by acquire(), and produce().

◆ idseetmp

std::vector<uint32_t, cms::cuda::HostAllocator<uint32_t> > EcalCPUDigisProducer::idseetmp
private

Definition at line 65 of file EcalCPUDigisProducer.cc.

Referenced by acquire(), and produce().

◆ integrityBlockSizeErrorsToken_

edm::EDPutTokenT<EcalElectronicsIdCollection> EcalCPUDigisProducer::integrityBlockSizeErrorsToken_
private

Definition at line 62 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ integrityTTIdErrorsToken_

edm::EDPutTokenT<EcalElectronicsIdCollection> EcalCPUDigisProducer::integrityTTIdErrorsToken_
private

Definition at line 61 of file EcalCPUDigisProducer.cc.

Referenced by produce().

◆ produceDummyIntegrityCollections_

bool EcalCPUDigisProducer::produceDummyIntegrityCollections_
private

Definition at line 44 of file EcalCPUDigisProducer.cc.

Referenced by produce().

EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
EcalCPUDigisProducer::idsebtmp
std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > idsebtmp
Definition: EcalCPUDigisProducer.cc:65
EcalCPUDigisProducer::digisOutEBToken_
edm::EDPutTokenT< EBDigiCollection > digisOutEBToken_
Definition: EcalCPUDigisProducer.cc:40
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::SortedCollection
Definition: SortedCollection.h:49
EcalCPUDigisProducer::ebSrFlagToken_
edm::EDPutTokenT< EBSrFlagCollection > ebSrFlagToken_
Definition: EcalCPUDigisProducer.cc:47
EcalCPUDigisProducer::digisInEEToken_
edm::EDGetTokenT< InputProduct > digisInEEToken_
Definition: EcalCPUDigisProducer.cc:37
EcalCPUDigisProducer::eeIntegrityGainErrorsToken_
edm::EDPutTokenT< EEDetIdCollection > eeIntegrityGainErrorsToken_
Definition: EcalCPUDigisProducer.cc:56
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
EcalCPUDigisProducer::eeIntegrityGainSwitchErrorsToken_
edm::EDPutTokenT< EEDetIdCollection > eeIntegrityGainSwitchErrorsToken_
Definition: EcalCPUDigisProducer.cc:57
EcalCPUDigisProducer::dataebtmp
std::vector< uint16_t, cms::cuda::HostAllocator< uint16_t > > dataebtmp
Definition: EcalCPUDigisProducer.cc:66
EcalCPUDigisProducer::ebIntegrityChIdErrorsToken_
edm::EDPutTokenT< EBDetIdCollection > ebIntegrityChIdErrorsToken_
Definition: EcalCPUDigisProducer.cc:53
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalCPUDigisProducer::produceDummyIntegrityCollections_
bool produceDummyIntegrityCollections_
Definition: EcalCPUDigisProducer.cc:44
EcalCPUDigisProducer::ebIntegrityGainErrorsToken_
edm::EDPutTokenT< EBDetIdCollection > ebIntegrityGainErrorsToken_
Definition: EcalCPUDigisProducer.cc:51
EcalCPUDigisProducer::digisOutEEToken_
edm::EDPutTokenT< EEDigiCollection > digisOutEEToken_
Definition: EcalCPUDigisProducer.cc:41
EcalCPUDigisProducer::ebIntegrityGainSwitchErrorsToken_
edm::EDPutTokenT< EBDetIdCollection > ebIntegrityGainSwitchErrorsToken_
Definition: EcalCPUDigisProducer.cc:52
edm::EDCollection
Definition: EDCollection.h:16
EcalCPUDigisProducer::integrityBlockSizeErrorsToken_
edm::EDPutTokenT< EcalElectronicsIdCollection > integrityBlockSizeErrorsToken_
Definition: EcalCPUDigisProducer.cc:62
cms::cuda::ScopedContextAcquire
Definition: ScopedContext.h:101
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
cudaCheck
#define cudaCheck(ARG,...)
Definition: cudaCheck.h:62
EcalCPUDigisProducer::idseetmp
std::vector< uint32_t, cms::cuda::HostAllocator< uint32_t > > idseetmp
Definition: EcalCPUDigisProducer.cc:65
EcalCPUDigisProducer::integrityTTIdErrorsToken_
edm::EDPutTokenT< EcalElectronicsIdCollection > integrityTTIdErrorsToken_
Definition: EcalCPUDigisProducer.cc:61
EcalCPUDigisProducer::digisInEBToken_
edm::EDGetTokenT< InputProduct > digisInEBToken_
Definition: EcalCPUDigisProducer.cc:36
EcalCPUDigisProducer::eeSrFlagToken_
edm::EDPutTokenT< EESrFlagCollection > eeSrFlagToken_
Definition: EcalCPUDigisProducer.cc:48
EcalCPUDigisProducer::dataeetmp
std::vector< uint16_t, cms::cuda::HostAllocator< uint16_t > > dataeetmp
Definition: EcalCPUDigisProducer.cc:66
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
EcalCPUDigisProducer::eeIntegrityChIdErrorsToken_
edm::EDPutTokenT< EEDetIdCollection > eeIntegrityChIdErrorsToken_
Definition: EcalCPUDigisProducer.cc:58