CMS 3D CMS Logo

PFRecHitHCALParamsESProducer.cc
Go to the documentation of this file.
1 #include <array>
2 #include <memory>
3 #include <vector>
4 
10 #include "CalorimeterDefinitions.h"
11 
13  using namespace particleFlowRecHitProducer;
14 
16  public:
18  : ESProducer(iConfig),
19  energyThresholdsHB_(iConfig.getParameter<std::array<double, HCAL::kMaxDepthHB>>("energyThresholdsHB")),
20  energyThresholdsHE_(iConfig.getParameter<std::array<double, HCAL::kMaxDepthHE>>("energyThresholdsHE")) {
21  setWhatProduced(this);
22  }
23 
24  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
26  desc.add<std::vector<double>>("energyThresholdsHB", {0.1, 0.2, 0.3, 0.3});
27  desc.add<std::vector<double>>("energyThresholdsHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2});
28  descriptions.addWithDefaultLabel(desc);
29  }
30 
31  std::unique_ptr<reco::PFRecHitHCALParamsHostCollection> produce(PFRecHitHCALParamsRecord const& iRecord) {
32  auto product = std::make_unique<reco::PFRecHitHCALParamsHostCollection>(HCAL::kMaxDepthHB + HCAL::kMaxDepthHE,
34  for (uint32_t idx = 0; idx < HCAL::kMaxDepthHB; ++idx) {
35  product->view().energyThresholds()[idx] = energyThresholdsHB_[idx];
36  }
37  for (uint32_t idx = 0; idx < HCAL::kMaxDepthHE; ++idx) {
38  product->view().energyThresholds()[idx + HCAL::kMaxDepthHB] = energyThresholdsHE_[idx];
39  }
40  return product;
41  }
42 
43  private:
44  std::array<double, HCAL::kMaxDepthHB> energyThresholdsHB_;
45  std::array<double, HCAL::kMaxDepthHE> energyThresholdsHE_;
46  };
47 
48 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
49 
51 DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(PFRecHitHCALParamsESProducer);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::unique_ptr< reco::PFRecHitHCALParamsHostCollection > produce(PFRecHitHCALParamsRecord const &iRecord)
alpaka::DevCpu const & host()
Definition: host.h:14
Definition: HCAL.py:1
#define DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(type)
Definition: ModuleFactory.h:17