CMS 3D CMS Logo

EcalUncalibRecHitConvertGPU2CPUFormat.cc
Go to the documentation of this file.
11 
13 public:
17 
18 private:
20  void produce(edm::Event&, edm::EventSetup const&) override;
21 
22 private:
23  const bool isPhase2_;
26 
29 };
30 
33 
34  desc.add<edm::InputTag>("recHitsLabelGPUEB", edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEB"));
35  desc.add<std::string>("recHitsLabelCPUEB", "EcalUncalibRecHitsEB");
36  desc.ifValue(
37  edm::ParameterDescription<bool>("isPhase2", false, true),
38  false >>
40  "recHitsLabelGPUEE", edm::InputTag("ecalUncalibRecHitProducerGPU", "EcalUncalibRecHitsEE"), true) and
41  edm::ParameterDescription<std::string>("recHitsLabelCPUEE", "EcalUncalibRecHitsEE", true)) or
42  true >> edm::EmptyGroupDescription());
43  confDesc.add("ecalUncalibRecHitConvertGPU2CPUFormat", desc);
44 }
45 
47  : isPhase2_{ps.getParameter<bool>("isPhase2")},
48  recHitsGPUEB_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("recHitsLabelGPUEB"))},
49  recHitsGPUEE_{isPhase2_ ? edm::EDGetTokenT<InputProduct>{}
50  : consumes<InputProduct>(ps.getParameter<edm::InputTag>("recHitsLabelGPUEE"))},
51  recHitsLabelCPUEB_{ps.getParameter<std::string>("recHitsLabelCPUEB")},
52  recHitsLabelCPUEE_{isPhase2_ ? std::string{""} : ps.getParameter<std::string>("recHitsLabelCPUEE")} {
53  produces<EBUncalibratedRecHitCollection>(recHitsLabelCPUEB_);
54  if (!isPhase2_)
55  produces<EEUncalibratedRecHitCollection>(recHitsLabelCPUEE_);
56 }
57 
59 
61  auto const& recHitsGPUEB = event.get(recHitsGPUEB_);
62  auto recHitsCPUEB = std::make_unique<EBUncalibratedRecHitCollection>();
63  recHitsCPUEB->reserve(recHitsGPUEB.amplitude.size());
64 
65  for (uint32_t i = 0; i < recHitsGPUEB.amplitude.size(); ++i) {
66  recHitsCPUEB->emplace_back(DetId{recHitsGPUEB.did[i]},
67  recHitsGPUEB.amplitude[i],
68  recHitsGPUEB.pedestal[i],
69  recHitsGPUEB.jitter[i],
70  recHitsGPUEB.chi2[i],
71  recHitsGPUEB.flags[i]);
72  if (isPhase2_)
73  (*recHitsCPUEB)[i].setAmplitudeError(recHitsGPUEB.amplitudeError[i]);
74  (*recHitsCPUEB)[i].setJitterError(recHitsGPUEB.jitterError[i]);
75  auto const offset = i * EcalDataFrame::MAXSAMPLES;
76  for (uint32_t sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample)
77  (*recHitsCPUEB)[i].setOutOfTimeAmplitude(sample, recHitsGPUEB.amplitudesAll[offset + sample]);
78  }
79  if (!isPhase2_) {
80  auto const& recHitsGPUEE = event.get(recHitsGPUEE_);
81  auto recHitsCPUEE = std::make_unique<EEUncalibratedRecHitCollection>();
82  recHitsCPUEE->reserve(recHitsGPUEE.amplitude.size());
83  for (uint32_t i = 0; i < recHitsGPUEE.amplitude.size(); ++i) {
84  recHitsCPUEE->emplace_back(DetId{recHitsGPUEE.did[i]},
85  recHitsGPUEE.amplitude[i],
86  recHitsGPUEE.pedestal[i],
87  recHitsGPUEE.jitter[i],
88  recHitsGPUEE.chi2[i],
89  recHitsGPUEE.flags[i]);
90  (*recHitsCPUEE)[i].setJitterError(recHitsGPUEE.jitterError[i]);
91  auto const offset = i * EcalDataFrame::MAXSAMPLES;
92  for (uint32_t sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
93  (*recHitsCPUEE)[i].setOutOfTimeAmplitude(sample, recHitsGPUEE.amplitudesAll[offset + sample]);
94  }
95  }
96  event.put(std::move(recHitsCPUEE), recHitsLabelCPUEE_);
97  }
98  event.put(std::move(recHitsCPUEB), recHitsLabelCPUEB_);
99 }
100 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< InputProduct > recHitsGPUEB_
static void fillDescriptions(edm::ConfigurationDescriptions &)
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void produce(edm::Event &, edm::EventSetup const &) override
Definition: DetId.h:17
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< InputProduct > recHitsGPUEE_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1