CMS 3D CMS Logo

HGCalTowerMapsWrapper.cc
Go to the documentation of this file.
2 
5 
9 
14 
18 
20 public:
22  ~HGCalTowerMapsWrapper() override = default;
23 
24  void configure(const std::pair<const HGCalTriggerGeometryBase* const, const edm::ParameterSet&>& parameters) override;
25 
27  l1t::HGCalTowerBxCollection& outputs) const override;
28 
29 private:
31  std::vector<l1thgcfirmware::HGCalTowerMap>& towerMaps_SA) const;
32  void convertAlgorithmOutputs(const std::vector<l1thgcfirmware::HGCalTower>& towerMaps_SA,
33  l1t::HGCalTowerBxCollection& outputTowerMaps) const;
34 
36 
37  std::unique_ptr<l1thgcfirmware::TowerMapsAlgoConfig> theConfiguration_;
38 };
39 
41 
43  std::vector<l1thgcfirmware::HGCalTowerMap>& towerMaps_SA) const {
44  for (const auto& map : inputTowerMaps) {
45  std::vector<l1thgcfirmware::HGCalTowerCoord> tower_ids;
46  for (const auto& tower : map->towers()) {
47  tower_ids.emplace_back(tower.first, tower.second.eta(), tower.second.phi());
48  }
49 
50  l1thgcfirmware::HGCalTowerMap towerMapSA(tower_ids);
51 
52  for (const auto& tower : map->towers()) {
53  towerMapSA.addEt(tower.first, tower.second.etEm(), tower.second.etHad());
54  }
55  towerMaps_SA.emplace_back(towerMapSA);
56  }
57 }
58 
59 void HGCalTowerMapsWrapper::convertAlgorithmOutputs(const std::vector<l1thgcfirmware::HGCalTower>& towers_SA,
60  l1t::HGCalTowerBxCollection& outputTowerMaps) const {
61  for (const auto& towerSA : towers_SA) {
62  outputTowerMaps.push_back(
63  0, l1t::HGCalTower(towerSA.etEm(), towerSA.etHad(), towerSA.eta(), towerSA.phi(), towerSA.id()));
64  }
65 }
66 
69  std::vector<l1thgcfirmware::HGCalTowerMap> inputs_SA;
70  convertCMSSWInputs(inputs, inputs_SA);
71 
72  std::vector<l1thgcfirmware::HGCalTower> outputs_SA;
73  theAlgo_.runAlgorithm(inputs_SA, outputs_SA);
74 
75  convertAlgorithmOutputs(outputs_SA, outputs);
76 }
77 
79  const std::pair<const HGCalTriggerGeometryBase* const, const edm::ParameterSet&>& parameters) {}
80 
std::unique_ptr< l1thgcfirmware::TowerMapsAlgoConfig > theConfiguration_
void convertCMSSWInputs(const std::vector< edm::Ptr< l1t::HGCalTowerMap >> &inputTowerMaps, std::vector< l1thgcfirmware::HGCalTowerMap > &towerMaps_SA) const
void convertAlgorithmOutputs(const std::vector< l1thgcfirmware::HGCalTower > &towerMaps_SA, l1t::HGCalTowerBxCollection &outputTowerMaps) const
bool addEt(short bin_id, float etEm, float etHad)
void process(const std::vector< edm::Ptr< l1t::HGCalTowerMap >> &inputs, l1t::HGCalTowerBxCollection &outputs) const override
void runAlgorithm(const std::vector< l1thgcfirmware::HGCalTowerMap > &inputTowerMaps_SA, std::vector< l1thgcfirmware::HGCalTower > &outputTowers_SA) const
HGCalTowerMapsWrapper(const edm::ParameterSet &conf)
void configure(const std::pair< const HGCalTriggerGeometryBase *const, const edm::ParameterSet &> &parameters) override
~HGCalTowerMapsWrapper() override=default
#define DEFINE_EDM_PLUGIN(factory, type, name)
void push_back(int bx, T object)
HGCalTowerMapImplSA theAlgo_