Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-18 08:23:38

0001 #include "L1Trigger/L1THGCal/interface/backend/HGCalTowerMap_SA.h"
0002 
0003 #include <unordered_map>
0004 
0005 using namespace l1thgcfirmware;
0006 
0007 HGCalTowerMap::HGCalTowerMap(const std::vector<l1thgcfirmware::HGCalTowerCoord>& tower_ids) {
0008   for (const auto tower_id : tower_ids) {
0009     towerMap_[tower_id.rawId] = l1thgcfirmware::HGCalTower(0., 0., tower_id.eta, tower_id.phi, tower_id.rawId);
0010   }
0011 }
0012 
0013 HGCalTowerMap& HGCalTowerMap::operator+=(const HGCalTowerMap& map) {
0014   for (const auto& tower : map.towers()) {
0015     auto this_tower = towerMap_.find(tower.first);
0016     if (this_tower != towerMap_.end()) {
0017       this_tower->second += tower.second;
0018     }
0019   }
0020 
0021   return *this;
0022 }
0023 
0024 bool HGCalTowerMap::addEt(short bin_id, float etEm, float etHad) {
0025   auto this_tower = towerMap_.find(bin_id);
0026   if (this_tower == towerMap_.end())
0027     return false;
0028   this_tower->second.addEtEm(etEm);
0029   this_tower->second.addEtHad(etHad);
0030   return true;
0031 }