CMS 3D CMS Logo

EcalRecHitConvertGPU2CPUFormat.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("ecalRecHitProducerGPU", "EcalRecHitsGPUEB"));
32  desc.add<edm::InputTag>("recHitsLabelGPUEE", edm::InputTag("ecalRecHitProducerGPU", "EcalRecHitsGPUEE"));
33 
34  desc.add<std::string>("recHitsLabelCPUEB", "EcalRecHitsEB");
35  desc.add<std::string>("recHitsLabelCPUEE", "EcalRecHitsEE");
36 
37  confDesc.addWithDefaultLabel(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<EBRecHitCollection>(recHitsLabelCPUEB_);
46  produces<EERecHitCollection>(recHitsLabelCPUEE_);
47 }
48 
50 
52  auto const& hRecHitsGPUEB = event.get(recHitsGPUEB_);
53  auto const& hRecHitsGPUEE = event.get(recHitsGPUEE_);
54 
55  auto recHitsCPUEB = std::make_unique<EBRecHitCollection>();
56  auto recHitsCPUEE = std::make_unique<EERecHitCollection>();
57  recHitsCPUEB->reserve(hRecHitsGPUEB.energy.size());
58  recHitsCPUEE->reserve(hRecHitsGPUEE.energy.size());
59 
60  for (uint32_t i = 0; i < hRecHitsGPUEB.energy.size(); ++i) {
61  //
62  // Save only if energy is >= 0 !
63  // This is extremely important because the channels that were supposed
64  // to be excluded get "-1" as energy
65  //
66 
67  if (hRecHitsGPUEB.energy[i] >= 0) {
68  recHitsCPUEB->emplace_back(DetId{hRecHitsGPUEB.did[i]},
69  hRecHitsGPUEB.energy[i],
70  hRecHitsGPUEB.time[i],
71  hRecHitsGPUEB.extra[i],
72  hRecHitsGPUEB.flagBits[i]);
73  }
74  }
75 
76  for (uint32_t i = 0; i < hRecHitsGPUEE.energy.size(); ++i) {
77  //
78  // Save only if energy is >= 0 !
79  // This is extremely important because the channels that were supposed
80  // to be excluded get "-1" as energy
81  //
82 
83  if (hRecHitsGPUEE.energy[i] >= 0) {
84  recHitsCPUEE->emplace_back(DetId{hRecHitsGPUEE.did[i]},
85  hRecHitsGPUEE.energy[i],
86  hRecHitsGPUEE.time[i],
87  hRecHitsGPUEE.extra[i],
88  hRecHitsGPUEE.flagBits[i]);
89  }
90  }
91 
92  event.put(std::move(recHitsCPUEB), recHitsLabelCPUEB_);
93  event.put(std::move(recHitsCPUEE), recHitsLabelCPUEE_);
94 }
95 
EcalRecHitConvertGPU2CPUFormat::recHitsLabelCPUEE_
const std::string recHitsLabelCPUEE_
Definition: EcalRecHitConvertGPU2CPUFormat.cc:25
mps_fire.i
i
Definition: mps_fire.py:428
edm::EDGetTokenT
Definition: EDGetToken.h:33
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
EcalRecHitConvertGPU2CPUFormat::EcalRecHitConvertGPU2CPUFormat
EcalRecHitConvertGPU2CPUFormat(edm::ParameterSet const &ps)
Definition: EcalRecHitConvertGPU2CPUFormat.cc:40
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
EcalRecHitCollections.h
EcalRecHitConvertGPU2CPUFormat::recHitsGPUEE_
const edm::EDGetTokenT< InputProduct > recHitsGPUEE_
Definition: EcalRecHitConvertGPU2CPUFormat.cc:23
DetId
Definition: DetId.h:17
EcalRecHitConvertGPU2CPUFormat::recHitsLabelCPUEB_
const std::string recHitsLabelCPUEB_
Definition: EcalRecHitConvertGPU2CPUFormat.cc:25
MakerMacros.h
EcalRecHitConvertGPU2CPUFormat
Definition: EcalRecHitConvertGPU2CPUFormat.cc:11
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EcalRecHitConvertGPU2CPUFormat::~EcalRecHitConvertGPU2CPUFormat
~EcalRecHitConvertGPU2CPUFormat() override
Definition: EcalRecHitConvertGPU2CPUFormat.cc:49
EcalDigiCollections.h
EcalRecHit.h
EcalRecHit.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
EcalRecHitConvertGPU2CPUFormat::produce
void produce(edm::Event &, edm::EventSetup const &) override
Definition: EcalRecHitConvertGPU2CPUFormat.cc:51
edm::stream::EDProducer
Definition: EDProducer.h:38
EcalRecHitConvertGPU2CPUFormat::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: EcalRecHitConvertGPU2CPUFormat.cc:28
edm::EventSetup
Definition: EventSetup.h:58
EcalRecHitConvertGPU2CPUFormat::recHitsGPUEB_
const edm::EDGetTokenT< InputProduct > recHitsGPUEB_
Definition: EcalRecHitConvertGPU2CPUFormat.cc:22
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
ecal::RecHit< calo::common::VecStoragePolicy< calo::common::CUDAHostAllocatorAlias > >