CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
l1thgcfirmware::HGCalTowerMap Class Reference

#include <HGCalTowerMap_SA.h>

Public Member Functions

bool addEt (short bin_id, float etEm, float etHad)
 
 HGCalTowerMap ()=default
 
 HGCalTowerMap (const std::vector< l1thgcfirmware::HGCalTowerCoord > &tower_ids)
 
HGCalTowerMapoperator+= (const HGCalTowerMap &map)
 
const std::unordered_map< unsigned short, l1thgcfirmware::HGCalTower > & towers () const
 
 ~HGCalTowerMap ()=default
 

Private Attributes

std::unordered_map< unsigned short, l1thgcfirmware::HGCalTowertowerMap_
 

Detailed Description

Definition at line 11 of file HGCalTowerMap_SA.h.

Constructor & Destructor Documentation

◆ HGCalTowerMap() [1/2]

l1thgcfirmware::HGCalTowerMap::HGCalTowerMap ( )
default

◆ HGCalTowerMap() [2/2]

HGCalTowerMap::HGCalTowerMap ( const std::vector< l1thgcfirmware::HGCalTowerCoord > &  tower_ids)

Definition at line 7 of file HGCalTowerMap_SA.cc.

References towerMap_.

7  {
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 }
std::unordered_map< unsigned short, l1thgcfirmware::HGCalTower > towerMap_

◆ ~HGCalTowerMap()

l1thgcfirmware::HGCalTowerMap::~HGCalTowerMap ( )
default

Member Function Documentation

◆ addEt()

bool HGCalTowerMap::addEt ( short  bin_id,
float  etEm,
float  etHad 
)

Definition at line 24 of file HGCalTowerMap_SA.cc.

References towerMap_.

Referenced by HGCalTowerMapsWrapper::convertCMSSWInputs().

24  {
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 }
std::unordered_map< unsigned short, l1thgcfirmware::HGCalTower > towerMap_

◆ operator+=()

HGCalTowerMap & HGCalTowerMap::operator+= ( const HGCalTowerMap map)

Definition at line 13 of file HGCalTowerMap_SA.cc.

References genParticles_cff::map, hgcalTowerProducer_cfi::tower, and towerMap_.

13  {
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 }
std::unordered_map< unsigned short, l1thgcfirmware::HGCalTower > towerMap_

◆ towers()

const std::unordered_map<unsigned short, l1thgcfirmware::HGCalTower>& l1thgcfirmware::HGCalTowerMap::towers ( ) const
inline

Definition at line 22 of file HGCalTowerMap_SA.h.

References towerMap_.

Referenced by HGCalTowerMapImplSA::runAlgorithm().

22 { return towerMap_; }
std::unordered_map< unsigned short, l1thgcfirmware::HGCalTower > towerMap_

Member Data Documentation

◆ towerMap_

std::unordered_map<unsigned short, l1thgcfirmware::HGCalTower> l1thgcfirmware::HGCalTowerMap::towerMap_
private

Definition at line 25 of file HGCalTowerMap_SA.h.

Referenced by addEt(), HGCalTowerMap(), operator+=(), and towers().