CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTowerMap2DImpl Class Reference

#include <HGCalTowerMap2DImpl.h>

Public Member Functions

void buildTowerMap2D (const std::vector< edm::Ptr< l1t::HGCalTriggerCell >> &triggerCellsPtrs, l1t::HGCalTowerMapBxCollection &towermaps)
 
void eventSetup (const edm::EventSetup &es)
 
 HGCalTowerMap2DImpl (const edm::ParameterSet &conf)
 
void resetTowerMaps ()
 

Private Member Functions

std::vector< l1t::HGCalTowerMapnewTowerMaps ()
 

Private Attributes

std::vector< double > etaBins_
 
std::vector< double > layerWeights_
 
int nEtaBins_
 
int nPhiBins_
 
std::vector< double > phiBins_
 
HGCalTriggerTools triggerTools_
 
bool useLayerWeights_
 

Detailed Description

Author
: Thomas Strebler

Description: first iteration of HGCal Tower Maps

Definition at line 13 of file HGCalTowerMap2DImpl.h.

Constructor & Destructor Documentation

HGCalTowerMap2DImpl::HGCalTowerMap2DImpl ( const edm::ParameterSet conf)

Definition at line 14 of file HGCalTowerMap2DImpl.cc.

References edm::errors::Configuration, PVValHelper::eta, etaBins_, Exception, createfilelist::int, nEtaBins_, newTowerMaps(), nPhiBins_, phi, and phiBins_.

14  :
15  nEtaBins_(conf.getParameter<int>("nEtaBins")),
16  nPhiBins_(conf.getParameter<int>("nPhiBins")),
17  etaBins_(conf.getParameter<std::vector<double> >("etaBins")),
18  phiBins_(conf.getParameter<std::vector<double> >("phiBins")),
19  useLayerWeights_(conf.getParameter<bool>("useLayerWeights")),
20  layerWeights_(conf.getParameter< std::vector<double> >("layerWeights"))
21 {
22  edm::LogInfo("HGCalTowerMap2DImpl") << "Number of eta bins for the tower maps: " << nEtaBins_<<endl;
23  edm::LogInfo("HGCalTowerMap2DImpl") << "Number of phi bins for the tower maps: " << nPhiBins_<<endl;
24 
25  if(!etaBins_.empty() && int(etaBins_.size())!=nEtaBins_+1){
26  throw edm::Exception(edm::errors::Configuration, "Configuration")
27  << "HGCalTowerMap2DImpl nEtaBins for the tower map not consistent with etaBins size"<<endl;
28  }
29  if(!phiBins_.empty() && int(phiBins_.size())!=nPhiBins_+1){
30  throw edm::Exception(edm::errors::Configuration, "Configuration")
31  << "HGCalTowerMap2DImpl nPhiBins for the tower map not consistent with phiBins size"<<endl;
32  }
33 
34 
35  std::vector<l1t::HGCalTowerMap> towerMaps = newTowerMaps();
36  edm::LogInfo("HGCalTowerMap2DImpl") << "Eta bins for the tower maps: {";
37  for(auto eta : towerMaps[0].etaBins()) edm::LogInfo("HGCalTowerMap2DImpl") << eta << ",";
38  edm::LogInfo("HGCalTowerMap2DImpl") << "}" <<endl;
39  edm::LogInfo("HGCalTowerMap2DImpl") << "Phi bins for the tower maps: {";
40  for(auto phi : towerMaps[0].phiBins()) edm::LogInfo("HGCalTowerMap2DImpl") << phi << ",";
41  edm::LogInfo("HGCalTowerMap2DImpl") << "}" <<endl;
42 
43 }
T getParameter(std::string const &) const
std::vector< double > layerWeights_
std::vector< l1t::HGCalTowerMap > newTowerMaps()
std::vector< double > etaBins_
std::vector< double > phiBins_

Member Function Documentation

void HGCalTowerMap2DImpl::buildTowerMap2D ( const std::vector< edm::Ptr< l1t::HGCalTriggerCell >> &  triggerCellsPtrs,
l1t::HGCalTowerMapBxCollection towermaps 
)

Definition at line 68 of file HGCalTowerMap2DImpl.cc.

References mps_fire::i, HGCalTriggerTools::lastLayerBH(), HGCalTriggerTools::lastLayerEE(), layerWeights_, HGCalTriggerTools::layerWithOffset(), newTowerMaps(), p4, BXVector< T >::resize(), BXVector< T >::set(), l1t::HGCalTower::setEtEm(), l1t::HGCalTower::setEtHad(), l1t::L1Candidate::setHwEta(), l1t::L1Candidate::setHwPhi(), reco::LeafCandidate::setP4(), triggerTools_, and useLayerWeights_.

70  {
71 
72  std::vector<l1t::HGCalTowerMap> towerMapsTmp = newTowerMaps();
73 
74  for(const auto& tc : triggerCellsPtrs){
75 
76  unsigned layer = triggerTools_.layerWithOffset(tc->detId());
77  int iEta = towerMapsTmp[layer-1].iEta(tc->eta());
78  int iPhi = towerMapsTmp[layer-1].iPhi(tc->phi());
79 
80  double calibPt = tc->pt();
81  if(useLayerWeights_) calibPt = layerWeights_[layer]*(tc->mipPt());
83  tc->eta(),
84  tc->phi(),
85  0. );
86 
87  double etEm = layer<=triggerTools_.lastLayerEE() ? calibPt : 0;
88  double etHad = layer>triggerTools_.lastLayerEE() ? calibPt : 0;
89 
90  l1t::HGCalTower tower;
91  tower.setP4(p4);
92  tower.setEtEm(etEm);
93  tower.setEtHad(etHad);
94  tower.setHwEta(iEta);
95  tower.setHwPhi(iPhi);
96 
97  towerMapsTmp[layer-1].addTower(iEta,iPhi,tower);
98 
99  }
100 
101  /* store towerMaps in the persistent collection */
102  towerMaps.resize(0, triggerTools_.lastLayerBH());
103  int i=0;
104  for(auto towerMap : towerMapsTmp){
105  towerMaps.set( 0, i, towerMap);
106  i++;
107  }
108 
109 
110 }
void setEtEm(double et)
Definition: HGCalTower.cc:31
unsigned lastLayerEE() const
std::vector< double > layerWeights_
std::vector< l1t::HGCalTowerMap > newTowerMaps()
HGCalTriggerTools triggerTools_
unsigned layerWithOffset(const DetId &) const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
double p4[4]
Definition: TauolaWrapper.h:92
unsigned lastLayerBH() const
void setHwPhi(int phi)
Definition: L1Candidate.h:43
void setHwEta(int eta)
Definition: L1Candidate.h:42
void setEtHad(double et)
Definition: HGCalTower.cc:36
void setP4(const LorentzVector &p4) final
set 4-momentum
void HGCalTowerMap2DImpl::eventSetup ( const edm::EventSetup es)
inline

Definition at line 26 of file HGCalTowerMap2DImpl.h.

References HGCalTriggerTools::eventSetup(), and triggerTools_.

27  {
29  }
void eventSetup(const edm::EventSetup &)
HGCalTriggerTools triggerTools_
std::vector< l1t::HGCalTowerMap > HGCalTowerMap2DImpl::newTowerMaps ( )
private

Definition at line 46 of file HGCalTowerMap2DImpl.cc.

References etaBins_, HGCalTriggerTools::lastLayerBH(), genParticles_cff::map, SiStripPI::max, nEtaBins_, nPhiBins_, phiBins_, and triggerTools_.

Referenced by buildTowerMap2D(), and HGCalTowerMap2DImpl().

46  {
47 
48  //If no custom binning specified, assume uniform one
50  if(etaBins_.empty() || phiBins_.empty()){
52  map = mapTmp;
53  }
54  else{
56  map = mapTmp;
57  }
58 
59  std::vector<l1t::HGCalTowerMap> towerMaps(max(triggerTools_.lastLayerBH(),unsigned(1)),map); //Always create at least 1 towerMap
60  for(unsigned layer=0; layer<triggerTools_.lastLayerBH(); layer++) towerMaps[layer].setLayer(layer+1);
61  return towerMaps;
62 
63 }
HGCalTriggerTools triggerTools_
unsigned lastLayerBH() const
std::vector< double > etaBins_
std::vector< double > phiBins_
void HGCalTowerMap2DImpl::resetTowerMaps ( )

Member Data Documentation

std::vector<double> HGCalTowerMap2DImpl::etaBins_
private

Definition at line 36 of file HGCalTowerMap2DImpl.h.

Referenced by HGCalTowerMap2DImpl(), and newTowerMaps().

std::vector<double> HGCalTowerMap2DImpl::layerWeights_
private

Definition at line 40 of file HGCalTowerMap2DImpl.h.

Referenced by buildTowerMap2D().

int HGCalTowerMap2DImpl::nEtaBins_
private

Definition at line 34 of file HGCalTowerMap2DImpl.h.

Referenced by HGCalTowerMap2DImpl(), and newTowerMaps().

int HGCalTowerMap2DImpl::nPhiBins_
private

Definition at line 35 of file HGCalTowerMap2DImpl.h.

Referenced by HGCalTowerMap2DImpl(), and newTowerMaps().

std::vector<double> HGCalTowerMap2DImpl::phiBins_
private

Definition at line 37 of file HGCalTowerMap2DImpl.h.

Referenced by HGCalTowerMap2DImpl(), and newTowerMaps().

HGCalTriggerTools HGCalTowerMap2DImpl::triggerTools_
private

Definition at line 41 of file HGCalTowerMap2DImpl.h.

Referenced by buildTowerMap2D(), eventSetup(), and newTowerMaps().

bool HGCalTowerMap2DImpl::useLayerWeights_
private

Definition at line 39 of file HGCalTowerMap2DImpl.h.

Referenced by buildTowerMap2D().