CMS 3D CMS Logo

HGCalTowerMap2DImpl.cc
Go to the documentation of this file.
1 
9 
12 
13 
14 
15 HGCalTowerMap2DImpl::HGCalTowerMap2DImpl(const edm::ParameterSet& conf) : useLayerWeights_(conf.getParameter<bool>("useLayerWeights")),
16  layerWeights_(conf.getParameter< std::vector<double> >("layerWeights")),
17  towerGeometryHelper_(conf.getParameter<edm::ParameterSet>("L1TTriggerTowerConfig")) {
18 
19 }
20 
21 
22 std::unordered_map<int, l1t::HGCalTowerMap> HGCalTowerMap2DImpl::newTowerMaps() {
23  std::unordered_map<int, l1t::HGCalTowerMap> towerMaps;
24  for(unsigned layer = 1; layer<=triggerTools_.lastLayerBH(); layer++) {
25  // FIXME: this is hardcoded...quite ugly
26  if (layer <= triggerTools_.lastLayerEE() && layer%2 == 0) continue;
27  towerMaps[layer] = l1t::HGCalTowerMap(towerGeometryHelper_.getTowerCoordinates(), layer);
28  }
29 
30  return towerMaps;
31 
32 }
33 
34 
35 
36 void HGCalTowerMap2DImpl::buildTowerMap2D(const std::vector<edm::Ptr<l1t::HGCalTriggerCell>> & triggerCellsPtrs,
37  l1t::HGCalTowerMapBxCollection & towerMaps) {
38 
39  std::unordered_map<int, l1t::HGCalTowerMap> towerMapsTmp = newTowerMaps();
40 
41  for(auto tc: triggerCellsPtrs) {
42  unsigned layer = triggerTools_.layerWithOffset(tc->detId());
43  // FIXME: should actually sum the energy not the Et...
44  double calibPt = tc->pt();
45  if(useLayerWeights_) 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(towerGeometryHelper_.getTriggerTowerFromTriggerCell(tc->detId(), tc->eta(), tc->phi()), etEm, etHad);
51 
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 
62 
63 }
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)