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  if (triggerTools_.isNose(tc->detId()))
36  continue;
37  unsigned layer = triggerTools_.layerWithOffset(tc->detId());
38  if (towerMapsTmp.find(layer) == towerMapsTmp.end()) {
39  throw cms::Exception("Out of range")
40  << "HGCalTowerMap2dImpl: Found trigger cell in layer " << layer << " for which there is no tower map\n";
41  }
42  // FIXME: should actually sum the energy not the Et...
43  double calibPt = tc->pt();
44  if (useLayerWeights_)
45  calibPt = layerWeights_[layer] * tc->mipPt();
46 
47  double etEm = layer <= triggerTools_.lastLayerEE() ? calibPt : 0;
48  double etHad = layer > triggerTools_.lastLayerEE() ? calibPt : 0;
49 
50  towerMapsTmp[layer].addEt(
51  towerGeometryHelper_.getTriggerTowerFromTriggerCell(tc->detId(), tc->eta(), tc->phi()), etEm, etHad);
52  }
53 
54  /* store towerMaps in the persistent collection */
55  towerMaps.resize(0, towerMapsTmp.size());
56  int i = 0;
57  for (auto towerMap : towerMapsTmp) {
58  towerMaps.set(0, i, towerMap.second);
59  i++;
60  }
61 }
HGCalTowerMap2DImpl::HGCalTowerMap2DImpl
HGCalTowerMap2DImpl(const edm::ParameterSet &conf)
Definition: HGCalTowerMap2DImpl.cc:13
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
HGCalTowerMap2DImpl::layerWeights_
std::vector< double > layerWeights_
Definition: HGCalTowerMap2DImpl.h:29
HGCalTowerMap2DImpl::triggerTools_
HGCalTriggerTools triggerTools_
Definition: HGCalTowerMap2DImpl.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
EDMException.h
BXVector
Definition: BXVector.h:15
l1t::HGCalTowerMap
Definition: HGCalTowerMap.h:15
HGCalTowerMap2DImpl::buildTowerMap2D
void buildTowerMap2D(const std::vector< edm::Ptr< l1t::HGCalTriggerCell >> &triggerCellsPtrs, l1t::HGCalTowerMapBxCollection &towermaps)
Definition: HGCalTowerMap2DImpl.cc:30
HGCalTriggerGeometryBase.h
HGCalTriggerTools::lastLayerBH
unsigned lastLayerBH() const
Definition: HGCalTriggerTools.h:56
HGCalTowerMap2DImpl.h
HGCalTriggerTools::layerWithOffset
unsigned layerWithOffset(const DetId &) const
Definition: HGCalTriggerTools.cc:134
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:36
ParameterSet
Definition: Functions.h:16
HGCalTowerMap2DImpl::useLayerWeights_
bool useLayerWeights_
Definition: HGCalTowerMap2DImpl.h:28
BXVector::resize
void resize(int bx, unsigned size)
edm::Ptr
Definition: AssociationVector.h:31
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:246
HGCalTriggerTowerGeometryHelper::getTowerCoordinates
const std::vector< l1t::HGCalTowerCoord > & getTowerCoordinates() const
Definition: HGCalTriggerTowerGeometryHelper.cc:83
BXVector::set
void set(int bx, unsigned i, const T &object)
HGCalTriggerTools::lastLayerEE
unsigned lastLayerEE() const
Definition: HGCalTriggerTools.h:54
HGCalTowerMap2DImpl::towerGeometryHelper_
HGCalTriggerTowerGeometryHelper towerGeometryHelper_
Definition: HGCalTowerMap2DImpl.h:33
HGCalTriggerTowerGeometryHelper::getTriggerTowerFromTriggerCell
unsigned short getTriggerTowerFromTriggerCell(const unsigned tcId, const float &eta, const float &phi) const
Definition: HGCalTriggerTowerGeometryHelper.cc:87