CMS 3D CMS Logo

PFRecHitECALParamsESProducer.cc
Go to the documentation of this file.
1 #include <memory>
2 
10 
12  using namespace particleFlowRecHitProducer;
13 
15  public:
17  : ESProducer(iConfig), cleaningThreshold_(iConfig.getParameter<double>("cleaningThreshold")) {
18  auto cc = setWhatProduced(this);
19  thresholdsToken_ = cc.consumes();
20  }
21 
22  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
24  desc.add<double>("cleaningThreshold", 2);
25  descriptions.addWithDefaultLabel(desc);
26  }
27 
28  std::unique_ptr<reco::PFRecHitECALParamsHostCollection> produce(const EcalPFRecHitThresholdsRcd& iRecord) {
29  const auto& thresholds = iRecord.get(thresholdsToken_);
30  auto product = std::make_unique<reco::PFRecHitECALParamsHostCollection>(ECAL::kSize, cms::alpakatools::host());
31  for (uint32_t denseId = 0; denseId < ECAL::Barrel::kSize; denseId++)
32  product->view().energyThresholds()[denseId] = thresholds.barrel(denseId);
33  for (uint32_t denseId = 0; denseId < ECAL::Endcap::kSize; denseId++)
34  product->view().energyThresholds()[denseId + ECAL::Barrel::kSize] = thresholds.endcap(denseId);
35  product->view().cleaningThreshold() = cleaningThreshold_;
36  return product;
37  }
38 
39  private:
40  const double cleaningThreshold_;
42  };
43 
44 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
45 
47 DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(PFRecHitECALParamsESProducer);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
std::unique_ptr< reco::PFRecHitECALParamsHostCollection > produce(const EcalPFRecHitThresholdsRcd &iRecord)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
alpaka::DevCpu const & host()
Definition: host.h:14
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > thresholdsToken_
#define DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(type)
Definition: ModuleFactory.h:17