CMS 3D CMS Logo

EcalUncalibRecHitConvertGPU2CPUFormat.cc
Go to the documentation of this file.
10 
12 public:
16 
17 private:
19  void produce(edm::Event&, edm::EventSetup const&) override;
20 
21 private:
24 
26 };
27 
30 
31  desc.add<edm::InputTag>("recHitsLabelGPUEB", edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEB"));
32  desc.add<edm::InputTag>("recHitsLabelGPUEE", edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEE"));
33 
34  desc.add<std::string>("recHitsLabelCPUEB", "EcalUncalibRecHitsEB");
35  desc.add<std::string>("recHitsLabelCPUEE", "EcalUncalibRecHitsEE");
36 
37  confDesc.add("ecalUncalibRecHitConvertGPU2CPUFormat", desc);
38 }
39 
41  : recHitsGPUEB_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("recHitsLabelGPUEB"))},
42  recHitsGPUEE_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("recHitsLabelGPUEE"))},
43  recHitsLabelCPUEB_{ps.getParameter<std::string>("recHitsLabelCPUEB")},
44  recHitsLabelCPUEE_{ps.getParameter<std::string>("recHitsLabelCPUEE")} {
45  produces<EBUncalibratedRecHitCollection>(recHitsLabelCPUEB_);
46  produces<EEUncalibratedRecHitCollection>(recHitsLabelCPUEE_);
47 }
48 
50 
52  edm::Handle<InputProduct> hRecHitsGPUEB, hRecHitsGPUEE;
53  event.getByToken(recHitsGPUEB_, hRecHitsGPUEB);
54  event.getByToken(recHitsGPUEE_, hRecHitsGPUEE);
55 
56  auto recHitsCPUEB = std::make_unique<EBUncalibratedRecHitCollection>();
57  auto recHitsCPUEE = std::make_unique<EEUncalibratedRecHitCollection>();
58  recHitsCPUEB->reserve(hRecHitsGPUEB->amplitude.size());
59  recHitsCPUEE->reserve(hRecHitsGPUEE->amplitude.size());
60 
61  for (uint32_t i = 0; i < hRecHitsGPUEB->amplitude.size(); ++i) {
62  recHitsCPUEB->emplace_back(DetId{hRecHitsGPUEB->did[i]},
63  hRecHitsGPUEB->amplitude[i],
64  hRecHitsGPUEB->pedestal[i],
65  hRecHitsGPUEB->jitter[i],
66  hRecHitsGPUEB->chi2[i],
67  hRecHitsGPUEB->flags[i]);
68  (*recHitsCPUEB)[i].setJitterError(hRecHitsGPUEB->jitterError[i]);
69  auto const offset = i * EcalDataFrame::MAXSAMPLES;
70  for (uint32_t sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample)
71  (*recHitsCPUEB)[i].setOutOfTimeAmplitude(sample, hRecHitsGPUEB->amplitudesAll[offset + sample]);
72  }
73 
74  for (uint32_t i = 0; i < hRecHitsGPUEE->amplitude.size(); ++i) {
75  recHitsCPUEE->emplace_back(DetId{hRecHitsGPUEE->did[i]},
76  hRecHitsGPUEE->amplitude[i],
77  hRecHitsGPUEE->pedestal[i],
78  hRecHitsGPUEE->jitter[i],
79  hRecHitsGPUEE->chi2[i],
80  hRecHitsGPUEE->flags[i]);
81  (*recHitsCPUEE)[i].setJitterError(hRecHitsGPUEE->jitterError[i]);
82  auto const offset = i * EcalDataFrame::MAXSAMPLES;
83  for (uint32_t sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample)
84  (*recHitsCPUEE)[i].setOutOfTimeAmplitude(sample, hRecHitsGPUEE->amplitudesAll[offset + sample]);
85  }
86 
87  event.put(std::move(recHitsCPUEB), recHitsLabelCPUEB_);
88  event.put(std::move(recHitsCPUEE), recHitsLabelCPUEE_);
89 }
90 
EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
EcalUncalibRecHitConvertGPU2CPUFormat::~EcalUncalibRecHitConvertGPU2CPUFormat
~EcalUncalibRecHitConvertGPU2CPUFormat() override
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:49
ecal::UncalibratedRecHit::jitter
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type jitter
Definition: EcalUncalibratedRecHit.h:26
mps_fire.i
i
Definition: mps_fire.py:428
ecal::UncalibratedRecHit::jitterError
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type jitterError
Definition: EcalUncalibratedRecHit.h:27
ecal::UncalibratedRecHit::amplitudesAll
StoragePolicy::template StorageSelector< reco::ComputationScalarType >::type amplitudesAll
Definition: EcalUncalibratedRecHit.h:22
simplePhotonAnalyzer_cfi.sample
sample
Definition: simplePhotonAnalyzer_cfi.py:12
EcalUncalibRecHitConvertGPU2CPUFormat::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:28
EcalUncalibRecHitConvertGPU2CPUFormat::recHitsGPUEE_
const edm::EDGetTokenT< InputProduct > recHitsGPUEE_
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:23
edm::EDGetTokenT
Definition: EDGetToken.h:33
EcalUncalibRecHitConvertGPU2CPUFormat
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:11
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
EcalRecHitCollections.h
ecal::UncalibratedRecHit::did
StoragePolicy::template StorageSelector< uint32_t >::type did
Definition: EcalUncalibratedRecHit.h:28
DetId
Definition: DetId.h:17
MakerMacros.h
EcalUncalibRecHitConvertGPU2CPUFormat::recHitsLabelCPUEB_
const std::string recHitsLabelCPUEB_
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:25
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EcalUncalibRecHitConvertGPU2CPUFormat::EcalUncalibRecHitConvertGPU2CPUFormat
EcalUncalibRecHitConvertGPU2CPUFormat(edm::ParameterSet const &ps)
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:40
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
EcalDigiCollections.h
ecal::UncalibratedRecHit::pedestal
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type pedestal
Definition: EcalUncalibratedRecHit.h:25
EcalUncalibratedRecHit.h
EcalUncalibRecHitConvertGPU2CPUFormat::recHitsLabelCPUEE_
const std::string recHitsLabelCPUEE_
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:25
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
EcalUncalibratedRecHit.h
ecal::UncalibratedRecHit::amplitude
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type amplitude
Definition: EcalUncalibratedRecHit.h:23
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
EcalUncalibRecHitConvertGPU2CPUFormat::recHitsGPUEB_
const edm::EDGetTokenT< InputProduct > recHitsGPUEB_
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:22
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalUncalibRecHitConvertGPU2CPUFormat::produce
void produce(edm::Event &, edm::EventSetup const &) override
Definition: EcalUncalibRecHitConvertGPU2CPUFormat.cc:51
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
ecal::UncalibratedRecHit< calo::common::VecStoragePolicy< calo::common::CUDAHostAllocatorAlias > >
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ecal::UncalibratedRecHit::chi2
StoragePolicy::template StorageSelector< reco::StorageScalarType >::type chi2
Definition: EcalUncalibratedRecHit.h:24
ParameterSet.h
ecal::UncalibratedRecHit::flags
StoragePolicy::template StorageSelector< uint32_t >::type flags
Definition: EcalUncalibratedRecHit.h:29
event
Definition: event.py:1
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15