CMS 3D CMS Logo

HGCalTowerMap2DImpl.cc
Go to the documentation of this file.
1 
9 
12 
14  : useLayerWeights_(conf.getParameter<bool>("useLayerWeights")),
15  layerWeights_(conf.getParameter<std::vector<double>>("layerWeights")),
16  towerGeometryHelper_(conf.getParameter<edm::ParameterSet>("L1TTriggerTowerConfig")) {}
17 
18 std::unordered_map<int, l1t::HGCalTowerMap> HGCalTowerMap2DImpl::newTowerMaps() {
19  std::unordered_map<int, l1t::HGCalTowerMap> towerMaps;
20  for (unsigned layer = 1; layer <= triggerTools_.lastLayerBH(); layer++) {
21  // FIXME: this is hardcoded...quite ugly
22  if (layer <= triggerTools_.lastLayerEE() && layer % 2 == 0)
23  continue;
24  towerMaps[layer] = l1t::HGCalTowerMap(towerGeometryHelper_.getTowerCoordinates(), layer);
25  }
26 
27  return towerMaps;
28 }
29 
31  l1t::HGCalTowerMapBxCollection& towerMaps) {
32  std::unordered_map<int, l1t::HGCalTowerMap> towerMapsTmp = newTowerMaps();
33 
34  for (auto tc : triggerCellsPtrs) {
35  unsigned layer = triggerTools_.layerWithOffset(tc->detId());
36  // FIXME: should actually sum the energy not the Et...
37  double calibPt = tc->pt();
38  if (useLayerWeights_)
39  calibPt = layerWeights_[layer] * tc->mipPt();
40 
41  double etEm = layer <= triggerTools_.lastLayerEE() ? calibPt : 0;
42  double etHad = layer > triggerTools_.lastLayerEE() ? calibPt : 0;
43 
44  towerMapsTmp[layer].addEt(
45  towerGeometryHelper_.getTriggerTowerFromTriggerCell(tc->detId(), tc->eta(), tc->phi()), etEm, etHad);
46  }
47 
48  /* store towerMaps in the persistent collection */
49  towerMaps.resize(0, towerMapsTmp.size());
50  int i = 0;
51  for (auto towerMap : towerMapsTmp) {
52  towerMaps.set(0, i, towerMap.second);
53  i++;
54  }
55 }
unsigned lastLayerEE() const
std::vector< double > layerWeights_
HGCalTriggerTools triggerTools_
unsigned layerWithOffset(const DetId &) const
const std::vector< l1t::HGCalTowerCoord > & getTowerCoordinates() const
std::unordered_map< int, l1t::HGCalTowerMap > newTowerMaps()
unsigned short getTriggerTowerFromTriggerCell(const unsigned tcId, const float &eta, const float &phi) const
void buildTowerMap2D(const std::vector< edm::Ptr< l1t::HGCalTriggerCell >> &triggerCellsPtrs, l1t::HGCalTowerMapBxCollection &towermaps)
unsigned lastLayerBH() const
void set(int bx, unsigned i, const T &object)
HGCalTriggerTowerGeometryHelper towerGeometryHelper_
void resize(int bx, unsigned size)
HLT enums.
HGCalTowerMap2DImpl(const edm::ParameterSet &conf)