CMS 3D CMS Logo

HGCalTowerMap2DImpl.h
Go to the documentation of this file.
1 #ifndef __L1Trigger_L1THGCal_HGCalTowerMap2DImpl_h__
2 #define __L1Trigger_L1THGCal_HGCalTowerMap2DImpl_h__
3 
7 
13 
15 public:
17 
18  void resetTowerMaps();
19 
20  template <class T>
22  std::unordered_map<int, l1t::HGCalTowerMap> towerMapsTmp = newTowerMaps();
23 
24  for (const auto& ptr : ptrs) {
25  if (triggerTools_.isNose(ptr->detId()))
26  continue;
27  unsigned layer = triggerTools_.layerWithOffset(ptr->detId());
28  if (towerMapsTmp.find(layer) == towerMapsTmp.end()) {
29  throw cms::Exception("Out of range")
30  << "HGCalTowerMap2dImpl: Found trigger sum in layer " << layer << " for which there is no tower map\n";
31  }
32  // FIXME: should actually sum the energy not the Et...
33  double calibPt = ptr->pt();
34  if (useLayerWeights_)
35  calibPt = layerWeights_[layer] * ptr->mipPt();
36 
37  double etEm = layer <= triggerTools_.lastLayerEE() ? calibPt : 0;
38  double etHad = layer > triggerTools_.lastLayerEE() ? calibPt : 0;
39 
40  towerMapsTmp[layer].addEt(towerGeometryHelper_.getTriggerTower(*ptr), etEm, etHad);
41  }
42 
43  /* store towerMaps in the persistent collection */
44  towerMaps.resize(0, towerMapsTmp.size());
45  int i = 0;
46  for (const auto& towerMap : towerMapsTmp) {
47  towerMaps.set(0, i, towerMap.second);
48  i++;
49  }
50  }
51 
52  void eventSetup(const edm::EventSetup& es) {
55  }
56 
57 private:
59  std::vector<double> layerWeights_;
61  std::unordered_map<int, l1t::HGCalTowerMap> newTowerMaps();
62 
64 };
65 
66 #endif
HGCalTriggerTools.h
HGCalTowerMap2DImpl::HGCalTowerMap2DImpl
HGCalTowerMap2DImpl(const edm::ParameterSet &conf)
Definition: HGCalTowerMap2DImpl.cc:13
HGCalTriggerTools::eventSetup
void eventSetup(const edm::EventSetup &)
Definition: HGCalTriggerTools.cc:35
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
HGCalTowerMap2DImpl::layerWeights_
std::vector< double > layerWeights_
Definition: HGCalTowerMap2DImpl.h:59
HGCalTowerMap2DImpl::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalTowerMap2DImpl.h:60
HGCalTriggerSums.h
HGCalTriggerTowerGeometryHelper::getTriggerTower
unsigned short getTriggerTower(const l1t::HGCalTriggerCell &) const
Definition: HGCalTriggerTowerGeometryHelper.cc:122
HGCalTowerMap2DImpl::buildTowerMap2D
void buildTowerMap2D(const std::vector< edm::Ptr< T >> &ptrs, l1t::HGCalTowerMapBxCollection &towerMaps)
Definition: HGCalTowerMap2DImpl.h:21
HGCalTowerMap2DImpl::resetTowerMaps
void resetTowerMaps()
BXVector
Definition: BXVector.h:15
HGCalTriggerTowerGeometryHelper.h
HGCalTowerMap2DImpl
Definition: HGCalTowerMap2DImpl.h:14
HGCalTriggerTools::layerWithOffset
unsigned layerWithOffset(const DetId &) const
Definition: HGCalTriggerTools.cc:134
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
HGCalTriggerTools::isNose
bool isNose(const DetId &) const
Definition: HGCalTriggerTools.cc:170
HGCalTowerMap2DImpl::newTowerMaps
std::unordered_map< int, l1t::HGCalTowerMap > newTowerMaps()
Definition: HGCalTowerMap2DImpl.cc:18
edm::ParameterSet
Definition: ParameterSet.h:47
HGCalTowerMap2DImpl::useLayerWeights_
bool useLayerWeights_
Definition: HGCalTowerMap2DImpl.h:58
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:58
BXVector::resize
void resize(int bx, unsigned size)
edm::Ptr
Definition: AssociationVector.h:31
HGCalTriggerTowerGeometryHelper::eventSetup
void eventSetup(const edm::EventSetup &es)
Definition: HGCalTriggerTowerGeometryHelper.h:33
HGCalTriggerTowerGeometryHelper
Definition: HGCalTriggerTowerGeometryHelper.h:27
Exception
Definition: hltDiff.cc:245
BXVector::set
void set(int bx, unsigned i, const T &object)
HGCalTowerMap.h
EventSetup.h
HGCalTowerMap2DImpl::eventSetup
void eventSetup(const edm::EventSetup &es)
Definition: HGCalTowerMap2DImpl.h:52
HGCalTriggerTools
Definition: HGCalTriggerTools.h:32
HGCalTriggerCell.h
ParameterSet.h
HGCalTriggerTools::lastLayerEE
unsigned lastLayerEE() const
Definition: HGCalTriggerTools.h:54
HGCalTowerMap2DImpl::towerGeometryHelper_
HGCalTriggerTowerGeometryHelper towerGeometryHelper_
Definition: HGCalTowerMap2DImpl.h:63