CMS 3D CMS Logo

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

#include <HGCalTowerMap.h>

Public Member Functions

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

Private Attributes

unsigned layer_
 
std::unordered_map< unsigned short, l1t::HGCalTowertowerMap_
 

Detailed Description

Definition at line 15 of file HGCalTowerMap.h.

Constructor & Destructor Documentation

l1t::HGCalTowerMap::HGCalTowerMap ( )
inline

Definition at line 19 of file HGCalTowerMap.h.

References layer().

19 : layer_(0) {}
HGCalTowerMap::HGCalTowerMap ( const std::vector< l1t::HGCalTowerCoord > &  tower_ids,
const int  layer = 0 
)

Definition at line 8 of file HGCalTowerMap.cc.

References towerMap_.

9  : layer_(layer) {
10  for(auto tower_id: tower_ids) {
11  towerMap_[tower_id.rawId] = l1t::HGCalTower(0., 0., tower_id.eta, tower_id.phi, tower_id.rawId);
12  }
13 }
int layer() const
Definition: HGCalTowerMap.h:23
std::unordered_map< unsigned short, l1t::HGCalTower > towerMap_
Definition: HGCalTowerMap.h:35

Member Function Documentation

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

Definition at line 37 of file HGCalTowerMap.cc.

References towerMap_.

Referenced by layer().

37  {
38  auto this_tower = towerMap_.find(bin_id);
39  if(this_tower == towerMap_.end()) return false;
40  this_tower->second.addEtEm(etEm);
41  this_tower->second.addEtHad(etHad);
42 
43  return true;
44 }
std::unordered_map< unsigned short, l1t::HGCalTower > towerMap_
Definition: HGCalTowerMap.h:35
int l1t::HGCalTowerMap::layer ( ) const
inline
unsigned l1t::HGCalTowerMap::nTowers ( ) const
inline

Definition at line 29 of file HGCalTowerMap.h.

References towerMap_.

Referenced by operator+=().

29 { return towerMap_.size(); }
std::unordered_map< unsigned short, l1t::HGCalTower > towerMap_
Definition: HGCalTowerMap.h:35
const HGCalTowerMap & HGCalTowerMap::operator+= ( const HGCalTowerMap map)

Definition at line 17 of file HGCalTowerMap.cc.

References Exception, nTowers(), edm::errors::StdException, towerMap_, and towers().

Referenced by layer().

17  {
18  if (nTowers() != map.nTowers()) {
19  throw edm::Exception(edm::errors::StdException, "StdException")
20  << "HGCalTowerMap: Trying to add HGCalTowerMaps with different bins: " << nTowers() << " and " << map.nTowers() <<endl;
21  }
22 
23  for(auto tower: map.towers()) {
24  auto this_tower = towerMap_.find(tower.first);
25  if(this_tower == towerMap_.end()) {
26  throw edm::Exception(edm::errors::StdException, "StdException")
27  << "HGCalTowerMap: Trying to add HGCalTowerMaps but could not find bin: " << tower.first <<endl;
28  } else {
29  this_tower->second+=tower.second;
30  }
31 
32  }
33  return *this;
34 }
const std::unordered_map< unsigned short, l1t::HGCalTower > & towers() const
Definition: HGCalTowerMap.h:30
std::unordered_map< unsigned short, l1t::HGCalTower > towerMap_
Definition: HGCalTowerMap.h:35
unsigned nTowers() const
Definition: HGCalTowerMap.h:29
const std::unordered_map<unsigned short, l1t::HGCalTower>& l1t::HGCalTowerMap::towers ( ) const
inline

Definition at line 30 of file HGCalTowerMap.h.

References towerMap_.

Referenced by HGCalTowerMap3DImpl::buildTowerMap3D(), and operator+=().

30 { return towerMap_; }
std::unordered_map< unsigned short, l1t::HGCalTower > towerMap_
Definition: HGCalTowerMap.h:35

Member Data Documentation

unsigned l1t::HGCalTowerMap::layer_
private

Definition at line 36 of file HGCalTowerMap.h.

Referenced by layer().

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

Definition at line 35 of file HGCalTowerMap.h.

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