CMS 3D CMS Logo

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

#include <ElectronHcalHelper.h>

Classes

struct  Configuration
 

Public Member Functions

void checkSetup (const edm::EventSetup &)
 
 ElectronHcalHelper (const Configuration &)
 
bool hasActiveHcal (const reco::SuperCluster &sc) const
 
double hcalESum (const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
 
double hcalESumDepth1 (const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
 
double hcalESumDepth1BehindClusters (const std::vector< CaloTowerDetId > &towers) const
 
double hcalESumDepth2 (const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
 
double hcalESumDepth2BehindClusters (const std::vector< CaloTowerDetId > &towers) const
 
std::vector< CaloTowerDetIdhcalTowersBehindClusters (const reco::SuperCluster &sc) const
 
double hOverEConeSize () const
 
void readEvent (const edm::Event &)
 
 ~ElectronHcalHelper ()
 

Private Attributes

edm::ESHandle< CaloGeometrycaloGeom_
 
unsigned long long caloGeomCacheId_
 
const Configuration cfg_
 
EgammaHadTowerhadTower_
 
EgammaHcalIsolationhcalIso_
 
EgammaTowerIsolationtowerIso1_
 
EgammaTowerIsolationtowerIso2_
 

Detailed Description

Definition at line 21 of file ElectronHcalHelper.h.

Constructor & Destructor Documentation

ElectronHcalHelper::ElectronHcalHelper ( const Configuration cfg)

Definition at line 11 of file ElectronHcalHelper.cc.

12  : cfg_(cfg), caloGeomCacheId_(0), hcalIso_(nullptr), towerIso1_(nullptr), towerIso2_(nullptr), hadTower_(nullptr) {}
EgammaTowerIsolation * towerIso1_
const Configuration cfg_
unsigned long long caloGeomCacheId_
EgammaHcalIsolation * hcalIso_
EgammaHadTower * hadTower_
EgammaTowerIsolation * towerIso2_
ElectronHcalHelper::~ElectronHcalHelper ( )

Definition at line 118 of file ElectronHcalHelper.cc.

References cfg_, hadTower_, hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, towerIso1_, towerIso2_, and ElectronHcalHelper::Configuration::useTowers.

118  {
119  if (cfg_.hOverEConeSize == 0) {
120  return;
121  }
122  if (cfg_.useTowers) {
123  delete towerIso1_;
124  delete towerIso2_;
125  delete hadTower_;
126  } else {
127  delete hcalIso_;
128  }
129 }
EgammaTowerIsolation * towerIso1_
const Configuration cfg_
EgammaHcalIsolation * hcalIso_
EgammaHadTower * hadTower_
EgammaTowerIsolation * towerIso2_

Member Function Documentation

void ElectronHcalHelper::checkSetup ( const edm::EventSetup es)

Definition at line 14 of file ElectronHcalHelper.cc.

References caloGeom_, caloGeomCacheId_, cfg_, edm::EventSetup::get(), hadTower_, ElectronHcalHelper::Configuration::hOverEConeSize, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::checkSetup(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

14  {
15  if (cfg_.hOverEConeSize == 0) {
16  return;
17  }
18 
19  if (cfg_.useTowers) {
20  delete hadTower_;
21  hadTower_ = new EgammaHadTower(es);
22  } else {
23  unsigned long long newCaloGeomCacheId_ = es.get<CaloGeometryRecord>().cacheIdentifier();
24  if (caloGeomCacheId_ != newCaloGeomCacheId_) {
25  caloGeomCacheId_ = newCaloGeomCacheId_;
26  es.get<CaloGeometryRecord>().get(caloGeom_);
27  }
28  }
29 }
const Configuration cfg_
edm::ESHandle< CaloGeometry > caloGeom_
unsigned long long caloGeomCacheId_
T get() const
Definition: EventSetup.h:73
EgammaHadTower * hadTower_
bool ElectronHcalHelper::hasActiveHcal ( const reco::SuperCluster sc) const
double ElectronHcalHelper::hcalESum ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  excludeTowers = 0 
) const

Definition at line 75 of file ElectronHcalHelper.cc.

References cfg_, EgammaHcalIsolation::getHcalESum(), hcalESumDepth1(), hcalESumDepth2(), hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, and ElectronHcalHelper::Configuration::useTowers.

Referenced by EgammaHLTBcHcalIsolationProducersRegional::produce().

75  {
76  if (cfg_.hOverEConeSize == 0) {
77  return 0;
78  }
79  if (cfg_.useTowers) {
80  return (hcalESumDepth1(sc, excludeTowers) + hcalESumDepth2(sc, excludeTowers));
81  } else {
82  return hcalIso_->getHcalESum(&sc);
83  }
84 }
const Configuration cfg_
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
EgammaHcalIsolation * hcalIso_
double getHcalESum(const reco::Candidate *c) const
double ElectronHcalHelper::hcalESumDepth1 ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  excludeTowers = 0 
) const

Definition at line 86 of file ElectronHcalHelper.cc.

References cfg_, EgammaHcalIsolation::getHcalESumDepth1(), EgammaTowerIsolation::getTowerESum(), hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, towerIso1_, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::calculateShowerShape(), and hcalESum().

87  {
88  if (cfg_.hOverEConeSize == 0) {
89  return 0;
90  }
91  if (cfg_.useTowers) {
92  return towerIso1_->getTowerESum(&sc, excludeTowers);
93  } else {
94  return hcalIso_->getHcalESumDepth1(&sc);
95  }
96 }
EgammaTowerIsolation * towerIso1_
const Configuration cfg_
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
EgammaHcalIsolation * hcalIso_
double getHcalESumDepth1(const reco::Candidate *c) const
double ElectronHcalHelper::hcalESumDepth1BehindClusters ( const std::vector< CaloTowerDetId > &  towers) const

Definition at line 67 of file ElectronHcalHelper.cc.

References EgammaHadTower::getDepth1HcalESum(), and hadTower_.

Referenced by GsfElectronAlgo::calculateShowerShape(), hOverEConeSize(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

67  {
69 }
double getDepth1HcalESum(const reco::SuperCluster &sc) const
EgammaHadTower * hadTower_
double ElectronHcalHelper::hcalESumDepth2 ( const reco::SuperCluster sc,
const std::vector< CaloTowerDetId > *  excludeTowers = 0 
) const

Definition at line 98 of file ElectronHcalHelper.cc.

References cfg_, EgammaHcalIsolation::getHcalESumDepth2(), EgammaTowerIsolation::getTowerESum(), hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, towerIso2_, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::calculateShowerShape(), and hcalESum().

99  {
100  if (cfg_.hOverEConeSize == 0) {
101  return 0;
102  }
103  if (cfg_.useTowers) {
104  return towerIso2_->getTowerESum(&sc, excludeTowers);
105  } else {
106  return hcalIso_->getHcalESumDepth2(&sc);
107  }
108 }
const Configuration cfg_
double getHcalESumDepth2(const reco::Candidate *c) const
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
EgammaHcalIsolation * hcalIso_
EgammaTowerIsolation * towerIso2_
double ElectronHcalHelper::hcalESumDepth2BehindClusters ( const std::vector< CaloTowerDetId > &  towers) const

Definition at line 71 of file ElectronHcalHelper.cc.

References EgammaHadTower::getDepth2HcalESum(), and hadTower_.

Referenced by GsfElectronAlgo::calculateShowerShape(), hOverEConeSize(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

71  {
73 }
double getDepth2HcalESum(const reco::SuperCluster &sc) const
EgammaHadTower * hadTower_
std::vector< CaloTowerDetId > ElectronHcalHelper::hcalTowersBehindClusters ( const reco::SuperCluster sc) const

Definition at line 63 of file ElectronHcalHelper.cc.

References hadTower_, and EgammaHadTower::towersOf().

Referenced by GsfElectronAlgo::calculateShowerShape(), hOverEConeSize(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

63  {
64  return hadTower_->towersOf(sc);
65 }
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
EgammaHadTower * hadTower_
double ElectronHcalHelper::hOverEConeSize ( ) const
inline
void ElectronHcalHelper::readEvent ( const edm::Event evt)

Definition at line 31 of file ElectronHcalHelper.cc.

References caloGeom_, cfg_, edm::Event::getByToken(), hadTower_, hcalIso_, ElectronHcalHelper::Configuration::hcalRecHits, ElectronHcalHelper::Configuration::hcalTowers, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEHBMinE, ElectronHcalHelper::Configuration::hOverEHFMinE, ElectronHcalHelper::Configuration::hOverEPtMin, edm::Handle< T >::product(), EgammaHadTower::setTowerCollection(), towerIso1_, towerIso2_, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::beginEvent(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

31  {
32  if (cfg_.hOverEConeSize == 0) {
33  return;
34  }
35 
36  if (cfg_.useTowers) {
37  delete towerIso1_;
38  towerIso1_ = nullptr;
39  delete towerIso2_;
40  towerIso2_ = nullptr;
41 
43  if (!evt.getByToken(cfg_.hcalTowers, towersH_)) {
44  edm::LogError("ElectronHcalHelper::readEvent") << "failed to get the hcal towers";
45  }
49  } else {
50  delete hcalIso_;
51  hcalIso_ = nullptr;
52 
54  if (!evt.getByToken(cfg_.hcalRecHits, hbhe_)) {
55  edm::LogError("ElectronHcalHelper::readEvent") << "failed to get the rechits";
56  }
57 
60  }
61 }
EgammaTowerIsolation * towerIso1_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const Configuration cfg_
void setTowerCollection(const CaloTowerCollection *towercollection)
edm::ESHandle< CaloGeometry > caloGeom_
edm::EDGetTokenT< HBHERecHitCollection > hcalRecHits
T const * product() const
Definition: Handle.h:69
EgammaHcalIsolation * hcalIso_
EgammaHadTower * hadTower_
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
EgammaTowerIsolation * towerIso2_

Member Data Documentation

edm::ESHandle<CaloGeometry> ElectronHcalHelper::caloGeom_
private

Definition at line 64 of file ElectronHcalHelper.h.

Referenced by checkSetup(), and readEvent().

unsigned long long ElectronHcalHelper::caloGeomCacheId_
private

Definition at line 63 of file ElectronHcalHelper.h.

Referenced by checkSetup().

const Configuration ElectronHcalHelper::cfg_
private
EgammaHadTower* ElectronHcalHelper::hadTower_
private
EgammaHcalIsolation* ElectronHcalHelper::hcalIso_
private
EgammaTowerIsolation* ElectronHcalHelper::towerIso1_
private

Definition at line 70 of file ElectronHcalHelper.h.

Referenced by hcalESumDepth1(), readEvent(), and ~ElectronHcalHelper().

EgammaTowerIsolation* ElectronHcalHelper::towerIso2_
private

Definition at line 71 of file ElectronHcalHelper.h.

Referenced by hcalESumDepth2(), readEvent(), and ~ElectronHcalHelper().