CMS 3D CMS Logo

EcalUncalibRecHitSoAToLegacy.cc
Go to the documentation of this file.
13 
15 public:
17  ~EcalUncalibRecHitSoAToLegacy() override = default;
19 
20 private:
22  void produce(edm::Event &, edm::EventSetup const &) override;
23 
24 private:
25  const bool isPhase2_;
30 };
31 
34 
35  desc.add<edm::InputTag>("uncalibRecHitsPortableEB",
36  edm::InputTag("ecalMultiFitUncalibRecHitPortable", "EcalUncalibRecHitsEB"));
37  desc.add<std::string>("recHitsLabelCPUEB", "EcalUncalibRecHitsEB");
38  desc.ifValue(edm::ParameterDescription<bool>("isPhase2", false, true),
40  "uncalibRecHitsPortableEE",
41  edm::InputTag("ecalMultiFitUncalibRecHitPortable", "EcalUncalibRecHitsEE"),
42  true) and
43  edm::ParameterDescription<std::string>("recHitsLabelCPUEE", "EcalUncalibRecHitsEE", true)) or
44  true >> edm::EmptyGroupDescription());
45  confDesc.add("ecalUncalibRecHitSoAToLegacy", desc);
46 }
47 
49  : isPhase2_{ps.getParameter<bool>("isPhase2")},
50  uncalibRecHitsPortableEB_{consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibRecHitsPortableEB"))},
51  uncalibRecHitsPortableEE_{
52  isPhase2_ ? edm::EDGetTokenT<InputProduct>{}
53  : consumes<InputProduct>(ps.getParameter<edm::InputTag>("uncalibRecHitsPortableEE"))},
54  uncalibRecHitsCPUEBToken_{
55  produces<EBUncalibratedRecHitCollection>(ps.getParameter<std::string>("recHitsLabelCPUEB"))},
56  uncalibRecHitsCPUEEToken_{
58  : produces<EEUncalibratedRecHitCollection>(ps.getParameter<std::string>("recHitsLabelCPUEE"))} {}
59 
61  auto const &uncalRecHitsEBColl = event.get(uncalibRecHitsPortableEB_);
62  auto const &uncalRecHitsEBCollView = uncalRecHitsEBColl.const_view();
63  auto recHitsCPUEB = std::make_unique<EBUncalibratedRecHitCollection>();
64  recHitsCPUEB->reserve(uncalRecHitsEBCollView.size());
65 
66  for (uint32_t i = 0; i < uncalRecHitsEBCollView.size(); ++i) {
67  recHitsCPUEB->emplace_back(DetId{uncalRecHitsEBCollView.id()[i]},
68  uncalRecHitsEBCollView.amplitude()[i],
69  uncalRecHitsEBCollView.pedestal()[i],
70  uncalRecHitsEBCollView.jitter()[i],
71  uncalRecHitsEBCollView.chi2()[i],
72  uncalRecHitsEBCollView.flags()[i]);
73  if (isPhase2_) {
74  (*recHitsCPUEB)[i].setAmplitudeError(uncalRecHitsEBCollView.amplitudeError()[i]);
75  }
76  (*recHitsCPUEB)[i].setJitterError(uncalRecHitsEBCollView.jitterError()[i]);
77  for (uint32_t sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
78  (*recHitsCPUEB)[i].setOutOfTimeAmplitude(sample, uncalRecHitsEBCollView.outOfTimeAmplitudes()[i][sample]);
79  }
80  }
81  event.put(uncalibRecHitsCPUEBToken_, std::move(recHitsCPUEB));
82 
83  if (!isPhase2_) {
84  auto const &uncalRecHitsEEColl = event.get(uncalibRecHitsPortableEE_);
85  auto const &uncalRecHitsEECollView = uncalRecHitsEEColl.const_view();
86  auto recHitsCPUEE = std::make_unique<EEUncalibratedRecHitCollection>();
87  recHitsCPUEE->reserve(uncalRecHitsEECollView.size());
88 
89  for (uint32_t i = 0; i < uncalRecHitsEECollView.size(); ++i) {
90  recHitsCPUEE->emplace_back(DetId{uncalRecHitsEECollView.id()[i]},
91  uncalRecHitsEECollView.amplitude()[i],
92  uncalRecHitsEECollView.pedestal()[i],
93  uncalRecHitsEECollView.jitter()[i],
94  uncalRecHitsEECollView.chi2()[i],
95  uncalRecHitsEECollView.flags()[i]);
96  (*recHitsCPUEE)[i].setJitterError(uncalRecHitsEECollView.jitterError()[i]);
97  for (uint32_t sample = 0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
98  (*recHitsCPUEE)[i].setOutOfTimeAmplitude(sample, uncalRecHitsEECollView.outOfTimeAmplitudes()[i][sample]);
99  }
100  }
101  event.put(uncalibRecHitsCPUEEToken_, std::move(recHitsCPUEE));
102  }
103 }
104 
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDPutTokenT< EBUncalibratedRecHitCollection > uncalibRecHitsCPUEBToken_
~EcalUncalibRecHitSoAToLegacy() override=default
const edm::EDGetTokenT< InputProduct > uncalibRecHitsPortableEB_
const edm::EDPutTokenT< EEUncalibratedRecHitCollection > uncalibRecHitsCPUEEToken_
void produce(edm::Event &, edm::EventSetup const &) override
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
Definition: DetId.h:17
EcalUncalibRecHitSoAToLegacy(edm::ParameterSet const &ps)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< InputProduct > uncalibRecHitsPortableEE_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
PortableHostCollection< EcalUncalibratedRecHitSoA > EcalUncalibratedRecHitHostCollection