CMS 3D CMS Logo

ElectronHcalHelper.cc
Go to the documentation of this file.
1 
8 
9 using namespace reco;
10 
12  : cfg_(cfg), caloGeomCacheId_(0), hcalIso_(nullptr), towerIso1_(nullptr), towerIso2_(nullptr), hadTower_(nullptr) {}
13 
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_;
27  }
28  }
29 }
30 
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 
45  } else {
46  delete hcalIso_;
47  hcalIso_ = nullptr;
48 
50  if (!evt.getByToken(cfg_.hcalRecHits, hbhe_)) {
51  edm::LogError("ElectronHcalHelper::readEvent") << "failed to get the rechits";
52  }
53 
56  }
57 }
58 
59 std::vector<CaloTowerDetId> ElectronHcalHelper::hcalTowersBehindClusters(const reco::SuperCluster& sc) const {
60  return hadTower_->towersOf(sc);
61 }
62 
63 double ElectronHcalHelper::hcalESumDepth1BehindClusters(const std::vector<CaloTowerDetId>& towers) const {
65 }
66 
67 double ElectronHcalHelper::hcalESumDepth2BehindClusters(const std::vector<CaloTowerDetId>& towers) const {
69 }
70 
71 double ElectronHcalHelper::hcalESum(const SuperCluster& sc, const std::vector<CaloTowerDetId>* excludeTowers) const {
72  if (cfg_.hOverEConeSize == 0) {
73  return 0;
74  }
75  if (cfg_.useTowers) {
76  return (hcalESumDepth1(sc, excludeTowers) + hcalESumDepth2(sc, excludeTowers));
77  } else {
78  return hcalIso_->getHcalESum(&sc);
79  }
80 }
81 
83  const std::vector<CaloTowerDetId>* excludeTowers) const {
84  if (cfg_.hOverEConeSize == 0) {
85  return 0;
86  }
87  if (cfg_.useTowers) {
88  return towerIso1_->getTowerESum(&sc, excludeTowers);
89  } else {
90  return hcalIso_->getHcalESumDepth1(&sc);
91  }
92 }
93 
95  const std::vector<CaloTowerDetId>* excludeTowers) const {
96  if (cfg_.hOverEConeSize == 0) {
97  return 0;
98  }
99  if (cfg_.useTowers) {
100  return towerIso2_->getTowerESum(&sc, excludeTowers);
101  } else {
102  return hcalIso_->getHcalESumDepth2(&sc);
103  }
104 }
105 
109  } else {
110  return true;
111  }
112 }
113 
115  if (cfg_.hOverEConeSize == 0) {
116  return;
117  }
118  if (cfg_.useTowers) {
119  delete towerIso1_;
120  delete towerIso2_;
121  delete hadTower_;
122  } else {
123  delete hcalIso_;
124  }
125 }
ElectronHcalHelper::cfg_
const Configuration cfg_
Definition: ElectronHcalHelper.h:60
MessageLogger.h
EgammaHcalIsolation::getHcalESumDepth2
double getHcalESumDepth2(const reco::Candidate *c) const
Definition: EgammaHcalIsolation.h:76
ElectronHcalHelper::hcalESumDepth1
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
Definition: ElectronHcalHelper.cc:82
reco::SuperCluster
Definition: SuperCluster.h:18
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
ElectronHcalHelper::hcalESumDepth1BehindClusters
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers) const
Definition: ElectronHcalHelper.cc:63
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
EgammaHadTower.h
EgammaHcalIsolation::getHcalESum
double getHcalESum(const reco::Candidate *c) const
Definition: EgammaHcalIsolation.h:48
ElectronHcalHelper::Configuration::hOverEHFMinE
double hOverEHFMinE
Definition: ElectronHcalHelper.h:37
EgammaHcalIsolation
Definition: EgammaHcalIsolation.h:30
ElectronHcalHelper::hcalIso_
EgammaHcalIsolation * hcalIso_
Definition: ElectronHcalHelper.h:67
EgammaHadTower::hasActiveHcal
bool hasActiveHcal(const std::vector< CaloTowerDetId > &towers) const
Definition: EgammaHadTower.cc:116
ElectronHcalHelper::caloGeomCacheId_
unsigned long long caloGeomCacheId_
Definition: ElectronHcalHelper.h:63
EgammaTowerIsolation::getTowerESum
double getTowerESum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=nullptr) const
Definition: EgammaTowerIsolation.h:208
ElectronHcalHelper::towersFromCollection_
const CaloTowerCollection * towersFromCollection_
Definition: ElectronHcalHelper.h:73
EgammaHadTower::getDepth2HcalESum
double getDepth2HcalESum(const std::vector< CaloTowerDetId > &towers, CaloTowerCollection const &) const
Definition: EgammaHadTower.cc:105
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
ElectronHcalHelper::Configuration::hcalTowers
edm::EDGetTokenT< CaloTowerCollection > hcalTowers
Definition: ElectronHcalHelper.h:31
ElectronHcalHelper::Configuration::hOverEConeSize
double hOverEConeSize
Definition: ElectronHcalHelper.h:25
ElectronHcalHelper::hasActiveHcal
bool hasActiveHcal(const reco::SuperCluster &sc) const
Definition: ElectronHcalHelper.cc:106
ElectronHcalHelper::towerIso1_
EgammaTowerIsolation * towerIso1_
Definition: ElectronHcalHelper.h:70
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
EgammaTowerIsolation.h
ElectronHcalHelper::Configuration::hcalRecHits
edm::EDGetTokenT< HBHERecHitCollection > hcalRecHits
Definition: ElectronHcalHelper.h:35
ElectronHcalHelper::Configuration
Definition: ElectronHcalHelper.h:23
CaloGeometryRecord.h
ElectronHcalHelper::hcalESumDepth2BehindClusters
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers) const
Definition: ElectronHcalHelper.cc:67
ElectronHcalHelper::towerIso2_
EgammaTowerIsolation * towerIso2_
Definition: ElectronHcalHelper.h:71
ElectronHcalHelper::hcalTowersBehindClusters
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc) const
Definition: ElectronHcalHelper.cc:59
edm::LogError
Definition: MessageLogger.h:183
ElectronHcalHelper::Configuration::hOverEHBMinE
double hOverEHBMinE
Definition: ElectronHcalHelper.h:36
EgammaTowerIsolation
Definition: EgammaTowerIsolation.h:196
ElectronHcalHelper::ElectronHcalHelper
ElectronHcalHelper(const Configuration &)
Definition: ElectronHcalHelper.cc:11
ElectronHcalHelper::checkSetup
void checkSetup(const edm::EventSetup &)
Definition: ElectronHcalHelper.cc:14
edm::EventSetup
Definition: EventSetup.h:57
ElectronHcalHelper::caloGeom_
edm::ESHandle< CaloGeometry > caloGeom_
Definition: ElectronHcalHelper.h:64
get
#define get
looper.cfg
cfg
Definition: looper.py:297
EgammaHadTower::towersOf
std::vector< CaloTowerDetId > towersOf(const reco::SuperCluster &sc) const
Definition: EgammaHadTower.cc:50
EgammaHcalIsolation::getHcalESumDepth1
double getHcalESumDepth1(const reco::Candidate *c) const
Definition: EgammaHcalIsolation.h:58
HLT_2018_cff.towers
towers
Definition: HLT_2018_cff.py:35030
ElectronHcalHelper::hadTower_
EgammaHadTower * hadTower_
Definition: ElectronHcalHelper.h:72
ElectronHcalHelper::~ElectronHcalHelper
~ElectronHcalHelper()
Definition: ElectronHcalHelper.cc:114
ElectronHcalHelper::Configuration::hOverEPtMin
double hOverEPtMin
Definition: ElectronHcalHelper.h:32
ElectronHcalHelper::Configuration::checkHcalStatus
bool checkHcalStatus
Definition: ElectronHcalHelper.h:28
ElectronHcalHelper.h
ElectronHcalHelper::hcalESum
double hcalESum(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
Definition: ElectronHcalHelper.cc:71
EgammaHadTower::getDepth1HcalESum
double getDepth1HcalESum(const std::vector< CaloTowerDetId > &towers, CaloTowerCollection const &) const
Definition: EgammaHadTower.cc:94
ElectronHcalHelper::Configuration::useTowers
bool useTowers
Definition: ElectronHcalHelper.h:28
EgammaHadTower
Definition: EgammaHadTower.h:17
edm::Event
Definition: Event.h:73
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:337
ElectronHcalHelper::readEvent
void readEvent(const edm::Event &)
Definition: ElectronHcalHelper.cc:31
ElectronHcalHelper::hcalESumDepth2
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=nullptr) const
Definition: ElectronHcalHelper.cc:94
EgammaHcalIsolation.h