CMS 3D CMS Logo

HGCalTowerMap.cc
Go to the documentation of this file.
5 
6 using namespace l1t;
7 
8 HGCalTowerMap::HGCalTowerMap(const std::vector<HGCalTowerCoord>& tower_ids, const int layer = 0) : layer_(layer) {
9  for (auto tower_id : tower_ids) {
10  towerMap_[tower_id.rawId] = l1t::HGCalTower(0., 0., tower_id.eta, tower_id.phi, tower_id.rawId);
11  }
12 }
13 
15  if (nTowers() != map.nTowers()) {
16  throw edm::Exception(edm::errors::StdException, "StdException")
17  << "HGCalTowerMap: Trying to add HGCalTowerMaps with different bins: " << nTowers() << " and " << map.nTowers()
18  << endl;
19  }
20 
21  for (const auto& tower : map.towers()) {
22  auto this_tower = towerMap_.find(tower.first);
23  if (this_tower == towerMap_.end()) {
24  throw edm::Exception(edm::errors::StdException, "StdException")
25  << "HGCalTowerMap: Trying to add HGCalTowerMaps but could not find bin: " << tower.first << endl;
26  } else {
27  this_tower->second += tower.second;
28  }
29  }
30  return *this;
31 }
32 
33 bool HGCalTowerMap::addEt(short bin_id, float etEm, float etHad) {
34  auto this_tower = towerMap_.find(bin_id);
35  if (this_tower == towerMap_.end())
36  return false;
37  this_tower->second.addEtEm(etEm);
38  this_tower->second.addEtHad(etHad);
39 
40  return true;
41 }
MessageLogger.h
l1t::HGCalTowerMap::nTowers
unsigned nTowers() const
Definition: HGCalTowerMap.h:27
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
l1t::HGCalTower
Definition: HGCalTower.h:13
EDMException.h
l1t::HGCalTowerMap::towerMap_
std::unordered_map< unsigned short, l1t::HGCalTower > towerMap_
Definition: HGCalTowerMap.h:31
l1t::HGCalTowerMap
Definition: HGCalTowerMap.h:15
l1t::HGCalTowerMap::addEt
bool addEt(short bin_id, float etEm, float etHad)
Definition: HGCalTowerMap.cc:33
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
l1t::HGCalTowerMap::HGCalTowerMap
HGCalTowerMap()
Definition: HGCalTowerMap.h:17
l1t
delete x;
Definition: CaloConfig.h:22
edm::errors::StdException
Definition: EDMException.h:28
l1t::HGCalTowerMap::operator+=
const HGCalTowerMap & operator+=(const HGCalTowerMap &map)
Definition: HGCalTowerMap.cc:14
Exception
Definition: hltDiff.cc:245
HGCalTowerMap.h
genParticles_cff.map
map
Definition: genParticles_cff.py:11
sistrip::layer_
static const char layer_[]
Definition: ConstantsForGranularity.h:30
GlobalPoint.h