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 
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void produce(edm::Event &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const edm::EDGetTokenT< InputProduct > recHitsGPUEB_
Definition: DetId.h:17
EcalRecHitConvertGPU2CPUFormat(edm::ParameterSet const &ps)
const edm::EDGetTokenT< InputProduct > recHitsGPUEE_
static void fillDescriptions(edm::ConfigurationDescriptions &)
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1