CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HGCalTowerMap2DImpl.h
Go to the documentation of this file.
1 #ifndef __L1Trigger_L1THGCal_HGCalTowerMap2DImpl_h__
2 #define __L1Trigger_L1THGCal_HGCalTowerMap2DImpl_h__
3 
6 
12 
14 public:
16 
17  void resetTowerMaps();
18 
19  template <class T>
21  std::unordered_map<int, l1t::HGCalTowerMap> towerMapsTmp = newTowerMaps();
22 
23  for (const auto& ptr : ptrs) {
24  bool isNose = triggerTools_.isNose(ptr->detId());
25  unsigned layer = triggerTools_.layerWithOffset(ptr->detId());
26 
27  if (towerMapsTmp.find(layer) == towerMapsTmp.end()) {
28  throw cms::Exception("Out of range")
29  << "HGCalTowerMap2dImpl: Found trigger sum in layer " << layer << " for which there is no tower map\n";
30  }
31  // FIXME: should actually sum the energy not the Et...
32  double calibPt = ptr->pt();
33  if (useLayerWeights_)
34  calibPt = layerWeights_[layer] * ptr->mipPt();
35 
36  double etEm = layer <= triggerTools_.lastLayerEE(isNose) ? calibPt : 0;
37  double etHad = layer > triggerTools_.lastLayerEE(isNose) ? calibPt : 0;
38 
39  towerMapsTmp[layer].addEt(towerGeometryHelper_.getTriggerTower(*ptr), etEm, etHad);
40  }
41 
42  /* store towerMaps in the persistent collection */
43  towerMaps.resize(0, towerMapsTmp.size());
44  int i = 0;
45  for (const auto& towerMap : towerMapsTmp) {
46  towerMaps.set(0, i, towerMap.second);
47  i++;
48  }
49  }
50 
54  }
55 
56 private:
58  std::vector<double> layerWeights_;
60  std::unordered_map<int, l1t::HGCalTowerMap> newTowerMaps();
61 
63 };
64 
65 #endif
void setGeometry(const HGCalTriggerGeometryBase *const geom)
std::vector< double > layerWeights_
unsigned short getTriggerTower(const l1t::HGCalTriggerCell &) const
HGCalTriggerTools triggerTools_
unsigned layerWithOffset(const DetId &) const
std::unordered_map< int, l1t::HGCalTowerMap > newTowerMaps()
constexpr std::array< uint8_t, layerIndexSize > layer
void setGeometry(const HGCalTriggerGeometryBase *const)
unsigned lastLayerEE(bool nose=false) const
bool isNose(const DetId &) const
void set(int bx, unsigned i, const T &object)
HGCalTriggerTowerGeometryHelper towerGeometryHelper_
void setGeometry(const HGCalTriggerGeometryBase *const geom)
void resize(int bx, unsigned size)
void buildTowerMap2D(const std::vector< edm::Ptr< T >> &ptrs, l1t::HGCalTowerMapBxCollection &towerMaps)
HGCalTowerMap2DImpl(const edm::ParameterSet &conf)