CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HGCalTowerMap_SA.cc
Go to the documentation of this file.
2 
3 #include <unordered_map>
4 
5 using namespace l1thgcfirmware;
6 
7 HGCalTowerMap::HGCalTowerMap(const std::vector<l1thgcfirmware::HGCalTowerCoord>& tower_ids) {
8  for (const auto tower_id : tower_ids) {
9  towerMap_[tower_id.rawId] = l1thgcfirmware::HGCalTower(0., 0., tower_id.eta, tower_id.phi, tower_id.rawId);
10  }
11 }
12 
14  for (const auto& tower : map.towers()) {
15  auto this_tower = towerMap_.find(tower.first);
16  if (this_tower != towerMap_.end()) {
17  this_tower->second += tower.second;
18  }
19  }
20 
21  return *this;
22 }
23 
24 bool HGCalTowerMap::addEt(short bin_id, float etEm, float etHad) {
25  auto this_tower = towerMap_.find(bin_id);
26  if (this_tower == towerMap_.end())
27  return false;
28  this_tower->second.addEtEm(etEm);
29  this_tower->second.addEtHad(etHad);
30  return true;
31 }
bool addEt(short bin_id, float etEm, float etHad)
const std::unordered_map< unsigned short, l1thgcfirmware::HGCalTower > & towers() const
HGCalTowerMap & operator+=(const HGCalTowerMap &map)
std::unordered_map< unsigned short, l1thgcfirmware::HGCalTower > towerMap_