From 3ae9ab5067179f98aaaf3332a2acdf08fea8bd5c Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Thu, 15 Apr 2021 23:53:12 +0200 Subject: [PATCH 01/27] merge plugins into one --- .../plugins/cuts/PhoHadronicOverEMCut.cc | 34 -------------- .../cuts/PhoSingleTowerHadOverEmCut.cc | 34 -------------- .../plugins/cuts/PhotonHcalOverEcalCut.cc | 44 +++++++++++++++++++ 3 files changed, 44 insertions(+), 68 deletions(-) delete mode 100644 RecoEgamma/PhotonIdentification/plugins/cuts/PhoHadronicOverEMCut.cc delete mode 100644 RecoEgamma/PhotonIdentification/plugins/cuts/PhoSingleTowerHadOverEmCut.cc create mode 100644 RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc diff --git a/RecoEgamma/PhotonIdentification/plugins/cuts/PhoHadronicOverEMCut.cc b/RecoEgamma/PhotonIdentification/plugins/cuts/PhoHadronicOverEMCut.cc deleted file mode 100644 index f20230ab5295c..0000000000000 --- a/RecoEgamma/PhotonIdentification/plugins/cuts/PhoHadronicOverEMCut.cc +++ /dev/null @@ -1,34 +0,0 @@ -#include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h" -#include "DataFormats/EgammaCandidates/interface/Photon.h" - -class PhoHadronicOverEMCut : public CutApplicatorBase { -public: - PhoHadronicOverEMCut(const edm::ParameterSet& c) - : CutApplicatorBase(c), - _hadronicOverEMCutValueEB(c.getParameter("hadronicOverEMCutValueEB")), - _hadronicOverEMCutValueEE(c.getParameter("hadronicOverEMCutValueEE")), - _barrelCutOff(c.getParameter("barrelCutOff")) {} - - result_type operator()(const reco::PhotonPtr&) const final; - - double value(const reco::CandidatePtr& cand) const final; - - CandidateType candidateType() const final { return PHOTON; } - -private: - const float _hadronicOverEMCutValueEB, _hadronicOverEMCutValueEE, _barrelCutOff; -}; - -DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhoHadronicOverEMCut, "PhoHadronicOverEMCut"); - -CutApplicatorBase::result_type PhoHadronicOverEMCut::operator()(const reco::PhotonPtr& cand) const { - const float hadronicOverEMCutValue = - (std::abs(cand->superCluster()->eta()) < _barrelCutOff ? _hadronicOverEMCutValueEB : _hadronicOverEMCutValueEE); - - return cand->hadronicOverEm() < hadronicOverEMCutValue; -} - -double PhoHadronicOverEMCut::value(const reco::CandidatePtr& cand) const { - reco::PhotonPtr pho(cand); - return pho->hadronicOverEm(); -} diff --git a/RecoEgamma/PhotonIdentification/plugins/cuts/PhoSingleTowerHadOverEmCut.cc b/RecoEgamma/PhotonIdentification/plugins/cuts/PhoSingleTowerHadOverEmCut.cc deleted file mode 100644 index 3b929d16961eb..0000000000000 --- a/RecoEgamma/PhotonIdentification/plugins/cuts/PhoSingleTowerHadOverEmCut.cc +++ /dev/null @@ -1,34 +0,0 @@ -#include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h" -#include "DataFormats/EgammaCandidates/interface/Photon.h" - -class PhoSingleTowerHadOverEmCut : public CutApplicatorBase { -public: - PhoSingleTowerHadOverEmCut(const edm::ParameterSet& c) - : CutApplicatorBase(c), - _hadronicOverEMCutValueEB(c.getParameter("hadronicOverEMCutValueEB")), - _hadronicOverEMCutValueEE(c.getParameter("hadronicOverEMCutValueEE")), - _barrelCutOff(c.getParameter("barrelCutOff")) {} - - result_type operator()(const reco::PhotonPtr&) const final; - - double value(const reco::CandidatePtr& cand) const final; - - CandidateType candidateType() const final { return PHOTON; } - -private: - const float _hadronicOverEMCutValueEB, _hadronicOverEMCutValueEE, _barrelCutOff; -}; - -DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhoSingleTowerHadOverEmCut, "PhoSingleTowerHadOverEmCut"); - -CutApplicatorBase::result_type PhoSingleTowerHadOverEmCut::operator()(const reco::PhotonPtr& cand) const { - const float hadronicOverEMCutValue = - (std::abs(cand->superCluster()->eta()) < _barrelCutOff ? _hadronicOverEMCutValueEB : _hadronicOverEMCutValueEE); - - return cand->hadTowOverEm() < hadronicOverEMCutValue; -} - -double PhoSingleTowerHadOverEmCut::value(const reco::CandidatePtr& cand) const { - reco::PhotonPtr pho(cand); - return pho->hadTowOverEm(); -} diff --git a/RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc b/RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc new file mode 100644 index 0000000000000..a3f564be12812 --- /dev/null +++ b/RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc @@ -0,0 +1,44 @@ +#include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h" +#include "DataFormats/EgammaCandidates/interface/Photon.h" + +template +class PhotonHcalOverEcalCut : public CutApplicatorBase { +public: + PhotonHcalOverEcalCut(const edm::ParameterSet& c) + : CutApplicatorBase(c), + _hcalOverEcalCutValueEB(c.getParameter("hcalOverEcalCutValueEB")), + _hcalOverEcalCutValueEE(c.getParameter("hcalOverEcalCutValueEE")), + _barrelCutOff(c.getParameter("barrelCutOff")) {} + + result_type operator()(const reco::PhotonPtr&) const final; + + double value(const reco::CandidatePtr& cand) const final; + + CandidateType candidateType() const final { return PHOTON; } + +private: + const float _hcalOverEcalCutValueEB, _hcalOverEcalCutValueEE, _barrelCutOff; +}; + +DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhotonHcalOverEcalCut, "PhotonHcalOverEcalCut"); +DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhotonHcalOverEcalCut, "PhotonHcalOverEcalBcCut"); + +template +CutApplicatorBase::result_type PhotonHcalOverEcalCut::operator()(const reco::PhotonPtr& cand) const { + const float hcalOverEcalCutValue = + (std::abs(cand->superCluster()->eta()) < _barrelCutOff ? _hcalOverEcalCutValueEB : _hcalOverEcalCutValueEE); + + if constexpr (isBC) + return cand->hcalOverEcalBc() < hcalOverEcalCutValue; + else + return cand->hcalOverEcal() < hcalOverEcalCutValue; +} + +template +double PhotonHcalOverEcalCut::value(const reco::CandidatePtr& cand) const { + reco::PhotonPtr pho(cand); + if constexpr (isBC) + return pho->hcalOverEcalBc(); + else + return pho->hcalOverEcal(); +} From 8d047f50af6d7b2a8e294e8768633c21c4d9b39e Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 20 Apr 2021 10:07:13 +0200 Subject: [PATCH 02/27] DataFormat changes --- .../EgammaCandidates/interface/GsfElectron.h | 101 +++++++-------- .../EgammaCandidates/interface/Photon.h | 122 ++++++++---------- .../EgammaCandidates/src/GsfElectron.cc | 6 +- .../EgammaCandidates/src/classes_def.xml | 12 +- 4 files changed, 117 insertions(+), 124 deletions(-) diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index e1b5c1a7c367a..ef838d752f28c 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -17,6 +17,7 @@ #include "DataFormats/GeometryVector/interface/GlobalVector.h" #include #include +#include namespace reco { @@ -362,13 +363,11 @@ namespace reco { float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal float r9; // ratio of the 3x3 energy and supercluster energy - float hcalDepth1OverEcal; // hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers within a cone) - float hcalDepth2OverEcal; // hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers within a cone) - std::vector hcalTowersBehindClusters; // - float hcalDepth1OverEcalBc; // hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers behind clusters) - float hcalDepth2OverEcalBc; // hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers behind clusters) - bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) float sigmaIetaIphi; + std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) + std::vector hcalTowersBehindClusters; + bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) float eMax; float e2nd; float eTop; @@ -383,16 +382,14 @@ namespace reco { : sigmaEtaEta(std::numeric_limits::max()), sigmaIetaIeta(std::numeric_limits::max()), sigmaIphiIphi(std::numeric_limits::max()), - e1x5(0.), - e2x5Max(0.), - e5x5(0.), + e1x5(0.f), + e2x5Max(0.f), + e5x5(0.f), r9(-std::numeric_limits::max()), - hcalDepth1OverEcal(0.), - hcalDepth2OverEcal(0.), - hcalDepth1OverEcalBc(0.), - hcalDepth2OverEcalBc(0.), - invalidHcal(false), sigmaIetaIphi(0.f), + hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + invalidHcal(false), eMax(0.f), e2nd(0.f), eTop(0.f), @@ -413,16 +410,18 @@ namespace reco { float e2x5Max() const { return showerShape_.e2x5Max; } float e5x5() const { return showerShape_.e5x5; } float r9() const { return showerShape_.r9; } - float hcalDepth1OverEcal() const { return showerShape_.hcalDepth1OverEcal; } - float hcalDepth2OverEcal() const { return showerShape_.hcalDepth2OverEcal; } - float hcalOverEcal() const { return hcalDepth1OverEcal() + hcalDepth2OverEcal(); } + float hcalOverEcal(int depth = 0) const { + const auto &hovere = showerShape_.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + } + float hcalOverEcalBc(int depth = 0) const { + const auto &hovere = showerShape_.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + } const std::vector &hcalTowersBehindClusters() const { return showerShape_.hcalTowersBehindClusters; } - float hcalDepth1OverEcalBc() const { return showerShape_.hcalDepth1OverEcalBc; } - float hcalDepth2OverEcalBc() const { return showerShape_.hcalDepth2OverEcalBc; } - float hcalOverEcalBc() const { return hcalDepth1OverEcalBc() + hcalDepth2OverEcalBc(); } - float hcalOverEcalValid() const { return !showerShape_.invalidHcal; } + bool hcalOverEcalValid() const { return !showerShape_.invalidHcal; } float eLeft() const { return showerShape_.eLeft; } float eRight() const { return showerShape_.eRight; } float eTop() const { return showerShape_.eTop; } @@ -437,13 +436,15 @@ namespace reco { float full5x5_e2x5Max() const { return full5x5_showerShape_.e2x5Max; } float full5x5_e5x5() const { return full5x5_showerShape_.e5x5; } float full5x5_r9() const { return full5x5_showerShape_.r9; } - float full5x5_hcalDepth1OverEcal() const { return full5x5_showerShape_.hcalDepth1OverEcal; } - float full5x5_hcalDepth2OverEcal() const { return full5x5_showerShape_.hcalDepth2OverEcal; } - float full5x5_hcalOverEcal() const { return full5x5_hcalDepth1OverEcal() + full5x5_hcalDepth2OverEcal(); } - float full5x5_hcalDepth1OverEcalBc() const { return full5x5_showerShape_.hcalDepth1OverEcalBc; } - float full5x5_hcalDepth2OverEcalBc() const { return full5x5_showerShape_.hcalDepth2OverEcalBc; } - float full5x5_hcalOverEcalBc() const { return full5x5_hcalDepth1OverEcalBc() + full5x5_hcalDepth2OverEcalBc(); } - float full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } + float full5x5_hcalOverEcal(int depth = 0) const { + const auto &hovere = full5x5_showerShape_.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + } + float full5x5_hcalOverEcalBc(int depth = 0) const { + const auto &hovere = full5x5_showerShape_.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + } + bool full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } float full5x5_e2x5Left() const { return full5x5_showerShape_.e2x5Left; } float full5x5_e2x5Right() const { return full5x5_showerShape_.e2x5Right; } float full5x5_e2x5Top() const { return full5x5_showerShape_.e2x5Top; } @@ -465,8 +466,6 @@ namespace reco { float scE2x5Max() const { return e2x5Max(); } float scE5x5() const { return e5x5(); } float hadronicOverEm() const { return hcalOverEcal(); } - float hadronicOverEm1() const { return hcalDepth1OverEcal(); } - float hadronicOverEm2() const { return hcalDepth2OverEcal(); } private: // attributes @@ -502,42 +501,42 @@ namespace reco { float tkSumPt; // track iso with electron footprint removed float tkSumPtHEEP; // track iso used for the HEEP ID float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed - float hcalDepth1TowerSumEt; // hcal depht 1 iso deposit with electron footprint removed - float hcalDepth2TowerSumEt; // hcal depht 2 iso deposit with electron footprint removed - float hcalDepth1TowerSumEtBc; // hcal depht 1 iso deposit without towers behind clusters - float hcalDepth2TowerSumEtBc; // hcal depht 2 iso deposit without towers behind clusters + std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed IsolationVariables() : tkSumPt(0.), tkSumPtHEEP(0.), ecalRecHitSumEt(0.), - hcalDepth1TowerSumEt(0.), - hcalDepth2TowerSumEt(0.), - hcalDepth1TowerSumEtBc(0.), - hcalDepth2TowerSumEtBc(0.) {} + hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}} {} }; // 03 accessors float dr03TkSumPt() const { return dr03_.tkSumPt; } float dr03TkSumPtHEEP() const { return dr03_.tkSumPtHEEP; } float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt; } - float dr03HcalDepth1TowerSumEt() const { return dr03_.hcalDepth1TowerSumEt; } - float dr03HcalDepth2TowerSumEt() const { return dr03_.hcalDepth2TowerSumEt; } - float dr03HcalTowerSumEt() const { return dr03HcalDepth1TowerSumEt() + dr03HcalDepth2TowerSumEt(); } - float dr03HcalDepth1TowerSumEtBc() const { return dr03_.hcalDepth1TowerSumEtBc; } - float dr03HcalDepth2TowerSumEtBc() const { return dr03_.hcalDepth2TowerSumEtBc; } - float dr03HcalTowerSumEtBc() const { return dr03HcalDepth1TowerSumEtBc() + dr03HcalDepth2TowerSumEtBc(); } + float dr03HcalTowerSumEt(int depth = 0) const { + const auto &hcaliso = dr03_.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } + float dr03HcalTowerSumEtBc(int depth = 0) const { + const auto &hcaliso = dr03_.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } const IsolationVariables &dr03IsolationVariables() const { return dr03_; } // 04 accessors float dr04TkSumPt() const { return dr04_.tkSumPt; } float dr04TkSumPtHEEP() const { return dr04_.tkSumPtHEEP; } float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt; } - float dr04HcalDepth1TowerSumEt() const { return dr04_.hcalDepth1TowerSumEt; } - float dr04HcalDepth2TowerSumEt() const { return dr04_.hcalDepth2TowerSumEt; } - float dr04HcalTowerSumEt() const { return dr04HcalDepth1TowerSumEt() + dr04HcalDepth2TowerSumEt(); } - float dr04HcalDepth1TowerSumEtBc() const { return dr04_.hcalDepth1TowerSumEtBc; } - float dr04HcalDepth2TowerSumEtBc() const { return dr04_.hcalDepth2TowerSumEtBc; } - float dr04HcalTowerSumEtBc() const { return dr04HcalDepth1TowerSumEtBc() + dr04HcalDepth2TowerSumEtBc(); } + float dr04HcalTowerSumEt(int depth = 0) const { + const auto &hcaliso = dr04_.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } + float dr04HcalTowerSumEtBc(int depth = 0) const { + const auto &hcaliso = dr04_.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } const IsolationVariables &dr04IsolationVariables() const { return dr04_; } // setters ?!? @@ -751,7 +750,7 @@ namespace reco { // Beware that correctEcalEnergy() is modifying few attributes which // were potentially used for preselection, whose value used in // preselection will not be available any more : - // hcalDepth1OverEcal, hcalDepth2OverEcal, eSuperClusterOverP, + // hcalOverEcal, eSuperClusterOverP, // eSeedClusterOverP, eEleClusterOverPout. //======================================================= diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 67309c70d2984..57d45d283d869 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -15,6 +15,7 @@ #include "DataFormats/EgammaCandidates/interface/PhotonCore.h" #include "DataFormats/EgammaReco/interface/ElectronSeed.h" #include "DataFormats/EgammaReco/interface/SuperCluster.h" +#include namespace reco { @@ -142,10 +143,8 @@ namespace reco { float e3x3; float e5x5; float maxEnergyXtal; - float hcalDepth1OverEcal; // hcal over ecal energy using first hcal depth - float hcalDepth2OverEcal; // hcal over ecal energy using 2nd hcal depth - float hcalDepth1OverEcalBc; - float hcalDepth2OverEcalBc; + std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; float effSigmaRR; @@ -174,10 +173,8 @@ namespace reco { e3x3(0.f), e5x5(0.f), maxEnergyXtal(0.f), - hcalDepth1OverEcal(0), - hcalDepth2OverEcal(0), - hcalDepth1OverEcalBc(0), - hcalDepth2OverEcalBc(0), + hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, invalidHcal(false), effSigmaRR(std::numeric_limits::max()), sigmaIetaIphi(std::numeric_limits::max()), @@ -205,27 +202,36 @@ namespace reco { void full5x5_setShowerShapeVariables(const ShowerShape& a) { full5x5_showerShapeBlock_ = a; } /// the total hadronic over electromagnetic fraction - float hadronicOverEm() const { return showerShapeBlock_.hcalDepth1OverEcal + showerShapeBlock_.hcalDepth2OverEcal; } - /// the hadronic release in depth1 over electromagnetic fraction - float hadronicDepth1OverEm() const { return showerShapeBlock_.hcalDepth1OverEcal; } - /// the hadronic release in depth2 over electromagnetic fraction - float hadronicDepth2OverEm() const { return showerShapeBlock_.hcalDepth2OverEcal; } - /// returns false if hadronicOverEm is not reliably estimated (e.g. because hcal was off or masked) - float hadronicOverEmValid() const { return !showerShapeBlock_.invalidHcal; } - - /// the ration of hadronic energy in towers behind the BCs in the SC and the SC energy - float hadTowOverEm() const { - return showerShapeBlock_.hcalDepth1OverEcalBc + showerShapeBlock_.hcalDepth2OverEcalBc; + float hcalOverEcal(int depth = 0) const { + const auto &hovere = showerShapeBlock_.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; } - /// the ration of hadronic energy in towers depth1 behind the BCs in the SC and the SC energy - float hadTowDepth1OverEm() const { return showerShapeBlock_.hcalDepth1OverEcalBc; } - /// the ration of hadronic energy in towers depth2 behind the BCs in the SC and the SC energy - float hadTowDepth2OverEm() const { return showerShapeBlock_.hcalDepth2OverEcalBc; } + float hadronicOverEm(int depth = 0) const { return hcalOverEcal(depth); } + + /// the ratio of total energy of hcal rechits behind the SC and the SC energy + float hcalOverEcalBc(int depth = 0) const { + const auto &hovere = showerShapeBlock_.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + } + float hadTowOverEm(int depth = 0) const { return hcalOverEcalBc(depth); } + const std::vector& hcalTowersBehindClusters() const { return showerShapeBlock_.hcalTowersBehindClusters; } - /// returns false if hadTowOverEm is not reliably estimated (e.g. because hcal was off or masked) - float hadTowOverEmValid() const { return !showerShapeBlock_.invalidHcal; } + + /// returns false if H/E is not reliably estimated (e.g. because hcal was off or masked) + bool hadronicOverEmValid() const { return !showerShapeBlock_.invalidHcal; } + bool hadTowOverEmValid() const { return !showerShapeBlock_.invalidHcal; } + + /// as above, but using 5x5 energy in the ecal + float full5x5_hcalOverEcal(int depth = 0) const { + const auto &hovere = full5x5_showerShapeBlock_.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + } + float full5x5_hcalOverEcalBc(int depth = 0) const { + const auto &hovere = full5x5_showerShapeBlock_.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + } /// Shower shape variables float e1x5() const { return showerShapeBlock_.e1x5; } @@ -360,18 +366,8 @@ namespace reco { //EcalRecHit isolation float ecalRecHitSumEt; - //HcalTower isolation - float hcalTowerSumEt; - //HcalDepth1Tower isolation - float hcalDepth1TowerSumEt; - //HcalDepth2Tower isolation - float hcalDepth2TowerSumEt; - //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalTowerSumEtBc; - //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth1TowerSumEtBc; - //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth2TowerSumEtBc; + std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed //Sum of track pT in a cone of dR float trkSumPtSolidCone; //Sum of track pT in a hollow cone of outer radius, inner radius @@ -385,12 +381,8 @@ namespace reco { : ecalRecHitSumEt(0), - hcalTowerSumEt(0), - hcalDepth1TowerSumEt(0), - hcalDepth2TowerSumEt(0), - hcalTowerSumEtBc(0), - hcalDepth1TowerSumEtBc(0), - hcalDepth2TowerSumEtBc(0), + hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, trkSumPtSolidCone(0), trkSumPtHollowCone(0), nTrkSolidCone(0), @@ -408,18 +400,16 @@ namespace reco { /// Egamma Isolation variables in cone dR=0.4 ///Ecal isolation sum calculated from recHits float ecalRecHitSumEtConeDR04() const { return isolationR04_.ecalRecHitSumEt; } - /// Hcal isolation sum - float hcalTowerSumEtConeDR04() const { return isolationR04_.hcalTowerSumEt; } - /// Hcal-Depth1 isolation sum - float hcalDepth1TowerSumEtConeDR04() const { return isolationR04_.hcalDepth1TowerSumEt; } - /// Hcal-Depth2 isolation sum - float hcalDepth2TowerSumEtConeDR04() const { return isolationR04_.hcalDepth2TowerSumEt; } - /// Hcal isolation sum subtracting the hadronic energy in towers behind the BCs in the SC - float hcalTowerSumEtBcConeDR04() const { return isolationR04_.hcalTowerSumEtBc; } - /// Hcal-Depth1 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth1TowerSumEtBcConeDR04() const { return isolationR04_.hcalDepth1TowerSumEtBc; } - /// Hcal-Depth2 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth2TowerSumEtBcConeDR04() const { return isolationR04_.hcalDepth2TowerSumEtBc; } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() + float hcalTowerSumEtConeDR04(int depth = 0) const { + const auto &hcaliso = isolationR04_.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() + float hcalTowerSumEtBcConeDR04(int depth = 0) const { + const auto &hcaliso = isolationR04_.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } // Track pT sum float trkSumPtSolidConeDR04() const { return isolationR04_.trkSumPtSolidCone; } //As above, excluding the core at the center of the cone @@ -431,18 +421,16 @@ namespace reco { // /// Isolation variables in cone dR=0.3 float ecalRecHitSumEtConeDR03() const { return isolationR03_.ecalRecHitSumEt; } - /// Hcal isolation sum - float hcalTowerSumEtConeDR03() const { return isolationR03_.hcalTowerSumEt; } - /// Hcal-Depth1 isolation sum - float hcalDepth1TowerSumEtConeDR03() const { return isolationR03_.hcalDepth1TowerSumEt; } - /// Hcal-Depth2 isolation sum - float hcalDepth2TowerSumEtConeDR03() const { return isolationR03_.hcalDepth2TowerSumEt; } - /// Hcal isolation sum subtracting the hadronic energy in towers behind the BCs in the SC - float hcalTowerSumEtBcConeDR03() const { return isolationR03_.hcalTowerSumEtBc; } - /// Hcal-Depth1 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth1TowerSumEtBcConeDR03() const { return isolationR03_.hcalDepth1TowerSumEtBc; } - /// Hcal-Depth2 isolation sum subtracting the hadronic energy in towers behind the BCs in the SC - float hcalDepth2TowerSumEtBcConeDR03() const { return isolationR03_.hcalDepth2TowerSumEtBc; } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() + float hcalTowerSumEtConeDR03(int depth = 0) const { + const auto &hcaliso = isolationR03_.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } + /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() + float hcalTowerSumEtBcConeDR03(int depth = 0) const { + const auto &hcaliso = isolationR03_.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + } // Track pT sum c float trkSumPtSolidConeDR03() const { return isolationR03_.trkSumPtSolidCone; } //As above, excluding the core at the center of the cone diff --git a/DataFormats/EgammaCandidates/src/GsfElectron.cc b/DataFormats/EgammaCandidates/src/GsfElectron.cc index 3197b3cbc837c..dbba47911b68a 100644 --- a/DataFormats/EgammaCandidates/src/GsfElectron.cc +++ b/DataFormats/EgammaCandidates/src/GsfElectron.cc @@ -178,8 +178,10 @@ void GsfElectron::setCorrectedEcalEnergy(float newEnergy, bool rescaleDependentV momentum *= newEnergy / momentum.e(); setP4(momentum); if (corrections_.correctedEcalEnergy > 0. && rescaleDependentValues) { - showerShape_.hcalDepth1OverEcal *= corrections_.correctedEcalEnergy / newEnergy; - showerShape_.hcalDepth2OverEcal *= corrections_.correctedEcalEnergy / newEnergy; + for (size_t id = 0; id < showerShape_.hcalOverEcal.size(); ++id) { + showerShape_.hcalOverEcal[id] *= corrections_.correctedEcalEnergy / newEnergy; + showerShape_.hcalOverEcalBc[id] *= corrections_.correctedEcalEnergy / newEnergy; + } trackClusterMatching_.eSuperClusterOverP *= newEnergy / corrections_.correctedEcalEnergy; corrections_.correctedEcalEnergyError *= newEnergy / corrections_.correctedEcalEnergy; } diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 586d6664267a4..858531ae4320e 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -38,7 +38,8 @@ - + + @@ -50,7 +51,8 @@ - + + @@ -165,14 +167,16 @@ - + + - + + From ee3bbf4f51dfabde7a5eee1f2f85fc0d0afd2eb5 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 20 Apr 2021 10:08:22 +0200 Subject: [PATCH 03/27] ele and pho algo/producer changes --- .../interface/ElectronHcalHelper.h | 58 +++-- .../interface/GsfElectronAlgo.h | 20 +- .../src/ElectronHcalHelper.cc | 110 ++++------ .../src/GsfElectronAlgo.cc | 151 ++++++++----- .../plugins/ElectronSeedProducer.cc | 18 +- .../plugins/GsfElectronProducer.cc | 47 +++-- RecoEgamma/EgammaIsolationAlgos/BuildFile.xml | 1 + .../interface/EgammaHcalIsolation.h | 170 +++++++++------ .../src/EgammaHcalIsolation.cc | 199 ++++++++++++------ .../EgammaPhotonProducers/BuildFile.xml | 1 + .../python/gedPhotons_cfi.py | 17 +- .../python/photons_cfi.py | 29 +-- .../src/GEDPhotonProducer.cc | 140 ++++++------ .../src/PhotonProducer.cc | 92 ++++---- 14 files changed, 605 insertions(+), 448 deletions(-) diff --git a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h index 40d3474b794ba..fde8ec45e6081 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h @@ -1,7 +1,6 @@ #ifndef ElectronHcalHelper_h #define ElectronHcalHelper_h -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "FWCore/Framework/interface/Event.h" @@ -11,13 +10,14 @@ #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHadTower.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h" #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" +#include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h" class ConsumesCollector; class EgammaHadTower; class HcalTopology; class HcalChannelQuality; +class HcalHcalSeverityLevelComputer; class CaloTowerConstituentsMap; class ElectronHcalHelper { @@ -27,58 +27,50 @@ class ElectronHcalHelper { double hOverEConeSize; // strategy - bool useTowers, checkHcalStatus; - - // specific parameters if use towers - edm::EDGetTokenT hcalTowers; - double hOverEPtMin; // min tower Et for H/E evaluation + bool onlyBehindCluster, checkHcalStatus; // specific parameters if use rechits edm::EDGetTokenT hcalRecHits; - double hOverEHBMinE; - double hOverEHFMinE; + std::array eThresHB; + int maxSeverityHB; + std::array eThresHE; + int maxSeverityHE; }; ElectronHcalHelper(const Configuration &cfg, edm::ConsumesCollector &&cc); - void beginEvent(const edm::Event &, const edm::EventSetup &); - - double hcalESum(const reco::SuperCluster &, const std::vector *excludeTowers = nullptr) const; - double hcalESumDepth1(const reco::SuperCluster &, const std::vector *excludeTowers = nullptr) const; - double hcalESumDepth2(const reco::SuperCluster &, const std::vector *excludeTowers = nullptr) const; - double hOverEConeSize() const { return cfg_.hOverEConeSize; } + void beginEvent(const edm::Event &evt, const edm::EventSetup &eventSetup); - // Behind clusters inline auto hcalTowersBehindClusters(const reco::SuperCluster &sc) const { return egamma::towersOf(sc, *towerMap_); } - inline auto hcalESumDepth1BehindClusters(const std::vector &towers) const { - return egamma::depth1HcalESum(towers, *towersFromCollection_); - } - inline auto hcalESumDepth2BehindClusters(const std::vector &towers) const { - return egamma::depth2HcalESum(towers, *towersFromCollection_); - } + double hcalESum(const reco::SuperCluster &, int depth) const; + double hOverEConeSize() const { return cfg_.hOverEConeSize; } + int maxSeverityHB() const { return cfg_.maxSeverityHB; } + int maxSeverityHE() const { return cfg_.maxSeverityHE; } // forward EgammaHadTower methods, if checkHcalStatus is enabled, using towers and H/E - // otherwise, return true bool hasActiveHcal(const reco::SuperCluster &sc) const; + // QoL when one needs raw instances of EgammaHcalIsolation in addition to this class + const auto hcalTopology() const { return hcalTopology_; } + const auto hcalChannelQuality() const { return hcalChannelQuality_; } + const auto hcalSevLvlComputer() const { return hcalSevLvlComputer_; } + const auto towerMap() const { return towerMap_; } + private: const Configuration cfg_; - edm::ESGetToken hcalChannelQualityToken_; + edm::ESGetToken caloGeometryToken_; edm::ESGetToken hcalTopologyToken_; + edm::ESGetToken hcalChannelQualityToken_; + edm::ESGetToken hcalSevLvlComputerToken_; edm::ESGetToken towerMapToken_; - edm::ESGetToken caloGeometryToken_; // event data (rechits strategy) - std::unique_ptr hcalIso_ = nullptr; - - // event data (towers strategy) - std::unique_ptr towerIso1_ = nullptr; - std::unique_ptr towerIso2_ = nullptr; - CaloTowerCollection const *towersFromCollection_ = nullptr; - CaloTowerConstituentsMap const *towerMap_ = nullptr; - HcalChannelQuality const *hcalQuality_ = nullptr; + std::unique_ptr hcalIso_; HcalTopology const *hcalTopology_ = nullptr; + HcalChannelQuality const *hcalChannelQuality_ = nullptr; + HcalSeverityLevelComputer const *hcalSevLvlComputer_ = nullptr; + CaloTowerConstituentsMap const *towerMap_ = nullptr; }; #endif diff --git a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h index a54ff1f8b5771..55c69af70a144 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h @@ -34,7 +34,6 @@ #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h" #include "RecoEgamma/EgammaElectronAlgos/interface/RegressionHelper.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EleTkIsolFromCands.h" #include "RecoEgamma/ElectronIdentification/interface/ElectronMVAEstimator.h" #include "RecoEgamma/ElectronIdentification/interface/SoftElectronMVAEstimator.h" @@ -60,7 +59,7 @@ class GsfElectronAlgo { struct Tokens { edm::EDGetTokenT gsfElectronCores; - edm::EDGetTokenT hcalTowersTag; + edm::EDGetTokenT hcalRecHitsTag; edm::EDGetTokenT barrelSuperClusters; edm::EDGetTokenT endcapSuperClusters; edm::EDGetTokenT barrelRecHitCollection; @@ -114,10 +113,10 @@ class GsfElectronAlgo { double maxHOverEEndcapsCone; double maxHBarrelCone; double maxHEndcapsCone; - double maxHOverEBarrelTower; - double maxHOverEEndcapsTower; - double maxHBarrelTower; - double maxHEndcapsTower; + double maxHOverEBarrelBc; + double maxHOverEEndcapsBc; + double maxHBarrelBc; + double maxHEndcapsBc; // maximum eta difference between the supercluster position and the track position at the closest impact to the supercluster double maxDeltaEtaBarrel; @@ -179,7 +178,8 @@ class GsfElectronAlgo { GsfElectronAlgo(const Tokens&, const StrategyConfiguration&, const CutsConfiguration& cutsCfg, - const ElectronHcalHelper::Configuration& hcalCfg, + const ElectronHcalHelper::Configuration& hcalCone, + const ElectronHcalHelper::Configuration& hcalBc, const IsolationConfiguration&, const EcalRecHitsConfiguration&, std::unique_ptr&& crackCorrectionFunction, @@ -231,7 +231,8 @@ class GsfElectronAlgo { template reco::GsfElectron::ShowerShape calculateShowerShape(const reco::SuperClusterRef&, - ElectronHcalHelper const& hcalHelper, + ElectronHcalHelper const& hcalHelperCone, + ElectronHcalHelper const& hcalHelperBc, EventData const& eventData, CaloTopology const& topology, CaloGeometry const& geometry, @@ -258,7 +259,8 @@ class GsfElectronAlgo { const edm::ESGetToken ecalPFRechitThresholdsToken_; // additional configuration and helpers - ElectronHcalHelper hcalHelper_; + ElectronHcalHelper hcalHelperCone_; + ElectronHcalHelper hcalHelperBc_; std::unique_ptr crackCorrectionFunction_; RegressionHelper regHelper_; }; diff --git a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc index d37dd87742ca3..aea93e163fa23 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc @@ -1,92 +1,74 @@ #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "FWCore/Framework/interface/ConsumesCollector.h" using namespace reco; ElectronHcalHelper::ElectronHcalHelper(const Configuration& cfg, edm::ConsumesCollector&& cc) : cfg_(cfg) { - if (cfg_.hOverEConeSize == 0) { + if (cfg_.hOverEConeSize == 0. and !cfg_.onlyBehindCluster) { return; } - if (cfg_.useTowers) { - hcalChannelQualityToken_ = cc.esConsumes(edm::ESInputTag("", "withTopo")); - hcalTopologyToken_ = cc.esConsumes(); - towerMapToken_ = cc.esConsumes(); - } else { - caloGeometryToken_ = cc.esConsumes(); - } + caloGeometryToken_ = cc.esConsumes(); + hcalTopologyToken_ = cc.esConsumes(); + hcalChannelQualityToken_ = cc.esConsumes(edm::ESInputTag("", "withTopo")); + hcalSevLvlComputerToken_ = cc.esConsumes(); + towerMapToken_ = cc.esConsumes(); } void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup& eventSetup) { - if (cfg_.hOverEConeSize == 0) { + if (cfg_.hOverEConeSize == 0. and !cfg_.onlyBehindCluster) { return; } - if (cfg_.useTowers) { - towersFromCollection_ = &evt.get(cfg_.hcalTowers); + hcalTopology_ = &eventSetup.getData(hcalTopologyToken_); + hcalChannelQuality_ = &eventSetup.getData(hcalChannelQualityToken_); + hcalSevLvlComputer_ = &eventSetup.getData(hcalSevLvlComputerToken_); + towerMap_ = &eventSetup.getData(towerMapToken_); - towerMap_ = &eventSetup.getData(towerMapToken_); - hcalQuality_ = &eventSetup.getData(hcalChannelQualityToken_); - hcalTopology_ = &eventSetup.getData(hcalTopologyToken_); - - towerIso1_ = - std::make_unique(cfg_.hOverEConeSize, 0., cfg_.hOverEPtMin, 1, towersFromCollection_); - towerIso2_ = - std::make_unique(cfg_.hOverEConeSize, 0., cfg_.hOverEPtMin, 2, towersFromCollection_); - } else { - hcalIso_ = std::make_unique(cfg_.hOverEConeSize, - 0., - cfg_.hOverEHBMinE, - cfg_.hOverEHFMinE, + if (cfg_.onlyBehindCluster) { + hcalIso_ = std::make_unique(EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, 0., + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, 0., + cfg_.eThresHB, + std::array{{0., 0., 0., 0.}}, + cfg_.maxSeverityHB, + cfg_.eThresHE, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + cfg_.maxSeverityHE, + evt.get(cfg_.hcalRecHits), eventSetup.getHandle(caloGeometryToken_), - evt.get(cfg_.hcalRecHits)); - } -} - -double ElectronHcalHelper::hcalESum(const SuperCluster& sc, const std::vector* excludeTowers) const { - if (cfg_.hOverEConeSize == 0) { - return 0; - } - if (cfg_.useTowers) { - return (hcalESumDepth1(sc, excludeTowers) + hcalESumDepth2(sc, excludeTowers)); - } else { - return hcalIso_->getHcalESum(&sc); + eventSetup.getHandle(hcalTopologyToken_), + eventSetup.getHandle(hcalChannelQualityToken_), + eventSetup.getHandle(hcalSevLvlComputerToken_), + towerMap_); } -} - -double ElectronHcalHelper::hcalESumDepth1(const SuperCluster& sc, - const std::vector* excludeTowers) const { - if (cfg_.hOverEConeSize == 0) { - return 0; - } - if (cfg_.useTowers) { - return towerIso1_->getTowerESum(&sc, excludeTowers); - } else { - return hcalIso_->getHcalESumDepth1(&sc); + else { + hcalIso_ = std::make_unique(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + cfg_.hOverEConeSize, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + 0., + cfg_.eThresHB, + std::array{{0., 0., 0., 0.}}, + cfg_.maxSeverityHB, + cfg_.eThresHE, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + cfg_.maxSeverityHE, + evt.get(cfg_.hcalRecHits), + eventSetup.getHandle(caloGeometryToken_), + eventSetup.getHandle(hcalTopologyToken_), + eventSetup.getHandle(hcalChannelQualityToken_), + eventSetup.getHandle(hcalSevLvlComputerToken_), + towerMap_); } } -double ElectronHcalHelper::hcalESumDepth2(const SuperCluster& sc, - const std::vector* excludeTowers) const { - if (cfg_.hOverEConeSize == 0) { - return 0; - } - if (cfg_.useTowers) { - return towerIso2_->getTowerESum(&sc, excludeTowers); - } else { - return hcalIso_->getHcalESumDepth2(&sc); - } +bool ElectronHcalHelper::hasActiveHcal(const reco::SuperCluster &sc) const { + return (cfg_.checkHcalStatus) ? egamma::hasActiveHcal(hcalTowersBehindClusters(sc), *towerMap_, *hcalChannelQuality_, *hcalTopology_) : true; } -bool ElectronHcalHelper::hasActiveHcal(const reco::SuperCluster& sc) const { - if (cfg_.checkHcalStatus && cfg_.hOverEConeSize != 0 && cfg_.useTowers) { - return egamma::hasActiveHcal(egamma::towersOf(sc, *towerMap_), *towerMap_, *hcalQuality_, *hcalTopology_); - } else { - return true; - } +double ElectronHcalHelper::hcalESum(const SuperCluster &sc, int depth) const { + return (cfg_.onlyBehindCluster) ? hcalIso_->getHcalESumBc(&sc, depth) : (cfg_.hOverEConeSize > 0.) ? hcalIso_->getHcalESum(&sc, depth) : 0.; } diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index d85d7efd0bea0..8234a97e5a410 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -69,10 +69,8 @@ struct GsfElectronAlgo::EventData { edm::Handle conversions; // isolation helpers - EgammaTowerIsolation hadDepth1Isolation03, hadDepth1Isolation04; - EgammaTowerIsolation hadDepth2Isolation03, hadDepth2Isolation04; - EgammaTowerIsolation hadDepth1Isolation03Bc, hadDepth1Isolation04Bc; - EgammaTowerIsolation hadDepth2Isolation03Bc, hadDepth2Isolation04Bc; + EgammaHcalIsolation hadIsolation03, hadIsolation04; + EgammaHcalIsolation hadIsolation03Bc, hadIsolation04Bc; EgammaRecHitIsolation ecalBarrelIsol03, ecalBarrelIsol04; EgammaRecHitIsolation ecalEndcapIsol03, ecalEndcapIsol04; @@ -290,7 +288,8 @@ reco::GsfElectron::SaturationInfo GsfElectronAlgo::calculateSaturationInfo(const template reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco::SuperClusterRef& theClus, - ElectronHcalHelper const& hcalHelper, + ElectronHcalHelper const& hcalHelperCone, + ElectronHcalHelper const& hcalHelperBc, EventData const& eventData, CaloTopology const& topology, CaloGeometry const& geometry, @@ -327,7 +326,7 @@ reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco: &thresholds, cfg_.cuts.multThresEB, cfg_.cuts.multThresEE) - : ClusterTools::localCovariances(seedCluster, recHits, &topology); + : ClusterTools::localCovariances(seedCluster, recHits, &topology); showerShape.sigmaEtaEta = sqrt(covariances[0]); showerShape.sigmaIetaIeta = sqrt(localCovariances[0]); @@ -340,15 +339,16 @@ reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco: const float scale = full5x5 ? showerShape.e5x5 : theClus->energy(); - showerShape.hcalDepth1OverEcal = hcalHelper.hcalESumDepth1(*theClus) / theClus->energy(); - showerShape.hcalDepth2OverEcal = hcalHelper.hcalESumDepth2(*theClus) / theClus->energy(); - showerShape.hcalTowersBehindClusters = hcalHelper.hcalTowersBehindClusters(*theClus); - showerShape.hcalDepth1OverEcalBc = - hcalHelper.hcalESumDepth1BehindClusters(showerShape.hcalTowersBehindClusters) / scale; - showerShape.hcalDepth2OverEcalBc = - hcalHelper.hcalESumDepth2BehindClusters(showerShape.hcalTowersBehindClusters) / scale; - showerShape.invalidHcal = (showerShape.hcalDepth1OverEcalBc == 0 && showerShape.hcalDepth2OverEcalBc == 0 && - !hcalHelper.hasActiveHcal(*theClus)); + for (int id = 0; id < 7; ++id) { + showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*theClus, id) / scale; + showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*theClus, id) / scale; + } + showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*theClus); + showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*theClus); + std::cout << "GsfEleAlgo :: ntower behind cluster: " << showerShape.hcalTowersBehindClusters.size() << std::endl; + for (uint ibc = 0; ibc < showerShape.hcalTowersBehindClusters.size(); ++ibc) + std::cout << "GsfEleAlgo :: calotower " << ibc << " detid ieta iphi: " << showerShape.hcalTowersBehindClusters[ibc] + << " " << showerShape.hcalTowersBehindClusters[ibc].ieta() << " " << showerShape.hcalTowersBehindClusters[ibc].iphi() << std::endl; // extra shower shapes const float see_by_spp = showerShape.sigmaIetaIeta * showerShape.sigmaIphiIphi; @@ -381,7 +381,8 @@ reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco: GsfElectronAlgo::GsfElectronAlgo(const Tokens& input, const StrategyConfiguration& strategy, const CutsConfiguration& cuts, - const ElectronHcalHelper::Configuration& hcal, + const ElectronHcalHelper::Configuration& hcalCone, + const ElectronHcalHelper::Configuration& hcalBc, const IsolationConfiguration& iso, const EcalRecHitsConfiguration& recHits, std::unique_ptr&& crackCorrectionFunction, @@ -402,7 +403,8 @@ GsfElectronAlgo::GsfElectronAlgo(const Tokens& input, trackerGeometryToken_{cc.esConsumes()}, ecalSeveretyLevelAlgoToken_{cc.esConsumes()}, ecalPFRechitThresholdsToken_{cc.esConsumes()}, - hcalHelper_{hcal, std::move(cc)}, + hcalHelperCone_{hcalCone, std::move(cc)}, + hcalHelperBc_{hcalBc, std::move(cc)}, crackCorrectionFunction_{std::forward>(crackCorrectionFunction)}, regHelper_{reg, cfg_.strategy.useEcalRegression, cfg_.strategy.useCombinationRegression, cc} @@ -420,12 +422,11 @@ void GsfElectronAlgo::checkSetup(const edm::EventSetup& es) { GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, CaloGeometry const& caloGeometry, EcalSeverityLevelAlgo const& ecalSeveretyLevelAlgo) { - auto const& towers = event.get(cfg_.tokens.hcalTowersTag); + auto const& hcalRecHits = event.get(cfg_.tokens.hcalRecHitsTag); // Isolation algos float egHcalIsoConeSizeOutSmall = 0.3, egHcalIsoConeSizeOutLarge = 0.4; float egHcalIsoConeSizeIn = cfg_.iso.intRadiusHcal, egHcalIsoPtMin = cfg_.iso.etMinHcal; - int egHcalDepth1 = 1, egHcalDepth2 = 2; float egIsoConeSizeOutSmall = 0.3, egIsoConeSizeOutLarge = 0.4, egIsoJurassicWidth = cfg_.iso.jurassicWidth; float egIsoPtMinBarrel = cfg_.iso.etMinBarrel, egIsoEMinBarrel = cfg_.iso.eMinBarrel, @@ -449,22 +450,60 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, .vertices = event.getHandle(cfg_.tokens.vtxCollectionTag), .conversions = cfg_.strategy.fillConvVtxFitProb ? event.getHandle(cfg_.tokens.conversions) : edm::Handle(), - .hadDepth1Isolation03 = - EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth1, &towers), - .hadDepth1Isolation04 = - EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth1, &towers), - .hadDepth2Isolation03 = - EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth2, &towers), - .hadDepth2Isolation04 = - EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, egHcalIsoConeSizeIn, egHcalIsoPtMin, egHcalDepth2, &towers), - .hadDepth1Isolation03Bc = - EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, 0., egHcalIsoPtMin, egHcalDepth1, &towers), - .hadDepth1Isolation04Bc = - EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, 0., egHcalIsoPtMin, egHcalDepth1, &towers), - .hadDepth2Isolation03Bc = - EgammaTowerIsolation(egHcalIsoConeSizeOutSmall, 0., egHcalIsoPtMin, egHcalDepth2, &towers), - .hadDepth2Isolation04Bc = - EgammaTowerIsolation(egHcalIsoConeSizeOutLarge, 0., egHcalIsoPtMin, egHcalDepth2, &towers), + + .hadIsolation03 = + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutSmall, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeIn, + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hcalRecHits, caloGeometry, + *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + .hadIsolation04 = + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutLarge, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeIn, + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hcalRecHits, caloGeometry, + *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + .hadIsolation03Bc = + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutSmall, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, 0., + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hcalRecHits, caloGeometry, + *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + .hadIsolation04Bc = + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutLarge, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, 0., + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hcalRecHits, caloGeometry, + *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + .ecalBarrelIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall, egIsoConeSizeInBarrel, egIsoJurassicWidth, @@ -545,7 +584,8 @@ reco::GsfElectronCollection GsfElectronAlgo::completeElectrons(edm::Event const& auto const& thresholds = eventSetup.getData(ecalPFRechitThresholdsToken_); // prepare access to hcal data - hcalHelper_.beginEvent(event, eventSetup); + hcalHelperCone_.beginEvent(event, eventSetup); + hcalHelperBc_.beginEvent(event, eventSetup); checkSetup(eventSetup); auto eventData = beginEvent(event, caloGeometry, ecalSeveretyLevelAlgo); @@ -586,6 +626,8 @@ reco::GsfElectronCollection GsfElectronAlgo::completeElectrons(edm::Event const& gsfTrackTable = egamma::conv::TrackTable(*eventData.originalGsfTracks); } + std::cout << "GsfEleAlgo :: run lumi event " << event.eventAuxiliary().run() << " " << event.eventAuxiliary().luminosityBlock() + << " " << event.eventAuxiliary().event() << std::endl; createElectron(electrons, electronData, eventData, @@ -644,20 +686,20 @@ void GsfElectronAlgo::setCutBasedPreselectionFlag(GsfElectron& ele, const reco:: LogTrace("GsfElectronAlgo") << "E/p criteria are satisfied"; // HoE cuts - LogTrace("GsfElectronAlgo") << "HoE1 : " << ele.hcalDepth1OverEcal() << ", HoE2 : " << ele.hcalDepth2OverEcal(); + LogTrace("GsfElectronAlgo") << "HoE : " << ele.hcalOverEcal(); double hoeCone = ele.hcalOverEcal(); - double hoeTower = ele.hcalOverEcalBc(); + double hoeBc = ele.hcalOverEcalBc(); const reco::CaloCluster& seedCluster = *(ele.superCluster()->seed()); int detector = seedCluster.hitsAndFractions()[0].first.subdetId(); bool HoEveto = false; double scle = ele.superCluster()->energy(); if (detector == EcalBarrel) - HoEveto = hoeCone * scle < cfg.maxHBarrelCone || hoeTower * scle < cfg.maxHBarrelTower || - hoeCone < cfg.maxHOverEBarrelCone || hoeTower < cfg.maxHOverEBarrelTower; + HoEveto = hoeCone * scle < cfg.maxHBarrelCone || hoeBc * scle < cfg.maxHBarrelBc || + hoeCone < cfg.maxHOverEBarrelCone || hoeBc < cfg.maxHOverEBarrelBc; else if (detector == EcalEndcap) - HoEveto = hoeCone * scle < cfg.maxHEndcapsCone || hoeTower * scle < cfg.maxHEndcapsTower || - hoeCone < cfg.maxHOverEEndcapsCone || hoeTower < cfg.maxHOverEEndcapsTower; + HoEveto = hoeCone * scle < cfg.maxHEndcapsCone || hoeBc * scle < cfg.maxHEndcapsBc || + hoeCone < cfg.maxHOverEEndcapsCone || hoeBc < cfg.maxHOverEEndcapsBc; if (!HoEveto) return; @@ -860,9 +902,9 @@ void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons, reco::GsfElectron::ShowerShape full5x5_showerShape; if (!EcalTools::isHGCalDet((DetId::Detector)region)) { showerShape = calculateShowerShape( - electronData.superClusterRef, hcalHelper_, eventData, topology, geometry, thresholds); + electronData.superClusterRef, hcalHelperCone_, hcalHelperBc_, eventData, topology, geometry, thresholds); full5x5_showerShape = calculateShowerShape( - electronData.superClusterRef, hcalHelper_, eventData, topology, geometry, thresholds); + electronData.superClusterRef, hcalHelperCone_, hcalHelperBc_, eventData, topology, geometry, thresholds); } //==================================================== @@ -1024,20 +1066,17 @@ void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons, dr04.tkSumPtHEEP = eventData.tkIsolHEEP04Calc(*ele.gsfTrack()).ptSum; if (!EcalTools::isHGCalDet((DetId::Detector)region)) { - dr03.hcalDepth1TowerSumEt = eventData.hadDepth1Isolation03.getTowerEtSum(&ele); - dr03.hcalDepth2TowerSumEt = eventData.hadDepth2Isolation03.getTowerEtSum(&ele); - dr03.hcalDepth1TowerSumEtBc = - eventData.hadDepth1Isolation03Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters)); - dr03.hcalDepth2TowerSumEtBc = - eventData.hadDepth2Isolation03Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters)); + for (int id = 0; id < 7; ++id) { + dr03.hcalRecHitSumEt[id] = eventData.hadIsolation03.getHcalEtSum(&ele, id); + dr03.hcalRecHitSumEtBc[id] = eventData.hadIsolation03Bc.getHcalEtSumBc(&ele, id); + + dr04.hcalRecHitSumEt[id] = eventData.hadIsolation04.getHcalEtSum(&ele, id); + dr04.hcalRecHitSumEtBc[id] = eventData.hadIsolation04Bc.getHcalEtSumBc(&ele, id); + } + dr03.ecalRecHitSumEt = eventData.ecalBarrelIsol03.getEtSum(&ele); dr03.ecalRecHitSumEt += eventData.ecalEndcapIsol03.getEtSum(&ele); - dr04.hcalDepth1TowerSumEt = eventData.hadDepth1Isolation04.getTowerEtSum(&ele); - dr04.hcalDepth2TowerSumEt = eventData.hadDepth2Isolation04.getTowerEtSum(&ele); - dr04.hcalDepth1TowerSumEtBc = - eventData.hadDepth1Isolation04Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters)); - dr04.hcalDepth2TowerSumEtBc = - eventData.hadDepth2Isolation04Bc.getTowerEtSum(&ele, &(showerShape.hcalTowersBehindClusters)); + dr04.ecalRecHitSumEt = eventData.ecalBarrelIsol04.getEtSum(&ele); dr04.ecalRecHitSumEt += eventData.ecalEndcapIsol04.getEtSum(&ele); } diff --git a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc index 96578f86d3b38..0db87caf1c1fe 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc @@ -80,9 +80,11 @@ ElectronSeedProducer::ElectronSeedProducer(const edm::ParameterSet& conf) ElectronHcalHelper::Configuration hcalCfg{}; hcalCfg.hOverEConeSize = conf.getParameter("hOverEConeSize"); if (hcalCfg.hOverEConeSize > 0) { - hcalCfg.useTowers = true; - hcalCfg.hcalTowers = consumes(conf.getParameter("hcalTowers")); - hcalCfg.hOverEPtMin = conf.getParameter("hOverEPtMin"); + hcalCfg.hcalRecHits = consumes(conf.getParameter("hcalRecHits")); + hcalCfg.eThresHB = conf.getParameter>("recHitEThresholdHB"); + hcalCfg.maxSeverityHB = conf.getParameter("maxHcalRecHitSeverity"); + hcalCfg.eThresHE = conf.getParameter>("recHitEThresholdHE"); + hcalCfg.maxSeverityHE = hcalCfg.maxSeverityHB; } hcalHelper_ = std::make_unique(hcalCfg, consumesCollector()); @@ -168,7 +170,7 @@ SuperClusterRefVector ElectronSeedProducer::filterClusters( if (scl.energy() / cosh(sclEta) > SCEtCut_) { if (applyHOverECut_) { bool hoeVeto = false; - double had = hcalHelper_->hcalESumDepth1(scl) + hcalHelper_->hcalESumDepth2(scl); + double had = hcalHelper_->hcalESum(scl, 0); double scle = scl.energy(); int det_group = scl.seed()->hitsAndFractions()[0].first.det(); int detector = scl.seed()->hitsAndFractions()[0].first.subdetId(); @@ -212,10 +214,10 @@ void ElectronSeedProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add("hOverEConeSize", 0.15); desc.add("maxHOverEBarrel", 0.15); desc.add("maxHOverEEndcaps", 0.15); - - // H/E towers - desc.add("hcalTowers", {"towerMaker"}); - desc.add("hOverEPtMin", 0.0); + desc.add("hcalRecHits", {"hbhereco"}); + desc.add>("recHitEThresholdHB", {0.1, 0.2, 0.3, 0.3}); // FIXME defaults for tests + desc.add>("recHitEThresholdHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); + desc.add("maxHcalRecHitSeverity", 9); // H/E equivalent for HGCal desc.add("allowHGCal", false); diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index 6272f867fde43..9104080b478a5 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -96,7 +96,7 @@ class GsfElectronProducer : public edm::stream::EDProducer("gsfElectronCoresTag", {"ecalDrivenGsfElectronCores"}); - desc.add("hcalTowers", {"towerMaker"}); desc.add("vtxTag", {"offlinePrimaryVertices"}); desc.add("conversionsTag", {"allConversions"}); desc.add("gsfPfRecTracksTag", {"pfTrackElec"}); @@ -130,6 +129,7 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("beamSpotTag", {"offlineBeamSpot"}); desc.add("egmPFCandidatesTag", {"particleFlowEGamma"}); desc.add("checkHcalStatus", true); + desc.add("hcalRecHits", edm::InputTag("hbhereco")); // steering desc.add("useDefaultEnergyCorrection", true); @@ -153,6 +153,11 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add>("recHitSeverityToBeExcludedBarrel"); desc.add>("recHitSeverityToBeExcludedEndcaps"); + // Hcal rec hits configuration + desc.add>("recHitEThresholdHB", {0.1, 0.2, 0.3, 0.3}); // FIXME defaults for tests + desc.add>("recHitEThresholdHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); + desc.add("maxHcalRecHitSeverity", 9); + // Isolation algos configuration desc.add("trkIsol03Cfg", EleTkIsolFromCands::pSetDescript()); desc.add("trkIsol04Cfg", EleTkIsolFromCands::pSetDescript()); @@ -190,15 +195,14 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr psd0.add("maxDeltaPhiBarrel", 0.15); psd0.add("maxDeltaPhiEndcaps", 0.15); psd0.add("hOverEConeSize", 0.15); - psd0.add("hOverEPtMin", 0.0); psd0.add("maxHOverEBarrelCone", 0.15); psd0.add("maxHOverEEndcapsCone", 0.15); psd0.add("maxHBarrelCone", 0.0); psd0.add("maxHEndcapsCone", 0.0); - psd0.add("maxHOverEBarrelTower", 0.15); - psd0.add("maxHOverEEndcapsTower", 0.15); - psd0.add("maxHBarrelTower", 0.0); - psd0.add("maxHEndcapsTower", 0.0); + psd0.add("maxHOverEBarrelBc", 0.15); + psd0.add("maxHOverEEndcapsBc", 0.15); + psd0.add("maxHBarrelBc", 0.0); + psd0.add("maxHEndcapsBc", 0.0); psd0.add("maxSigmaIetaIetaBarrel", 999999999.0); psd0.add("maxSigmaIetaIetaEndcaps", 999999999.0); psd0.add("maxFbremBarrel", 999999999.0); @@ -258,10 +262,10 @@ namespace { .maxHOverEEndcapsCone = pset.getParameter("maxHOverEEndcapsCone"), .maxHBarrelCone = pset.getParameter("maxHBarrelCone"), .maxHEndcapsCone = pset.getParameter("maxHEndcapsCone"), - .maxHOverEBarrelTower = pset.getParameter("maxHOverEBarrelTower"), - .maxHOverEEndcapsTower = pset.getParameter("maxHOverEEndcapsTower"), - .maxHBarrelTower = pset.getParameter("maxHBarrelTower"), - .maxHEndcapsTower = pset.getParameter("maxHEndcapsTower"), + .maxHOverEBarrelBc = pset.getParameter("maxHOverEBarrelBc"), + .maxHOverEEndcapsBc = pset.getParameter("maxHOverEEndcapsBc"), + .maxHBarrelBc = pset.getParameter("maxHBarrelBc"), + .maxHEndcapsBc = pset.getParameter("maxHEndcapsBc"), .maxDeltaEtaBarrel = pset.getParameter("maxDeltaEtaBarrel"), .maxDeltaEtaEndcaps = pset.getParameter("maxDeltaEtaEndcaps"), .maxDeltaPhiBarrel = pset.getParameter("maxDeltaPhiBarrel"), @@ -293,7 +297,7 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf } inputCfg_.gsfElectronCores = consumes(cfg.getParameter("gsfElectronCoresTag")); - inputCfg_.hcalTowersTag = consumes(cfg.getParameter("hcalTowers")); + inputCfg_.hcalRecHitsTag = consumes(cfg.getParameter("hcalRecHits")); inputCfg_.barrelRecHitCollection = consumes(cfg.getParameter("barrelRecHitCollectionTag")); inputCfg_.endcapRecHitCollection = consumes(cfg.getParameter("endcapRecHitCollectionTag")); inputCfg_.ctfTracks = consumes(cfg.getParameter("ctfTracksTag")); @@ -328,12 +332,24 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf auto const& psetPreselection = cfg.getParameter("preselection"); hcalCfg_.hOverEConeSize = psetPreselection.getParameter("hOverEConeSize"); if (hcalCfg_.hOverEConeSize > 0) { - hcalCfg_.useTowers = true; + hcalCfg_.onlyBehindCluster = false; hcalCfg_.checkHcalStatus = cfg.getParameter("checkHcalStatus"); - hcalCfg_.hcalTowers = consumes(cfg.getParameter("hcalTowers")); - hcalCfg_.hOverEPtMin = psetPreselection.getParameter("hOverEPtMin"); + hcalCfg_.hcalRecHits = consumes(cfg.getParameter("hcalRecHits")); + hcalCfg_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); + hcalCfg_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); + hcalCfg_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); + hcalCfg_.maxSeverityHE = hcalCfg_.maxSeverityHB; } + hcalCfgBc_.hOverEConeSize = 0.; + hcalCfgBc_.onlyBehindCluster = true; + hcalCfgBc_.checkHcalStatus = cfg.getParameter("checkHcalStatus"); + hcalCfgBc_.hcalRecHits = consumes(cfg.getParameter("hcalRecHits")); + hcalCfgBc_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); + hcalCfgBc_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); + hcalCfgBc_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); + hcalCfgBc_.maxSeverityHE = hcalCfgBc_.maxSeverityHB; + // Ecal rec hits configuration GsfElectronAlgo::EcalRecHitsConfiguration recHitsCfg; auto const& flagnamesbarrel = cfg.getParameter>("recHitFlagsToBeExcludedBarrel"); @@ -377,6 +393,7 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf strategyCfg_, cutsCfg_, hcalCfg_, + hcalCfgBc_, isoCfg, recHitsCfg, EcalClusterFunctionFactory::get()->create(cfg.getParameter("crackCorrectionFunction"), cfg), diff --git a/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml b/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml index be76324d4a98a..99851dede1113 100644 --- a/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml +++ b/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml @@ -11,6 +11,7 @@ + diff --git a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h index 8a2b5c016e062..00c04ce546037 100644 --- a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h +++ b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h @@ -9,102 +9,142 @@ //***************************************************************************** //C++ includes -#include -#include +#include //CMSSW includes #include "FWCore/Framework/interface/ESHandle.h" #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "RecoCaloTools/Selectors/interface/CaloDualConeSelector.h" #include "DataFormats/GeometryVector/interface/GlobalPoint.h" #include "DataFormats/GeometryVector/interface/GlobalVector.h" + #include "DataFormats/EgammaReco/interface/SuperCluster.h" #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" + #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" + +#include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h" +#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHadTower.h" -//Sum helper functions +// sum helper functions double scaleToE(const double &eta); double scaleToEt(const double &eta); class EgammaHcalIsolation { public: - enum HcalDepth { AllDepths = 0, Depth1 = 1, Depth2 = 2 }; + enum class InclusionRule : int { + withinConeAroundCluster = 0, + isBehindClusterSeed = 1 + }; - //constructors - EgammaHcalIsolation(double extRadius, + // constructors + EgammaHcalIsolation(InclusionRule extIncRule, + double extRadius, + InclusionRule intIncRule, double intRadius, - double eLowB, - double eLowE, - double etLowB, - double etLowE, - edm::ESHandle theCaloGeom, - const HBHERecHitCollection &mhbhe); - - //destructor - ~EgammaHcalIsolation(); - - //AllDepths - double getHcalESum(const reco::Candidate *c) const { return getHcalESum(c->get().get()); } - double getHcalEtSum(const reco::Candidate *c) const { return getHcalEtSum(c->get().get()); } - double getHcalESum(const reco::SuperCluster *sc) const { return getHcalESum(sc->position()); } - double getHcalEtSum(const reco::SuperCluster *sc) const { return getHcalEtSum(sc->position()); } - double getHcalESum(const math::XYZPoint &p) const { return getHcalESum(GlobalPoint(p.x(), p.y(), p.z())); } - double getHcalEtSum(const math::XYZPoint &p) const { return getHcalEtSum(GlobalPoint(p.x(), p.y(), p.z())); } - double getHcalESum(const GlobalPoint &pclu) const { return getHcalSum(pclu, AllDepths, &scaleToE); } - double getHcalEtSum(const GlobalPoint &pclu) const { return getHcalSum(pclu, AllDepths, &scaleToEt); } - - //Depth1 - double getHcalESumDepth1(const reco::Candidate *c) const { - return getHcalESumDepth1(c->get().get()); - } - double getHcalEtSumDepth1(const reco::Candidate *c) const { - return getHcalEtSumDepth1(c->get().get()); - } - double getHcalESumDepth1(const reco::SuperCluster *sc) const { return getHcalESumDepth1(sc->position()); } - double getHcalEtSumDepth1(const reco::SuperCluster *sc) const { return getHcalEtSumDepth1(sc->position()); } - double getHcalESumDepth1(const math::XYZPoint &p) const { - return getHcalESumDepth1(GlobalPoint(p.x(), p.y(), p.z())); - } - double getHcalEtSumDepth1(const math::XYZPoint &p) const { - return getHcalEtSumDepth1(GlobalPoint(p.x(), p.y(), p.z())); + const std::array &eThresHB, + const std::array &etThresHB, + int maxSeverityHB, + const std::array &eThresHE, + const std::array &etThresHE, + int maxSeverityHE, + const HBHERecHitCollection &mhbhe, + edm::ESHandle caloGeometry, + edm::ESHandle hcalTopology, + edm::ESHandle hcalChStatus, + edm::ESHandle hcalSevLvlComputer, + edm::ESHandle towerMap); + + EgammaHcalIsolation(InclusionRule extIncRule, + double extRadius, + InclusionRule intIncRule, + double intRadius, + const std::array &eThresHB, + const std::array &etThresHB, + int maxSeverityHB, + const std::array &eThresHE, + const std::array &etThresHE, + int maxSeverityHE, + const HBHERecHitCollection &mhbhe, + const CaloGeometry &caloGeometry, + const HcalTopology &hcalTopology, + const HcalChannelQuality &hcalChStatus, + const HcalSeverityLevelComputer &hcalSevLvlComputer, + const CaloTowerConstituentsMap &towerMap); + + double getHcalESum(const reco::Candidate *c, int depth = 0) const { return getHcalESum(c->get().get(), depth); } + double getHcalEtSum(const reco::Candidate *c, int depth = 0) const { return getHcalEtSum(c->get().get(), depth); } + double getHcalESum(const reco::SuperCluster *sc, int depth = 0) const { return getHcalESum(sc->position(), depth); } + double getHcalEtSum(const reco::SuperCluster *sc, int depth = 0) const { return getHcalEtSum(sc->position(), depth); } + double getHcalESum(const math::XYZPoint &p, int depth = 0) const { return getHcalESum(GlobalPoint(p.x(), p.y(), p.z()), depth); } + double getHcalEtSum(const math::XYZPoint &p, int depth = 0) const { return getHcalEtSum(GlobalPoint(p.x(), p.y(), p.z()), depth); } + double getHcalESum(const GlobalPoint &pclu, int depth = 0) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToE); } + double getHcalEtSum(const GlobalPoint &pclu, int depth = 0) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToEt); } + + double getHcalESumBc(const reco::Candidate *c, int depth = 0) const { return getHcalESumBc(c->get().get(), depth); } + double getHcalEtSumBc(const reco::Candidate *c, int depth = 0) const { return getHcalEtSumBc(c->get().get(), depth); } + double getHcalESumBc(const reco::SuperCluster *sc, int depth = 0) const { + const auto tower = egamma::towerOf(*(sc->seed()), towerMap_); + + if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) + return getHcalESumBc(sc->position(), depth, tower.ieta(), tower.iphi(), -1); + else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) + return getHcalESumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 1); + + return getHcalESumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 0); } - double getHcalESumDepth1(const GlobalPoint &pclu) const { return getHcalSum(pclu, Depth1, &scaleToE); } - double getHcalEtSumDepth1(const GlobalPoint &pclu) const { return getHcalSum(pclu, Depth1, &scaleToEt); } + double getHcalEtSumBc(const reco::SuperCluster *sc, int depth = 0) const { + const auto tower = egamma::towerOf(*(sc->seed()), towerMap_); - //Depth2 - double getHcalESumDepth2(const reco::Candidate *c) const { - return getHcalESumDepth2(c->get().get()); + if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) + return getHcalEtSumBc(sc->position(), depth, tower.ieta(), tower.iphi(), -1); + else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) + return getHcalEtSumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 1); + + return getHcalEtSumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 0); + } + double getHcalESumBc(const math::XYZPoint &p, int depth, int ieta, int iphi, int include_or_exclude) const { + return getHcalESumBc(GlobalPoint(p.x(), p.y(), p.z()), depth, ieta, iphi, include_or_exclude); } - double getHcalEtSumDepth2(const reco::Candidate *c) const { - return getHcalEtSumDepth2(c->get().get()); + double getHcalEtSumBc(const math::XYZPoint &p, int depth, int ieta, int iphi, int include_or_exclude) const { + return getHcalEtSumBc(GlobalPoint(p.x(), p.y(), p.z()), depth, ieta, iphi, include_or_exclude); } - double getHcalESumDepth2(const reco::SuperCluster *sc) const { return getHcalESumDepth2(sc->position()); } - double getHcalEtSumDepth2(const reco::SuperCluster *sc) const { return getHcalEtSumDepth2(sc->position()); } - double getHcalESumDepth2(const math::XYZPoint &p) const { - return getHcalESumDepth2(GlobalPoint(p.x(), p.y(), p.z())); + double getHcalESumBc(const GlobalPoint &pclu, int depth, int ieta, int iphi, int include_or_exclude) const { + return getHcalSum(pclu, depth, ieta, iphi, include_or_exclude, &scaleToE); } - double getHcalEtSumDepth2(const math::XYZPoint &p) const { - return getHcalEtSumDepth2(GlobalPoint(p.x(), p.y(), p.z())); + double getHcalEtSumBc(const GlobalPoint &pclu, int depth, int ieta, int iphi, int include_or_exclude) const { + return getHcalSum(pclu, depth, ieta, iphi, include_or_exclude, &scaleToEt); } - double getHcalESumDepth2(const GlobalPoint &pclu) const { return getHcalSum(pclu, Depth2, &scaleToE); } - double getHcalEtSumDepth2(const GlobalPoint &pclu) const { return getHcalSum(pclu, Depth2, &scaleToEt); } private: - bool isDepth2(const DetId &) const; - double getHcalSum(const GlobalPoint &, const HcalDepth &, double (*)(const double &)) const; + double goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; + double getHcalSum(const GlobalPoint &pclu, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; + + InclusionRule extIncRule_; double extRadius_; + InclusionRule intIncRule_; double intRadius_; - double eLowB_; - double eLowE_; - double etLowB_; - double etLowE_; - edm::ESHandle theCaloGeom_; - const HBHERecHitCollection &mhbhe_; + std::array eThresHB_; + std::array etThresHB_; + int maxSeverityHB_; - CaloDualConeSelector *doubleConeSel_; + std::array eThresHE_; + std::array etThresHE_; + int maxSeverityHE_; + + const HBHERecHitCollection &mhbhe_; + const CaloGeometry &caloGeometry_; + const HcalTopology &hcalTopology_; + const HcalChannelQuality &hcalChStatus_; + const HcalSeverityLevelComputer &hcalSevLvlComputer_; + const CaloTowerConstituentsMap &towerMap_; }; #endif diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc index 76b6526731d45..7b59e15c1dfed 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc @@ -5,10 +5,6 @@ // Institute: IIHE-VUB //============================================================================= //***************************************************************************** -//C++ includes -#include -#include - //ROOT includes #include @@ -18,77 +14,152 @@ #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h" #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" - -using namespace std; +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DataFormats/Math/interface/deltaR.h" double scaleToE(const double& eta) { return 1.0; } double scaleToEt(const double& eta) { return sin(2 * atan(exp(-eta))); } -EgammaHcalIsolation::EgammaHcalIsolation(double extRadius, +EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, + double extRadius, + InclusionRule intIncRule, double intRadius, - double eLowB, - double eLowE, - double etLowB, - double etLowE, - edm::ESHandle theCaloGeom, - const HBHERecHitCollection& mhbhe) - : extRadius_(extRadius), - intRadius_(intRadius), - eLowB_(eLowB), - eLowE_(eLowE), - etLowB_(etLowB), - etLowE_(etLowE), - theCaloGeom_(theCaloGeom), - mhbhe_(mhbhe) { - //set up the geometry and selector - const CaloGeometry* caloGeom = theCaloGeom_.product(); - doubleConeSel_ = new CaloDualConeSelector(intRadius_, extRadius_, caloGeom, DetId::Hcal); + const std::array &eThresHB, + const std::array &etThresHB, + int maxSeverityHB, + const std::array &eThresHE, + const std::array &etThresHE, + int maxSeverityHE, + const HBHERecHitCollection& mhbhe, + edm::ESHandle caloGeometry, + edm::ESHandle hcalTopology, + edm::ESHandle hcalChStatus, + edm::ESHandle hcalSevLvlComputer, + edm::ESHandle towerMap) : extIncRule_(extIncRule), + extRadius_(extRadius * extRadius), + intIncRule_(intIncRule), + intRadius_(intRadius * intRadius), + maxSeverityHB_(maxSeverityHB), + maxSeverityHE_(maxSeverityHE), + mhbhe_(mhbhe), + caloGeometry_(*caloGeometry.product()), + hcalTopology_(*hcalTopology.product()), + hcalChStatus_(*hcalChStatus.product()), + hcalSevLvlComputer_(*hcalSevLvlComputer.product()), + towerMap_(*towerMap.product()) +{ + eThresHB_ = eThresHB; + etThresHB_ = etThresHB; + eThresHE_ = eThresHE; + etThresHE_ = etThresHE; + + // make some adjustments for the BC rules + if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { + extRadius_ = 0.1 * 0.1; // any number that covers the rechit whole is enough + intRadius_ = 0.; + } + else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) { + intRadius_ = 0.; + } + else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) { + edm::LogWarning("EgammaHcalIsolation") << " external and internal rechit inclusion rules can't both be isBehindClusterSeed." + << " Setting both to withinConeAroundCluster!"; + extIncRule_ = InclusionRule::withinConeAroundCluster; + intIncRule_ = InclusionRule::withinConeAroundCluster; + } } -EgammaHcalIsolation::~EgammaHcalIsolation() { delete doubleConeSel_; } +EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, + double extRadius, + InclusionRule intIncRule, + double intRadius, + const std::array &eThresHB, + const std::array &etThresHB, + int maxSeverityHB, + const std::array &eThresHE, + const std::array &etThresHE, + int maxSeverityHE, + const HBHERecHitCollection& mhbhe, + const CaloGeometry &caloGeometry, + const HcalTopology &hcalTopology, + const HcalChannelQuality &hcalChStatus, + const HcalSeverityLevelComputer &hcalSevLvlComputer, + const CaloTowerConstituentsMap &towerMap) : extIncRule_(extIncRule), + extRadius_(extRadius * extRadius), + intIncRule_(intIncRule), + intRadius_(intRadius * intRadius), + maxSeverityHB_(maxSeverityHB), + maxSeverityHE_(maxSeverityHE), + mhbhe_(mhbhe), + caloGeometry_(caloGeometry), + hcalTopology_(hcalTopology), + hcalChStatus_(hcalChStatus), + hcalSevLvlComputer_(hcalSevLvlComputer), + towerMap_(towerMap) +{ + eThresHB_ = eThresHB; + etThresHB_ = etThresHB; + eThresHE_ = eThresHE; + etThresHE_ = etThresHE; -double EgammaHcalIsolation::getHcalSum(const GlobalPoint& pclu, - const HcalDepth& depth, - double (*scale)(const double&)) const { - double sum = 0.; - if (!mhbhe_.empty()) { - //Compute the HCAL energy behind ECAL - doubleConeSel_->selectCallback(pclu, mhbhe_, [this, &sum, &depth, &scale](const HBHERecHit& i) { - double eta = theCaloGeom_.product()->getPosition(i.detid()).eta(); - HcalDetId hcalDetId(i.detid()); - if (hcalDetId.subdet() == HcalBarrel && //Is it in the barrel? - i.energy() > eLowB_ && //Does it pass the min energy? - i.energy() * scaleToEt(eta) > etLowB_ && //Does it pass the min et? - (depth == AllDepths || depth == Depth1)) { //Are we asking for the first depth? - sum += i.energy() * scale(eta); - } - if (hcalDetId.subdet() == HcalEndcap && //Is it in the endcap? - i.energy() > eLowE_ && //Does it pass the min energy? - i.energy() * scaleToEt(eta) > etLowE_) { //Does it pass the min et? - switch (depth) { //Which depth? - case AllDepths: - sum += i.energy() * scale(eta); - break; - case Depth1: - sum += (isDepth2(i.detid())) ? 0 : i.energy() * scale(eta); - break; - case Depth2: - sum += (isDepth2(i.detid())) ? i.energy() * scale(eta) : 0; - break; - } - } - }); + // make some adjustments for the BC rules + if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { + extRadius_ = 0.1 * 0.1; // any number that covers the rechit whole is enough + intRadius_ = 0.; + } + else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) { + intRadius_ = 0.; } + else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) { + edm::LogWarning("EgammaHcalIsolation") << " external and internal rechit inclusion rules can't both be isBehindClusterSeed." + << " Setting both to withinConeAroundCluster!"; + extIncRule_ = InclusionRule::withinConeAroundCluster; + intIncRule_ = InclusionRule::withinConeAroundCluster; + } +} - return sum; +double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, + double (*scale)(const double&)) const { + const auto phit = caloGeometry_.getPosition(hit.detid()); + + if (deltaR2(pclu, phit) > extRadius_ or deltaR2(pclu, phit) < intRadius_) + return 0.; + + const HcalDetId hid(hit.detid()); + const int hd = hid.depth(), he = hid.ieta(), hp = hid.iphi(); + + if (include_or_exclude == -1 and (he != ieta or hp != iphi)) + return 0.; + + if (include_or_exclude == 1 and (he == ieta and hp == iphi)) + return 0.; + + const bool right_depth = (depth == 0 or hd == depth); + if (!right_depth) + return 0.; + + DetId did = hcalTopology_.idFront(hid); + const uint32_t flag = hit.flags(); + const uint32_t dbflag = hcalChStatus_.getValues(did)->getValue(); + int severity = hcalSevLvlComputer_.getSeverityLevel(did, flag, dbflag); + //bool isRecovered = hcalSevLvlComputer_.recoveredRecHit(did, flag); + + const double het = hit.energy() * scaleToEt(phit.eta()); + const bool goodHB = hid.subdet() == HcalBarrel and severity <= maxSeverityHB_ and hit.energy() > eThresHB_[hd - 1] and het > etThresHB_[hd - 1]; + const bool goodHE = hid.subdet() == HcalEndcap and severity <= maxSeverityHE_ and hit.energy() > eThresHE_[hd - 1] and het > etThresHE_[hd - 1]; + + if (goodHB or goodHE) + return hit.energy() * scale(phit.eta()); + + return 0.; } -bool EgammaHcalIsolation::isDepth2(const DetId& detId) const { - if ((HcalDetId(detId).depth() == 2 && HcalDetId(detId).ietaAbs() >= 18 && HcalDetId(detId).ietaAbs() < 27) || - (HcalDetId(detId).depth() == 3 && HcalDetId(detId).ietaAbs() == 27)) { - return true; +double EgammaHcalIsolation::getHcalSum(const GlobalPoint &pclu, + int depth, int ieta, int iphi, int include_or_exclude, + double (*scale)(const double&)) const { + double sum = 0.; + for (const auto &hit : mhbhe_) + sum += goodHitEnergy(pclu, hit, depth, ieta, iphi, include_or_exclude, scale); - } else { - return false; - } + return sum; } diff --git a/RecoEgamma/EgammaPhotonProducers/BuildFile.xml b/RecoEgamma/EgammaPhotonProducers/BuildFile.xml index 5ec8092465903..d63630dd1b231 100644 --- a/RecoEgamma/EgammaPhotonProducers/BuildFile.xml +++ b/RecoEgamma/EgammaPhotonProducers/BuildFile.xml @@ -12,6 +12,7 @@ + diff --git a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py index 4c348242aedef..3884e3db19fe5 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py @@ -45,14 +45,17 @@ hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), preshowerHits = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - hcalTowers = cms.InputTag("towerMaker"), + hcalRecHits = cms.InputTag("hbhereco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(0.94), - minR9Endcap = cms.double(0.95), + minR9Endcap = cms.double(0.95), multThresEB = cms.double(1.00), multThresEE = cms.double(1.25), hOverEConeSize = cms.double(0.15), + recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), + recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), + maxHcalRecHitSeverity = isolationSumsCalculator.maxHcalRecHitSeverity, posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(10.0), @@ -63,10 +66,10 @@ ecalRecHitSumEtSlopeBarrel = cms.double(0.), ecalRecHitSumEtOffsetEndcap = cms.double(999999999), ecalRecHitSumEtSlopeEndcap = cms.double(0.), - hcalTowerSumEtOffsetBarrel = cms.double(999999999), - hcalTowerSumEtSlopeBarrel = cms.double(0.), - hcalTowerSumEtOffsetEndcap = cms.double(999999999), - hcalTowerSumEtSlopeEndcap = cms.double(0.), + hcalRecHitSumEtOffsetBarrel = cms.double(999999999), + hcalRecHitSumEtSlopeBarrel = cms.double(0.), + hcalRecHitSumEtOffsetEndcap = cms.double(999999999), + hcalRecHitSumEtSlopeEndcap = cms.double(0.), nTrackSolidConeBarrel =cms.double(999999999), nTrackSolidConeEndcap =cms.double(999999999), nTrackHollowConeBarrel =cms.double(999999999), @@ -89,7 +92,7 @@ RecHitSeverityToBeExcludedEB = cleanedHybridSuperClusters.RecHitSeverityToBeExcluded, RecHitFlagToBeExcludedEE = multi5x5BasicClustersCleaned.RecHitFlagToBeExcluded, RecHitSeverityToBeExcludedEE = cleanedHybridSuperClusters.RecHitSeverityToBeExcluded, - checkHcalStatus = cms.bool(True), + checkHcalStatus = cms.bool(True) ) diff --git a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py index b645058a20610..65574ff28d49d 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py @@ -36,14 +36,17 @@ hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), preshowerHits = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - hcalTowers = cms.InputTag("towerMaker"), + hcalRecHits = cms.InputTag("hbhereco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(0.94), - minR9Endcap = cms.double(0.95), + minR9Endcap = cms.double(0.95), multThresEB = cms.double(1.00), multThresEE = cms.double(1.25), hOverEConeSize = cms.double(0.15), + recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), + recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), + maxHcalRecHitSeverity = isolationSumsCalculator.maxHcalRecHitSeverity, posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(10.0), @@ -54,10 +57,10 @@ ecalRecHitSumEtSlopeBarrel = cms.double(0.), ecalRecHitSumEtOffsetEndcap = cms.double(999999999), ecalRecHitSumEtSlopeEndcap = cms.double(0.), - hcalTowerSumEtOffsetBarrel = cms.double(999999999), - hcalTowerSumEtSlopeBarrel = cms.double(0.), - hcalTowerSumEtOffsetEndcap = cms.double(999999999), - hcalTowerSumEtSlopeEndcap = cms.double(0.), + hcalRecHitSumEtOffsetBarrel = cms.double(999999999), + hcalRecHitSumEtSlopeBarrel = cms.double(0.), + hcalRecHitSumEtOffsetEndcap = cms.double(999999999), + hcalRecHitSumEtSlopeEndcap = cms.double(0.), nTrackSolidConeBarrel =cms.double(999999999), nTrackSolidConeEndcap =cms.double(999999999), nTrackHollowConeBarrel =cms.double(999999999), @@ -80,7 +83,7 @@ RecHitSeverityToBeExcludedEB = cleanedHybridSuperClusters.RecHitSeverityToBeExcluded, RecHitFlagToBeExcludedEE = multi5x5BasicClustersCleaned.RecHitFlagToBeExcluded, RecHitSeverityToBeExcludedEE = cleanedHybridSuperClusters.RecHitSeverityToBeExcluded, - checkHcalStatus = cms.bool(True), + checkHcalStatus = cms.bool(True) ) photonsFromMultiCl = photons.clone( @@ -109,12 +112,14 @@ barrelEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEB"), hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), - hcalTowers = cms.InputTag("towerMaker"), + hcalRecHits = cms.InputTag("hbhereco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(10.0), minR9Endcap = cms.double(10.0), hOverEConeSize = cms.double(0.15), + recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), + recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(5.0), @@ -125,10 +130,10 @@ ecalRecHitSumEtSlopeBarrel = cms.double(0.), ecalRecHitSumEtOffsetEndcap = cms.double(999999999), ecalRecHitSumEtSlopeEndcap = cms.double(0.), - hcalTowerSumEtOffsetBarrel = cms.double(999999999), - hcalTowerSumEtSlopeBarrel = cms.double(0.), - hcalTowerSumEtOffsetEndcap = cms.double(999999999), - hcalTowerSumEtSlopeEndcap = cms.double(0.), + hcalRecHitSumEtOffsetBarrel = cms.double(999999999), + hcalRecHitSumEtSlopeBarrel = cms.double(0.), + hcalRecHitSumEtOffsetEndcap = cms.double(999999999), + hcalRecHitSumEtSlopeEndcap = cms.double(0.), nTrackSolidConeBarrel =cms.double(999999999), nTrackSolidConeEndcap =cms.double(999999999), nTrackHollowConeBarrel =cms.double(999999999), diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index c4a73d116bab7..533d4afa1f9ec 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -8,7 +8,6 @@ #include "CommonTools/Utils/interface/StringToEnumValue.h" #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" #include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h" -#include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Common/interface/ValueMap.h" #include "DataFormats/EgammaCandidates/interface/Conversion.h" @@ -38,8 +37,6 @@ #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionBaseClass.h" #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h" #include "RecoEcal/EgammaCoreTools/interface/EcalTools.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHadTower.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h" #include "RecoEgamma/EgammaPhotonAlgos/interface/PhotonEnergyCorrector.h" #include "RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h" #include "RecoEgamma/PhotonIdentification/interface/PhotonMIPHaloTagger.h" @@ -48,6 +45,7 @@ #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" #include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h" class GEDPhotonProducer : public edm::stream::EDProducer<> { public: @@ -77,7 +75,8 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { const EcalRecHitCollection* ecalBarrelHits, const EcalRecHitCollection* ecalEndcapHits, const EcalRecHitCollection* preshowerHits, - CaloTowerCollection const* hcalTowers, + ElectronHcalHelper const& hcalHelperCone, + ElectronHcalHelper const& hcalHelperBc, const reco::VertexCollection& pvVertices, reco::PhotonCollection& outputCollection, int& iSC, @@ -111,7 +110,7 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT preshowerHits_; edm::EDGetTokenT pfEgammaCandidates_; edm::EDGetTokenT pfCandidates_; - edm::EDGetTokenT hcalTowers_; + edm::EDGetTokenT hcalRecHits_; edm::EDGetTokenT vertexProducer_; //for isolation with map-based veto edm::EDGetTokenT>> particleBasedIsolationToken; @@ -143,8 +142,7 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { double multThresEB_; double multThresEE_; double hOverEConeSize_; - double maxHOverE_; - double minSCEt_; + bool checkHcalStatus_; double highEt_; double minR9Barrel_; double minR9Endcap_; @@ -165,11 +163,13 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { std::unique_ptr photonEnergyCorrector_ = nullptr; std::string candidateP4type_; - bool checkHcalStatus_; - const edm::ESGetToken caloTopologyToken_; const edm::ESGetToken caloGeometryToken_; const edm::ESGetToken ecalPFRechitThresholdsToken_; + + // additional configuration and helpers + std::unique_ptr hcalHelperCone_; + std::unique_ptr hcalHelperBc_; }; #include "FWCore/Framework/interface/MakerMacros.h" @@ -240,10 +240,8 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) preshowerHits_ = consumes(config.getParameter("preshowerHits")); vertexProducer_ = consumes(config.getParameter("primaryVertexProducer")); - auto hcTow = config.getParameter("hcalTowers"); - if (not hcTow.label().empty()) { - hcalTowers_ = consumes(hcTow); - } + hcalRecHits_ = consumes(config.getParameter("hcalRecHits")); + // photonCollection_ = config.getParameter("outputPhotonCollection"); multThresEB_ = config.getParameter("multThresEB"); @@ -275,6 +273,31 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) photonEnergyCorrector_ = std::make_unique(config, consumesCollector()); + checkHcalStatus_ = config.getParameter("checkHcalStatus"); + ElectronHcalHelper::Configuration cfgCone, cfgBc; + cfgCone.hOverEConeSize = hOverEConeSize_; + if (cfgCone.hOverEConeSize > 0) { + cfgCone.onlyBehindCluster = false; + cfgCone.checkHcalStatus = checkHcalStatus_; + cfgCone.hcalRecHits = hcalRecHits_; + cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; + } + + cfgBc.hOverEConeSize = 0.; + cfgBc.onlyBehindCluster = true; + cfgBc.checkHcalStatus = checkHcalStatus_; + cfgBc.hcalRecHits = hcalRecHits_; + cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; + + hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); + hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); + //AA // cut values for pre-selection @@ -282,8 +305,8 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) config.getParameter("maxHoverEBarrel"), config.getParameter("ecalRecHitSumEtOffsetBarrel"), config.getParameter("ecalRecHitSumEtSlopeBarrel"), - config.getParameter("hcalTowerSumEtOffsetBarrel"), - config.getParameter("hcalTowerSumEtSlopeBarrel"), + config.getParameter("hcalRecHitSumEtOffsetBarrel"), + config.getParameter("hcalRecHitSumEtSlopeBarrel"), config.getParameter("nTrackSolidConeBarrel"), config.getParameter("nTrackHollowConeBarrel"), config.getParameter("trackPtSumSolidConeBarrel"), @@ -294,8 +317,8 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) config.getParameter("maxHoverEEndcap"), config.getParameter("ecalRecHitSumEtOffsetEndcap"), config.getParameter("ecalRecHitSumEtSlopeEndcap"), - config.getParameter("hcalTowerSumEtOffsetEndcap"), - config.getParameter("hcalTowerSumEtSlopeEndcap"), + config.getParameter("hcalRecHitSumEtOffsetEndcap"), + config.getParameter("hcalRecHitSumEtSlopeEndcap"), config.getParameter("nTrackSolidConeEndcap"), config.getParameter("nTrackHollowConeEndcap"), config.getParameter("trackPtSumSolidConeEndcap"), @@ -318,8 +341,6 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) photonMIPHaloTagger_->setup(mipVariableSet, consumesCollector()); } - checkHcalStatus_ = config.getParameter("checkHcalStatus"); - // Register the product produces(photonCollection_); if (not pfEgammaCandidates_.isUninitialized()) { @@ -413,12 +434,13 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& eve } } - // get Hcal towers collection - CaloTowerCollection const* hcalTowers = hcalTowers_.isUninitialized() ? nullptr : &theEvent.get(hcalTowers_); - // get the geometry from the event setup: caloGeom_ = &eventSetup.getData(caloGeometryToken_); + // prepare access to hcal data + hcalHelperCone_->beginEvent(theEvent, eventSetup); + hcalHelperBc_->beginEvent(theEvent, eventSetup); + auto const& topology = eventSetup.getData(caloTopologyToken_); auto const& thresholds = eventSetup.getData(ecalPFRechitThresholdsToken_); @@ -446,7 +468,8 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& eve &barrelRecHits, &endcapRecHits, &preshowerRecHits, - hcalTowers, + *hcalHelperCone_, + *hcalHelperBc_, //vtx, vertexCollection, *outputPhotonCollection_p, @@ -509,7 +532,8 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, const EcalRecHitCollection* ecalBarrelHits, const EcalRecHitCollection* ecalEndcapHits, const EcalRecHitCollection* preshowerHits, - CaloTowerCollection const* hcalTowers, + ElectronHcalHelper const& hcalHelperCone, + ElectronHcalHelper const& hcalHelperBc, const reco::VertexCollection& vertexCollection, reco::PhotonCollection& outputPhotonCollection, int& iSC, @@ -552,44 +576,9 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, if (parentSCRef.isNonnull() && ptFast(parentSCRef->energy(), parentSCRef->position(), {0, 0, 0}) <= preselCutValues[0]) continue; - // calculate HoE - - double HoE1, HoE2; - HoE1 = HoE2 = 0.; - - std::vector TowersBehindClus; - float hcalDepth1OverEcalBc, hcalDepth2OverEcalBc; - hcalDepth1OverEcalBc = hcalDepth2OverEcalBc = 0.f; - bool invalidHcal = false; - - if (not hcalTowers_.isUninitialized()) { - EgammaTowerIsolation towerIso1(hOverEConeSize_, 0., 0., 1, hcalTowers); - EgammaTowerIsolation towerIso2(hOverEConeSize_, 0., 0., 2, hcalTowers); - HoE1 = towerIso1.getTowerESum(&(*scRef)) / scRef->energy(); - HoE2 = towerIso2.getTowerESum(&(*scRef)) / scRef->energy(); - - edm::ESHandle ctmaph; - es.get().get(ctmaph); - - edm::ESHandle hcalQuality; - es.get().get("withTopo", hcalQuality); - - edm::ESHandle hcalTopology; - es.get().get(hcalTopology); - - TowersBehindClus = egamma::towersOf(*scRef, *ctmaph); - hcalDepth1OverEcalBc = egamma::depth1HcalESum(TowersBehindClus, *hcalTowers) / scRef->energy(); - hcalDepth2OverEcalBc = egamma::depth2HcalESum(TowersBehindClus, *hcalTowers) / scRef->energy(); - - if (checkHcalStatus_ && hcalDepth1OverEcalBc == 0 && hcalDepth2OverEcalBc == 0) { - invalidHcal = !egamma::hasActiveHcal(TowersBehindClus, *ctmaph, *hcalQuality, *hcalTopology); - } - } - - // std::cout << " GEDPhotonProducer calculation of HoE with towers in a cone " << HoE1 << " " << HoE2 << std::endl; - //std::cout << " GEDPhotonProducer calcualtion of HoE with towers behind the BCs " << hcalDepth1OverEcalBc << " " << hcalDepth2OverEcalBc << std::endl; float maxXtal = (hits != nullptr ? EcalClusterTools::eMax(*(scRef->seed()), hits) : 0.f); + //AA //Change these to consider severity level of hits float e1x5 = (hits != nullptr ? EcalClusterTools::e1x5(*(scRef->seed()), hits, topology) : 0.f); @@ -626,7 +615,7 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, &thresholds, multThresEB_, multThresEE_) - : std::array({{0.f, 0.f, 0.f}})); + : std::array({{0.f, 0.f, 0.f}})); float full5x5_sigmaEtaEta = sqrt(full5x5_cov[0]); float full5x5_sigmaIetaIeta = sqrt(full5x5_locCov[0]); @@ -669,12 +658,13 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.maxEnergyXtal = maxXtal; showerShape.sigmaEtaEta = sigmaEtaEta; showerShape.sigmaIetaIeta = sigmaIetaIeta; - showerShape.hcalDepth1OverEcal = HoE1; - showerShape.hcalDepth2OverEcal = HoE2; - showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc; - showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc; - showerShape.hcalTowersBehindClusters = TowersBehindClus; - showerShape.invalidHcal = invalidHcal; + for (int id = 0; id < 7; ++id) { + showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / scRef->energy(); + showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / scRef->energy(); + } + showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*scRef); + showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); + /// fill extra shower shapes const float spp = (!edm::isFinite(locCov[2]) ? 0. : sqrt(locCov[2])); const float sep = locCov[1]; @@ -778,6 +768,10 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, } // fill preshower shapes full5x5_showerShape.effSigmaRR = sigmaRR; + for (int id = 0; id < 7; ++id) { + full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / full5x5_e5x5; + full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / full5x5_e5x5; + } newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape); /// get ecal photon specific corrected energy @@ -810,11 +804,6 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, newCandidate.setFiducialVolumeFlags(fiducialFlags); } - // std::cout << " final p4 " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl; - - // std::cout << " GEDPhotonProducer from candidate HoE with towers in a cone " << newCandidate.hadronicOverEm() << " " << newCandidate.hadronicDepth1OverEm() << " " << newCandidate.hadronicDepth2OverEm() << std::endl; - // std::cout << " GEDPhotonProducer from candidate of HoE with towers behind the BCs " << newCandidate.hadTowOverEm() << " " << newCandidate.hadTowDepth1OverEm() << " " << newCandidate.hadTowDepth2OverEm() << std::endl; - // fill MIP Vairables for Halo: Block for MIP are filled from PhotonMIPHaloTagger reco::Photon::MIPVariables mipVar; if (subdet == EcalBarrel && runMIPTagger_) { @@ -929,13 +918,6 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, newCandidate.setCandidateP4type(reco::Photon::regression2); } - // std::cout << " GEDPhotonProducer pf based isolation chargedHadron " << newCandidate.chargedHadronIso() << " neutralHadron " << newCandidate.neutralHadronIso() << " Photon " << newCandidate.photonIso() << std::endl; - //std::cout << " GEDPhotonProducer from candidate HoE with towers in a cone " << newCandidate.hadronicOverEm() << " " << newCandidate.hadronicDepth1OverEm() << " " << newCandidate.hadronicDepth2OverEm() << std::endl; - //std::cout << " GEDPhotonProducer from candidate of HoE with towers behind the BCs " << newCandidate.hadTowOverEm() << " " << newCandidate.hadTowDepth1OverEm() << " " << newCandidate.hadTowDepth2OverEm() << std::endl; - //std::cout << " standard p4 before " << newCandidate.p4() << " energy " << newCandidate.energy() << std::endl; - //std::cout << " type " < @@ -56,7 +54,8 @@ class PhotonProducer : public edm::stream::EDProducer<> { const CaloTopology* topology, const EcalRecHitCollection* ecalBarrelHits, const EcalRecHitCollection* ecalEndcapHits, - CaloTowerCollection const& hcalTowers, + ElectronHcalHelper const& hcalHelperCone, + ElectronHcalHelper const& hcalHelperBc, reco::VertexCollection& pvVertices, reco::PhotonCollection& outputCollection, int& iSC, @@ -67,7 +66,7 @@ class PhotonProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT photonCoreProducer_; edm::EDGetTokenT barrelEcalHits_; edm::EDGetTokenT endcapEcalHits_; - edm::EDGetTokenT hcalTowers_; + edm::EDGetTokenT hcalRecHits_; edm::EDGetTokenT vertexProducer_; //AA @@ -79,8 +78,6 @@ class PhotonProducer : public edm::stream::EDProducer<> { std::vector severitiesexclEE_; double hOverEConeSize_; - double maxHOverE_; - double minSCEt_; double highEt_; double minR9Barrel_; double minR9Endcap_; @@ -103,19 +100,23 @@ class PhotonProducer : public edm::stream::EDProducer<> { PhotonEnergyCorrector photonEnergyCorrector_; std::string candidateP4type_; + + // additional configuration and helpers + std::unique_ptr hcalHelperCone_; + std::unique_ptr hcalHelperBc_; }; #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(PhotonProducer); PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCorrector_(config, consumesCollector()) { - // use onfiguration file to setup input/output collection names + // use configuration file to setup input/output collection names photonCoreProducer_ = consumes(config.getParameter("photonCoreProducer")); barrelEcalHits_ = consumes(config.getParameter("barrelEcalHits")); endcapEcalHits_ = consumes(config.getParameter("endcapEcalHits")); vertexProducer_ = consumes(config.getParameter("primaryVertexProducer")); - hcalTowers_ = consumes(config.getParameter("hcalTowers")); + hcalRecHits_ = consumes(config.getParameter("hcalRecHits")); hOverEConeSize_ = config.getParameter("hOverEConeSize"); highEt_ = config.getParameter("highEt"); // R9 value to decide converted/unconverted @@ -151,6 +152,30 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo severitiesexclEE_ = StringToEnumValue(severitynamesEE); + ElectronHcalHelper::Configuration cfgCone, cfgBc; + cfgCone.hOverEConeSize = hOverEConeSize_; + if (cfgCone.hOverEConeSize > 0) { + cfgCone.onlyBehindCluster = false; + cfgCone.checkHcalStatus = false; + cfgCone.hcalRecHits = hcalRecHits_; + cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; + } + + cfgBc.hOverEConeSize = 0.; + cfgBc.onlyBehindCluster = true; + cfgBc.checkHcalStatus = false; + cfgBc.hcalRecHits = hcalRecHits_; + cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; + + hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); + hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); + //AA // @@ -169,8 +194,8 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo preselCutValuesBarrel_.push_back(config.getParameter("maxHoverEBarrel")); preselCutValuesBarrel_.push_back(config.getParameter("ecalRecHitSumEtOffsetBarrel")); preselCutValuesBarrel_.push_back(config.getParameter("ecalRecHitSumEtSlopeBarrel")); - preselCutValuesBarrel_.push_back(config.getParameter("hcalTowerSumEtOffsetBarrel")); - preselCutValuesBarrel_.push_back(config.getParameter("hcalTowerSumEtSlopeBarrel")); + preselCutValuesBarrel_.push_back(config.getParameter("hcalRecHitSumEtOffsetBarrel")); + preselCutValuesBarrel_.push_back(config.getParameter("hcalRecHitSumEtSlopeBarrel")); preselCutValuesBarrel_.push_back(config.getParameter("nTrackSolidConeBarrel")); preselCutValuesBarrel_.push_back(config.getParameter("nTrackHollowConeBarrel")); preselCutValuesBarrel_.push_back(config.getParameter("trackPtSumSolidConeBarrel")); @@ -181,8 +206,8 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo preselCutValuesEndcap_.push_back(config.getParameter("maxHoverEEndcap")); preselCutValuesEndcap_.push_back(config.getParameter("ecalRecHitSumEtOffsetEndcap")); preselCutValuesEndcap_.push_back(config.getParameter("ecalRecHitSumEtSlopeEndcap")); - preselCutValuesEndcap_.push_back(config.getParameter("hcalTowerSumEtOffsetEndcap")); - preselCutValuesEndcap_.push_back(config.getParameter("hcalTowerSumEtSlopeEndcap")); + preselCutValuesEndcap_.push_back(config.getParameter("hcalRecHitSumEtOffsetEndcap")); + preselCutValuesEndcap_.push_back(config.getParameter("hcalRecHitSumEtSlopeEndcap")); preselCutValuesEndcap_.push_back(config.getParameter("nTrackSolidConeEndcap")); preselCutValuesEndcap_.push_back(config.getParameter("nTrackHollowConeEndcap")); preselCutValuesEndcap_.push_back(config.getParameter("trackPtSumSolidConeEndcap")); @@ -245,13 +270,14 @@ void PhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEve theEventSetup.get().get(sevLv); // - // get Hcal towers collection - auto const& hcalTowers = theEvent.get(hcalTowers_); - edm::ESHandle pTopology; theEventSetup.get().get(pTopology); const CaloTopology* topology = pTopology.product(); + // prepare access to hcal data + hcalHelperCone_->beginEvent(theEvent, theEventSetup); + hcalHelperBc_->beginEvent(theEvent, theEventSetup); + // Get the primary event vertex Handle vertexHandle; reco::VertexCollection vertexCollection; @@ -276,7 +302,8 @@ void PhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEve topology, &barrelRecHits, &endcapRecHits, - hcalTowers, + *hcalHelperCone_, + *hcalHelperBc_, vertexCollection, outputPhotonCollection, iSC, @@ -294,7 +321,8 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, const CaloTopology* topology, const EcalRecHitCollection* ecalBarrelHits, const EcalRecHitCollection* ecalEndcapHits, - CaloTowerCollection const& hcalTowers, + ElectronHcalHelper const& hcalHelperCone, + ElectronHcalHelper const& hcalHelperBc, reco::VertexCollection& vertexCollection, reco::PhotonCollection& outputPhotonCollection, int& iSC, @@ -343,19 +371,6 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, // SC energy preselection if (scRef->energy() / cosh(scRef->eta()) <= preselCutValues[0]) continue; - // calculate HoE - - EgammaTowerIsolation towerIso1(hOverEConeSize_, 0., 0., 1, &hcalTowers); - EgammaTowerIsolation towerIso2(hOverEConeSize_, 0., 0., 2, &hcalTowers); - double HoE1 = towerIso1.getTowerESum(&(*scRef)) / scRef->energy(); - double HoE2 = towerIso2.getTowerESum(&(*scRef)) / scRef->energy(); - - edm::ESHandle ctmaph; - es.get().get(ctmaph); - - auto towersBehindCluster = egamma::towersOf(*scRef, *ctmaph); - float hcalDepth1OverEcalBc = egamma::depth1HcalESum(towersBehindCluster, hcalTowers) / scRef->energy(); - float hcalDepth2OverEcalBc = egamma::depth2HcalESum(towersBehindCluster, hcalTowers) / scRef->energy(); // recalculate position of seed BasicCluster taking shower depth for unconverted photon math::XYZPoint unconvPos = @@ -425,11 +440,11 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.maxEnergyXtal = maxXtal; showerShape.sigmaEtaEta = sigmaEtaEta; showerShape.sigmaIetaIeta = sigmaIetaIeta; - showerShape.hcalDepth1OverEcal = HoE1; - showerShape.hcalDepth2OverEcal = HoE2; - showerShape.hcalDepth1OverEcalBc = hcalDepth1OverEcalBc; - showerShape.hcalDepth2OverEcalBc = hcalDepth2OverEcalBc; - showerShape.hcalTowersBehindClusters = towersBehindCluster; + for (int id = 0; id < 7; ++id) { + showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / scRef->energy(); + showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / scRef->energy(); + } + showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); newCandidate.setShowerShapeVariables(showerShape); /// fill full5x5 shower shape block @@ -441,6 +456,11 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal; full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta; full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta; + for (int id = 0; id < 7; ++id) { + full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / full5x5_e5x5; + full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / full5x5_e5x5; + } + full5x5_showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape); /// get ecal photon specific corrected energy From 85de6958dcba0e6cd0325201d8eb18f9a6ed46d2 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 20 Apr 2021 10:09:43 +0200 Subject: [PATCH 04/27] propagate everything else --- DQM/Physics/src/SMPDQM.cc | 2 +- DQM/Physics/src/TopDiLeptonDQM.cc | 2 +- DQMOffline/EGamma/plugins/ElectronAnalyzer.cc | 12 +- DQMOffline/EGamma/plugins/ElectronAnalyzer.h | 12 +- .../plugins/ElectronTagProbeAnalyzer.cc | 12 +- .../EGamma/plugins/ElectronTagProbeAnalyzer.h | 12 +- DQMOffline/EGamma/plugins/PhotonAnalyzer.cc | 4 +- .../EGamma/plugins/ZToMuMuGammaAnalyzer.cc | 8 +- DQMOffline/Trigger/src/EgHLTOffHelper.cc | 5 +- DQMOffline/Trigger/src/FunctionDefs.cc | 4 +- PhysicsTools/NanoAOD/python/electrons_cff.py | 2 +- .../plugins/EGFull5x5ShowerShapeModifier.cc | 180 ++++++-- .../plugins/CutBasedElectronID.cc | 8 +- .../plugins/cuts/GsfEleEmHadD1IsoRhoCut.cc | 4 +- RecoEgamma/Examples/plugins/DQMAnalyzer.cc | 62 +-- .../plugins/GsfElectronDataAnalyzer.cc | 62 +-- .../plugins/GsfElectronFakeAnalyzer.cc | 56 +-- .../Examples/plugins/GsfElectronMCAnalyzer.cc | 64 +-- .../plugins/GsfElectronMCFakeAnalyzer.cc | 56 +-- .../interface/PhotonIsolationCalculator.h | 70 +-- .../Identification/cutBasedPhotonID_tools.py | 20 +- .../python/isolationCalculator_cfi.py | 126 ++++-- .../src/PhotonIsolationCalculator.cc | 416 +++++++++--------- .../PFProducer/plugins/PFPhotonTranslator.cc | 21 +- .../plugins/ElectronMcFakeValidator.cc | 52 +-- .../plugins/ElectronMcSignalValidator.cc | 60 +-- 26 files changed, 738 insertions(+), 594 deletions(-) diff --git a/DQM/Physics/src/SMPDQM.cc b/DQM/Physics/src/SMPDQM.cc index 2126dc370fe86..3840532532f8f 100644 --- a/DQM/Physics/src/SMPDQM.cc +++ b/DQM/Physics/src/SMPDQM.cc @@ -172,7 +172,7 @@ void SMPDQM::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { double elecCombRelIso = 1.; - elecCombRelIso = (elecIso.ecalRecHitSumEt + elecIso.hcalDepth1TowerSumEt + elecIso.tkSumPt) / elec->pt(); + elecCombRelIso = (elecIso.ecalRecHitSumEt + elecIso.hcalRecHitSumEt[0] + elecIso.tkSumPt) / elec->pt(); elIso_CombRelIso->Fill(elecCombRelIso); elIso_cal->Fill(elecIso.ecalRecHitSumEt); elIso_trk->Fill(elecIso.tkSumPt); diff --git a/DQM/Physics/src/TopDiLeptonDQM.cc b/DQM/Physics/src/TopDiLeptonDQM.cc index 55011fb2e91de..3bb8e971679a1 100644 --- a/DQM/Physics/src/TopDiLeptonDQM.cc +++ b/DQM/Physics/src/TopDiLeptonDQM.cc @@ -372,7 +372,7 @@ void TopDiLeptonDQM::analyze(const edm::Event& evt, const edm::EventSetup& conte double elecCombRelIso = 1.; if (elec->et() != 0.) - elecCombRelIso = (elecIso.ecalRecHitSumEt + elecIso.hcalDepth1TowerSumEt + elecIso.tkSumPt) / elec->et(); + elecCombRelIso = (elecIso.ecalRecHitSumEt + elecIso.hcalRecHitSumEt[0] + elecIso.tkSumPt) / elec->et(); ElecIso_CombRelIso_->Fill(elecCombRelIso); diff --git a/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc b/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc index 2216277a7b34e..814bec72a482b 100644 --- a/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc @@ -440,8 +440,8 @@ void ElectronAnalyzer::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const "EcalIsoSum (GeV)", "Events", "ELE_LOGY E1 P"); - h1_hcalTowerSumEt_dr03 = bookH1(iBooker, - "hcalTowerSumEt_dr03", + h1_hcalRecHitSumEt_dr03 = bookH1(iBooker, + "hcalRecHitSumEt_dr03", "hcal isolation sum, dR=0.3", 100, 0.0, @@ -691,7 +691,7 @@ void ElectronAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& // isolation h1_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt()); h1_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt()); - h1_hcalTowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt()); + h1_hcalRecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt()); // PF isolation GsfElectron::PflowIsolationVariables pfIso = gsfIter->pfIsolationVariables(); @@ -814,11 +814,11 @@ bool ElectronAnalyzer::isolationCut(const reco::GsfElectronCollection::const_ite if (gsfIter->dr03TkSumPt() > tkIso03Max_) return true; - if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) + if (gsfIter->isEB() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxBarrel_) return true; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxEndcaps_) return true; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(2) > hcalIso03Depth2MaxEndcaps_) return true; if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) return true; diff --git a/DQMOffline/EGamma/plugins/ElectronAnalyzer.h b/DQMOffline/EGamma/plugins/ElectronAnalyzer.h index 5468afc8f2a11..46b82959f2a40 100644 --- a/DQMOffline/EGamma/plugins/ElectronAnalyzer.h +++ b/DQMOffline/EGamma/plugins/ElectronAnalyzer.h @@ -313,17 +313,17 @@ class ElectronAnalyzer : public ElectronDqmAnalyzerBase { // isolation MonitorElement *h1_tkSumPt_dr03; MonitorElement *h1_ecalRecHitSumEt_dr03; - MonitorElement *h1_hcalTowerSumEt_dr03; + MonitorElement *h1_hcalRecHitSumEt_dr03; MonitorElement *h1_PFch_dr03; MonitorElement *h1_PFem_dr03; MonitorElement *h1_PFnh_dr03; - // MonitorElement * h1_hcalDepth1TowerSumEt_dr03 ; - // MonitorElement * h1_hcalDepth2TowerSumEt_dr03 ; + // MonitorElement * h1_hcalDepth1RecHitSumEt_dr03 ; + // MonitorElement * h1_hcalDepth2RecHitSumEt_dr03 ; // MonitorElement * h1_tkSumPt_dr04 ; // MonitorElement * h1_ecalRecHitSumEt_dr04 ; - // MonitorElement * h1_hcalTowerSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth1TowerSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth2TowerSumEt_dr04 ; + // MonitorElement * h1_hcalRecHitSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth1RecHitSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth2RecHitSumEt_dr04 ; // di-electron mass MonitorElement *h1_mee; diff --git a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc index 7bb34b7f974ff..ab188dc226c7b 100644 --- a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc @@ -304,8 +304,8 @@ void ElectronTagProbeAnalyzer::bookHistograms(DQMStore::IBooker& iBooker, edm::R "EcalIsoSum, cone 0.3 (GeV)", "Events", "ELE_LOGY E1 P"); - h1_hcalTowerSumEt_dr03 = bookH1(iBooker, - "hcalTowerSumEt_dr03", + h1_hcalRecHitSumEt_dr03 = bookH1(iBooker, + "hcalRecHitSumEt_dr03", "hcal isolation sum, dR=0.3", 100, 0.0, @@ -555,7 +555,7 @@ void ElectronTagProbeAnalyzer::analyze(const edm::Event& iEvent, const edm::Even // isolation h1_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h1_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h1_hcalTowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt()); + h1_hcalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt()); // inv Mass with opposite sign bool invMassTTAlreadyFilled = false; @@ -665,11 +665,11 @@ bool ElectronTagProbeAnalyzer::isolationCut(const reco::GsfElectronCollection::c if (gsfIter->dr03TkSumPt() > tkIso03Max_) return true; - if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) + if (gsfIter->isEB() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxBarrel_) return true; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxEndcaps_) return true; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(2) > hcalIso03Depth2MaxEndcaps_) return true; if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) return true; diff --git a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h index 62e4671e6b686..cf41bcef377f7 100644 --- a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h +++ b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h @@ -303,14 +303,14 @@ class ElectronTagProbeAnalyzer : public ElectronDqmAnalyzerBase { // isolation MonitorElement *h1_tkSumPt_dr03; MonitorElement *h1_ecalRecHitSumEt_dr03; - MonitorElement *h1_hcalTowerSumEt_dr03; - // MonitorElement * h1_hcalDepth1TowerSumEt_dr03 ; - // MonitorElement * h1_hcalDepth2TowerSumEt_dr03 ; + MonitorElement *h1_hcalRecHitSumEt_dr03; + // MonitorElement * h1_hcalDepth1RecHitSumEt_dr03 ; + // MonitorElement * h1_hcalDepth2RecHitSumEt_dr03 ; // MonitorElement * h1_tkSumPt_dr04 ; // MonitorElement * h1_ecalRecHitSumEt_dr04 ; - // MonitorElement * h1_hcalTowerSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth1TowerSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth2TowerSumEt_dr04 ; + // MonitorElement * h1_hcalRecHitSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth1RecHitSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth2RecHitSumEt_dr04 ; // di-electron mass MonitorElement *h1_mee; diff --git a/DQMOffline/EGamma/plugins/PhotonAnalyzer.cc b/DQMOffline/EGamma/plugins/PhotonAnalyzer.cc index 8506b5ee84abf..16c291459806a 100644 --- a/DQMOffline/EGamma/plugins/PhotonAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/PhotonAnalyzer.cc @@ -1711,8 +1711,8 @@ void PhotonAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& esup) { fill2DHistoVector(p_hOverEVsEta_, aPho->eta(), aPho->hadronicOverEm(), cut, type); fill2DHistoVector(p_hOverEVsEt_, aPho->et(), aPho->hadronicOverEm(), cut, type); - fill3DHistoVector(h_h1OverE_, aPho->hadronicDepth1OverEm(), cut, type, part); - fill3DHistoVector(h_h2OverE_, aPho->hadronicDepth2OverEm(), cut, type, part); + fill3DHistoVector(h_h1OverE_, aPho->hadronicOverEm(1), cut, type, part); + fill3DHistoVector(h_h2OverE_, aPho->hadronicOverEm(2), cut, type, part); // filling pf isolation variables if (aPho->isEB()) { diff --git a/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc b/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc index 2f95bd6906b57..fd61f1acb53ba 100644 --- a/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ZToMuMuGammaAnalyzer.cc @@ -1071,14 +1071,14 @@ void ZToMuMuGammaAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& e h_ecalSum_[0]->Fill(aPho->ecalRecHitSumEtConeDR04()); h_hcalSum_[0]->Fill(aPho->hcalTowerSumEtConeDR04()); h_hOverE_[0]->Fill(aPho->hadTowOverEm()); - h_h1OverE_[0]->Fill(aPho->hadTowDepth1OverEm()); - h_h2OverE_[0]->Fill(aPho->hadTowDepth2OverEm()); + h_h1OverE_[0]->Fill(aPho->hadTowOverEm(1)); + h_h2OverE_[0]->Fill(aPho->hadTowOverEm(2)); h_newhOverE_[0]->Fill(aPho->hadTowOverEm()); h_ecalSum_[iDet]->Fill(aPho->ecalRecHitSumEtConeDR04()); h_hcalSum_[iDet]->Fill(aPho->hcalTowerSumEtConeDR04()); h_hOverE_[iDet]->Fill(aPho->hadTowOverEm()); - h_h1OverE_[iDet]->Fill(aPho->hadTowDepth1OverEm()); - h_h2OverE_[iDet]->Fill(aPho->hadTowDepth2OverEm()); + h_h1OverE_[iDet]->Fill(aPho->hadTowOverEm(1)); + h_h2OverE_[iDet]->Fill(aPho->hadTowOverEm(2)); h_newhOverE_[iDet]->Fill(aPho->hadTowOverEm()); // Isolation from particle flow h_chHadIso_[0]->Fill(aPho->chargedHadronIso()); diff --git a/DQMOffline/Trigger/src/EgHLTOffHelper.cc b/DQMOffline/Trigger/src/EgHLTOffHelper.cc index db04f46b5c4ad..3c238dd6a2434 100644 --- a/DQMOffline/Trigger/src/EgHLTOffHelper.cc +++ b/DQMOffline/Trigger/src/EgHLTOffHelper.cc @@ -282,8 +282,8 @@ void OffHelper::fillIsolData(const reco::GsfElectron& ele, OffEle::IsolData& iso isolData.ptTrks = ele.dr03TkSumPt(); isolData.nrTrks = 999; //no longer supported isolData.em = ele.dr03EcalRecHitSumEt(); - isolData.hadDepth1 = ele.dr03HcalDepth1TowerSumEt(); - isolData.hadDepth2 = ele.dr03HcalDepth2TowerSumEt(); + isolData.hadDepth1 = ele.dr03HcalTowerSumEt(1); + isolData.hadDepth2 = ele.dr03HcalTowerSumEt(2); //now time to do the HLT algos if (calHLTHcalIsol_) @@ -503,7 +503,6 @@ void OffHelper::fillClusShapeData(const reco::Photon& pho, OffPho::ClusShapeData const auto& stdCov = EcalClusterTools::covariances(seedClus, eeRecHits_.product(), caloTopology_.product(), caloGeom_.product()); const auto& crysCov = EcalClusterTools::localCovariances(seedClus, eeRecHits_.product(), caloTopology_.product()); - clusShapeData.sigmaPhiPhi = sqrt(stdCov[2]); clusShapeData.sigmaIPhiIPhi = sqrt(crysCov[2]); } diff --git a/DQMOffline/Trigger/src/FunctionDefs.cc b/DQMOffline/Trigger/src/FunctionDefs.cc index 83e50a5df52d7..9dabef524d212 100644 --- a/DQMOffline/Trigger/src/FunctionDefs.cc +++ b/DQMOffline/Trigger/src/FunctionDefs.cc @@ -7,7 +7,7 @@ std::function hltdqm::getUnaryFuncExtraFloat; else if (varName == "hOverE") - varFunc = &reco::GsfElectron::hcalOverEcal; + varFunc = [] (const reco::GsfElectron &ele) -> float { return ele.hcalOverEcal(); }; return varFunc; } @@ -17,6 +17,6 @@ std::function hltdqm::getUnaryFuncExtraFloat; else if (varName == "hOverE") - varFunc = &reco::Photon::hadTowOverEm; + varFunc = [] (const reco::Photon &pho) -> float { return pho.hadTowOverEm(); }; return varFunc; } diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 5a8b732701fef..ec0e95f62d12b 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -384,7 +384,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): dr03TkSumPt = Var("?pt>35?dr03TkSumPt():0",float,doc="Non-PF track isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8), dr03TkSumPtHEEP = Var("?pt>35?dr03TkSumPtHEEP():0",float,doc="Non-PF track isolation within a delta R cone of 0.3 with electron pt > 35 GeV used in HEEP ID",precision=8), dr03EcalRecHitSumEt = Var("?pt>35?dr03EcalRecHitSumEt():0",float,doc="Non-PF Ecal isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8), - dr03HcalDepth1TowerSumEt = Var("?pt>35?dr03HcalDepth1TowerSumEt():0",float,doc="Non-PF Hcal isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8), + dr03HcalDepth1TowerSumEt = Var("?pt>35?dr03HcalTowerSumEt(1):0",float,doc="Non-PF Hcal isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8), hoe = Var("hadronicOverEm()",float,doc="H over E",precision=8), tightCharge = Var("isGsfCtfScPixChargeConsistent() + isGsfScPixChargeConsistent()",int,doc="Tight charge criteria (0:none, 1:isGsfScPixChargeConsistent, 2:isGsfCtfScPixChargeConsistent)"), convVeto = Var("passConversionVeto()",bool,doc="pass conversion veto"), diff --git a/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc b/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc index 9558ee844aa4a..3f1c0728eb68a 100644 --- a/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc +++ b/RecoEgamma/EgammaTools/plugins/EGFull5x5ShowerShapeModifier.cc @@ -29,10 +29,20 @@ class EGFull5x5ShowerShapeModifierFromValueMaps : public ModifyObjectValueBase { edm::EDGetTokenT> tok_e2x5Max; edm::EDGetTokenT> tok_e5x5; edm::EDGetTokenT> tok_r9; - edm::EDGetTokenT> tok_hcalDepth1OverEcal; - edm::EDGetTokenT> tok_hcalDepth2OverEcal; - edm::EDGetTokenT> tok_hcalDepth1OverEcalBc; - edm::EDGetTokenT> tok_hcalDepth2OverEcalBc; + edm::EDGetTokenT> tok_hcalOverEcalDepth1; + edm::EDGetTokenT> tok_hcalOverEcalDepth2; + edm::EDGetTokenT> tok_hcalOverEcalDepth3; + edm::EDGetTokenT> tok_hcalOverEcalDepth4; + edm::EDGetTokenT> tok_hcalOverEcalDepth5; + edm::EDGetTokenT> tok_hcalOverEcalDepth6; + edm::EDGetTokenT> tok_hcalOverEcalDepth7; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth1; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth2; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth3; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth4; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth5; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth6; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth7; }; struct photon_config { @@ -44,10 +54,20 @@ class EGFull5x5ShowerShapeModifierFromValueMaps : public ModifyObjectValueBase { edm::EDGetTokenT> tok_e3x3; edm::EDGetTokenT> tok_e5x5; edm::EDGetTokenT> tok_maxEnergyXtal; - edm::EDGetTokenT> tok_hcalDepth1OverEcal; - edm::EDGetTokenT> tok_hcalDepth2OverEcal; - edm::EDGetTokenT> tok_hcalDepth1OverEcalBc; - edm::EDGetTokenT> tok_hcalDepth2OverEcalBc; + edm::EDGetTokenT> tok_hcalOverEcalDepth1; + edm::EDGetTokenT> tok_hcalOverEcalDepth2; + edm::EDGetTokenT> tok_hcalOverEcalDepth3; + edm::EDGetTokenT> tok_hcalOverEcalDepth4; + edm::EDGetTokenT> tok_hcalOverEcalDepth5; + edm::EDGetTokenT> tok_hcalOverEcalDepth6; + edm::EDGetTokenT> tok_hcalOverEcalDepth7; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth1; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth2; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth3; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth4; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth5; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth6; + edm::EDGetTokenT> tok_hcalOverEcalBcDepth7; }; EGFull5x5ShowerShapeModifierFromValueMaps(const edm::ParameterSet& conf, edm::ConsumesCollector& cc); @@ -93,14 +113,34 @@ EGFull5x5ShowerShapeModifierFromValueMaps::EGFull5x5ShowerShapeModifierFromValue make_consumes(electrons.getParameter("e5x5"), e_conf.tok_e5x5, cc); if (electrons.exists("r9")) make_consumes(electrons.getParameter("r9"), e_conf.tok_r9, cc); - if (electrons.exists("hcalDepth1OverEcal")) - make_consumes(electrons.getParameter("hcalDepth1OverEcal"), e_conf.tok_hcalDepth1OverEcal, cc); - if (electrons.exists("hcalDepth2OverEcal")) - make_consumes(electrons.getParameter("hcalDepth2OverEcal"), e_conf.tok_hcalDepth2OverEcal, cc); - if (electrons.exists("hcalDepth1OverEcalBc")) - make_consumes(electrons.getParameter("hcalDepth1OverEcalBc"), e_conf.tok_hcalDepth1OverEcalBc, cc); - if (electrons.exists("hcalDepth2OverEcalBc")) - make_consumes(electrons.getParameter("hcalDepth2OverEcalBc"), e_conf.tok_hcalDepth2OverEcalBc, cc); + if (electrons.exists("hcalOverEcalDepth1")) + make_consumes(electrons.getParameter("hcalOverEcalDepth1"), e_conf.tok_hcalOverEcalDepth1, cc); + if (electrons.exists("hcalOverEcalDepth2")) + make_consumes(electrons.getParameter("hcalOverEcalDepth2"), e_conf.tok_hcalOverEcalDepth2, cc); + if (electrons.exists("hcalOverEcalDepth3")) + make_consumes(electrons.getParameter("hcalOverEcalDepth3"), e_conf.tok_hcalOverEcalDepth3, cc); + if (electrons.exists("hcalOverEcalDepth4")) + make_consumes(electrons.getParameter("hcalOverEcalDepth4"), e_conf.tok_hcalOverEcalDepth4, cc); + if (electrons.exists("hcalOverEcalDepth5")) + make_consumes(electrons.getParameter("hcalOverEcalDepth5"), e_conf.tok_hcalOverEcalDepth5, cc); + if (electrons.exists("hcalOverEcalDepth6")) + make_consumes(electrons.getParameter("hcalOverEcalDepth6"), e_conf.tok_hcalOverEcalDepth6, cc); + if (electrons.exists("hcalOverEcalDepth7")) + make_consumes(electrons.getParameter("hcalOverEcalDepth7"), e_conf.tok_hcalOverEcalDepth7, cc); + if (electrons.exists("hcalOverEcalBcDepth1")) + make_consumes(electrons.getParameter("hcalOverEcalBcDepth1"), e_conf.tok_hcalOverEcalBcDepth1, cc); + if (electrons.exists("hcalOverEcalBcDepth2")) + make_consumes(electrons.getParameter("hcalOverEcalBcDepth2"), e_conf.tok_hcalOverEcalBcDepth2, cc); + if (electrons.exists("hcalOverEcalBcDepth3")) + make_consumes(electrons.getParameter("hcalOverEcalBcDepth3"), e_conf.tok_hcalOverEcalBcDepth3, cc); + if (electrons.exists("hcalOverEcalBcDepth4")) + make_consumes(electrons.getParameter("hcalOverEcalBcDepth4"), e_conf.tok_hcalOverEcalBcDepth4, cc); + if (electrons.exists("hcalOverEcalBcDepth5")) + make_consumes(electrons.getParameter("hcalOverEcalBcDepth5"), e_conf.tok_hcalOverEcalBcDepth5, cc); + if (electrons.exists("hcalOverEcalBcDepth6")) + make_consumes(electrons.getParameter("hcalOverEcalBcDepth6"), e_conf.tok_hcalOverEcalBcDepth6, cc); + if (electrons.exists("hcalOverEcalBcDepth7")) + make_consumes(electrons.getParameter("hcalOverEcalBcDepth7"), e_conf.tok_hcalOverEcalBcDepth7, cc); } if (conf.exists("photon_config")) { auto const& photons = conf.getParameterSet("photon_config"); @@ -120,14 +160,34 @@ EGFull5x5ShowerShapeModifierFromValueMaps::EGFull5x5ShowerShapeModifierFromValue make_consumes(photons.getParameter("e5x5"), ph_conf.tok_e5x5, cc); if (photons.exists("maxEnergyXtal")) make_consumes(photons.getParameter("maxEnergyXtal"), ph_conf.tok_maxEnergyXtal, cc); - if (photons.exists("hcalDepth1OverEcal")) - make_consumes(photons.getParameter("hcalDepth1OverEcal"), ph_conf.tok_hcalDepth1OverEcal, cc); - if (photons.exists("hcalDepth2OverEcal")) - make_consumes(photons.getParameter("hcalDepth2OverEcal"), ph_conf.tok_hcalDepth2OverEcal, cc); - if (photons.exists("hcalDepth1OverEcalBc")) - make_consumes(photons.getParameter("hcalDepth1OverEcalBc"), ph_conf.tok_hcalDepth1OverEcalBc, cc); - if (photons.exists("hcalDepth2OverEcalBc")) - make_consumes(photons.getParameter("hcalDepth2OverEcalBc"), ph_conf.tok_hcalDepth2OverEcalBc, cc); + if (photons.exists("hcalOverEcalDepth1")) + make_consumes(photons.getParameter("hcalOverEcalDepth1"), ph_conf.tok_hcalOverEcalDepth1, cc); + if (photons.exists("hcalOverEcalDepth2")) + make_consumes(photons.getParameter("hcalOverEcalDepth2"), ph_conf.tok_hcalOverEcalDepth2, cc); + if (photons.exists("hcalOverEcalDepth3")) + make_consumes(photons.getParameter("hcalOverEcalDepth3"), ph_conf.tok_hcalOverEcalDepth3, cc); + if (photons.exists("hcalOverEcalDepth4")) + make_consumes(photons.getParameter("hcalOverEcalDepth4"), ph_conf.tok_hcalOverEcalDepth4, cc); + if (photons.exists("hcalOverEcalDepth5")) + make_consumes(photons.getParameter("hcalOverEcalDepth5"), ph_conf.tok_hcalOverEcalDepth5, cc); + if (photons.exists("hcalOverEcalDepth6")) + make_consumes(photons.getParameter("hcalOverEcalDepth6"), ph_conf.tok_hcalOverEcalDepth6, cc); + if (photons.exists("hcalOverEcalDepth7")) + make_consumes(photons.getParameter("hcalOverEcalDepth7"), ph_conf.tok_hcalOverEcalDepth7, cc); + if (photons.exists("hcalOverEcalBcDepth1")) + make_consumes(photons.getParameter("hcalOverEcalBcDepth1"), ph_conf.tok_hcalOverEcalBcDepth1, cc); + if (photons.exists("hcalOverEcalBcDepth2")) + make_consumes(photons.getParameter("hcalOverEcalBcDepth2"), ph_conf.tok_hcalOverEcalBcDepth2, cc); + if (photons.exists("hcalOverEcalBcDepth3")) + make_consumes(photons.getParameter("hcalOverEcalBcDepth3"), ph_conf.tok_hcalOverEcalBcDepth3, cc); + if (photons.exists("hcalOverEcalBcDepth4")) + make_consumes(photons.getParameter("hcalOverEcalBcDepth4"), ph_conf.tok_hcalOverEcalBcDepth4, cc); + if (photons.exists("hcalOverEcalBcDepth5")) + make_consumes(photons.getParameter("hcalOverEcalBcDepth5"), ph_conf.tok_hcalOverEcalBcDepth5, cc); + if (photons.exists("hcalOverEcalBcDepth6")) + make_consumes(photons.getParameter("hcalOverEcalBcDepth6"), ph_conf.tok_hcalOverEcalBcDepth6, cc); + if (photons.exists("hcalOverEcalBcDepth7")) + make_consumes(photons.getParameter("hcalOverEcalBcDepth7"), ph_conf.tok_hcalOverEcalBcDepth7, cc); } ele_idx = pho_idx = 0; @@ -164,10 +224,20 @@ void EGFull5x5ShowerShapeModifierFromValueMaps::setEvent(const edm::Event& evt) get_product(evt, e_conf.tok_e2x5Max, ele_vmaps); get_product(evt, e_conf.tok_e5x5, ele_vmaps); get_product(evt, e_conf.tok_r9, ele_vmaps); - get_product(evt, e_conf.tok_hcalDepth1OverEcal, ele_vmaps); - get_product(evt, e_conf.tok_hcalDepth2OverEcal, ele_vmaps); - get_product(evt, e_conf.tok_hcalDepth1OverEcalBc, ele_vmaps); - get_product(evt, e_conf.tok_hcalDepth2OverEcalBc, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalDepth1, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalDepth2, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalDepth3, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalDepth4, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalDepth5, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalDepth6, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalDepth7, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalBcDepth1, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalBcDepth2, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalBcDepth3, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalBcDepth4, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalBcDepth5, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalBcDepth6, ele_vmaps); + get_product(evt, e_conf.tok_hcalOverEcalBcDepth7, ele_vmaps); if (!ph_conf.tok_photon_src.isUninitialized()) { auto phos = evt.getHandle(ph_conf.tok_photon_src); @@ -183,10 +253,20 @@ void EGFull5x5ShowerShapeModifierFromValueMaps::setEvent(const edm::Event& evt) get_product(evt, ph_conf.tok_e3x3, pho_vmaps); get_product(evt, ph_conf.tok_e5x5, pho_vmaps); get_product(evt, ph_conf.tok_maxEnergyXtal, pho_vmaps); - get_product(evt, ph_conf.tok_hcalDepth1OverEcal, pho_vmaps); - get_product(evt, ph_conf.tok_hcalDepth2OverEcal, pho_vmaps); - get_product(evt, ph_conf.tok_hcalDepth1OverEcalBc, pho_vmaps); - get_product(evt, ph_conf.tok_hcalDepth2OverEcalBc, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalDepth1, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalDepth2, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalDepth3, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalDepth4, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalDepth5, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalDepth6, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalDepth7, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalBcDepth1, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalBcDepth2, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalBcDepth3, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalBcDepth4, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalBcDepth5, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalBcDepth6, pho_vmaps); + get_product(evt, ph_conf.tok_hcalOverEcalBcDepth7, pho_vmaps); } namespace { @@ -218,10 +298,20 @@ void EGFull5x5ShowerShapeModifierFromValueMaps::modifyObject(pat::Electron& ele) assignValue(ptr, e_conf.tok_e2x5Max, ele_vmaps, full5x5.e2x5Max); assignValue(ptr, e_conf.tok_e5x5, ele_vmaps, full5x5.e5x5); assignValue(ptr, e_conf.tok_r9, ele_vmaps, full5x5.r9); - assignValue(ptr, e_conf.tok_hcalDepth1OverEcal, ele_vmaps, full5x5.hcalDepth1OverEcal); - assignValue(ptr, e_conf.tok_hcalDepth2OverEcal, ele_vmaps, full5x5.hcalDepth2OverEcal); - assignValue(ptr, e_conf.tok_hcalDepth1OverEcalBc, ele_vmaps, full5x5.hcalDepth1OverEcalBc); - assignValue(ptr, e_conf.tok_hcalDepth2OverEcalBc, ele_vmaps, full5x5.hcalDepth2OverEcalBc); + assignValue(ptr, e_conf.tok_hcalOverEcalDepth1, ele_vmaps, full5x5.hcalOverEcal[0]); + assignValue(ptr, e_conf.tok_hcalOverEcalDepth2, ele_vmaps, full5x5.hcalOverEcal[1]); + assignValue(ptr, e_conf.tok_hcalOverEcalDepth3, ele_vmaps, full5x5.hcalOverEcal[2]); + assignValue(ptr, e_conf.tok_hcalOverEcalDepth4, ele_vmaps, full5x5.hcalOverEcal[3]); + assignValue(ptr, e_conf.tok_hcalOverEcalDepth5, ele_vmaps, full5x5.hcalOverEcal[4]); + assignValue(ptr, e_conf.tok_hcalOverEcalDepth6, ele_vmaps, full5x5.hcalOverEcal[5]); + assignValue(ptr, e_conf.tok_hcalOverEcalDepth7, ele_vmaps, full5x5.hcalOverEcal[6]); + assignValue(ptr, e_conf.tok_hcalOverEcalBcDepth1, ele_vmaps, full5x5.hcalOverEcalBc[0]); + assignValue(ptr, e_conf.tok_hcalOverEcalBcDepth2, ele_vmaps, full5x5.hcalOverEcalBc[1]); + assignValue(ptr, e_conf.tok_hcalOverEcalBcDepth3, ele_vmaps, full5x5.hcalOverEcalBc[2]); + assignValue(ptr, e_conf.tok_hcalOverEcalBcDepth4, ele_vmaps, full5x5.hcalOverEcalBc[3]); + assignValue(ptr, e_conf.tok_hcalOverEcalBcDepth5, ele_vmaps, full5x5.hcalOverEcalBc[4]); + assignValue(ptr, e_conf.tok_hcalOverEcalBcDepth6, ele_vmaps, full5x5.hcalOverEcalBc[5]); + assignValue(ptr, e_conf.tok_hcalOverEcalBcDepth7, ele_vmaps, full5x5.hcalOverEcalBc[6]); ele.full5x5_setShowerShape(full5x5); ++ele_idx; @@ -248,10 +338,20 @@ void EGFull5x5ShowerShapeModifierFromValueMaps::modifyObject(pat::Photon& pho) c assignValue(ptr, ph_conf.tok_e3x3, pho_vmaps, full5x5.e3x3); assignValue(ptr, ph_conf.tok_e5x5, pho_vmaps, full5x5.e5x5); assignValue(ptr, ph_conf.tok_maxEnergyXtal, pho_vmaps, full5x5.maxEnergyXtal); - assignValue(ptr, ph_conf.tok_hcalDepth1OverEcal, pho_vmaps, full5x5.hcalDepth1OverEcal); - assignValue(ptr, ph_conf.tok_hcalDepth2OverEcal, pho_vmaps, full5x5.hcalDepth2OverEcal); - assignValue(ptr, ph_conf.tok_hcalDepth1OverEcalBc, pho_vmaps, full5x5.hcalDepth1OverEcalBc); - assignValue(ptr, ph_conf.tok_hcalDepth2OverEcalBc, pho_vmaps, full5x5.hcalDepth2OverEcalBc); + assignValue(ptr, ph_conf.tok_hcalOverEcalDepth1, pho_vmaps, full5x5.hcalOverEcal[0]); + assignValue(ptr, ph_conf.tok_hcalOverEcalDepth2, pho_vmaps, full5x5.hcalOverEcal[1]); + assignValue(ptr, ph_conf.tok_hcalOverEcalDepth3, pho_vmaps, full5x5.hcalOverEcal[2]); + assignValue(ptr, ph_conf.tok_hcalOverEcalDepth4, pho_vmaps, full5x5.hcalOverEcal[3]); + assignValue(ptr, ph_conf.tok_hcalOverEcalDepth5, pho_vmaps, full5x5.hcalOverEcal[4]); + assignValue(ptr, ph_conf.tok_hcalOverEcalDepth6, pho_vmaps, full5x5.hcalOverEcal[5]); + assignValue(ptr, ph_conf.tok_hcalOverEcalDepth7, pho_vmaps, full5x5.hcalOverEcal[6]); + assignValue(ptr, ph_conf.tok_hcalOverEcalBcDepth1, pho_vmaps, full5x5.hcalOverEcalBc[0]); + assignValue(ptr, ph_conf.tok_hcalOverEcalBcDepth2, pho_vmaps, full5x5.hcalOverEcalBc[1]); + assignValue(ptr, ph_conf.tok_hcalOverEcalBcDepth3, pho_vmaps, full5x5.hcalOverEcalBc[2]); + assignValue(ptr, ph_conf.tok_hcalOverEcalBcDepth4, pho_vmaps, full5x5.hcalOverEcalBc[3]); + assignValue(ptr, ph_conf.tok_hcalOverEcalBcDepth5, pho_vmaps, full5x5.hcalOverEcalBc[4]); + assignValue(ptr, ph_conf.tok_hcalOverEcalBcDepth6, pho_vmaps, full5x5.hcalOverEcalBc[5]); + assignValue(ptr, ph_conf.tok_hcalOverEcalBcDepth7, pho_vmaps, full5x5.hcalOverEcalBc[6]); pho.full5x5_setShowerShapeVariables(full5x5); ++pho_idx; diff --git a/RecoEgamma/ElectronIdentification/plugins/CutBasedElectronID.cc b/RecoEgamma/ElectronIdentification/plugins/CutBasedElectronID.cc index f8563a42b08f1..68a4a1b2903b2 100644 --- a/RecoEgamma/ElectronIdentification/plugins/CutBasedElectronID.cc +++ b/RecoEgamma/ElectronIdentification/plugins/CutBasedElectronID.cc @@ -454,8 +454,8 @@ double CutBasedElectronID::robustSelection(const reco::GsfElectron* electron, double ecalIso = electron->dr04EcalRecHitSumEt(); double ecalIsoPed = (electron->isEB()) ? std::max(0., ecalIso - 1.) : ecalIso; double hcalIso = electron->dr04HcalTowerSumEt(); - double hcalIso1 = electron->dr04HcalDepth1TowerSumEt(); - double hcalIso2 = electron->dr04HcalDepth2TowerSumEt(); + double hcalIso1 = electron->dr04HcalTowerSumEt(1); + double hcalIso2 = electron->dr04HcalTowerSumEt(2); if (version_ == "V00") { sigmaee = electron->sigmaEtaEta(); @@ -479,8 +479,8 @@ double CutBasedElectronID::robustSelection(const reco::GsfElectron* electron, ecalIso = electron->dr03EcalRecHitSumEt(); ecalIsoPed = (electron->isEB()) ? std::max(0., ecalIso - 1.) : ecalIso; hcalIso = electron->dr03HcalTowerSumEt(); - hcalIso1 = electron->dr03HcalDepth1TowerSumEt(); - hcalIso2 = electron->dr03HcalDepth2TowerSumEt(); + hcalIso1 = electron->dr03HcalTowerSumEt(1); + hcalIso2 = electron->dr03HcalTowerSumEt(2); } if (version_ == "V05") { diff --git a/RecoEgamma/ElectronIdentification/plugins/cuts/GsfEleEmHadD1IsoRhoCut.cc b/RecoEgamma/ElectronIdentification/plugins/cuts/GsfEleEmHadD1IsoRhoCut.cc index 560f00dc9243a..96b1cb313292f 100644 --- a/RecoEgamma/ElectronIdentification/plugins/cuts/GsfEleEmHadD1IsoRhoCut.cc +++ b/RecoEgamma/ElectronIdentification/plugins/cuts/GsfEleEmHadD1IsoRhoCut.cc @@ -51,7 +51,7 @@ void GsfEleEmHadD1IsoRhoCut::getEventContent(const edm::EventBase& ev) { CutApplicatorBase::result_type GsfEleEmHadD1IsoRhoCut::operator()(const reco::GsfElectronPtr& cand) const { const double rho = (*rhoHandle_); - const float isolEmHadDepth1 = cand->dr03EcalRecHitSumEt() + cand->dr03HcalDepth1TowerSumEt(); + const float isolEmHadDepth1 = cand->dr03EcalRecHitSumEt() + cand->dr03HcalTowerSumEt(1); const float sinTheta = cand->p() != 0. ? cand->pt() / cand->p() : 0.; const float et = energyRetriever_(*cand) * sinTheta; @@ -63,5 +63,5 @@ CutApplicatorBase::result_type GsfEleEmHadD1IsoRhoCut::operator()(const reco::Gs double GsfEleEmHadD1IsoRhoCut::value(const reco::CandidatePtr& cand) const { reco::GsfElectronPtr ele(cand); - return ele->dr03EcalRecHitSumEt() + ele->dr03HcalDepth1TowerSumEt(); + return ele->dr03EcalRecHitSumEt() + ele->dr03HcalTowerSumEt(1); } diff --git a/RecoEgamma/Examples/plugins/DQMAnalyzer.cc b/RecoEgamma/Examples/plugins/DQMAnalyzer.cc index 2d3beba9f7984..1c2af96df2529 100644 --- a/RecoEgamma/Examples/plugins/DQMAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/DQMAnalyzer.cc @@ -273,12 +273,12 @@ class DQMAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1TowerSumEt_dr03; - TH1F *h_ele_hcalDepth2TowerSumEt_dr03; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1TowerSumEt_dr04; - TH1F *h_ele_hcalDepth2TowerSumEt_dr04; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; TH1F *h_ele_mee_os; }; @@ -650,16 +650,16 @@ void DQMAnalyzer::beginJob() { h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); //================================================== // T&P @@ -830,27 +830,27 @@ void DQMAnalyzer::endJob() { h_ele_tkSumPt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr03->Write(); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1TowerSumEt_dr03->Write(); - h_ele_hcalDepth2TowerSumEt_dr03->Write(); + h_ele_hcalDepth1RecHitSumEt_dr03->Write(); + h_ele_hcalDepth2RecHitSumEt_dr03->Write(); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1TowerSumEt_dr04->Write(); - h_ele_hcalDepth2TowerSumEt_dr04->Write(); + h_ele_hcalDepth1RecHitSumEt_dr04->Write(); + h_ele_hcalDepth2RecHitSumEt_dr04->Write(); } void DQMAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -967,12 +967,12 @@ void DQMAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetu h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(2)); } // association matching object-reco electrons @@ -1207,11 +1207,11 @@ bool DQMAnalyzer::isolationCut(const reco::GsfElectronCollection::const_iterator if (gsfIter->dr03TkSumPt() > tkIso03Max_) return true; - if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) + if (gsfIter->isEB() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxBarrel_) return true; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxEndcaps_) return true; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(2) > hcalIso03Depth2MaxEndcaps_) return true; if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) return true; diff --git a/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc index 43b3ae70b1f2f..48b4ac200fc5e 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc @@ -335,12 +335,12 @@ class GsfElectronDataAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1TowerSumEt_dr03; - TH1F *h_ele_hcalDepth2TowerSumEt_dr03; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1TowerSumEt_dr04; - TH1F *h_ele_hcalDepth2TowerSumEt_dr04; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; // electron selection double minEt_; @@ -1222,16 +1222,16 @@ void GsfElectronDataAnalyzer::beginJob() { // isolation h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.); @@ -1835,24 +1835,24 @@ void GsfElectronDataAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr03->Write(); - h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr03->Write(); + h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr03->Write(); + h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr04->Write(); - h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr04->Write(); + h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr04->Write(); + h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr04->Write(); } void GsfElectronDataAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -1955,11 +1955,11 @@ void GsfElectronDataAnalyzer::analyze(const edm::Event &iEvent, const edm::Event if (gsfIter->dr03TkSumPt() > tkIso03Max_) continue; - if (gsfIter->isEB() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxBarrel_) + if (gsfIter->isEB() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxBarrel_) continue; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth1TowerSumEt() > hcalIso03Depth1MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(1) > hcalIso03Depth1MaxEndcaps_) continue; - if (gsfIter->isEE() && gsfIter->dr03HcalDepth2TowerSumEt() > hcalIso03Depth2MaxEndcaps_) + if (gsfIter->isEE() && gsfIter->dr03HcalTowerSumEt(2) > hcalIso03Depth2MaxEndcaps_) continue; if (gsfIter->isEB() && gsfIter->dr03EcalRecHitSumEt() > ecalIso03MaxBarrel_) continue; @@ -2190,12 +2190,12 @@ void GsfElectronDataAnalyzer::analyze(const edm::Event &iEvent, const edm::Event h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(2)); float enrj1 = gsfIter->superCluster()->energy(); // mee diff --git a/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc index 16523b4acf2df..08c74649f9c4c 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc @@ -364,12 +364,12 @@ class GsfElectronFakeAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1TowerSumEt_dr03; - TH1F *h_ele_hcalDepth2TowerSumEt_dr03; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1TowerSumEt_dr04; - TH1F *h_ele_hcalDepth2TowerSumEt_dr04; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; std::string outputFile_; edm::InputTag electronCollection_; @@ -1366,16 +1366,16 @@ void GsfElectronFakeAnalyzer::beginJob() { // isolation h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.); @@ -2096,24 +2096,24 @@ void GsfElectronFakeAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr03->Write(); - h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr03->Write(); + h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr03->Write(); + h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr04->Write(); - h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr04->Write(); + h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr04->Write(); + h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr04->Write(); } void GsfElectronFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -2592,12 +2592,12 @@ void GsfElectronFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::Event h_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); } // gsf electron found diff --git a/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc index 6a74806aab367..06693961a9238 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc @@ -429,12 +429,12 @@ class GsfElectronMCAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1TowerSumEt_dr03; - TH1F *h_ele_hcalDepth2TowerSumEt_dr03; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1TowerSumEt_dr04; - TH1F *h_ele_hcalDepth2TowerSumEt_dr04; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; std::string outputFile_; edm::InputTag electronCollection_; @@ -1836,22 +1836,22 @@ void GsfElectronMCAnalyzer::beginJob() { h_ele_tkSumPt_dr03->Sumw2(); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03->Sumw2(); - h_ele_hcalDepth1TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr03->Sumw2(); - h_ele_hcalDepth2TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr03->Sumw2(); + h_ele_hcalDepth1RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr03->Sumw2(); + h_ele_hcalDepth2RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr03->Sumw2(); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "tk isolation sum, dR=0.4", 100, 0.0, 20.); h_ele_tkSumPt_dr04->Sumw2(); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04->Sumw2(); - h_ele_hcalDepth1TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr04->Sumw2(); - h_ele_hcalDepth2TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr04->Sumw2(); + h_ele_hcalDepth1RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr04->Sumw2(); + h_ele_hcalDepth2RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr04->Sumw2(); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode of GSF components", 100, 0., 1.); @@ -2840,24 +2840,24 @@ void GsfElectronMCAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr03->Write(); - h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr03->Write(); + h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr03->Write(); + h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr04->Write(); - h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr04->Write(); + h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr04->Write(); + h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr04->Write(); } GsfElectronMCAnalyzer::~GsfElectronMCAnalyzer() { @@ -3581,12 +3581,12 @@ void GsfElectronMCAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSe h_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); } // gsf electron found diff --git a/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc index 007356f7dd3c1..b3498acb04cda 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc @@ -404,12 +404,12 @@ class GsfElectronMCFakeAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1TowerSumEt_dr03; - TH1F *h_ele_hcalDepth2TowerSumEt_dr03; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1TowerSumEt_dr04; - TH1F *h_ele_hcalDepth2TowerSumEt_dr04; + TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; }; #include "FWCore/Framework/interface/MakerMacros.h" @@ -1352,16 +1352,16 @@ void GsfElectronMCFakeAnalyzer::beginJob() { // isolation h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr03 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr03 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2TowerSumEt_dr04 = - new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2RecHitSumEt_dr04 = + new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.); @@ -2083,24 +2083,24 @@ void GsfElectronMCFakeAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr03->Write(); - h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr03->Write(); + h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr03->Write(); + h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1TowerSumEt_dr04->Write(); - h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2TowerSumEt_dr04->Write(); + h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1RecHitSumEt_dr04->Write(); + h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2RecHitSumEt_dr04->Write(); } void GsfElectronMCFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -2578,12 +2578,12 @@ void GsfElectronMCFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::Eve h_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h_ele_hcalDepth1TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); - h_ele_hcalDepth2TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEt()); + h_ele_hcalDepth1RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); } // gsf electron found diff --git a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h index 33867a543f477..00b1214ed3f5a 100644 --- a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h +++ b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h @@ -7,11 +7,21 @@ #include "DataFormats/EgammaCandidates/interface/Photon.h" #include "FWCore/Utilities/interface/Visibility.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" +#include "Geometry/CaloTopology/interface/HcalTopology.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h" +#include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h" +#include "CondFormats/HcalObjects/interface/HcalChannelQuality.h" +#include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h" + #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h" #include #include "FWCore/Framework/interface/ConsumesCollector.h" +#include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h" class PhotonIsolationCalculator { public: @@ -65,25 +75,30 @@ class PhotonIsolationCalculator { bool vetoClusteredHits, bool useNumCrystals) const dso_internal; - double calculateHcalTowerIso(const reco::Photon* photon, - const edm::Event& iEvent, - const edm::EventSetup& iSetup, - double RCone, - double RConeInner, - double eMin, - signed int depth) const dso_internal; - - double calculateHcalTowerIso(const reco::Photon* photon, - const edm::Event& iEvent, - const edm::EventSetup& iSetup, - double RCone, - double eMin, - signed int depth) const dso_internal; + template + double calculateHcalRecHitIso(const reco::Photon* photon, + const CaloGeometry& geometry, + const HcalTopology &hcalTopology, + const HcalChannelQuality &hcalChStatus, + const HcalSeverityLevelComputer &hcalSevLvlComputer, + const CaloTowerConstituentsMap &towerMap, + const HBHERecHitCollection &hcalRecHits, + double RCone, + double RConeInner, + double eMin, + int maxSeverity, + int depth) const dso_internal; private: edm::EDGetToken barrelecalCollection_; edm::EDGetToken endcapecalCollection_; - edm::EDGetToken hcalCollection_; + edm::EDGetTokenT hcalRecHitsTag_; + + edm::ESGetToken caloGeometryToken_; + edm::ESGetToken hcalTopologyToken_; + edm::ESGetToken hcalChannelQualityToken_; + edm::ESGetToken hcalSevLvlComputerToken_; + edm::ESGetToken towerMapToken_; edm::EDGetToken trackInputTag_; edm::EDGetToken beamSpotProducerTag_; @@ -92,24 +107,25 @@ class PhotonIsolationCalculator { bool vetoClusteredEcalHits_; bool useNumCrystals_; - double trkIsoBarrelRadiusA_[6]; - double ecalIsoBarrelRadiusA_[5]; - double hcalIsoBarrelRadiusA_[9]; - double trkIsoBarrelRadiusB_[6]; - double ecalIsoBarrelRadiusB_[5]; - double hcalIsoBarrelRadiusB_[9]; + std::array trkIsoBarrelRadiusA_; + std::array ecalIsoBarrelRadiusA_; + std::array hcalIsoBarrelRadiusA_; + std::array trkIsoBarrelRadiusB_; + std::array ecalIsoBarrelRadiusB_; + std::array hcalIsoBarrelRadiusB_; - double trkIsoEndcapRadiusA_[6]; - double ecalIsoEndcapRadiusA_[5]; - double hcalIsoEndcapRadiusA_[9]; - double trkIsoEndcapRadiusB_[6]; - double ecalIsoEndcapRadiusB_[5]; - double hcalIsoEndcapRadiusB_[9]; + std::array trkIsoEndcapRadiusA_; + std::array ecalIsoEndcapRadiusA_; + std::array hcalIsoEndcapRadiusA_; + std::array trkIsoEndcapRadiusB_; + std::array ecalIsoEndcapRadiusB_; + std::array hcalIsoEndcapRadiusB_; std::vector flagsEB_; std::vector flagsEE_; std::vector severityExclEB_; std::vector severityExclEE_; + int maxHcalSeverity_; }; #endif // PhotonIsolationCalculator_H diff --git a/RecoEgamma/PhotonIdentification/python/Identification/cutBasedPhotonID_tools.py b/RecoEgamma/PhotonIdentification/python/Identification/cutBasedPhotonID_tools.py index 2e3d01d1c4740..510f617eaae46 100644 --- a/RecoEgamma/PhotonIdentification/python/Identification/cutBasedPhotonID_tools.py +++ b/RecoEgamma/PhotonIdentification/python/Identification/cutBasedPhotonID_tools.py @@ -116,15 +116,15 @@ def psetPhoSCEtaMultiRangeCut(): isIgnored = cms.bool(False) ) -# Configure the cut on the single tower H/E -def psetPhoSingleTowerHadOverEmCut( wpEB, wpEE): +# Configure the cut on H/E +def psetPhoHcalOverEcalBcCut( wpEB, wpEE): """ Arguments: two containers of working point cut values of the type WorkingPoint_* """ return cms.PSet( - cutName = cms.string('PhoSingleTowerHadOverEmCut'), - hadronicOverEMCutValueEB = cms.double( wpEB.hOverECut ), - hadronicOverEMCutValueEE = cms.double( wpEE.hOverECut ), + cutName = cms.string('PhotonHcalOverEcalBcCut'), + hcalOverEcalCutValueEB = cms.double( wpEB.hOverECut ), + hcalOverEcalCutValueEE = cms.double( wpEE.hOverECut ), barrelCutOff = cms.double(ebCutOff), needsAdditionalProducts = cms.bool(False), isIgnored = cms.bool(False) @@ -332,7 +332,7 @@ def configureVIDCutBasedPhoID_V1( wpEB, wpEE, isoInputs ): cutFlow = cms.VPSet( psetMinPtCut(), # pt cut psetPhoSCEtaMultiRangeCut(), # eta cut - psetPhoSingleTowerHadOverEmCut(wpEB,wpEE), # H/E cut + psetPhoHcalOverEcalBcCut(wpEB,wpEE), # H/E cut psetPhoFull5x5SigmaIEtaIEtaValueMapCut(wpEB,wpEE), # full 5x5 sigmaIEtaIEta cut psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs), # charged hadron isolation cut psetNeuHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut @@ -360,7 +360,7 @@ def configureVIDCutBasedPhoID_V2( wpEB, wpEE, isoInputs ): cutFlow = cms.VPSet( psetMinPtCut(), # pt cut psetPhoSCEtaMultiRangeCut(), # eta cut - psetPhoSingleTowerHadOverEmCut(wpEB,wpEE), # H/E cut + psetPhoHcalOverEcalBcCut(wpEB,wpEE), # H/E cut psetPhoFull5x5SigmaIEtaIEtaValueMapCut(wpEB,wpEE), # full 5x5 sigmaIEtaIEta cut psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs), # charged hadron isolation cut psetNeuHadIsoWithEAExpoScalingEBCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut @@ -389,7 +389,7 @@ def configureVIDCutBasedPhoID_V3( wpEB, wpEE, isoInputs ): cutFlow = cms.VPSet( psetMinPtCut(), # pt cut psetPhoSCEtaMultiRangeCut(), # eta cut - psetPhoSingleTowerHadOverEmCut(wpEB,wpEE), # H/E cut + psetPhoHcalOverEcalBcCut(wpEB,wpEE), # H/E cut psetPhoFull5x5SigmaIEtaIEtaCut(wpEB,wpEE), # full 5x5 sigmaIEtaIEta cut psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs), # charged hadron isolation cut psetNeuHadIsoWithEAExpoScalingEBCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut @@ -418,7 +418,7 @@ def configureVIDCutBasedPhoID_V4( wpEB, wpEE, isoInputs ): cutFlow = cms.VPSet( psetMinPtCut(), # pt cut psetPhoSCEtaMultiRangeCut(), # eta cut - psetPhoSingleTowerHadOverEmCut(wpEB,wpEE), # H/E cut + psetPhoHcalOverEcalBcCut(wpEB,wpEE), # H/E cut psetPhoFull5x5SigmaIEtaIEtaCut(wpEB,wpEE), # full 5x5 sigmaIEtaIEta cut psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs), # charged hadron isolation cut psetNeuHadIsoWithEAExpoScalingCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut @@ -446,7 +446,7 @@ def configureVIDCutBasedPhoID_V5( wpEB, wpEE, isoInputs ): cutFlow = cms.VPSet( psetMinPtCut(), # pt cut psetPhoSCEtaMultiRangeCut(), # eta cut - psetPhoSingleTowerHadOverEmCut(wpEB,wpEE), # H/E cut + psetPhoHcalOverEcalBcCut(wpEB,wpEE), # H/E cut psetPhoFull5x5SigmaIEtaIEtaCut(wpEB,wpEE), # full 5x5 sigmaIEtaIEta cut psetChHadIsoWithEALinScalingCut(wpEB,wpEE,isoInputs), # charged hadron isolation cut psetNeuHadIsoWithEAQuadScalingCut(wpEB,wpEE,isoInputs), # neutral hadron isolation cut diff --git a/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py b/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py index 598bde8bacc1a..04bd2f3c57a54 100644 --- a/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py +++ b/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py @@ -7,7 +7,7 @@ barrelEcalRecHitCollection = cms.InputTag('ecalRecHit:EcalRecHitsEB'), endcapEcalRecHitCollection = cms.InputTag('ecalRecHit:EcalRecHitsEE'), - HcalRecHitCollection = cms.InputTag('towerMaker'), + HcalRecHitCollection = cms.InputTag('hbhereco'), # Photon will be marked as being near phi module boundary if # it is closer than this. Currently half a crystal. @@ -51,26 +51,50 @@ EcalRecHitEtaSliceB_Barrel = cms.double(2.5), EcalRecHitThreshEB_Barrel = cms.double(0.095), EcalRecHitThreshEtB_Barrel = cms.double(0.0), - #Hcal towers - HcalTowerInnerRadiusA_Barrel = cms.double(0.15), - HcalTowerOuterRadiusA_Barrel = cms.double(0.4), - HcalTowerThreshEA_Barrel = cms.double(0.0), - HcalDepth1TowerInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth1TowerOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth1TowerThreshEA_Barrel = cms.double(0.0), - HcalDepth2TowerInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth2TowerOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth2TowerThreshEA_Barrel = cms.double(0.0), + #Hcal rechits + HcalDepth1RecHitInnerRadiusA_Barrel = cms.double(0.15), + HcalDepth1RecHitOuterRadiusA_Barrel = cms.double(0.4), + HcalDepth1RecHitThreshEA_Barrel = cms.double(0.0), + HcalDepth2RecHitInnerRadiusA_Barrel = cms.double(0.15), + HcalDepth2RecHitOuterRadiusA_Barrel = cms.double(0.4), + HcalDepth2RecHitThreshEA_Barrel = cms.double(0.0), + HcalDepth3RecHitInnerRadiusA_Barrel = cms.double(0.15), + HcalDepth3RecHitOuterRadiusA_Barrel = cms.double(0.4), + HcalDepth3RecHitThreshEA_Barrel = cms.double(0.0), + HcalDepth4RecHitInnerRadiusA_Barrel = cms.double(0.15), + HcalDepth4RecHitOuterRadiusA_Barrel = cms.double(0.4), + HcalDepth4RecHitThreshEA_Barrel = cms.double(0.0), + HcalDepth5RecHitInnerRadiusA_Barrel = cms.double(0.15), + HcalDepth5RecHitOuterRadiusA_Barrel = cms.double(0.4), + HcalDepth5RecHitThreshEA_Barrel = cms.double(0.0), + HcalDepth6RecHitInnerRadiusA_Barrel = cms.double(0.15), + HcalDepth6RecHitOuterRadiusA_Barrel = cms.double(0.4), + HcalDepth6RecHitThreshEA_Barrel = cms.double(0.0), + HcalDepth7RecHitInnerRadiusA_Barrel = cms.double(0.15), + HcalDepth7RecHitOuterRadiusA_Barrel = cms.double(0.4), + HcalDepth7RecHitThreshEA_Barrel = cms.double(0.0), # - HcalTowerInnerRadiusB_Barrel = cms.double(0.15), - HcalTowerOuterRadiusB_Barrel = cms.double(0.3), - HcalTowerThreshEB_Barrel = cms.double(0.0), - HcalDepth1TowerInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth1TowerOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth1TowerThreshEB_Barrel = cms.double(0.0), - HcalDepth2TowerInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth2TowerOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth2TowerThreshEB_Barrel = cms.double(0.0), + HcalDepth1RecHitInnerRadiusB_Barrel = cms.double(0.15), + HcalDepth1RecHitOuterRadiusB_Barrel = cms.double(0.3), + HcalDepth1RecHitThreshEB_Barrel = cms.double(0.0), + HcalDepth2RecHitInnerRadiusB_Barrel = cms.double(0.15), + HcalDepth2RecHitOuterRadiusB_Barrel = cms.double(0.3), + HcalDepth2RecHitThreshEB_Barrel = cms.double(0.0), + HcalDepth3RecHitInnerRadiusB_Barrel = cms.double(0.15), + HcalDepth3RecHitOuterRadiusB_Barrel = cms.double(0.3), + HcalDepth3RecHitThreshEB_Barrel = cms.double(0.0), + HcalDepth4RecHitInnerRadiusB_Barrel = cms.double(0.15), + HcalDepth4RecHitOuterRadiusB_Barrel = cms.double(0.3), + HcalDepth4RecHitThreshEB_Barrel = cms.double(0.0), + HcalDepth5RecHitInnerRadiusB_Barrel = cms.double(0.15), + HcalDepth5RecHitOuterRadiusB_Barrel = cms.double(0.3), + HcalDepth5RecHitThreshEB_Barrel = cms.double(0.0), + HcalDepth6RecHitInnerRadiusB_Barrel = cms.double(0.15), + HcalDepth6RecHitOuterRadiusB_Barrel = cms.double(0.3), + HcalDepth6RecHitThreshEB_Barrel = cms.double(0.0), + HcalDepth7RecHitInnerRadiusB_Barrel = cms.double(0.15), + HcalDepth7RecHitOuterRadiusB_Barrel = cms.double(0.3), + HcalDepth7RecHitThreshEB_Barrel = cms.double(0.0), #### ENDCAP #tracks @@ -106,25 +130,51 @@ #spikeIdThreshold = cms.double(0.95), #Hcal towers - HcalTowerInnerRadiusA_Endcap = cms.double(0.15), - HcalTowerOuterRadiusA_Endcap = cms.double(0.4), - HcalTowerThreshEA_Endcap = cms.double(0.0), - HcalDepth1TowerInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth1TowerOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth1TowerThreshEA_Endcap = cms.double(0.0), - HcalDepth2TowerInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth2TowerOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth2TowerThreshEA_Endcap = cms.double(0.0), + HcalDepth1RecHitInnerRadiusA_Endcap = cms.double(0.15), + HcalDepth1RecHitOuterRadiusA_Endcap = cms.double(0.4), + HcalDepth1RecHitThreshEA_Endcap = cms.double(0.0), + HcalDepth2RecHitInnerRadiusA_Endcap = cms.double(0.15), + HcalDepth2RecHitOuterRadiusA_Endcap = cms.double(0.4), + HcalDepth2RecHitThreshEA_Endcap = cms.double(0.0), + HcalDepth3RecHitInnerRadiusA_Endcap = cms.double(0.15), + HcalDepth3RecHitOuterRadiusA_Endcap = cms.double(0.4), + HcalDepth3RecHitThreshEA_Endcap = cms.double(0.0), + HcalDepth4RecHitInnerRadiusA_Endcap = cms.double(0.15), + HcalDepth4RecHitOuterRadiusA_Endcap = cms.double(0.4), + HcalDepth4RecHitThreshEA_Endcap = cms.double(0.0), + HcalDepth5RecHitInnerRadiusA_Endcap = cms.double(0.15), + HcalDepth5RecHitOuterRadiusA_Endcap = cms.double(0.4), + HcalDepth5RecHitThreshEA_Endcap = cms.double(0.0), + HcalDepth6RecHitInnerRadiusA_Endcap = cms.double(0.15), + HcalDepth6RecHitOuterRadiusA_Endcap = cms.double(0.4), + HcalDepth6RecHitThreshEA_Endcap = cms.double(0.0), + HcalDepth7RecHitInnerRadiusA_Endcap = cms.double(0.15), + HcalDepth7RecHitOuterRadiusA_Endcap = cms.double(0.4), + HcalDepth7RecHitThreshEA_Endcap = cms.double(0.0), # - HcalTowerInnerRadiusB_Endcap = cms.double(0.15), - HcalTowerOuterRadiusB_Endcap = cms.double(0.3), - HcalTowerThreshEB_Endcap = cms.double(0.0), - HcalDepth1TowerInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth1TowerOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth1TowerThreshEB_Endcap = cms.double(0.0), - HcalDepth2TowerInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth2TowerOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth2TowerThreshEB_Endcap = cms.double(0.0), + HcalDepth1RecHitInnerRadiusB_Endcap = cms.double(0.15), + HcalDepth1RecHitOuterRadiusB_Endcap = cms.double(0.3), + HcalDepth1RecHitThreshEB_Endcap = cms.double(0.0), + HcalDepth2RecHitInnerRadiusB_Endcap = cms.double(0.15), + HcalDepth2RecHitOuterRadiusB_Endcap = cms.double(0.3), + HcalDepth2RecHitThreshEB_Endcap = cms.double(0.0), + HcalDepth3RecHitInnerRadiusB_Endcap = cms.double(0.15), + HcalDepth3RecHitOuterRadiusB_Endcap = cms.double(0.3), + HcalDepth3RecHitThreshEB_Endcap = cms.double(0.0), + HcalDepth4RecHitInnerRadiusB_Endcap = cms.double(0.15), + HcalDepth4RecHitOuterRadiusB_Endcap = cms.double(0.3), + HcalDepth4RecHitThreshEB_Endcap = cms.double(0.0), + HcalDepth5RecHitInnerRadiusB_Endcap = cms.double(0.15), + HcalDepth5RecHitOuterRadiusB_Endcap = cms.double(0.3), + HcalDepth5RecHitThreshEB_Endcap = cms.double(0.0), + HcalDepth6RecHitInnerRadiusB_Endcap = cms.double(0.15), + HcalDepth6RecHitOuterRadiusB_Endcap = cms.double(0.3), + HcalDepth6RecHitThreshEB_Endcap = cms.double(0.0), + HcalDepth7RecHitInnerRadiusB_Endcap = cms.double(0.15), + HcalDepth7RecHitOuterRadiusB_Endcap = cms.double(0.3), + HcalDepth7RecHitThreshEB_Endcap = cms.double(0.0), + + maxHcalRecHitSeverity = cms.int32(9), #recHitFlagsToBeExcluded = cms.vstring( # 'kFaultyHardware', diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 92de9976ab632..95c0bc6ed1371 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -15,14 +15,12 @@ #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/PhotonTkIsolation.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaEcalIsolation.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h" +#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" @@ -43,9 +41,14 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, iC.consumes(conf.getParameter("barrelEcalRecHitCollection")); endcapecalCollection_ = iC.consumes(conf.getParameter("endcapEcalRecHitCollection")); - auto hcRHC = conf.getParameter("HcalRecHitCollection"); - if (not hcRHC.label().empty()) - hcalCollection_ = iC.consumes(hcRHC); + + hcalRecHitsTag_ = iC.consumes(conf.getParameter("HcalRecHitCollection")); + + caloGeometryToken_ = decltype(caloGeometryToken_){iC.esConsumes()}; + hcalTopologyToken_ = decltype(hcalTopologyToken_){iC.esConsumes()}; + hcalChannelQualityToken_ = decltype(hcalChannelQualityToken_){iC.esConsumes(edm::ESInputTag("", "withTopo"))}; + hcalSevLvlComputerToken_ = decltype(hcalSevLvlComputerToken_){iC.esConsumes()}; + towerMapToken_ = decltype(towerMapToken_){iC.esConsumes()}; // gsfRecoInputTag_ = conf.getParameter("GsfRecoCollection"); modulePhiBoundary_ = conf.getParameter("modulePhiBoundary"); @@ -71,15 +74,27 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoBarrelRadiusA_[i++] = (conf.getParameter("EcalRecHitThreshEtA_Barrel")); i = 0; - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalTowerInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalTowerOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalTowerThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1TowerInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1TowerOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1TowerThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2TowerInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2TowerOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2TowerThreshEA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusA_Barrel")); + hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEA_Barrel")); i = 0; trkIsoBarrelRadiusB_[i++] = (conf.getParameter("TrackConeOuterRadiusB_Barrel")); @@ -97,15 +112,27 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoBarrelRadiusB_[i++] = (conf.getParameter("EcalRecHitThreshEtB_Barrel")); i = 0; - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalTowerInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalTowerOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalTowerThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1TowerInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1TowerOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1TowerThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2TowerInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2TowerOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2TowerThreshEB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusB_Barrel")); + hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEB_Barrel")); /// Isolation parameters for Endcap and for two different cone sizes i = 0; @@ -124,15 +151,27 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoEndcapRadiusA_[i++] = (conf.getParameter("EcalRecHitThreshEtA_Endcap")); i = 0; - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalTowerInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalTowerOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalTowerThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1TowerInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1TowerOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1TowerThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2TowerInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2TowerOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2TowerThreshEA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusA_Endcap")); + hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEA_Endcap")); i = 0; trkIsoEndcapRadiusB_[i++] = (conf.getParameter("TrackConeOuterRadiusB_Endcap")); @@ -150,21 +189,34 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoEndcapRadiusB_[i++] = (conf.getParameter("EcalRecHitThreshEtB_Endcap")); i = 0; - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalTowerInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalTowerOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalTowerThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1TowerInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1TowerOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1TowerThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2TowerInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2TowerOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2TowerThreshEB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusB_Endcap")); + hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEB_Endcap")); //Pick up the variables for the spike removal flagsEB_ = flagsEB; flagsEE_ = flagsEE; severityExclEB_ = severitiesEB; severityExclEE_ = severitiesEE; + maxHcalSeverity_ = conf.getParameter("maxHcalRecHitSeverity"); } void PhotonIsolationCalculator::calculate(const reco::Photon* pho, @@ -190,6 +242,13 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, phofid.isEEDeeGap = isEEDeeGap; phofid.isEBEEGap = isEBEEGap; + auto const& hcalRecHits = e.get(hcalRecHitsTag_); + auto const& caloGeometry = es.getData(caloGeometryToken_); + auto const& hcalTopology = &es.getData(hcalTopologyToken_); + auto const& hcalChannelQuality = &es.getData(hcalChannelQualityToken_); + auto const& hcalSevLvlComputer = &es.getData(hcalSevLvlComputerToken_); + auto const& towerMap = es.getData(towerMapToken_); + // Calculate isolation variables. cone sizes and thresholds // are set for Barrel and endcap separately @@ -204,15 +263,9 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, double photonEcalRecHitEtaSliceA_; double photonEcalRecHitThreshEA_; double photonEcalRecHitThreshEtA_; - double photonHcalTowerConeInnerRadiusA_; - double photonHcalTowerConeOuterRadiusA_; - double photonHcalTowerThreshEA_; - double photonHcalDepth1TowerConeInnerRadiusA_; - double photonHcalDepth1TowerConeOuterRadiusA_; - double photonHcalDepth1TowerThreshEA_; - double photonHcalDepth2TowerConeInnerRadiusA_; - double photonHcalDepth2TowerConeOuterRadiusA_; - double photonHcalDepth2TowerThreshEA_; + std::array photonHcalRecHitConeInnerRadiusA_; // per depth, inclusive is a trivial sum of all depths + std::array photonHcalRecHitConeOuterRadiusA_; + std::array photonHcalRecHitThreshEA_; double trackConeOuterRadiusA_; double trackConeInnerRadiusA_; double isolationtrackThresholdA_; @@ -224,15 +277,9 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, double photonEcalRecHitEtaSliceB_; double photonEcalRecHitThreshEB_; double photonEcalRecHitThreshEtB_; - double photonHcalTowerConeInnerRadiusB_; - double photonHcalTowerConeOuterRadiusB_; - double photonHcalTowerThreshEB_; - double photonHcalDepth1TowerConeInnerRadiusB_; - double photonHcalDepth1TowerConeOuterRadiusB_; - double photonHcalDepth1TowerThreshEB_; - double photonHcalDepth2TowerConeInnerRadiusB_; - double photonHcalDepth2TowerConeOuterRadiusB_; - double photonHcalDepth2TowerThreshEB_; + std::array photonHcalRecHitConeInnerRadiusB_; // per depth, inclusive is a trivial sum of all depths + std::array photonHcalRecHitConeOuterRadiusB_; + std::array photonHcalRecHitThreshEB_; double trackConeOuterRadiusB_; double trackConeInnerRadiusB_; double isolationtrackThresholdB_; @@ -254,15 +301,11 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitThreshEA_ = ecalIsoBarrelRadiusA_[3]; photonEcalRecHitThreshEtA_ = ecalIsoBarrelRadiusA_[4]; - photonHcalTowerConeInnerRadiusA_ = hcalIsoBarrelRadiusA_[0]; - photonHcalTowerConeOuterRadiusA_ = hcalIsoBarrelRadiusA_[1]; - photonHcalTowerThreshEA_ = hcalIsoBarrelRadiusA_[2]; - photonHcalDepth1TowerConeInnerRadiusA_ = hcalIsoBarrelRadiusA_[3]; - photonHcalDepth1TowerConeOuterRadiusA_ = hcalIsoBarrelRadiusA_[4]; - photonHcalDepth1TowerThreshEA_ = hcalIsoBarrelRadiusA_[5]; - photonHcalDepth2TowerConeInnerRadiusA_ = hcalIsoBarrelRadiusA_[6]; - photonHcalDepth2TowerConeOuterRadiusA_ = hcalIsoBarrelRadiusA_[7]; - photonHcalDepth2TowerThreshEA_ = hcalIsoBarrelRadiusA_[8]; + for (size_t id = 0; id < 7; ++id) { + photonHcalRecHitConeInnerRadiusA_[id] = hcalIsoBarrelRadiusA_[id * 3]; + photonHcalRecHitConeOuterRadiusA_[id] = hcalIsoBarrelRadiusA_[(id * 3) + 1]; + photonHcalRecHitThreshEA_[id] = hcalIsoBarrelRadiusA_[(id * 3) + 2]; + } trackConeOuterRadiusB_ = trkIsoBarrelRadiusB_[0]; trackConeInnerRadiusB_ = trkIsoBarrelRadiusB_[1]; @@ -277,16 +320,11 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitThreshEB_ = ecalIsoBarrelRadiusB_[3]; photonEcalRecHitThreshEtB_ = ecalIsoBarrelRadiusB_[4]; - photonHcalTowerConeInnerRadiusB_ = hcalIsoBarrelRadiusB_[0]; - photonHcalTowerConeOuterRadiusB_ = hcalIsoBarrelRadiusB_[1]; - photonHcalTowerThreshEB_ = hcalIsoBarrelRadiusB_[2]; - photonHcalDepth1TowerConeInnerRadiusB_ = hcalIsoBarrelRadiusB_[3]; - photonHcalDepth1TowerConeOuterRadiusB_ = hcalIsoBarrelRadiusB_[4]; - photonHcalDepth1TowerThreshEB_ = hcalIsoBarrelRadiusB_[5]; - photonHcalDepth2TowerConeInnerRadiusB_ = hcalIsoBarrelRadiusB_[6]; - photonHcalDepth2TowerConeOuterRadiusB_ = hcalIsoBarrelRadiusB_[7]; - photonHcalDepth2TowerThreshEB_ = hcalIsoBarrelRadiusB_[8]; - + for (size_t id = 0; id < 7; ++id) { + photonHcalRecHitConeInnerRadiusB_[id] = hcalIsoBarrelRadiusB_[id * 3]; + photonHcalRecHitConeOuterRadiusB_[id] = hcalIsoBarrelRadiusB_[(id * 3) + 1]; + photonHcalRecHitThreshEB_[id] = hcalIsoBarrelRadiusB_[(id * 3) + 2]; + } } else { // detector==EcalEndcap @@ -303,15 +341,11 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitThreshEA_ = ecalIsoEndcapRadiusA_[3]; photonEcalRecHitThreshEtA_ = ecalIsoEndcapRadiusA_[4]; - photonHcalTowerConeInnerRadiusA_ = hcalIsoEndcapRadiusA_[0]; - photonHcalTowerConeOuterRadiusA_ = hcalIsoEndcapRadiusA_[1]; - photonHcalTowerThreshEA_ = hcalIsoEndcapRadiusA_[2]; - photonHcalDepth1TowerConeInnerRadiusA_ = hcalIsoEndcapRadiusA_[3]; - photonHcalDepth1TowerConeOuterRadiusA_ = hcalIsoEndcapRadiusA_[4]; - photonHcalDepth1TowerThreshEA_ = hcalIsoEndcapRadiusA_[5]; - photonHcalDepth2TowerConeInnerRadiusA_ = hcalIsoEndcapRadiusA_[6]; - photonHcalDepth2TowerConeOuterRadiusA_ = hcalIsoEndcapRadiusA_[7]; - photonHcalDepth2TowerThreshEA_ = hcalIsoEndcapRadiusA_[8]; + for (size_t id = 0; id < 7; ++id) { + photonHcalRecHitConeInnerRadiusA_[id] = hcalIsoEndcapRadiusA_[id * 3]; + photonHcalRecHitConeOuterRadiusA_[id] = hcalIsoEndcapRadiusA_[(id * 3) + 1]; + photonHcalRecHitThreshEA_[id] = hcalIsoEndcapRadiusA_[(id * 3) + 2]; + } trackConeOuterRadiusB_ = trkIsoEndcapRadiusB_[0]; trackConeInnerRadiusB_ = trkIsoEndcapRadiusB_[1]; @@ -326,15 +360,11 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitThreshEB_ = ecalIsoEndcapRadiusB_[3]; photonEcalRecHitThreshEtB_ = ecalIsoEndcapRadiusB_[4]; - photonHcalTowerConeInnerRadiusB_ = hcalIsoEndcapRadiusB_[0]; - photonHcalTowerConeOuterRadiusB_ = hcalIsoEndcapRadiusB_[1]; - photonHcalTowerThreshEB_ = hcalIsoEndcapRadiusB_[2]; - photonHcalDepth1TowerConeInnerRadiusB_ = hcalIsoEndcapRadiusB_[3]; - photonHcalDepth1TowerConeOuterRadiusB_ = hcalIsoEndcapRadiusB_[4]; - photonHcalDepth1TowerThreshEB_ = hcalIsoEndcapRadiusB_[5]; - photonHcalDepth2TowerConeInnerRadiusB_ = hcalIsoEndcapRadiusB_[6]; - photonHcalDepth2TowerConeOuterRadiusB_ = hcalIsoEndcapRadiusB_[7]; - photonHcalDepth2TowerThreshEB_ = hcalIsoEndcapRadiusB_[8]; + for (size_t id = 0; id < 7; ++id) { + photonHcalRecHitConeInnerRadiusB_[id] = hcalIsoEndcapRadiusB_[id * 3]; + photonHcalRecHitConeOuterRadiusB_[id] = hcalIsoEndcapRadiusB_[(id * 3) + 1]; + photonHcalRecHitThreshEB_[id] = hcalIsoEndcapRadiusB_[(id * 3) + 2]; + } } //Calculate hollow cone track isolation, CONE A @@ -430,82 +460,35 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, useNumCrystals_); phoisolR2.ecalRecHitSumEt = EcalRecHitIsoB; - double HcalTowerIsoA = calculateHcalTowerIso( - pho, e, es, photonHcalTowerConeOuterRadiusA_, photonHcalTowerConeInnerRadiusA_, photonHcalTowerThreshEA_, -1); - phoisolR1.hcalTowerSumEt = HcalTowerIsoA; - - double HcalTowerIsoB = calculateHcalTowerIso( - pho, e, es, photonHcalTowerConeOuterRadiusB_, photonHcalTowerConeInnerRadiusB_, photonHcalTowerThreshEB_, -1); - phoisolR2.hcalTowerSumEt = HcalTowerIsoB; - - //// Hcal depth1 - - double HcalDepth1TowerIsoA = calculateHcalTowerIso(pho, - e, - es, - photonHcalDepth1TowerConeOuterRadiusA_, - photonHcalDepth1TowerConeInnerRadiusA_, - photonHcalDepth1TowerThreshEA_, - 1); - phoisolR1.hcalDepth1TowerSumEt = HcalDepth1TowerIsoA; - - double HcalDepth1TowerIsoB = calculateHcalTowerIso(pho, - e, - es, - photonHcalDepth1TowerConeOuterRadiusB_, - photonHcalDepth1TowerConeInnerRadiusB_, - photonHcalDepth1TowerThreshEB_, - 1); - phoisolR2.hcalDepth1TowerSumEt = HcalDepth1TowerIsoB; - - //// Hcal depth2 - - double HcalDepth2TowerIsoA = calculateHcalTowerIso(pho, - e, - es, - photonHcalDepth2TowerConeOuterRadiusA_, - photonHcalDepth2TowerConeInnerRadiusA_, - photonHcalDepth2TowerThreshEA_, - 2); - phoisolR1.hcalDepth2TowerSumEt = HcalDepth2TowerIsoA; - - double HcalDepth2TowerIsoB = calculateHcalTowerIso(pho, - e, - es, - photonHcalDepth2TowerConeOuterRadiusB_, - photonHcalDepth2TowerConeInnerRadiusB_, - photonHcalDepth2TowerThreshEB_, - 2); - phoisolR2.hcalDepth2TowerSumEt = HcalDepth2TowerIsoB; - - // New Hcal isolation based on the new H/E definition (towers behind the BCs in the SC are used to evaluated H) - double HcalTowerBcIsoA = - calculateHcalTowerIso(pho, e, es, photonHcalTowerConeOuterRadiusA_, photonHcalTowerThreshEA_, -1); - phoisolR1.hcalTowerSumEtBc = HcalTowerBcIsoA; - - double HcalTowerBcIsoB = - calculateHcalTowerIso(pho, e, es, photonHcalTowerConeOuterRadiusB_, photonHcalTowerThreshEB_, -1); - phoisolR2.hcalTowerSumEtBc = HcalTowerBcIsoB; - - //// Hcal depth1 - - double HcalDepth1TowerBcIsoA = - calculateHcalTowerIso(pho, e, es, photonHcalDepth1TowerConeOuterRadiusA_, photonHcalDepth1TowerThreshEA_, 1); - phoisolR1.hcalDepth1TowerSumEtBc = HcalDepth1TowerBcIsoA; - - double HcalDepth1TowerBcIsoB = - calculateHcalTowerIso(pho, e, es, photonHcalDepth1TowerConeOuterRadiusB_, photonHcalDepth1TowerThreshEB_, 1); - phoisolR2.hcalDepth1TowerSumEtBc = HcalDepth1TowerBcIsoB; - - //// Hcal depth2 - - double HcalDepth2TowerBcIsoA = - calculateHcalTowerIso(pho, e, es, photonHcalDepth2TowerConeOuterRadiusA_, photonHcalDepth2TowerThreshEA_, 2); - phoisolR1.hcalDepth2TowerSumEtBc = HcalDepth2TowerBcIsoA; - - double HcalDepth2TowerBcIsoB = - calculateHcalTowerIso(pho, e, es, photonHcalDepth2TowerConeOuterRadiusB_, photonHcalDepth2TowerThreshEB_, 2); - phoisolR2.hcalDepth2TowerSumEtBc = HcalDepth2TowerBcIsoB; + for (size_t id = 0; id < 7; ++id) { + phoisolR1.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, + *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, + towerMap, hcalRecHits, + photonHcalRecHitConeOuterRadiusA_[id], + photonHcalRecHitConeInnerRadiusA_[id], + photonHcalRecHitThreshEA_[id], maxHcalSeverity_, id + 1); + + phoisolR2.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, + *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, + towerMap, hcalRecHits, + photonHcalRecHitConeOuterRadiusB_[id], + photonHcalRecHitConeInnerRadiusB_[id], + photonHcalRecHitThreshEB_[id], maxHcalSeverity_, id + 1); + + phoisolR1.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, + *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, + towerMap, hcalRecHits, + photonHcalRecHitConeOuterRadiusA_[id], + 0., + photonHcalRecHitThreshEA_[id], maxHcalSeverity_, id + 1); + + phoisolR2.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, + *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, + towerMap, hcalRecHits, + photonHcalRecHitConeOuterRadiusB_[id], + 0., + photonHcalRecHitThreshEB_[id], maxHcalSeverity_, id + 1); + } } void PhotonIsolationCalculator::classify(const reco::Photon* photon, @@ -642,51 +625,46 @@ double PhotonIsolationCalculator::calculateEcalRecHitIso(const reco::Photon* pho return ecalIsol; } -double PhotonIsolationCalculator::calculateHcalTowerIso(const reco::Photon* photon, - const edm::Event& iEvent, - const edm::EventSetup& iSetup, - double RCone, - double RConeInner, - double eMin, - signed int depth) const { - double hcalIsol = 0.; - - if (not hcalCollection_.isUninitialized()) { - edm::Handle hcalhitsCollH; - iEvent.getByToken(hcalCollection_, hcalhitsCollH); - - const CaloTowerCollection* toww = hcalhitsCollH.product(); - - //std::cout << "before iso call" << std::endl; - EgammaTowerIsolation phoIso(RCone, RConeInner, eMin, depth, toww); - hcalIsol = phoIso.getTowerEtSum(photon); - // delete phoIso; - //std::cout << "after call" << std::endl; - } - - return hcalIsol; -} - -double PhotonIsolationCalculator::calculateHcalTowerIso(const reco::Photon* photon, - const edm::Event& iEvent, - const edm::EventSetup& iSetup, - double RCone, - double eMin, - signed int depth) const { - double hcalIsol = 0.; - - if (not hcalCollection_.isUninitialized()) { - edm::Handle hcalhitsCollH; - iEvent.getByToken(hcalCollection_, hcalhitsCollH); - - const CaloTowerCollection* toww = hcalhitsCollH.product(); - - //std::cout << "before iso call" << std::endl; - EgammaTowerIsolation phoIso(RCone, 0., eMin, depth, toww); - hcalIsol = phoIso.getTowerEtSum(photon, &(photon->hcalTowersBehindClusters())); - // delete phoIso; - //std::cout << "after call" << std::endl; +template +double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* photon, + const CaloGeometry &geometry, + const HcalTopology &hcalTopology, + const HcalChannelQuality &hcalChStatus, + const HcalSeverityLevelComputer &hcalSevLvlComputer, + const CaloTowerConstituentsMap &towerMap, + const HBHERecHitCollection &hcalRecHits, + double RCone, + double RConeInner, + double eMin, + int maxSeverity, + int depth) const { + const std::array e04{{0., 0., 0., 0.}}; + const std::array e07{{0., 0., 0., 0., 0., 0., 0.}}; + + if constexpr (isoBC) { + auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RCone, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, RConeInner, + std::array{{eMin, eMin, eMin, eMin}}, + e04, + maxSeverity, + std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, + e07, + maxSeverity, + hcalRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); + + return hcaliso.getHcalEtSumBc(photon, depth); + } + else { + auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RCone, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RConeInner, + std::array{{eMin, eMin, eMin, eMin}}, + e04, + maxSeverity, + std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, + e07, + maxSeverity, + hcalRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); + + return hcaliso.getHcalEtSum(photon, depth); } - - return hcalIsol; } diff --git a/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc b/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc index aa6eb3cb4de2e..5118608a414f9 100644 --- a/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc +++ b/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc @@ -513,13 +513,13 @@ void PFPhotonTranslator::produce(edm::Event &iEvent, const edm::EventSetup &iSet iSetup.get().get(theCaloTopo_); const CaloTopology *topology = theCaloTopo_.product(); - // get Hcal towers collection + // get Hcal rechits collection Handle hcalTowersHandle; iEvent.getByLabel(hcalTowers_, hcalTowersHandle); */ //create photon collection - //if(status) createPhotons(vertexCollection, pcRefProd, topology, &barrelRecHits, &endcapRecHits, hcalTowersHandle, isolationValues, outputPhotonCollection); + //if(status) createPhotons(vertexCollection, pcRefProd, topology, &barrelRecHits, &endcapRecHits, hcalRecHitsHandle, isolationValues, outputPhotonCollection); if (status) createPhotons(vertexCollection, egPhotons, pcRefProd, isolationValues, outputPhotonCollection); @@ -962,8 +962,9 @@ void PFPhotonTranslator::createPhotons(reco::VertexCollection &vertexCollection, showerShape.maxEnergyXtal = egPhotonRef_[iphot]->maxEnergyXtal(); showerShape.sigmaEtaEta = egPhotonRef_[iphot]->sigmaEtaEta(); showerShape.sigmaIetaIeta = egPhotonRef_[iphot]->sigmaIetaIeta(); - showerShape.hcalDepth1OverEcal = egPhotonRef_[iphot]->hadronicDepth1OverEm(); - showerShape.hcalDepth2OverEcal = egPhotonRef_[iphot]->hadronicDepth2OverEm(); + for (int id = 0; id < 7; ++id) { + showerShape.hcalOverEcal[id] = egPhotonRef_[iphot]->hcalOverEcal(id + 1); + } myPhoton.setShowerShapeVariables(showerShape); saturationInfo.nSaturatedXtals = egPhotonRef_[iphot]->nSaturatedXtals(); @@ -980,17 +981,17 @@ void PFPhotonTranslator::createPhotons(reco::VertexCollection &vertexCollection, myPhoton.setFiducialVolumeFlags(fiducialFlags); isolationVariables03.ecalRecHitSumEt = egPhotonRef_[iphot]->ecalRecHitSumEtConeDR03(); - isolationVariables03.hcalTowerSumEt = egPhotonRef_[iphot]->hcalTowerSumEtConeDR03(); - isolationVariables03.hcalDepth1TowerSumEt = egPhotonRef_[iphot]->hcalDepth1TowerSumEtConeDR03(); - isolationVariables03.hcalDepth2TowerSumEt = egPhotonRef_[iphot]->hcalDepth2TowerSumEtConeDR03(); + for (int id = 0; id < 7; ++id) { + isolationVariables03.hcalRecHitSumEt[id] = egPhotonRef_[iphot]->hcalTowerSumEtConeDR03(id + 1); + } isolationVariables03.trkSumPtSolidCone = egPhotonRef_[iphot]->trkSumPtSolidConeDR03(); isolationVariables03.trkSumPtHollowCone = egPhotonRef_[iphot]->trkSumPtHollowConeDR03(); isolationVariables03.nTrkSolidCone = egPhotonRef_[iphot]->nTrkSolidConeDR03(); isolationVariables03.nTrkHollowCone = egPhotonRef_[iphot]->nTrkHollowConeDR03(); isolationVariables04.ecalRecHitSumEt = egPhotonRef_[iphot]->ecalRecHitSumEtConeDR04(); - isolationVariables04.hcalTowerSumEt = egPhotonRef_[iphot]->hcalTowerSumEtConeDR04(); - isolationVariables04.hcalDepth1TowerSumEt = egPhotonRef_[iphot]->hcalDepth1TowerSumEtConeDR04(); - isolationVariables04.hcalDepth2TowerSumEt = egPhotonRef_[iphot]->hcalDepth2TowerSumEtConeDR04(); + for (int id = 0; id < 7; ++id) { + isolationVariables04.hcalRecHitSumEt[id] = egPhotonRef_[iphot]->hcalTowerSumEtConeDR04(id + 1); + } isolationVariables04.trkSumPtSolidCone = egPhotonRef_[iphot]->trkSumPtSolidConeDR04(); isolationVariables04.trkSumPtHollowCone = egPhotonRef_[iphot]->trkSumPtHollowConeDR04(); isolationVariables04.nTrkSolidCone = egPhotonRef_[iphot]->nTrkSolidConeDR04(); diff --git a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc index 847924ede5b31..b4ceaa73a83ce 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcFakeValidator.cc @@ -3028,22 +3028,22 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h1_ele_ecalRecHitSumEt_dr03_barrel->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); if (bestGsfElectron.isEE()) h1_ele_ecalRecHitSumEt_dr03_endcaps->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h1_ele_hcalTowerSumEt_dr03_depth1->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEt_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEt_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); - h1_ele_hcalTowerSumEt_dr03_depth2->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEt()); - h1_ele_hcalTowerSumEtBc_dr03_depth1->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEt_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h1_ele_hcalTowerSumEt_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); + h1_ele_hcalTowerSumEtBc_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEtBc()); - h1_ele_hcalTowerSumEtBc_dr03_depth2->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); + h1_ele_hcalTowerSumEtBc_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); h1_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); if (bestGsfElectron.isEB()) h1_ele_tkSumPt_dr04_barrel->Fill(bestGsfElectron.dr04TkSumPt()); @@ -3054,33 +3054,33 @@ void ElectronMcFakeValidator::analyze(const edm::Event &iEvent, const edm::Event h1_ele_ecalRecHitSumEt_dr04_barrel->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); if (bestGsfElectron.isEE()) h1_ele_ecalRecHitSumEt_dr04_endcaps->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h1_ele_hcalTowerSumEt_dr04_depth1->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEt_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEt_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); - h1_ele_hcalTowerSumEt_dr04_depth2->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEt()); - h1_ele_hcalTowerSumEtBc_dr04_depth1->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEt_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h1_ele_hcalTowerSumEt_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); + h1_ele_hcalTowerSumEtBc_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEtBc()); - h1_ele_hcalTowerSumEtBc_dr04_depth2->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); + h1_ele_hcalTowerSumEtBc_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); - h1_ele_hcalDepth1OverEcalBc->Fill(bestGsfElectron.hcalDepth1OverEcalBc()); + h1_ele_hcalDepth1OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalDepth1OverEcalBc()); + h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalDepth1OverEcalBc()); - h1_ele_hcalDepth2OverEcalBc->Fill(bestGsfElectron.hcalDepth2OverEcalBc()); + h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(1)); + h1_ele_hcalDepth2OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalDepth2OverEcalBc_barrel->Fill(bestGsfElectron.hcalDepth2OverEcalBc()); + h1_ele_hcalDepth2OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalDepth2OverEcalBc_endcaps->Fill(bestGsfElectron.hcalDepth2OverEcalBc()); + h1_ele_hcalDepth2OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(2)); // conversion rejection int flags = bestGsfElectron.convFlags(); diff --git a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc index c8718d9760ee1..fbe882350914d 100644 --- a/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc +++ b/Validation/RecoEgamma/plugins/ElectronMcSignalValidator.cc @@ -4273,26 +4273,26 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h1_ele_ecalRecHitSumEt_dr03_barrel->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); if (bestGsfElectron.isEE()) h1_ele_ecalRecHitSumEt_dr03_endcaps->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h1_ele_hcalTowerSumEt_dr03_depth1->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEt_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEt_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEt()); - h1_ele_hcalTowerSumEt_dr03_depth2->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEt()); + h1_ele_hcalTowerSumEt_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h1_ele_hcalTowerSumEt_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEt_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEt()); + h1_ele_hcalTowerSumEt_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEt_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEt()); - h1_ele_hcalTowerSumEtBc_dr03_depth1->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEt_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); + h1_ele_hcalTowerSumEtBc_dr03_depth1->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth1_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalDepth1TowerSumEtBc()); - h1_ele_hcalTowerSumEtBc_dr03_depth2->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth1_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(1)); + h1_ele_hcalTowerSumEtBc_dr03_depth2->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth2_barrel->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr03_depth2_endcaps->Fill(bestGsfElectron.dr03HcalTowerSumEtBc(2)); h1_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); if (bestGsfElectron.isEB()) h1_ele_tkSumPt_dr04_barrel->Fill(bestGsfElectron.dr04TkSumPt()); @@ -4303,38 +4303,38 @@ void ElectronMcSignalValidator::analyze(const edm::Event &iEvent, const edm::Eve h1_ele_ecalRecHitSumEt_dr04_barrel->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); if (bestGsfElectron.isEE()) h1_ele_ecalRecHitSumEt_dr04_endcaps->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h1_ele_hcalTowerSumEt_dr04_depth1->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEt_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); + h1_ele_hcalTowerSumEt_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEt_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEt()); - h1_ele_hcalTowerSumEt_dr04_depth2->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEt()); + h1_ele_hcalTowerSumEt_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h1_ele_hcalTowerSumEt_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEt_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEt()); + h1_ele_hcalTowerSumEt_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEt_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEt()); + h1_ele_hcalTowerSumEt_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); - h1_ele_hcalTowerSumEtBc_dr04_depth1->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth1->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth1_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalDepth1TowerSumEtBc()); - h1_ele_hcalTowerSumEtBc_dr04_depth2->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth1_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(1)); + h1_ele_hcalTowerSumEtBc_dr04_depth2->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalTowerSumEtBc_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth2_barrel->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalTowerSumEtBc_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalDepth2TowerSumEtBc()); + h1_ele_hcalTowerSumEtBc_dr04_depth2_endcaps->Fill(bestGsfElectron.dr04HcalTowerSumEtBc(2)); - h1_ele_hcalDepth1OverEcalBc->Fill(bestGsfElectron.hcalDepth1OverEcalBc()); + h1_ele_hcalDepth1OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(1)); if (bestGsfElectron.isEB()) - h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalDepth1OverEcalBc()); + h1_ele_hcalDepth1OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(1)); if (bestGsfElectron.isEE()) - h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalDepth1OverEcalBc()); - h1_ele_hcalDepth2OverEcalBc->Fill(bestGsfElectron.hcalDepth2OverEcalBc()); + h1_ele_hcalDepth1OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(1)); + h1_ele_hcalDepth2OverEcalBc->Fill(bestGsfElectron.hcalOverEcalBc(2)); if (bestGsfElectron.isEB()) - h1_ele_hcalDepth2OverEcalBc_barrel->Fill(bestGsfElectron.hcalDepth2OverEcalBc()); + h1_ele_hcalDepth2OverEcalBc_barrel->Fill(bestGsfElectron.hcalOverEcalBc(2)); if (bestGsfElectron.isEE()) - h1_ele_hcalDepth2OverEcalBc_endcaps->Fill(bestGsfElectron.hcalDepth2OverEcalBc()); + h1_ele_hcalDepth2OverEcalBc_endcaps->Fill(bestGsfElectron.hcalOverEcalBc(2)); // conversion rejection int flags = bestGsfElectron.convFlags(); From 18ced797a4e8be1b55a8323f95acbf13ecbc84f3 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Wed, 28 Apr 2021 01:52:39 +0200 Subject: [PATCH 05/27] add HF and remove dR cut for BC rules --- .../interface/ElectronHcalHelper.h | 7 ++- .../interface/GsfElectronAlgo.h | 3 +- .../src/ElectronHcalHelper.cc | 12 ++++- .../src/GsfElectronAlgo.cc | 45 ++++++++++------ .../plugins/ElectronSeedProducer.cc | 13 ++++- .../plugins/GsfElectronProducer.cc | 21 ++++++-- .../interface/EgammaHcalIsolation.h | 42 ++++++++++----- .../src/EgammaHcalIsolation.cc | 53 +++++++++++++++---- .../python/gedPhotons_cfi.py | 6 ++- .../python/photons_cfi.py | 12 +++-- .../src/GEDPhotonProducer.cc | 28 +++++++--- .../src/PhotonProducer.cc | 28 +++++++--- .../interface/PhotonIsolationCalculator.h | 6 ++- .../python/isolationCalculator_cfi.py | 8 +-- .../src/PhotonIsolationCalculator.cc | 27 ++++++---- 15 files changed, 222 insertions(+), 89 deletions(-) diff --git a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h index fde8ec45e6081..98be31a538d61 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h @@ -30,11 +30,15 @@ class ElectronHcalHelper { bool onlyBehindCluster, checkHcalStatus; // specific parameters if use rechits - edm::EDGetTokenT hcalRecHits; + edm::EDGetTokenT hbheRecHits; + edm::EDGetTokenT hfRecHits; + std::array eThresHB; int maxSeverityHB; std::array eThresHE; int maxSeverityHE; + std::array eThresHF; + int maxSeverityHF; }; ElectronHcalHelper(const Configuration &cfg, edm::ConsumesCollector &&cc); @@ -46,6 +50,7 @@ class ElectronHcalHelper { double hOverEConeSize() const { return cfg_.hOverEConeSize; } int maxSeverityHB() const { return cfg_.maxSeverityHB; } int maxSeverityHE() const { return cfg_.maxSeverityHE; } + int maxSeverityHF() const { return cfg_.maxSeverityHF; } // forward EgammaHadTower methods, if checkHcalStatus is enabled, using towers and H/E bool hasActiveHcal(const reco::SuperCluster &sc) const; diff --git a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h index 55c69af70a144..67fee7289c4e0 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h @@ -59,7 +59,8 @@ class GsfElectronAlgo { struct Tokens { edm::EDGetTokenT gsfElectronCores; - edm::EDGetTokenT hcalRecHitsTag; + edm::EDGetTokenT hbheRecHitsTag; + edm::EDGetTokenT hfRecHitsTag; edm::EDGetTokenT barrelSuperClusters; edm::EDGetTokenT endcapSuperClusters; edm::EDGetTokenT barrelRecHitCollection; diff --git a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc index aea93e163fa23..37f4b9143df83 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc @@ -38,7 +38,11 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup cfg_.eThresHE, std::array{{0., 0., 0., 0., 0., 0., 0.}}, cfg_.maxSeverityHE, - evt.get(cfg_.hcalRecHits), + cfg_.eThresHF, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + cfg_.maxSeverityHF, + evt.get(cfg_.hbheRecHits), + evt.get(cfg_.hfRecHits), eventSetup.getHandle(caloGeometryToken_), eventSetup.getHandle(hcalTopologyToken_), eventSetup.getHandle(hcalChannelQualityToken_), @@ -56,7 +60,11 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup cfg_.eThresHE, std::array{{0., 0., 0., 0., 0., 0., 0.}}, cfg_.maxSeverityHE, - evt.get(cfg_.hcalRecHits), + cfg_.eThresHF, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + cfg_.maxSeverityHF, + evt.get(cfg_.hbheRecHits), + evt.get(cfg_.hfRecHits), eventSetup.getHandle(caloGeometryToken_), eventSetup.getHandle(hcalTopologyToken_), eventSetup.getHandle(hcalChannelQualityToken_), diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index 8234a97e5a410..8ab6821276ee9 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -340,15 +340,11 @@ reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco: const float scale = full5x5 ? showerShape.e5x5 : theClus->energy(); for (int id = 0; id < 7; ++id) { - showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*theClus, id) / scale; - showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*theClus, id) / scale; + showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*theClus, id + 1) / scale; + showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*theClus, id + 1) / scale; } showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*theClus); showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*theClus); - std::cout << "GsfEleAlgo :: ntower behind cluster: " << showerShape.hcalTowersBehindClusters.size() << std::endl; - for (uint ibc = 0; ibc < showerShape.hcalTowersBehindClusters.size(); ++ibc) - std::cout << "GsfEleAlgo :: calotower " << ibc << " detid ieta iphi: " << showerShape.hcalTowersBehindClusters[ibc] - << " " << showerShape.hcalTowersBehindClusters[ibc].ieta() << " " << showerShape.hcalTowersBehindClusters[ibc].iphi() << std::endl; // extra shower shapes const float see_by_spp = showerShape.sigmaIetaIeta * showerShape.sigmaIphiIphi; @@ -422,7 +418,8 @@ void GsfElectronAlgo::checkSetup(const edm::EventSetup& es) { GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, CaloGeometry const& caloGeometry, EcalSeverityLevelAlgo const& ecalSeveretyLevelAlgo) { - auto const& hcalRecHits = event.get(cfg_.tokens.hcalRecHitsTag); + auto const& hbheRecHits = event.get(cfg_.tokens.hbheRecHitsTag); + auto const& hfRecHits = event.get(cfg_.tokens.hfRecHitsTag); // Isolation algos float egHcalIsoConeSizeOutSmall = 0.3, egHcalIsoConeSizeOutLarge = 0.4; @@ -461,7 +458,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - hcalRecHits, caloGeometry, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHF(), + hbheRecHits, hfRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), .hadIsolation04 = @@ -474,7 +475,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - hcalRecHits, caloGeometry, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHF(), + hbheRecHits, hfRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), .hadIsolation03Bc = @@ -487,7 +492,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - hcalRecHits, caloGeometry, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHF(), + hbheRecHits, hfRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), .hadIsolation04Bc = @@ -500,7 +509,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - hcalRecHits, caloGeometry, + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, + egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHF(), + hbheRecHits, hfRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), @@ -626,8 +639,6 @@ reco::GsfElectronCollection GsfElectronAlgo::completeElectrons(edm::Event const& gsfTrackTable = egamma::conv::TrackTable(*eventData.originalGsfTracks); } - std::cout << "GsfEleAlgo :: run lumi event " << event.eventAuxiliary().run() << " " << event.eventAuxiliary().luminosityBlock() - << " " << event.eventAuxiliary().event() << std::endl; createElectron(electrons, electronData, eventData, @@ -1067,11 +1078,11 @@ void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons, if (!EcalTools::isHGCalDet((DetId::Detector)region)) { for (int id = 0; id < 7; ++id) { - dr03.hcalRecHitSumEt[id] = eventData.hadIsolation03.getHcalEtSum(&ele, id); - dr03.hcalRecHitSumEtBc[id] = eventData.hadIsolation03Bc.getHcalEtSumBc(&ele, id); + dr03.hcalRecHitSumEt[id] = eventData.hadIsolation03.getHcalEtSum(&ele, id + 1); + dr03.hcalRecHitSumEtBc[id] = eventData.hadIsolation03Bc.getHcalEtSumBc(&ele, id + 1); - dr04.hcalRecHitSumEt[id] = eventData.hadIsolation04.getHcalEtSum(&ele, id); - dr04.hcalRecHitSumEtBc[id] = eventData.hadIsolation04Bc.getHcalEtSumBc(&ele, id); + dr04.hcalRecHitSumEt[id] = eventData.hadIsolation04.getHcalEtSum(&ele, id + 1); + dr04.hcalRecHitSumEtBc[id] = eventData.hadIsolation04Bc.getHcalEtSumBc(&ele, id + 1); } dr03.ecalRecHitSumEt = eventData.ecalBarrelIsol03.getEtSum(&ele); diff --git a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc index 0db87caf1c1fe..67cc76d2bc177 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc @@ -80,11 +80,18 @@ ElectronSeedProducer::ElectronSeedProducer(const edm::ParameterSet& conf) ElectronHcalHelper::Configuration hcalCfg{}; hcalCfg.hOverEConeSize = conf.getParameter("hOverEConeSize"); if (hcalCfg.hOverEConeSize > 0) { - hcalCfg.hcalRecHits = consumes(conf.getParameter("hcalRecHits")); + hcalCfg.onlyBehindCluster = false; + hcalCfg.checkHcalStatus = false; + + hcalCfg.hbheRecHits = consumes(conf.getParameter("hbheRecHits")); + hcalCfg.hfRecHits = consumes(conf.getParameter("hfRecHits")); + hcalCfg.eThresHB = conf.getParameter>("recHitEThresholdHB"); hcalCfg.maxSeverityHB = conf.getParameter("maxHcalRecHitSeverity"); hcalCfg.eThresHE = conf.getParameter>("recHitEThresholdHE"); hcalCfg.maxSeverityHE = hcalCfg.maxSeverityHB; + hcalCfg.eThresHF = conf.getParameter>("recHitEThresholdHF"); + hcalCfg.maxSeverityHF = hcalCfg.maxSeverityHB; } hcalHelper_ = std::make_unique(hcalCfg, consumesCollector()); @@ -214,9 +221,11 @@ void ElectronSeedProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add("hOverEConeSize", 0.15); desc.add("maxHOverEBarrel", 0.15); desc.add("maxHOverEEndcaps", 0.15); - desc.add("hcalRecHits", {"hbhereco"}); + desc.add("hbheRecHits", {"hbhereco"}); + desc.add("hfRecHits", {"hfreco"}); desc.add>("recHitEThresholdHB", {0.1, 0.2, 0.3, 0.3}); // FIXME defaults for tests desc.add>("recHitEThresholdHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); + desc.add>("recHitEThresholdHF", {0.5, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85}); desc.add("maxHcalRecHitSeverity", 9); // H/E equivalent for HGCal diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index 9104080b478a5..a37a39096cbf1 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -129,7 +129,8 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("beamSpotTag", {"offlineBeamSpot"}); desc.add("egmPFCandidatesTag", {"particleFlowEGamma"}); desc.add("checkHcalStatus", true); - desc.add("hcalRecHits", edm::InputTag("hbhereco")); + desc.add("hbheRecHits", edm::InputTag("hbhereco")); + desc.add("hfRecHits", edm::InputTag("hfreco")); // steering desc.add("useDefaultEnergyCorrection", true); @@ -156,6 +157,7 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr // Hcal rec hits configuration desc.add>("recHitEThresholdHB", {0.1, 0.2, 0.3, 0.3}); // FIXME defaults for tests desc.add>("recHitEThresholdHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); + desc.add>("recHitEThresholdHF", {0.5, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85}); desc.add("maxHcalRecHitSeverity", 9); // Isolation algos configuration @@ -297,7 +299,8 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf } inputCfg_.gsfElectronCores = consumes(cfg.getParameter("gsfElectronCoresTag")); - inputCfg_.hcalRecHitsTag = consumes(cfg.getParameter("hcalRecHits")); + inputCfg_.hbheRecHitsTag = consumes(cfg.getParameter("hbheRecHits")); + inputCfg_.hfRecHitsTag = consumes(cfg.getParameter("hfRecHits")); inputCfg_.barrelRecHitCollection = consumes(cfg.getParameter("barrelRecHitCollectionTag")); inputCfg_.endcapRecHitCollection = consumes(cfg.getParameter("endcapRecHitCollectionTag")); inputCfg_.ctfTracks = consumes(cfg.getParameter("ctfTracksTag")); @@ -334,21 +337,31 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf if (hcalCfg_.hOverEConeSize > 0) { hcalCfg_.onlyBehindCluster = false; hcalCfg_.checkHcalStatus = cfg.getParameter("checkHcalStatus"); - hcalCfg_.hcalRecHits = consumes(cfg.getParameter("hcalRecHits")); + + hcalCfg_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); + hcalCfg_.hfRecHits = consumes(cfg.getParameter("hfRecHits")); + hcalCfg_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); hcalCfg_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); hcalCfg_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); hcalCfg_.maxSeverityHE = hcalCfg_.maxSeverityHB; + hcalCfg_.eThresHF = cfg.getParameter>("recHitEThresholdHF"); + hcalCfg_.maxSeverityHF = hcalCfg_.maxSeverityHB; } hcalCfgBc_.hOverEConeSize = 0.; hcalCfgBc_.onlyBehindCluster = true; hcalCfgBc_.checkHcalStatus = cfg.getParameter("checkHcalStatus"); - hcalCfgBc_.hcalRecHits = consumes(cfg.getParameter("hcalRecHits")); + + hcalCfgBc_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); + hcalCfgBc_.hfRecHits = consumes(cfg.getParameter("hfRecHits")); + hcalCfgBc_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); hcalCfgBc_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); hcalCfgBc_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); hcalCfgBc_.maxSeverityHE = hcalCfgBc_.maxSeverityHB; + hcalCfgBc_.eThresHF = cfg.getParameter>("recHitEThresholdHF"); + hcalCfgBc_.maxSeverityHF = hcalCfgBc_.maxSeverityHB; // Ecal rec hits configuration GsfElectronAlgo::EcalRecHitsConfiguration recHitsCfg; diff --git a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h index 00c04ce546037..fa64b457dc811 100644 --- a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h +++ b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h @@ -53,7 +53,11 @@ class EgammaHcalIsolation { const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, + const std::array &eThresHF, + const std::array &etThresHF, + int maxSeverityHF, const HBHERecHitCollection &mhbhe, + const HFRecHitCollection &mhf, edm::ESHandle caloGeometry, edm::ESHandle hcalTopology, edm::ESHandle hcalChStatus, @@ -70,25 +74,29 @@ class EgammaHcalIsolation { const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, + const std::array &eThresHF, + const std::array &etThresHF, + int maxSeverityHF, const HBHERecHitCollection &mhbhe, + const HFRecHitCollection &mhf, const CaloGeometry &caloGeometry, const HcalTopology &hcalTopology, const HcalChannelQuality &hcalChStatus, const HcalSeverityLevelComputer &hcalSevLvlComputer, const CaloTowerConstituentsMap &towerMap); - double getHcalESum(const reco::Candidate *c, int depth = 0) const { return getHcalESum(c->get().get(), depth); } - double getHcalEtSum(const reco::Candidate *c, int depth = 0) const { return getHcalEtSum(c->get().get(), depth); } - double getHcalESum(const reco::SuperCluster *sc, int depth = 0) const { return getHcalESum(sc->position(), depth); } - double getHcalEtSum(const reco::SuperCluster *sc, int depth = 0) const { return getHcalEtSum(sc->position(), depth); } - double getHcalESum(const math::XYZPoint &p, int depth = 0) const { return getHcalESum(GlobalPoint(p.x(), p.y(), p.z()), depth); } - double getHcalEtSum(const math::XYZPoint &p, int depth = 0) const { return getHcalEtSum(GlobalPoint(p.x(), p.y(), p.z()), depth); } - double getHcalESum(const GlobalPoint &pclu, int depth = 0) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToE); } - double getHcalEtSum(const GlobalPoint &pclu, int depth = 0) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToEt); } - - double getHcalESumBc(const reco::Candidate *c, int depth = 0) const { return getHcalESumBc(c->get().get(), depth); } - double getHcalEtSumBc(const reco::Candidate *c, int depth = 0) const { return getHcalEtSumBc(c->get().get(), depth); } - double getHcalESumBc(const reco::SuperCluster *sc, int depth = 0) const { + double getHcalESum(const reco::Candidate *c, int depth) const { return getHcalESum(c->get().get(), depth); } + double getHcalEtSum(const reco::Candidate *c, int depth) const { return getHcalEtSum(c->get().get(), depth); } + double getHcalESum(const reco::SuperCluster *sc, int depth) const { return getHcalESum(sc->position(), depth); } + double getHcalEtSum(const reco::SuperCluster *sc, int depth) const { return getHcalEtSum(sc->position(), depth); } + double getHcalESum(const math::XYZPoint &p, int depth) const { return getHcalESum(GlobalPoint(p.x(), p.y(), p.z()), depth); } + double getHcalEtSum(const math::XYZPoint &p, int depth) const { return getHcalEtSum(GlobalPoint(p.x(), p.y(), p.z()), depth); } + double getHcalESum(const GlobalPoint &pclu, int depth) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToE); } + double getHcalEtSum(const GlobalPoint &pclu, int depth) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToEt); } + + double getHcalESumBc(const reco::Candidate *c, int depth) const { return getHcalESumBc(c->get().get(), depth); } + double getHcalEtSumBc(const reco::Candidate *c, int depth) const { return getHcalEtSumBc(c->get().get(), depth); } + double getHcalESumBc(const reco::SuperCluster *sc, int depth) const { const auto tower = egamma::towerOf(*(sc->seed()), towerMap_); if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) @@ -98,7 +106,7 @@ class EgammaHcalIsolation { return getHcalESumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 0); } - double getHcalEtSumBc(const reco::SuperCluster *sc, int depth = 0) const { + double getHcalEtSumBc(const reco::SuperCluster *sc, int depth) const { const auto tower = egamma::towerOf(*(sc->seed()), towerMap_); if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) @@ -122,7 +130,8 @@ class EgammaHcalIsolation { } private: - double goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; + template + double goodHitEnergy(const GlobalPoint &pclu, const HcalRecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; double getHcalSum(const GlobalPoint &pclu, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; @@ -139,7 +148,12 @@ class EgammaHcalIsolation { std::array etThresHE_; int maxSeverityHE_; + std::array eThresHF_; + std::array etThresHF_; + int maxSeverityHF_; + const HBHERecHitCollection &mhbhe_; + const HFRecHitCollection &mhf_; const CaloGeometry &caloGeometry_; const HcalTopology &hcalTopology_; const HcalChannelQuality &hcalChStatus_; diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc index 7b59e15c1dfed..551bea5f6769c 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc @@ -17,8 +17,8 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/Math/interface/deltaR.h" -double scaleToE(const double& eta) { return 1.0; } -double scaleToEt(const double& eta) { return sin(2 * atan(exp(-eta))); } +double scaleToE(const double& eta) { return 1.; } +double scaleToEt(const double& eta) { return std::sin(2. * std::atan(std::exp(-eta))); } EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, double extRadius, @@ -30,7 +30,11 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, + const std::array &eThresHF, + const std::array &etThresHF, + int maxSeverityHF, const HBHERecHitCollection& mhbhe, + const HFRecHitCollection& mhf, edm::ESHandle caloGeometry, edm::ESHandle hcalTopology, edm::ESHandle hcalChStatus, @@ -41,7 +45,9 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, intRadius_(intRadius * intRadius), maxSeverityHB_(maxSeverityHB), maxSeverityHE_(maxSeverityHE), + maxSeverityHF_(maxSeverityHF), mhbhe_(mhbhe), + mhf_(mhf), caloGeometry_(*caloGeometry.product()), hcalTopology_(*hcalTopology.product()), hcalChStatus_(*hcalChStatus.product()), @@ -52,10 +58,12 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, etThresHB_ = etThresHB; eThresHE_ = eThresHE; etThresHE_ = etThresHE; + eThresHF_ = eThresHF; + etThresHF_ = etThresHF; // make some adjustments for the BC rules if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { - extRadius_ = 0.1 * 0.1; // any number that covers the rechit whole is enough + extRadius_ = 0.; intRadius_ = 0.; } else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) { @@ -79,7 +87,11 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, + const std::array &eThresHF, + const std::array &etThresHF, + int maxSeverityHF, const HBHERecHitCollection& mhbhe, + const HFRecHitCollection& mhf, const CaloGeometry &caloGeometry, const HcalTopology &hcalTopology, const HcalChannelQuality &hcalChStatus, @@ -90,7 +102,9 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, intRadius_(intRadius * intRadius), maxSeverityHB_(maxSeverityHB), maxSeverityHE_(maxSeverityHE), + maxSeverityHF_(maxSeverityHF), mhbhe_(mhbhe), + mhf_(mhf), caloGeometry_(caloGeometry), hcalTopology_(hcalTopology), hcalChStatus_(hcalChStatus), @@ -101,10 +115,12 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, etThresHB_ = etThresHB; eThresHE_ = eThresHE; etThresHE_ = etThresHE; + eThresHF_ = eThresHF; + etThresHF_ = etThresHF; // make some adjustments for the BC rules if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { - extRadius_ = 0.1 * 0.1; // any number that covers the rechit whole is enough + extRadius_ = 0.; intRadius_ = 0.; } else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) { @@ -118,15 +134,26 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, } } -double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, +template +double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HcalRecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double&)) const { const auto phit = caloGeometry_.getPosition(hit.detid()); - if (deltaR2(pclu, phit) > extRadius_ or deltaR2(pclu, phit) < intRadius_) + if ((extIncRule_ == InclusionRule::withinConeAroundCluster and deltaR2(pclu, phit) > extRadius_) or + (intIncRule_ == InclusionRule::withinConeAroundCluster and deltaR2(pclu, phit) < intRadius_)) return 0.; const HcalDetId hid(hit.detid()); - const int hd = hid.depth(), he = hid.ieta(), hp = hid.iphi(); + const int hd = (hid.subdet() != HcalForward) ? hid.depth() : hid.hfdepth(), he = hid.ieta(), hp = hid.iphi(); + const int h1 = hd - 1; + + if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > 4)) or + (hid.subdet() == HcalEndcap and (hd < 1 or hd > 7)) or + (hid.subdet() == HcalForward and (hd < 1 or hd > 2))) + std::cout << "hit in subdet " << hid.subdet() << " has unaccounted-for depth of " << hd << "!!" << std::endl; + + //if (hid.subdet() == HcalForward) + // std::cout << "HF hit has a depth of " << hd << "!!" << std::endl; // depth is 1 or 2 if (include_or_exclude == -1 and (he != ieta or hp != iphi)) return 0.; @@ -142,13 +169,14 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERec const uint32_t flag = hit.flags(); const uint32_t dbflag = hcalChStatus_.getValues(did)->getValue(); int severity = hcalSevLvlComputer_.getSeverityLevel(did, flag, dbflag); - //bool isRecovered = hcalSevLvlComputer_.recoveredRecHit(did, flag); + bool recovered = hcalSevLvlComputer_.recoveredRecHit(did, flag); const double het = hit.energy() * scaleToEt(phit.eta()); - const bool goodHB = hid.subdet() == HcalBarrel and severity <= maxSeverityHB_ and hit.energy() > eThresHB_[hd - 1] and het > etThresHB_[hd - 1]; - const bool goodHE = hid.subdet() == HcalEndcap and severity <= maxSeverityHE_ and hit.energy() > eThresHE_[hd - 1] and het > etThresHE_[hd - 1]; + const bool goodHB = hid.subdet() == HcalBarrel and (severity <= maxSeverityHB_ or recovered) and hit.energy() > eThresHB_[h1] and het > etThresHB_[h1]; + const bool goodHE = hid.subdet() == HcalEndcap and (severity <= maxSeverityHE_ or recovered) and hit.energy() > eThresHE_[h1] and het > etThresHE_[h1]; + const bool goodHF = hid.subdet() == HcalForward and (severity <= maxSeverityHF_ or recovered) and hit.energy() > eThresHF_[h1] and het > etThresHF_[h1]; - if (goodHB or goodHE) + if (goodHB or goodHE or goodHF) return hit.energy() * scale(phit.eta()); return 0.; @@ -161,5 +189,8 @@ double EgammaHcalIsolation::getHcalSum(const GlobalPoint &pclu, for (const auto &hit : mhbhe_) sum += goodHitEnergy(pclu, hit, depth, ieta, iphi, include_or_exclude, scale); + for (const auto &hit : mhf_) + sum += goodHitEnergy(pclu, hit, depth, ieta, iphi, include_or_exclude, scale); + return sum; } diff --git a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py index 3884e3db19fe5..9e1c06b327fcc 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py @@ -45,7 +45,8 @@ hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), preshowerHits = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - hcalRecHits = cms.InputTag("hbhereco"), + hbheRecHits = cms.InputTag("hbhereco"), + hfRecHits = cms.InputTag("hfreco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(0.94), @@ -53,8 +54,9 @@ multThresEB = cms.double(1.00), multThresEE = cms.double(1.25), hOverEConeSize = cms.double(0.15), - recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), + recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), # FIXME recheck thresholds recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), + recHitEThresholdHF = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), maxHcalRecHitSeverity = isolationSumsCalculator.maxHcalRecHitSeverity, posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), diff --git a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py index 65574ff28d49d..20bd79d1afb83 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py @@ -36,7 +36,8 @@ hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), preshowerHits = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - hcalRecHits = cms.InputTag("hbhereco"), + hbheRecHits = cms.InputTag("hbhereco"), + hfRecHits = cms.InputTag("hfreco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(0.94), @@ -44,8 +45,9 @@ multThresEB = cms.double(1.00), multThresEE = cms.double(1.25), hOverEConeSize = cms.double(0.15), - recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), + recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), # FIXME recheck thresholds recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), + recHitEThresholdHF = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), maxHcalRecHitSeverity = isolationSumsCalculator.maxHcalRecHitSeverity, posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), @@ -112,14 +114,16 @@ barrelEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEB"), hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), - hcalRecHits = cms.InputTag("hbhereco"), + hbheRecHits = cms.InputTag("hbhereco"), + hfRecHits = cms.InputTag("hfreco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(10.0), minR9Endcap = cms.double(10.0), hOverEConeSize = cms.double(0.15), - recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), + recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), # FIXME recheck thresholds recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), + recHitEThresholdHF = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(5.0), diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 533d4afa1f9ec..cef999e998408 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -110,7 +110,8 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT preshowerHits_; edm::EDGetTokenT pfEgammaCandidates_; edm::EDGetTokenT pfCandidates_; - edm::EDGetTokenT hcalRecHits_; + edm::EDGetTokenT hbheRecHits_; + edm::EDGetTokenT hfRecHits_; edm::EDGetTokenT vertexProducer_; //for isolation with map-based veto edm::EDGetTokenT>> particleBasedIsolationToken; @@ -240,7 +241,8 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) preshowerHits_ = consumes(config.getParameter("preshowerHits")); vertexProducer_ = consumes(config.getParameter("primaryVertexProducer")); - hcalRecHits_ = consumes(config.getParameter("hcalRecHits")); + hbheRecHits_ = consumes(config.getParameter("hbheRecHits")); + hfRecHits_ = consumes(config.getParameter("hfRecHits")); // photonCollection_ = config.getParameter("outputPhotonCollection"); @@ -279,21 +281,31 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) if (cfgCone.hOverEConeSize > 0) { cfgCone.onlyBehindCluster = false; cfgCone.checkHcalStatus = checkHcalStatus_; - cfgCone.hcalRecHits = hcalRecHits_; + + cfgCone.hbheRecHits = hbheRecHits_; + cfgCone.hfRecHits = hfRecHits_; + cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; + cfgCone.eThresHF = config.getParameter>("recHitEThresholdHF"); + cfgCone.maxSeverityHF = cfgCone.maxSeverityHB; } cfgBc.hOverEConeSize = 0.; cfgBc.onlyBehindCluster = true; cfgBc.checkHcalStatus = checkHcalStatus_; - cfgBc.hcalRecHits = hcalRecHits_; + + cfgBc.hbheRecHits = hbheRecHits_; + cfgBc.hfRecHits = hfRecHits_; + cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; + cfgBc.eThresHF = config.getParameter>("recHitEThresholdHF"); + cfgBc.maxSeverityHF = cfgBc.maxSeverityHB; hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); @@ -659,8 +671,8 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.sigmaEtaEta = sigmaEtaEta; showerShape.sigmaIetaIeta = sigmaIetaIeta; for (int id = 0; id < 7; ++id) { - showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / scRef->energy(); - showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / scRef->energy(); + showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / scRef->energy(); + showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / scRef->energy(); } showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*scRef); showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); @@ -769,8 +781,8 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, // fill preshower shapes full5x5_showerShape.effSigmaRR = sigmaRR; for (int id = 0; id < 7; ++id) { - full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / full5x5_e5x5; - full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / full5x5_e5x5; + full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / full5x5_e5x5; + full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / full5x5_e5x5; } newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape); diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index 3999604a8263f..81e222184b610 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -66,7 +66,8 @@ class PhotonProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT photonCoreProducer_; edm::EDGetTokenT barrelEcalHits_; edm::EDGetTokenT endcapEcalHits_; - edm::EDGetTokenT hcalRecHits_; + edm::EDGetTokenT hbheRecHits_; + edm::EDGetTokenT hfRecHits_; edm::EDGetTokenT vertexProducer_; //AA @@ -116,7 +117,8 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo barrelEcalHits_ = consumes(config.getParameter("barrelEcalHits")); endcapEcalHits_ = consumes(config.getParameter("endcapEcalHits")); vertexProducer_ = consumes(config.getParameter("primaryVertexProducer")); - hcalRecHits_ = consumes(config.getParameter("hcalRecHits")); + hbheRecHits_ = consumes(config.getParameter("hbheRecHits")); + hfRecHits_ = consumes(config.getParameter("hfRecHits")); hOverEConeSize_ = config.getParameter("hOverEConeSize"); highEt_ = config.getParameter("highEt"); // R9 value to decide converted/unconverted @@ -157,21 +159,31 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo if (cfgCone.hOverEConeSize > 0) { cfgCone.onlyBehindCluster = false; cfgCone.checkHcalStatus = false; - cfgCone.hcalRecHits = hcalRecHits_; + + cfgCone.hbheRecHits = hbheRecHits_; + cfgCone.hfRecHits = hfRecHits_; + cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; + cfgCone.eThresHF = config.getParameter>("recHitEThresholdHF"); + cfgCone.maxSeverityHF = cfgCone.maxSeverityHB; } cfgBc.hOverEConeSize = 0.; cfgBc.onlyBehindCluster = true; cfgBc.checkHcalStatus = false; - cfgBc.hcalRecHits = hcalRecHits_; + + cfgBc.hbheRecHits = hbheRecHits_; + cfgBc.hfRecHits = hfRecHits_; + cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; + cfgBc.eThresHF = config.getParameter>("recHitEThresholdHF"); + cfgBc.maxSeverityHF = cfgBc.maxSeverityHB; hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); @@ -441,8 +453,8 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.sigmaEtaEta = sigmaEtaEta; showerShape.sigmaIetaIeta = sigmaIetaIeta; for (int id = 0; id < 7; ++id) { - showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / scRef->energy(); - showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / scRef->energy(); + showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / scRef->energy(); + showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / scRef->energy(); } showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); newCandidate.setShowerShapeVariables(showerShape); @@ -457,8 +469,8 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta; full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta; for (int id = 0; id < 7; ++id) { - full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id) / full5x5_e5x5; - full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id) / full5x5_e5x5; + full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / full5x5_e5x5; + full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / full5x5_e5x5; } full5x5_showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape); diff --git a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h index 00b1214ed3f5a..16b425e9e220a 100644 --- a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h +++ b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h @@ -82,7 +82,8 @@ class PhotonIsolationCalculator { const HcalChannelQuality &hcalChStatus, const HcalSeverityLevelComputer &hcalSevLvlComputer, const CaloTowerConstituentsMap &towerMap, - const HBHERecHitCollection &hcalRecHits, + const HBHERecHitCollection &hbheRecHits, + const HFRecHitCollection &hfRecHits, double RCone, double RConeInner, double eMin, @@ -92,7 +93,8 @@ class PhotonIsolationCalculator { private: edm::EDGetToken barrelecalCollection_; edm::EDGetToken endcapecalCollection_; - edm::EDGetTokenT hcalRecHitsTag_; + edm::EDGetTokenT hbheRecHitsTag_; + edm::EDGetTokenT hfRecHitsTag_; edm::ESGetToken caloGeometryToken_; edm::ESGetToken hcalTopologyToken_; diff --git a/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py b/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py index 04bd2f3c57a54..c442d52043c56 100644 --- a/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py +++ b/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py @@ -7,8 +7,10 @@ barrelEcalRecHitCollection = cms.InputTag('ecalRecHit:EcalRecHitsEB'), endcapEcalRecHitCollection = cms.InputTag('ecalRecHit:EcalRecHitsEE'), - HcalRecHitCollection = cms.InputTag('hbhereco'), - + HBHERecHitCollection = cms.InputTag('hbhereco'), + HFRecHitCollection = cms.InputTag('hfreco'), + maxHcalRecHitSeverity = cms.int32(9), # FIXME recheck thresholds + # Photon will be marked as being near phi module boundary if # it is closer than this. Currently half a crystal. # 1 Ecal Crystal = 0.0174 radians = 1 degree @@ -174,8 +176,6 @@ HcalDepth7RecHitOuterRadiusB_Endcap = cms.double(0.3), HcalDepth7RecHitThreshEB_Endcap = cms.double(0.0), - maxHcalRecHitSeverity = cms.int32(9), - #recHitFlagsToBeExcluded = cms.vstring( # 'kFaultyHardware', # 'kPoorCalib', diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 95c0bc6ed1371..49bef65104c8e 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -42,7 +42,8 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, endcapecalCollection_ = iC.consumes(conf.getParameter("endcapEcalRecHitCollection")); - hcalRecHitsTag_ = iC.consumes(conf.getParameter("HcalRecHitCollection")); + hbheRecHitsTag_ = iC.consumes(conf.getParameter("HBHERecHitCollection")); + hfRecHitsTag_ = iC.consumes(conf.getParameter("HFRecHitCollection")); caloGeometryToken_ = decltype(caloGeometryToken_){iC.esConsumes()}; hcalTopologyToken_ = decltype(hcalTopologyToken_){iC.esConsumes()}; @@ -242,7 +243,8 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, phofid.isEEDeeGap = isEEDeeGap; phofid.isEBEEGap = isEBEEGap; - auto const& hcalRecHits = e.get(hcalRecHitsTag_); + auto const& hbheRecHits = e.get(hbheRecHitsTag_); + auto const& hfRecHits = e.get(hfRecHitsTag_); auto const& caloGeometry = es.getData(caloGeometryToken_); auto const& hcalTopology = &es.getData(hcalTopologyToken_); auto const& hcalChannelQuality = &es.getData(hcalChannelQualityToken_); @@ -463,28 +465,28 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, for (size_t id = 0; id < 7; ++id) { phoisolR1.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hcalRecHits, + towerMap, hbheRecHits, hfRecHits, photonHcalRecHitConeOuterRadiusA_[id], photonHcalRecHitConeInnerRadiusA_[id], photonHcalRecHitThreshEA_[id], maxHcalSeverity_, id + 1); phoisolR2.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hcalRecHits, + towerMap, hbheRecHits, hfRecHits, photonHcalRecHitConeOuterRadiusB_[id], photonHcalRecHitConeInnerRadiusB_[id], photonHcalRecHitThreshEB_[id], maxHcalSeverity_, id + 1); phoisolR1.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hcalRecHits, + towerMap, hbheRecHits, hfRecHits, photonHcalRecHitConeOuterRadiusA_[id], 0., photonHcalRecHitThreshEA_[id], maxHcalSeverity_, id + 1); phoisolR2.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hcalRecHits, + towerMap, hbheRecHits, hfRecHits, photonHcalRecHitConeOuterRadiusB_[id], 0., photonHcalRecHitThreshEB_[id], maxHcalSeverity_, id + 1); @@ -632,7 +634,8 @@ double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* pho const HcalChannelQuality &hcalChStatus, const HcalSeverityLevelComputer &hcalSevLvlComputer, const CaloTowerConstituentsMap &towerMap, - const HBHERecHitCollection &hcalRecHits, + const HBHERecHitCollection &hbheRecHits, + const HFRecHitCollection &hfRecHits, double RCone, double RConeInner, double eMin, @@ -650,7 +653,10 @@ double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* pho std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, e07, maxSeverity, - hcalRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); + std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, + e07, + maxSeverity, + hbheRecHits, hfRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); return hcaliso.getHcalEtSumBc(photon, depth); } @@ -663,7 +669,10 @@ double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* pho std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, e07, maxSeverity, - hcalRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); + std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, + e07, + maxSeverity, + hbheRecHits, hfRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); return hcaliso.getHcalEtSum(photon, depth); } From 4c513e7f46c63094355f1399ab879eea2d92e97e Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Fri, 30 Apr 2021 17:43:32 +0200 Subject: [PATCH 06/27] remove HF and centralized hcal thresholds --- .../interface/ElectronHcalHelper.h | 4 - .../interface/GsfElectronAlgo.h | 1 - .../src/ElectronHcalHelper.cc | 8 - .../src/GsfElectronAlgo.cc | 25 +-- .../plugins/ElectronSeedProducer.cc | 12 +- .../plugins/GsfElectronProducer.cc | 21 +- .../python/ecalDrivenElectronSeeds_cfi.py | 45 ++++ .../python/gsfElectronProducer_cfi.py | 204 ++++++++++++++++++ .../interface/EgammaHcalIsolation.h | 16 +- .../python/egammaHBHERecHitThreshold_cff.py | 10 + .../src/EgammaHcalIsolation.cc | 35 +-- .../python/gedPhotons_cfi.py | 11 +- .../python/photons_cfi.py | 20 +- .../src/GEDPhotonProducer.cc | 8 - .../src/PhotonProducer.cc | 8 - .../interface/PhotonIsolationCalculator.h | 27 ++- .../python/isolationCalculator_cfi.py | 110 ++-------- .../src/PhotonIsolationCalculator.cc | 191 +++------------- 18 files changed, 366 insertions(+), 390 deletions(-) create mode 100644 RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py create mode 100644 RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py create mode 100644 RecoEgamma/EgammaIsolationAlgos/python/egammaHBHERecHitThreshold_cff.py diff --git a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h index 98be31a538d61..5a9306914876d 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h @@ -31,14 +31,11 @@ class ElectronHcalHelper { // specific parameters if use rechits edm::EDGetTokenT hbheRecHits; - edm::EDGetTokenT hfRecHits; std::array eThresHB; int maxSeverityHB; std::array eThresHE; int maxSeverityHE; - std::array eThresHF; - int maxSeverityHF; }; ElectronHcalHelper(const Configuration &cfg, edm::ConsumesCollector &&cc); @@ -50,7 +47,6 @@ class ElectronHcalHelper { double hOverEConeSize() const { return cfg_.hOverEConeSize; } int maxSeverityHB() const { return cfg_.maxSeverityHB; } int maxSeverityHE() const { return cfg_.maxSeverityHE; } - int maxSeverityHF() const { return cfg_.maxSeverityHF; } // forward EgammaHadTower methods, if checkHcalStatus is enabled, using towers and H/E bool hasActiveHcal(const reco::SuperCluster &sc) const; diff --git a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h index 67fee7289c4e0..585edada3e9db 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h @@ -60,7 +60,6 @@ class GsfElectronAlgo { struct Tokens { edm::EDGetTokenT gsfElectronCores; edm::EDGetTokenT hbheRecHitsTag; - edm::EDGetTokenT hfRecHitsTag; edm::EDGetTokenT barrelSuperClusters; edm::EDGetTokenT endcapSuperClusters; edm::EDGetTokenT barrelRecHitCollection; diff --git a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc index 37f4b9143df83..5db266568ddf1 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc @@ -38,11 +38,7 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup cfg_.eThresHE, std::array{{0., 0., 0., 0., 0., 0., 0.}}, cfg_.maxSeverityHE, - cfg_.eThresHF, - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - cfg_.maxSeverityHF, evt.get(cfg_.hbheRecHits), - evt.get(cfg_.hfRecHits), eventSetup.getHandle(caloGeometryToken_), eventSetup.getHandle(hcalTopologyToken_), eventSetup.getHandle(hcalChannelQualityToken_), @@ -60,11 +56,7 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup cfg_.eThresHE, std::array{{0., 0., 0., 0., 0., 0., 0.}}, cfg_.maxSeverityHE, - cfg_.eThresHF, - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - cfg_.maxSeverityHF, evt.get(cfg_.hbheRecHits), - evt.get(cfg_.hfRecHits), eventSetup.getHandle(caloGeometryToken_), eventSetup.getHandle(hcalTopologyToken_), eventSetup.getHandle(hcalChannelQualityToken_), diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index 8ab6821276ee9..4cbbc2371c64c 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -419,7 +419,6 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, CaloGeometry const& caloGeometry, EcalSeverityLevelAlgo const& ecalSeveretyLevelAlgo) { auto const& hbheRecHits = event.get(cfg_.tokens.hbheRecHitsTag); - auto const& hfRecHits = event.get(cfg_.tokens.hfRecHitsTag); // Isolation algos float egHcalIsoConeSizeOutSmall = 0.3, egHcalIsoConeSizeOutLarge = 0.4; @@ -458,11 +457,7 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHF(), - hbheRecHits, hfRecHits, caloGeometry, + hbheRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), .hadIsolation04 = @@ -475,11 +470,7 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHF(), - hbheRecHits, hfRecHits, caloGeometry, + hbheRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), .hadIsolation03Bc = @@ -492,11 +483,7 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHF(), - hbheRecHits, hfRecHits, caloGeometry, + hbheRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), .hadIsolation04Bc = @@ -509,11 +496,7 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHE(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHF(), - hbheRecHits, hfRecHits, caloGeometry, + hbheRecHits, caloGeometry, *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), diff --git a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc index 67cc76d2bc177..c0119281bf6e3 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc @@ -83,15 +83,13 @@ ElectronSeedProducer::ElectronSeedProducer(const edm::ParameterSet& conf) hcalCfg.onlyBehindCluster = false; hcalCfg.checkHcalStatus = false; + //hcalCfg.hbheRecHits = consumes(conf.getParameter("hbheRecHits")); hcalCfg.hbheRecHits = consumes(conf.getParameter("hbheRecHits")); - hcalCfg.hfRecHits = consumes(conf.getParameter("hfRecHits")); hcalCfg.eThresHB = conf.getParameter>("recHitEThresholdHB"); hcalCfg.maxSeverityHB = conf.getParameter("maxHcalRecHitSeverity"); hcalCfg.eThresHE = conf.getParameter>("recHitEThresholdHE"); hcalCfg.maxSeverityHE = hcalCfg.maxSeverityHB; - hcalCfg.eThresHF = conf.getParameter>("recHitEThresholdHF"); - hcalCfg.maxSeverityHF = hcalCfg.maxSeverityHB; } hcalHelper_ = std::make_unique(hcalCfg, consumesCollector()); @@ -222,11 +220,9 @@ void ElectronSeedProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add("maxHOverEBarrel", 0.15); desc.add("maxHOverEEndcaps", 0.15); desc.add("hbheRecHits", {"hbhereco"}); - desc.add("hfRecHits", {"hfreco"}); - desc.add>("recHitEThresholdHB", {0.1, 0.2, 0.3, 0.3}); // FIXME defaults for tests - desc.add>("recHitEThresholdHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); - desc.add>("recHitEThresholdHF", {0.5, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85}); - desc.add("maxHcalRecHitSeverity", 9); + desc.add>("recHitEThresholdHB", {0., 0., 0., 0.}); + desc.add>("recHitEThresholdHE", {0., 0., 0., 0., 0., 0., 0.}); + desc.add("maxHcalRecHitSeverity", 999999); // H/E equivalent for HGCal desc.add("allowHGCal", false); diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index a37a39096cbf1..4f0122a66453f 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -128,9 +128,6 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add("seedsTag", {"ecalDrivenElectronSeeds"}); desc.add("beamSpotTag", {"offlineBeamSpot"}); desc.add("egmPFCandidatesTag", {"particleFlowEGamma"}); - desc.add("checkHcalStatus", true); - desc.add("hbheRecHits", edm::InputTag("hbhereco")); - desc.add("hfRecHits", edm::InputTag("hfreco")); // steering desc.add("useDefaultEnergyCorrection", true); @@ -155,10 +152,11 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add>("recHitSeverityToBeExcludedEndcaps"); // Hcal rec hits configuration - desc.add>("recHitEThresholdHB", {0.1, 0.2, 0.3, 0.3}); // FIXME defaults for tests - desc.add>("recHitEThresholdHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2}); - desc.add>("recHitEThresholdHF", {0.5, 0.85, 0.85, 0.85, 0.85, 0.85, 0.85}); - desc.add("maxHcalRecHitSeverity", 9); + desc.add("checkHcalStatus", true); + desc.add("hbheRecHits", edm::InputTag("hbhereco")); + desc.add>("recHitEThresholdHB", {0., 0., 0., 0.}); + desc.add>("recHitEThresholdHE", {0., 0., 0., 0., 0., 0., 0.}); + desc.add("maxHcalRecHitSeverity", 999999); // Isolation algos configuration desc.add("trkIsol03Cfg", EleTkIsolFromCands::pSetDescript()); @@ -300,7 +298,6 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf inputCfg_.gsfElectronCores = consumes(cfg.getParameter("gsfElectronCoresTag")); inputCfg_.hbheRecHitsTag = consumes(cfg.getParameter("hbheRecHits")); - inputCfg_.hfRecHitsTag = consumes(cfg.getParameter("hfRecHits")); inputCfg_.barrelRecHitCollection = consumes(cfg.getParameter("barrelRecHitCollectionTag")); inputCfg_.endcapRecHitCollection = consumes(cfg.getParameter("endcapRecHitCollectionTag")); inputCfg_.ctfTracks = consumes(cfg.getParameter("ctfTracksTag")); @@ -338,30 +335,26 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf hcalCfg_.onlyBehindCluster = false; hcalCfg_.checkHcalStatus = cfg.getParameter("checkHcalStatus"); + //hcalCfg_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); hcalCfg_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); - hcalCfg_.hfRecHits = consumes(cfg.getParameter("hfRecHits")); hcalCfg_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); hcalCfg_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); hcalCfg_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); hcalCfg_.maxSeverityHE = hcalCfg_.maxSeverityHB; - hcalCfg_.eThresHF = cfg.getParameter>("recHitEThresholdHF"); - hcalCfg_.maxSeverityHF = hcalCfg_.maxSeverityHB; } hcalCfgBc_.hOverEConeSize = 0.; hcalCfgBc_.onlyBehindCluster = true; hcalCfgBc_.checkHcalStatus = cfg.getParameter("checkHcalStatus"); + //hcalCfgBc_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); hcalCfgBc_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); - hcalCfgBc_.hfRecHits = consumes(cfg.getParameter("hfRecHits")); hcalCfgBc_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); hcalCfgBc_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); hcalCfgBc_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); hcalCfgBc_.maxSeverityHE = hcalCfgBc_.maxSeverityHB; - hcalCfgBc_.eThresHF = cfg.getParameter>("recHitEThresholdHF"); - hcalCfgBc_.maxSeverityHF = hcalCfgBc_.maxSeverityHB; // Ecal rec hits configuration GsfElectronAlgo::EcalRecHitsConfiguration recHitsCfg; diff --git a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py new file mode 100644 index 0000000000000..ffd7c2c57997a --- /dev/null +++ b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py @@ -0,0 +1,45 @@ +import FWCore.ParameterSet.Config as cms + +from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit + +ecalDrivenElectronSeeds = cms.EDProducer('ElectronSeedProducer', + initialSeedsVector = cms.VInputTag(), + useRecoVertex = cms.bool(False), + vertices = cms.InputTag('offlinePrimaryVerticesWithBS'), + beamSpot = cms.InputTag('offlineBeamSpot'), + dynamicPhiRoad = cms.bool(True), + SCEtCut = cms.double(0), + applyHOverECut = cms.bool(True), + hOverEConeSize = cms.double(0.15), + maxHOverEBarrel = cms.double(0.15), + maxHOverEEndcaps = cms.double(0.15), + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + allowHGCal = cms.bool(False), + HGCalConfig = cms.PSet( + HGCEEInput = cms.InputTag('HGCalRecHit', 'HGCEERecHits'), + HGCFHInput = cms.InputTag('HGCalRecHit', 'HGCHEFRecHits'), + HGCBHInput = cms.InputTag('HGCalRecHit', 'HGCHEBRecHits') + ), + nSigmasDeltaZ1 = cms.double(5), + deltaZ1WithVertex = cms.double(25), + z2MaxB = cms.double(0.09), + r2MaxF = cms.double(0.15), + rMaxI = cms.double(0.2), + LowPtThreshold = cms.double(5), + HighPtThreshold = cms.double(35), + SizeWindowENeg = cms.double(0.675), + DeltaPhi1Low = cms.double(0.23), + DeltaPhi1High = cms.double(0.08), + DeltaPhi2B = cms.double(0.008), + DeltaPhi2F = cms.double(0.012), + ePhiMin1 = cms.double(-0.125), + ePhiMax1 = cms.double(0.075), + PhiMax2B = cms.double(0.002), + PhiMax2F = cms.double(0.003), + barrelSuperClusters = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALBarrel'), + endcapSuperClusters = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALEndcapWithPreshower'), + mightGet = cms.optional.untracked.vstring +) diff --git a/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py b/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py new file mode 100644 index 0000000000000..4fffb05fd9d67 --- /dev/null +++ b/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py @@ -0,0 +1,204 @@ +import FWCore.ParameterSet.Config as cms + +from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit + +gsfElectronProducer = cms.EDProducer('GsfElectronProducer', + gsfElectronCoresTag = cms.InputTag('ecalDrivenGsfElectronCores'), + vtxTag = cms.InputTag('offlinePrimaryVertices'), + conversionsTag = cms.InputTag('allConversions'), + gsfPfRecTracksTag = cms.InputTag('pfTrackElec'), + barrelRecHitCollectionTag = cms.InputTag('ecalRecHit', 'EcalRecHitsEB'), + endcapRecHitCollectionTag = cms.InputTag('ecalRecHit', 'EcalRecHitsEE'), + seedsTag = cms.InputTag('ecalDrivenElectronSeeds'), + beamSpotTag = cms.InputTag('offlineBeamSpot'), + egmPFCandidatesTag = cms.InputTag('particleFlowEGamma'), + useDefaultEnergyCorrection = cms.bool(True), + useCombinationRegression = cms.bool(False), + ecalDrivenEcalEnergyFromClassBasedParameterization = cms.bool(True), + ecalDrivenEcalErrorFromClassBasedParameterization = cms.bool(True), + applyPreselection = cms.bool(False), + useEcalRegression = cms.bool(False), + applyAmbResolution = cms.bool(False), + ignoreNotPreselected = cms.bool(True), + useGsfPfRecTracks = cms.bool(True), + pureTrackerDrivenEcalErrorFromSimpleParameterization = cms.bool(True), + ambSortingStrategy = cms.uint32(1), + ambClustersOverlapStrategy = cms.uint32(1), + fillConvVtxFitProb = cms.bool(True), + resetMvaValuesUsingPFCandidates = cms.bool(False), + recHitFlagsToBeExcludedBarrel = cms.required.vstring, + recHitFlagsToBeExcludedEndcaps = cms.required.vstring, + recHitSeverityToBeExcludedBarrel = cms.required.vstring, + recHitSeverityToBeExcludedEndcaps = cms.required.vstring, + checkHcalStatus = cms.bool(True), + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + trkIsol03Cfg = cms.PSet( + barrelCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ), + endcapCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ) + ), + trkIsol04Cfg = cms.PSet( + barrelCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ), + endcapCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ) + ), + trkIsolHEEP03Cfg = cms.PSet( + barrelCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ), + endcapCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ) + ), + trkIsolHEEP04Cfg = cms.PSet( + barrelCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ), + endcapCuts = cms.PSet( + minPt = cms.double(1), + maxDR = cms.double(0.3), + minDR = cms.double(0), + minDEta = cms.double(0.005), + maxDZ = cms.double(0.1), + maxDPtPt = cms.double(-1), + minHits = cms.int32(8), + minPixelHits = cms.int32(1), + allowedQualities = cms.required.vstring, + algosToReject = cms.required.vstring + ) + ), + useNumCrystals = cms.bool(True), + etMinBarrel = cms.double(0), + etMinEndcaps = cms.double(0.11), + etMinHcal = cms.double(0), + eMinBarrel = cms.double(0.095), + eMinEndcaps = cms.double(0), + intRadiusEcalBarrel = cms.double(3), + intRadiusEcalEndcaps = cms.double(3), + intRadiusHcal = cms.double(0.15), + jurassicWidth = cms.double(1.5), + vetoClustered = cms.bool(False), + ctfTracksCheck = cms.bool(True), + ctfTracksTag = cms.InputTag('generalTracks'), + MaxElePtForOnlyMVA = cms.double(50), + PreSelectMVA = cms.double(-0.1), + preselection = cms.PSet( + minSCEtBarrel = cms.double(4), + minSCEtEndcaps = cms.double(4), + minEOverPBarrel = cms.double(0), + minEOverPEndcaps = cms.double(0), + maxEOverPBarrel = cms.double(999999999), + maxEOverPEndcaps = cms.double(999999999), + maxDeltaEtaBarrel = cms.double(0.02), + maxDeltaEtaEndcaps = cms.double(0.02), + maxDeltaPhiBarrel = cms.double(0.15), + maxDeltaPhiEndcaps = cms.double(0.15), + hOverEConeSize = cms.double(0.15), + maxHOverEBarrelCone = cms.double(0.15), + maxHOverEEndcapsCone = cms.double(0.15), + maxHBarrelCone = cms.double(0), + maxHEndcapsCone = cms.double(0), + maxHOverEBarrelBc = cms.double(0.15), + maxHOverEEndcapsBc = cms.double(0.15), + maxHBarrelBc = cms.double(0), + maxHEndcapsBc = cms.double(0), + maxSigmaIetaIetaBarrel = cms.double(999999999), + maxSigmaIetaIetaEndcaps = cms.double(999999999), + maxFbremBarrel = cms.double(999999999), + maxFbremEndcaps = cms.double(999999999), + isBarrel = cms.bool(False), + isEndcaps = cms.bool(False), + isFiducial = cms.bool(False), + seedFromTEC = cms.bool(True), + maxTIP = cms.double(999999999), + multThresEB = cms.double(1), + multThresEE = cms.double(1.25) + ), + crackCorrectionFunction = cms.string('EcalClusterCrackCorrection'), + ecalWeightsFromDB = cms.bool(True), + ecalRefinedRegressionWeightFiles = cms.vstring(), + combinationWeightsFromDB = cms.bool(True), + combinationRegressionWeightFile = cms.vstring(), + ecalRefinedRegressionWeightLabels = cms.vstring(), + combinationRegressionWeightLabels = cms.vstring(), + ElecMVAFilesString = cms.vstring( + 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_10_17Feb2011.weights.xml', + 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_12_17Feb2011.weights.xml', + 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_20_17Feb2011.weights.xml', + 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_22_17Feb2011.weights.xml' + ), + SoftElecMVAFilesString = cms.vstring('RecoEgamma/ElectronIdentification/data/TMVA_BDTSoftElectrons_7Feb2014.weights.xml'), + mightGet = cms.optional.untracked.vstring +) diff --git a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h index fa64b457dc811..5f3303ddb8008 100644 --- a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h +++ b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h @@ -53,11 +53,7 @@ class EgammaHcalIsolation { const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, - const std::array &eThresHF, - const std::array &etThresHF, - int maxSeverityHF, const HBHERecHitCollection &mhbhe, - const HFRecHitCollection &mhf, edm::ESHandle caloGeometry, edm::ESHandle hcalTopology, edm::ESHandle hcalChStatus, @@ -74,11 +70,7 @@ class EgammaHcalIsolation { const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, - const std::array &eThresHF, - const std::array &etThresHF, - int maxSeverityHF, const HBHERecHitCollection &mhbhe, - const HFRecHitCollection &mhf, const CaloGeometry &caloGeometry, const HcalTopology &hcalTopology, const HcalChannelQuality &hcalChStatus, @@ -130,8 +122,7 @@ class EgammaHcalIsolation { } private: - template - double goodHitEnergy(const GlobalPoint &pclu, const HcalRecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; + double goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; double getHcalSum(const GlobalPoint &pclu, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; @@ -148,12 +139,7 @@ class EgammaHcalIsolation { std::array etThresHE_; int maxSeverityHE_; - std::array eThresHF_; - std::array etThresHF_; - int maxSeverityHF_; - const HBHERecHitCollection &mhbhe_; - const HFRecHitCollection &mhf_; const CaloGeometry &caloGeometry_; const HcalTopology &hcalTopology_; const HcalChannelQuality &hcalChStatus_; diff --git a/RecoEgamma/EgammaIsolationAlgos/python/egammaHBHERecHitThreshold_cff.py b/RecoEgamma/EgammaIsolationAlgos/python/egammaHBHERecHitThreshold_cff.py new file mode 100644 index 0000000000000..a020211b9329e --- /dev/null +++ b/RecoEgamma/EgammaIsolationAlgos/python/egammaHBHERecHitThreshold_cff.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHBHE_cfi import _thresholdsHBphase1, _thresholdsHEphase1 + +egammaHBHERecHit = cms.PSet( + hbheRecHits = cms.InputTag('hbhereco'), + recHitEThresholdHB = _thresholdsHBphase1, + recHitEThresholdHE = _thresholdsHEphase1, + maxHcalRecHitSeverity = cms.int32(9), +) diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc index 551bea5f6769c..43c09767de244 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc @@ -30,11 +30,7 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, - const std::array &eThresHF, - const std::array &etThresHF, - int maxSeverityHF, const HBHERecHitCollection& mhbhe, - const HFRecHitCollection& mhf, edm::ESHandle caloGeometry, edm::ESHandle hcalTopology, edm::ESHandle hcalChStatus, @@ -45,9 +41,7 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, intRadius_(intRadius * intRadius), maxSeverityHB_(maxSeverityHB), maxSeverityHE_(maxSeverityHE), - maxSeverityHF_(maxSeverityHF), mhbhe_(mhbhe), - mhf_(mhf), caloGeometry_(*caloGeometry.product()), hcalTopology_(*hcalTopology.product()), hcalChStatus_(*hcalChStatus.product()), @@ -58,8 +52,6 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, etThresHB_ = etThresHB; eThresHE_ = eThresHE; etThresHE_ = etThresHE; - eThresHF_ = eThresHF; - etThresHF_ = etThresHF; // make some adjustments for the BC rules if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { @@ -87,11 +79,7 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, - const std::array &eThresHF, - const std::array &etThresHF, - int maxSeverityHF, const HBHERecHitCollection& mhbhe, - const HFRecHitCollection& mhf, const CaloGeometry &caloGeometry, const HcalTopology &hcalTopology, const HcalChannelQuality &hcalChStatus, @@ -102,9 +90,7 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, intRadius_(intRadius * intRadius), maxSeverityHB_(maxSeverityHB), maxSeverityHE_(maxSeverityHE), - maxSeverityHF_(maxSeverityHF), mhbhe_(mhbhe), - mhf_(mhf), caloGeometry_(caloGeometry), hcalTopology_(hcalTopology), hcalChStatus_(hcalChStatus), @@ -115,8 +101,6 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, etThresHB_ = etThresHB; eThresHE_ = eThresHE; etThresHE_ = etThresHE; - eThresHF_ = eThresHF; - etThresHF_ = etThresHF; // make some adjustments for the BC rules if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { @@ -134,8 +118,7 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, } } -template -double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HcalRecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, +double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double&)) const { const auto phit = caloGeometry_.getPosition(hit.detid()); @@ -144,16 +127,12 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HcalRec return 0.; const HcalDetId hid(hit.detid()); - const int hd = (hid.subdet() != HcalForward) ? hid.depth() : hid.hfdepth(), he = hid.ieta(), hp = hid.iphi(); + const int hd = hid.depth(), he = hid.ieta(), hp = hid.iphi(); const int h1 = hd - 1; if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > 4)) or - (hid.subdet() == HcalEndcap and (hd < 1 or hd > 7)) or - (hid.subdet() == HcalForward and (hd < 1 or hd > 2))) - std::cout << "hit in subdet " << hid.subdet() << " has unaccounted-for depth of " << hd << "!!" << std::endl; - - //if (hid.subdet() == HcalForward) - // std::cout << "HF hit has a depth of " << hd << "!!" << std::endl; // depth is 1 or 2 + (hid.subdet() == HcalEndcap and (hd < 1 or hd > 7))) + edm::LogWarning("EgammaHcalIsolation") << " hit in subdet " << hid.subdet() << " has an unaccounted for depth of " << hd << "!!"; if (include_or_exclude == -1 and (he != ieta or hp != iphi)) return 0.; @@ -174,9 +153,8 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HcalRec const double het = hit.energy() * scaleToEt(phit.eta()); const bool goodHB = hid.subdet() == HcalBarrel and (severity <= maxSeverityHB_ or recovered) and hit.energy() > eThresHB_[h1] and het > etThresHB_[h1]; const bool goodHE = hid.subdet() == HcalEndcap and (severity <= maxSeverityHE_ or recovered) and hit.energy() > eThresHE_[h1] and het > etThresHE_[h1]; - const bool goodHF = hid.subdet() == HcalForward and (severity <= maxSeverityHF_ or recovered) and hit.energy() > eThresHF_[h1] and het > etThresHF_[h1]; - if (goodHB or goodHE or goodHF) + if (goodHB or goodHE) return hit.energy() * scale(phit.eta()); return 0.; @@ -189,8 +167,5 @@ double EgammaHcalIsolation::getHcalSum(const GlobalPoint &pclu, for (const auto &hit : mhbhe_) sum += goodHitEnergy(pclu, hit, depth, ieta, iphi, include_or_exclude, scale); - for (const auto &hit : mhf_) - sum += goodHitEnergy(pclu, hit, depth, ieta, iphi, include_or_exclude, scale); - return sum; } diff --git a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py index 9e1c06b327fcc..24a8251cf508c 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py @@ -8,6 +8,7 @@ from RecoEgamma.EgammaTools.regressionModifier_cfi import * +from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit # # producer for photons # @@ -45,8 +46,6 @@ hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), preshowerHits = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - hbheRecHits = cms.InputTag("hbhereco"), - hfRecHits = cms.InputTag("hfreco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(0.94), @@ -54,10 +53,10 @@ multThresEB = cms.double(1.00), multThresEE = cms.double(1.25), hOverEConeSize = cms.double(0.15), - recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), # FIXME recheck thresholds - recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), - recHitEThresholdHF = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), - maxHcalRecHitSeverity = isolationSumsCalculator.maxHcalRecHitSeverity, + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(10.0), diff --git a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py index 20bd79d1afb83..e3a5e8f087142 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py @@ -4,6 +4,7 @@ from RecoEgamma.PhotonIdentification.mipVariable_cfi import * from RecoEcal.EgammaClusterProducers.hybridSuperClusters_cfi import * from RecoEcal.EgammaClusterProducers.multi5x5BasicClusters_cfi import * +from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit # # producer for photons # @@ -36,8 +37,6 @@ hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), preshowerHits = cms.InputTag("ecalPreshowerRecHit","EcalRecHitsES"), - hbheRecHits = cms.InputTag("hbhereco"), - hfRecHits = cms.InputTag("hfreco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(0.94), @@ -45,10 +44,10 @@ multThresEB = cms.double(1.00), multThresEE = cms.double(1.25), hOverEConeSize = cms.double(0.15), - recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), # FIXME recheck thresholds - recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), - recHitEThresholdHF = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), - maxHcalRecHitSeverity = isolationSumsCalculator.maxHcalRecHitSeverity, + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(10.0), @@ -114,16 +113,15 @@ barrelEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEB"), hbheModule = cms.string('hbhereco'), endcapEcalHits = cms.InputTag("ecalRecHit","EcalRecHitsEE"), - hbheRecHits = cms.InputTag("hbhereco"), - hfRecHits = cms.InputTag("hfreco"), runMIPTagger = cms.bool(True), highEt = cms.double(100.), minR9Barrel = cms.double(10.0), minR9Endcap = cms.double(10.0), hOverEConeSize = cms.double(0.15), - recHitEThresholdHB = cms.vdouble( 0., 0., 0., 0. ), # FIXME recheck thresholds - recHitEThresholdHE = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), - recHitEThresholdHF = cms.vdouble( 0., 0., 0., 0., 0., 0., 0. ), + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(5.0), diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index cef999e998408..7a0c54814d483 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -111,7 +111,6 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT pfEgammaCandidates_; edm::EDGetTokenT pfCandidates_; edm::EDGetTokenT hbheRecHits_; - edm::EDGetTokenT hfRecHits_; edm::EDGetTokenT vertexProducer_; //for isolation with map-based veto edm::EDGetTokenT>> particleBasedIsolationToken; @@ -242,7 +241,6 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) vertexProducer_ = consumes(config.getParameter("primaryVertexProducer")); hbheRecHits_ = consumes(config.getParameter("hbheRecHits")); - hfRecHits_ = consumes(config.getParameter("hfRecHits")); // photonCollection_ = config.getParameter("outputPhotonCollection"); @@ -283,14 +281,11 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) cfgCone.checkHcalStatus = checkHcalStatus_; cfgCone.hbheRecHits = hbheRecHits_; - cfgCone.hfRecHits = hfRecHits_; cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; - cfgCone.eThresHF = config.getParameter>("recHitEThresholdHF"); - cfgCone.maxSeverityHF = cfgCone.maxSeverityHB; } cfgBc.hOverEConeSize = 0.; @@ -298,14 +293,11 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) cfgBc.checkHcalStatus = checkHcalStatus_; cfgBc.hbheRecHits = hbheRecHits_; - cfgBc.hfRecHits = hfRecHits_; cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; - cfgBc.eThresHF = config.getParameter>("recHitEThresholdHF"); - cfgBc.maxSeverityHF = cfgBc.maxSeverityHB; hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index 81e222184b610..6f1f0d080936b 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -67,7 +67,6 @@ class PhotonProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT barrelEcalHits_; edm::EDGetTokenT endcapEcalHits_; edm::EDGetTokenT hbheRecHits_; - edm::EDGetTokenT hfRecHits_; edm::EDGetTokenT vertexProducer_; //AA @@ -118,7 +117,6 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo endcapEcalHits_ = consumes(config.getParameter("endcapEcalHits")); vertexProducer_ = consumes(config.getParameter("primaryVertexProducer")); hbheRecHits_ = consumes(config.getParameter("hbheRecHits")); - hfRecHits_ = consumes(config.getParameter("hfRecHits")); hOverEConeSize_ = config.getParameter("hOverEConeSize"); highEt_ = config.getParameter("highEt"); // R9 value to decide converted/unconverted @@ -161,14 +159,11 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo cfgCone.checkHcalStatus = false; cfgCone.hbheRecHits = hbheRecHits_; - cfgCone.hfRecHits = hfRecHits_; cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; - cfgCone.eThresHF = config.getParameter>("recHitEThresholdHF"); - cfgCone.maxSeverityHF = cfgCone.maxSeverityHB; } cfgBc.hOverEConeSize = 0.; @@ -176,14 +171,11 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo cfgBc.checkHcalStatus = false; cfgBc.hbheRecHits = hbheRecHits_; - cfgBc.hfRecHits = hfRecHits_; cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; - cfgBc.eThresHF = config.getParameter>("recHitEThresholdHF"); - cfgBc.maxSeverityHF = cfgBc.maxSeverityHB; hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); diff --git a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h index 16b425e9e220a..12e2045acfcab 100644 --- a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h +++ b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h @@ -23,6 +23,8 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "Geometry/CaloTopology/interface/CaloTowerConstituentsMap.h" +#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" + class PhotonIsolationCalculator { public: PhotonIsolationCalculator() {} @@ -83,18 +85,14 @@ class PhotonIsolationCalculator { const HcalSeverityLevelComputer &hcalSevLvlComputer, const CaloTowerConstituentsMap &towerMap, const HBHERecHitCollection &hbheRecHits, - const HFRecHitCollection &hfRecHits, double RCone, double RConeInner, - double eMin, - int maxSeverity, int depth) const dso_internal; private: edm::EDGetToken barrelecalCollection_; edm::EDGetToken endcapecalCollection_; edm::EDGetTokenT hbheRecHitsTag_; - edm::EDGetTokenT hfRecHitsTag_; edm::ESGetToken caloGeometryToken_; edm::ESGetToken hcalTopologyToken_; @@ -111,23 +109,34 @@ class PhotonIsolationCalculator { std::array trkIsoBarrelRadiusA_; std::array ecalIsoBarrelRadiusA_; - std::array hcalIsoBarrelRadiusA_; std::array trkIsoBarrelRadiusB_; std::array ecalIsoBarrelRadiusB_; - std::array hcalIsoBarrelRadiusB_; std::array trkIsoEndcapRadiusA_; std::array ecalIsoEndcapRadiusA_; - std::array hcalIsoEndcapRadiusA_; std::array trkIsoEndcapRadiusB_; std::array ecalIsoEndcapRadiusB_; - std::array hcalIsoEndcapRadiusB_; + + std::array hcalIsoInnerRadAEB_; + std::array hcalIsoOuterRadAEB_; + + std::array hcalIsoInnerRadBEB_; + std::array hcalIsoOuterRadBEB_; + + std::array hcalIsoInnerRadAEE_; + std::array hcalIsoOuterRadAEE_; + + std::array hcalIsoInnerRadBEE_; + std::array hcalIsoOuterRadBEE_; + + std::array hcalIsoEThresHB_; + std::array hcalIsoEThresHE_; + int maxHcalSeverity_; std::vector flagsEB_; std::vector flagsEE_; std::vector severityExclEB_; std::vector severityExclEE_; - int maxHcalSeverity_; }; #endif // PhotonIsolationCalculator_H diff --git a/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py b/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py index c442d52043c56..f77cf0aeaf9b4 100644 --- a/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py +++ b/RecoEgamma/PhotonIdentification/python/isolationCalculator_cfi.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms +from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit isolationSumsCalculator = cms.PSet( #required inputs @@ -7,9 +8,11 @@ barrelEcalRecHitCollection = cms.InputTag('ecalRecHit:EcalRecHitsEB'), endcapEcalRecHitCollection = cms.InputTag('ecalRecHit:EcalRecHitsEE'), - HBHERecHitCollection = cms.InputTag('hbhereco'), - HFRecHitCollection = cms.InputTag('hfreco'), - maxHcalRecHitSeverity = cms.int32(9), # FIXME recheck thresholds + + HBHERecHitCollection = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, # Photon will be marked as being near phi module boundary if # it is closer than this. Currently half a crystal. @@ -53,50 +56,13 @@ EcalRecHitEtaSliceB_Barrel = cms.double(2.5), EcalRecHitThreshEB_Barrel = cms.double(0.095), EcalRecHitThreshEtB_Barrel = cms.double(0.0), - #Hcal rechits - HcalDepth1RecHitInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth1RecHitOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth1RecHitThreshEA_Barrel = cms.double(0.0), - HcalDepth2RecHitInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth2RecHitOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth2RecHitThreshEA_Barrel = cms.double(0.0), - HcalDepth3RecHitInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth3RecHitOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth3RecHitThreshEA_Barrel = cms.double(0.0), - HcalDepth4RecHitInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth4RecHitOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth4RecHitThreshEA_Barrel = cms.double(0.0), - HcalDepth5RecHitInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth5RecHitOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth5RecHitThreshEA_Barrel = cms.double(0.0), - HcalDepth6RecHitInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth6RecHitOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth6RecHitThreshEA_Barrel = cms.double(0.0), - HcalDepth7RecHitInnerRadiusA_Barrel = cms.double(0.15), - HcalDepth7RecHitOuterRadiusA_Barrel = cms.double(0.4), - HcalDepth7RecHitThreshEA_Barrel = cms.double(0.0), -# - HcalDepth1RecHitInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth1RecHitOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth1RecHitThreshEB_Barrel = cms.double(0.0), - HcalDepth2RecHitInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth2RecHitOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth2RecHitThreshEB_Barrel = cms.double(0.0), - HcalDepth3RecHitInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth3RecHitOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth3RecHitThreshEB_Barrel = cms.double(0.0), - HcalDepth4RecHitInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth4RecHitOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth4RecHitThreshEB_Barrel = cms.double(0.0), - HcalDepth5RecHitInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth5RecHitOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth5RecHitThreshEB_Barrel = cms.double(0.0), - HcalDepth6RecHitInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth6RecHitOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth6RecHitThreshEB_Barrel = cms.double(0.0), - HcalDepth7RecHitInnerRadiusB_Barrel = cms.double(0.15), - HcalDepth7RecHitOuterRadiusB_Barrel = cms.double(0.3), - HcalDepth7RecHitThreshEB_Barrel = cms.double(0.0), + + # hcal rechits + HcalRecHitInnerRadiusA_Barrel = cms.vdouble(0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15), + HcalRecHitOuterRadiusA_Barrel = cms.vdouble(0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4), + + HcalRecHitInnerRadiusB_Barrel = cms.vdouble(0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15), + HcalRecHitOuterRadiusB_Barrel = cms.vdouble(0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3), #### ENDCAP #tracks @@ -131,50 +97,12 @@ #spikeIdString = cms.string('kSwissCrossBordersIncluded'), #spikeIdThreshold = cms.double(0.95), - #Hcal towers - HcalDepth1RecHitInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth1RecHitOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth1RecHitThreshEA_Endcap = cms.double(0.0), - HcalDepth2RecHitInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth2RecHitOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth2RecHitThreshEA_Endcap = cms.double(0.0), - HcalDepth3RecHitInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth3RecHitOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth3RecHitThreshEA_Endcap = cms.double(0.0), - HcalDepth4RecHitInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth4RecHitOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth4RecHitThreshEA_Endcap = cms.double(0.0), - HcalDepth5RecHitInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth5RecHitOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth5RecHitThreshEA_Endcap = cms.double(0.0), - HcalDepth6RecHitInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth6RecHitOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth6RecHitThreshEA_Endcap = cms.double(0.0), - HcalDepth7RecHitInnerRadiusA_Endcap = cms.double(0.15), - HcalDepth7RecHitOuterRadiusA_Endcap = cms.double(0.4), - HcalDepth7RecHitThreshEA_Endcap = cms.double(0.0), -# - HcalDepth1RecHitInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth1RecHitOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth1RecHitThreshEB_Endcap = cms.double(0.0), - HcalDepth2RecHitInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth2RecHitOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth2RecHitThreshEB_Endcap = cms.double(0.0), - HcalDepth3RecHitInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth3RecHitOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth3RecHitThreshEB_Endcap = cms.double(0.0), - HcalDepth4RecHitInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth4RecHitOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth4RecHitThreshEB_Endcap = cms.double(0.0), - HcalDepth5RecHitInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth5RecHitOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth5RecHitThreshEB_Endcap = cms.double(0.0), - HcalDepth6RecHitInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth6RecHitOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth6RecHitThreshEB_Endcap = cms.double(0.0), - HcalDepth7RecHitInnerRadiusB_Endcap = cms.double(0.15), - HcalDepth7RecHitOuterRadiusB_Endcap = cms.double(0.3), - HcalDepth7RecHitThreshEB_Endcap = cms.double(0.0), + # Hcal rechits + HcalRecHitInnerRadiusA_Endcap = cms.vdouble(0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15), + HcalRecHitOuterRadiusA_Endcap = cms.vdouble(0.4, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4), + + HcalRecHitInnerRadiusB_Endcap = cms.vdouble(0.15, 0.15, 0.15, 0.15, 0.15, 0.15, 0.15), + HcalRecHitOuterRadiusB_Endcap = cms.vdouble(0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3), #recHitFlagsToBeExcluded = cms.vstring( # 'kFaultyHardware', diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 49bef65104c8e..573d754325bba 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -17,7 +17,6 @@ #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/PhotonTkIsolation.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaEcalIsolation.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h" @@ -43,7 +42,6 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, iC.consumes(conf.getParameter("endcapEcalRecHitCollection")); hbheRecHitsTag_ = iC.consumes(conf.getParameter("HBHERecHitCollection")); - hfRecHitsTag_ = iC.consumes(conf.getParameter("HFRecHitCollection")); caloGeometryToken_ = decltype(caloGeometryToken_){iC.esConsumes()}; hcalTopologyToken_ = decltype(hcalTopologyToken_){iC.esConsumes()}; @@ -74,28 +72,8 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoBarrelRadiusA_[i++] = (conf.getParameter("EcalRecHitThreshEA_Barrel")); ecalIsoBarrelRadiusA_[i++] = (conf.getParameter("EcalRecHitThreshEtA_Barrel")); - i = 0; - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusA_Barrel")); - hcalIsoBarrelRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEA_Barrel")); + hcalIsoInnerRadAEB_ = conf.getParameter>("HcalRecHitInnerRadiusA_Barrel"); + hcalIsoOuterRadAEB_ = conf.getParameter>("HcalRecHitOuterRadiusA_Barrel"); i = 0; trkIsoBarrelRadiusB_[i++] = (conf.getParameter("TrackConeOuterRadiusB_Barrel")); @@ -112,28 +90,8 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoBarrelRadiusB_[i++] = (conf.getParameter("EcalRecHitThreshEB_Barrel")); ecalIsoBarrelRadiusB_[i++] = (conf.getParameter("EcalRecHitThreshEtB_Barrel")); - i = 0; - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusB_Barrel")); - hcalIsoBarrelRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEB_Barrel")); + hcalIsoInnerRadBEB_ = conf.getParameter>("HcalRecHitInnerRadiusB_Barrel"); + hcalIsoOuterRadBEB_ = conf.getParameter>("HcalRecHitOuterRadiusB_Barrel"); /// Isolation parameters for Endcap and for two different cone sizes i = 0; @@ -151,28 +109,8 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoEndcapRadiusA_[i++] = (conf.getParameter("EcalRecHitThreshEA_Endcap")); ecalIsoEndcapRadiusA_[i++] = (conf.getParameter("EcalRecHitThreshEtA_Endcap")); - i = 0; - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusA_Endcap")); - hcalIsoEndcapRadiusA_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEA_Endcap")); + hcalIsoInnerRadAEE_ = conf.getParameter>("HcalRecHitInnerRadiusA_Endcap"); + hcalIsoOuterRadAEE_ = conf.getParameter>("HcalRecHitOuterRadiusA_Endcap"); i = 0; trkIsoEndcapRadiusB_[i++] = (conf.getParameter("TrackConeOuterRadiusB_Endcap")); @@ -189,34 +127,17 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, ecalIsoEndcapRadiusB_[i++] = (conf.getParameter("EcalRecHitThreshEB_Endcap")); ecalIsoEndcapRadiusB_[i++] = (conf.getParameter("EcalRecHitThreshEtB_Endcap")); - i = 0; - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth1RecHitThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth2RecHitThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth3RecHitThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth4RecHitThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth5RecHitThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth6RecHitThreshEB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitInnerRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitOuterRadiusB_Endcap")); - hcalIsoEndcapRadiusB_[i++] = (conf.getParameter("HcalDepth7RecHitThreshEB_Endcap")); + hcalIsoInnerRadBEE_ = conf.getParameter>("HcalRecHitInnerRadiusB_Endcap"); + hcalIsoOuterRadBEE_ = conf.getParameter>("HcalRecHitOuterRadiusB_Endcap"); //Pick up the variables for the spike removal flagsEB_ = flagsEB; flagsEE_ = flagsEE; severityExclEB_ = severitiesEB; severityExclEE_ = severitiesEE; + + hcalIsoEThresHB_ = conf.getParameter>("recHitEThresholdHB"); + hcalIsoEThresHE_ = conf.getParameter>("recHitEThresholdHE"); maxHcalSeverity_ = conf.getParameter("maxHcalRecHitSeverity"); } @@ -244,7 +165,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, phofid.isEBEEGap = isEBEEGap; auto const& hbheRecHits = e.get(hbheRecHitsTag_); - auto const& hfRecHits = e.get(hfRecHitsTag_); auto const& caloGeometry = es.getData(caloGeometryToken_); auto const& hcalTopology = &es.getData(hcalTopologyToken_); auto const& hcalChannelQuality = &es.getData(hcalChannelQualityToken_); @@ -265,9 +185,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, double photonEcalRecHitEtaSliceA_; double photonEcalRecHitThreshEA_; double photonEcalRecHitThreshEtA_; - std::array photonHcalRecHitConeInnerRadiusA_; // per depth, inclusive is a trivial sum of all depths - std::array photonHcalRecHitConeOuterRadiusA_; - std::array photonHcalRecHitThreshEA_; double trackConeOuterRadiusA_; double trackConeInnerRadiusA_; double isolationtrackThresholdA_; @@ -279,9 +196,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, double photonEcalRecHitEtaSliceB_; double photonEcalRecHitThreshEB_; double photonEcalRecHitThreshEtB_; - std::array photonHcalRecHitConeInnerRadiusB_; // per depth, inclusive is a trivial sum of all depths - std::array photonHcalRecHitConeOuterRadiusB_; - std::array photonHcalRecHitThreshEB_; double trackConeOuterRadiusB_; double trackConeInnerRadiusB_; double isolationtrackThresholdB_; @@ -303,12 +217,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitThreshEA_ = ecalIsoBarrelRadiusA_[3]; photonEcalRecHitThreshEtA_ = ecalIsoBarrelRadiusA_[4]; - for (size_t id = 0; id < 7; ++id) { - photonHcalRecHitConeInnerRadiusA_[id] = hcalIsoBarrelRadiusA_[id * 3]; - photonHcalRecHitConeOuterRadiusA_[id] = hcalIsoBarrelRadiusA_[(id * 3) + 1]; - photonHcalRecHitThreshEA_[id] = hcalIsoBarrelRadiusA_[(id * 3) + 2]; - } - trackConeOuterRadiusB_ = trkIsoBarrelRadiusB_[0]; trackConeInnerRadiusB_ = trkIsoBarrelRadiusB_[1]; isolationtrackThresholdB_ = trkIsoBarrelRadiusB_[2]; @@ -321,12 +229,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitEtaSliceB_ = ecalIsoBarrelRadiusB_[2]; photonEcalRecHitThreshEB_ = ecalIsoBarrelRadiusB_[3]; photonEcalRecHitThreshEtB_ = ecalIsoBarrelRadiusB_[4]; - - for (size_t id = 0; id < 7; ++id) { - photonHcalRecHitConeInnerRadiusB_[id] = hcalIsoBarrelRadiusB_[id * 3]; - photonHcalRecHitConeOuterRadiusB_[id] = hcalIsoBarrelRadiusB_[(id * 3) + 1]; - photonHcalRecHitThreshEB_[id] = hcalIsoBarrelRadiusB_[(id * 3) + 2]; - } } else { // detector==EcalEndcap @@ -343,12 +245,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitThreshEA_ = ecalIsoEndcapRadiusA_[3]; photonEcalRecHitThreshEtA_ = ecalIsoEndcapRadiusA_[4]; - for (size_t id = 0; id < 7; ++id) { - photonHcalRecHitConeInnerRadiusA_[id] = hcalIsoEndcapRadiusA_[id * 3]; - photonHcalRecHitConeOuterRadiusA_[id] = hcalIsoEndcapRadiusA_[(id * 3) + 1]; - photonHcalRecHitThreshEA_[id] = hcalIsoEndcapRadiusA_[(id * 3) + 2]; - } - trackConeOuterRadiusB_ = trkIsoEndcapRadiusB_[0]; trackConeInnerRadiusB_ = trkIsoEndcapRadiusB_[1]; isolationtrackThresholdB_ = trkIsoEndcapRadiusB_[2]; @@ -361,12 +257,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, photonEcalRecHitEtaSliceB_ = ecalIsoEndcapRadiusB_[2]; photonEcalRecHitThreshEB_ = ecalIsoEndcapRadiusB_[3]; photonEcalRecHitThreshEtB_ = ecalIsoEndcapRadiusB_[4]; - - for (size_t id = 0; id < 7; ++id) { - photonHcalRecHitConeInnerRadiusB_[id] = hcalIsoEndcapRadiusB_[id * 3]; - photonHcalRecHitConeOuterRadiusB_[id] = hcalIsoEndcapRadiusB_[(id * 3) + 1]; - photonHcalRecHitThreshEB_[id] = hcalIsoEndcapRadiusB_[(id * 3) + 2]; - } } //Calculate hollow cone track isolation, CONE A @@ -465,31 +355,29 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, for (size_t id = 0; id < 7; ++id) { phoisolR1.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, hfRecHits, - photonHcalRecHitConeOuterRadiusA_[id], - photonHcalRecHitConeInnerRadiusA_[id], - photonHcalRecHitThreshEA_[id], maxHcalSeverity_, id + 1); + towerMap, hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id], + detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id], + id + 1); phoisolR2.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, hfRecHits, - photonHcalRecHitConeOuterRadiusB_[id], - photonHcalRecHitConeInnerRadiusB_[id], - photonHcalRecHitThreshEB_[id], maxHcalSeverity_, id + 1); + towerMap, hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id], + id + 1); phoisolR1.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, hfRecHits, - photonHcalRecHitConeOuterRadiusA_[id], - 0., - photonHcalRecHitThreshEA_[id], maxHcalSeverity_, id + 1); + towerMap, hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + 0., id + 1); phoisolR2.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, hfRecHits, - photonHcalRecHitConeOuterRadiusB_[id], - 0., - photonHcalRecHitThreshEB_[id], maxHcalSeverity_, id + 1); + towerMap, hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + 0., id + 1); } } @@ -635,11 +523,8 @@ double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* pho const HcalSeverityLevelComputer &hcalSevLvlComputer, const CaloTowerConstituentsMap &towerMap, const HBHERecHitCollection &hbheRecHits, - const HFRecHitCollection &hfRecHits, double RCone, double RConeInner, - double eMin, - int maxSeverity, int depth) const { const std::array e04{{0., 0., 0., 0.}}; const std::array e07{{0., 0., 0., 0., 0., 0., 0.}}; @@ -647,32 +532,26 @@ double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* pho if constexpr (isoBC) { auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RCone, EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, RConeInner, - std::array{{eMin, eMin, eMin, eMin}}, + hcalIsoEThresHB_, e04, - maxSeverity, - std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, + maxHcalSeverity_, + hcalIsoEThresHE_, e07, - maxSeverity, - std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, - e07, - maxSeverity, - hbheRecHits, hfRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); + maxHcalSeverity_, + hbheRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); return hcaliso.getHcalEtSumBc(photon, depth); } else { auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RCone, EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RConeInner, - std::array{{eMin, eMin, eMin, eMin}}, + hcalIsoEThresHB_, e04, - maxSeverity, - std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, - e07, - maxSeverity, - std::array{{eMin, eMin, eMin, eMin, eMin, eMin, eMin}}, + maxHcalSeverity_, + hcalIsoEThresHE_, e07, - maxSeverity, - hbheRecHits, hfRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); + maxHcalSeverity_, + hbheRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); return hcaliso.getHcalEtSum(photon, depth); } From cc25316e5cb960a653adc4999c8f53591685980f Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 4 May 2021 23:18:59 +0200 Subject: [PATCH 07/27] fold all depths but depth 1 into depth 2 when requested in the producer --- .../EgammaCandidates/interface/GsfElectron.h | 3 ++ .../EgammaCandidates/interface/Photon.h | 3 ++ .../EgammaCandidates/src/GsfElectron.cc | 33 +++++++++++++++++++ DataFormats/EgammaCandidates/src/Photon.cc | 33 +++++++++++++++++++ .../plugins/GsfElectronProducer.cc | 10 ++++++ .../python/gsfElectronProducer_cfi.py | 1 + .../python/gedPhotons_cfi.py | 1 + .../python/photons_cfi.py | 2 ++ .../src/GEDPhotonProducer.cc | 9 +++++ .../src/PhotonProducer.cc | 10 ++++++ 10 files changed, 105 insertions(+) diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index ef838d752f28c..332abd18e711c 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -549,6 +549,9 @@ namespace reco { const IsolationVariables &isolationVariables03() const { return dr03_; } const IsolationVariables &isolationVariables04() const { return dr04_; } + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + void hcalToRun2EffDepth(); + private: // attributes IsolationVariables dr03_; diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 57d45d283d869..7f976fa2b3ace 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -506,6 +506,9 @@ namespace reco { // setters void setPflowIDVariables(const PflowIDVariables& pfid) { pfID_ = pfid; } + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + void hcalToRun2EffDepth(); + private: /// check overlap with another candidate bool overlap(const Candidate&) const override; diff --git a/DataFormats/EgammaCandidates/src/GsfElectron.cc b/DataFormats/EgammaCandidates/src/GsfElectron.cc index dbba47911b68a..a9357b426446b 100644 --- a/DataFormats/EgammaCandidates/src/GsfElectron.cc +++ b/DataFormats/EgammaCandidates/src/GsfElectron.cc @@ -239,3 +239,36 @@ float GsfElectron::p4Error(P4Kind kind) const { throw cms::Exception("GsfElectron") << "unexpected p4 kind: " << kind; } } + +void GsfElectron::hcalToRun2EffDepth() { + auto &ss1 = showerShape_; + auto &ss2 = full5x5_showerShape_; + auto &iv1 = dr03_; + auto &iv2 = dr04_; + + for (uint id = 2u; id < ss1.hcalOverEcal.size(); ++id) { + ss1.hcalOverEcal[1] += ss1.hcalOverEcal[id]; + ss1.hcalOverEcalBc[1] += ss1.hcalOverEcalBc[id]; + + ss1.hcalOverEcal[id] = 0.f; + ss1.hcalOverEcalBc[id] = 0.f; + + ss2.hcalOverEcal[1] += ss2.hcalOverEcal[id]; + ss2.hcalOverEcalBc[1] += ss2.hcalOverEcalBc[id]; + + ss2.hcalOverEcal[id] = 0.f; + ss2.hcalOverEcalBc[id] = 0.f; + + iv1.hcalRecHitSumEt[1] += iv1.hcalRecHitSumEt[id]; + iv1.hcalRecHitSumEtBc[1] += iv1.hcalRecHitSumEtBc[id]; + + iv1.hcalRecHitSumEt[id] = 0.f; + iv1.hcalRecHitSumEtBc[id] = 0.f; + + iv2.hcalRecHitSumEt[1] += iv2.hcalRecHitSumEt[id]; + iv2.hcalRecHitSumEtBc[1] += iv2.hcalRecHitSumEtBc[id]; + + iv2.hcalRecHitSumEt[id] = 0.f; + iv2.hcalRecHitSumEtBc[id] = 0.f; + } +} diff --git a/DataFormats/EgammaCandidates/src/Photon.cc b/DataFormats/EgammaCandidates/src/Photon.cc index f8153964a5ce5..f0fade28a3cb3 100644 --- a/DataFormats/EgammaCandidates/src/Photon.cc +++ b/DataFormats/EgammaCandidates/src/Photon.cc @@ -179,3 +179,36 @@ const Candidate::LorentzVector& Photon::p4(P4type type) const { throw cms::Exception("reco::Photon") << "unexpected p4 type: " << type << " cannot return p4 "; } } + +void Photon::hcalToRun2EffDepth() { + auto &ss1 = showerShapeBlock_; + auto &ss2 = full5x5_showerShapeBlock_; + auto &iv1 = isolationR03_; + auto &iv2 = isolationR04_; + + for (uint id = 2u; id < ss1.hcalOverEcal.size(); ++id) { + ss1.hcalOverEcal[1] += ss1.hcalOverEcal[id]; + ss1.hcalOverEcalBc[1] += ss1.hcalOverEcalBc[id]; + + ss1.hcalOverEcal[id] = 0.f; + ss1.hcalOverEcalBc[id] = 0.f; + + ss2.hcalOverEcal[1] += ss2.hcalOverEcal[id]; + ss2.hcalOverEcalBc[1] += ss2.hcalOverEcalBc[id]; + + ss2.hcalOverEcal[id] = 0.f; + ss2.hcalOverEcalBc[id] = 0.f; + + iv1.hcalRecHitSumEt[1] += iv1.hcalRecHitSumEt[id]; + iv1.hcalRecHitSumEtBc[1] += iv1.hcalRecHitSumEtBc[id]; + + iv1.hcalRecHitSumEt[id] = 0.f; + iv1.hcalRecHitSumEtBc[id] = 0.f; + + iv2.hcalRecHitSumEt[1] += iv2.hcalRecHitSumEt[id]; + iv2.hcalRecHitSumEtBc[1] += iv2.hcalRecHitSumEtBc[id]; + + iv2.hcalRecHitSumEt[id] = 0.f; + iv2.hcalRecHitSumEtBc[id] = 0.f; + } +} diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index 4f0122a66453f..06f19a0fd19b1 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -98,6 +98,8 @@ class GsfElectronProducer : public edm::stream::EDProducer>("recHitEThresholdHB", {0., 0., 0., 0.}); desc.add>("recHitEThresholdHE", {0., 0., 0., 0., 0., 0., 0.}); desc.add("maxHcalRecHitSeverity", 999999); + desc.add("hcalRun2EffDepth", false); // Isolation algos configuration desc.add("trkIsol03Cfg", EleTkIsolFromCands::pSetDescript()); @@ -356,6 +359,8 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf hcalCfgBc_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); hcalCfgBc_.maxSeverityHE = hcalCfgBc_.maxSeverityHB; + hcalRun2EffDepth_ = cfg.getParameter("hcalRun2EffDepth"); + // Ecal rec hits configuration GsfElectronAlgo::EcalRecHitsConfiguration recHitsCfg; auto const& flagnamesbarrel = cfg.getParameter>("recHitFlagsToBeExcludedBarrel"); @@ -601,6 +606,11 @@ void GsfElectronProducer::produce(edm::Event& event, const edm::EventSetup& setu electrons.end()); logElectrons(electrons, event, "GsfElectronAlgo Info (after amb. solving)"); } + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + if (hcalRun2EffDepth_) { + for (auto &ele : electrons) + ele.hcalToRun2EffDepth(); + } // final filling event.emplace(electronPutToken_, std::move(electrons)); } diff --git a/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py b/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py index 4fffb05fd9d67..be27caf8d6abf 100644 --- a/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py +++ b/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py @@ -35,6 +35,7 @@ recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + hcalRun2EffDepth = cms.bool(False), trkIsol03Cfg = cms.PSet( barrelCuts = cms.PSet( minPt = cms.double(1), diff --git a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py index 24a8251cf508c..65685cd1a3473 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/gedPhotons_cfi.py @@ -57,6 +57,7 @@ recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + hcalRun2EffDepth = cms.bool(False), posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(10.0), diff --git a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py index e3a5e8f087142..8cafe88ed80e5 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py @@ -48,6 +48,7 @@ recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + hcalRun2EffDepth = cms.bool(False), posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(10.0), @@ -122,6 +123,7 @@ recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + hcalRun2EffDepth = cms.bool(False), posCalc_x0 = cms.double(0.89), posCalc_t0_barl = cms.double(7.7), minSCEtBarrel = cms.double(5.0), diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 7a0c54814d483..0db4332c1b854 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -170,6 +170,7 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { // additional configuration and helpers std::unique_ptr hcalHelperCone_; std::unique_ptr hcalHelperBc_; + bool hcalRun2EffDepth_; }; #include "FWCore/Framework/interface/MakerMacros.h" @@ -302,6 +303,8 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); + hcalRun2EffDepth_ = config.getParameter("hcalRun2EffDepth"); + //AA // cut values for pre-selection @@ -501,6 +504,12 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& eve // put the product in the event edm::LogInfo("GEDPhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n"; + + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + if (hcalRun2EffDepth_) { + for (auto &pho : *outputPhotonCollection_p) + pho.hcalToRun2EffDepth(); + } const auto photonOrphHandle = theEvent.put(std::move(outputPhotonCollection_p), photonCollection_); if (!recoStep_.isFinal() && not pfEgammaCandidates_.isUninitialized()) { diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index 6f1f0d080936b..c25f57799be5f 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -104,6 +104,7 @@ class PhotonProducer : public edm::stream::EDProducer<> { // additional configuration and helpers std::unique_ptr hcalHelperCone_; std::unique_ptr hcalHelperBc_; + bool hcalRun2EffDepth_; }; #include "FWCore/Framework/interface/MakerMacros.h" @@ -180,6 +181,8 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); + hcalRun2EffDepth_ = config.getParameter("hcalRun2EffDepth"); + //AA // @@ -316,6 +319,13 @@ void PhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEve // put the product in the event edm::LogInfo("PhotonProducer") << " Put in the event " << iSC << " Photon Candidates \n"; outputPhotonCollection_p->assign(outputPhotonCollection.begin(), outputPhotonCollection.end()); + + // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest + if (hcalRun2EffDepth_) { + for (auto &pho : *outputPhotonCollection_p) + pho.hcalToRun2EffDepth(); + } + theEvent.put(std::move(outputPhotonCollection_p), PhotonCollection_); } From ae5d43da4f88fa81b7c2f33e6d117caa46aadef2 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Sat, 8 May 2021 00:17:50 +0200 Subject: [PATCH 08/27] add ioread to read old files --- .../EgammaCandidates/interface/GsfElectron.h | 4 +- .../EgammaCandidates/interface/Photon.h | 8 ++- .../EgammaCandidates/src/classes_def.xml | 51 ++++++++++++++++++- 3 files changed, 55 insertions(+), 8 deletions(-) diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index 332abd18e711c..9837db24c3a98 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -363,11 +363,11 @@ namespace reco { float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal float r9; // ratio of the 3x3 energy and supercluster energy - float sigmaIetaIphi; std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) std::array hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) + float sigmaIetaIphi; float eMax; float e2nd; float eTop; @@ -386,10 +386,10 @@ namespace reco { e2x5Max(0.f), e5x5(0.f), r9(-std::numeric_limits::max()), - sigmaIetaIphi(0.f), hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, invalidHcal(false), + sigmaIetaIphi(0.f), eMax(0.f), e2nd(0.f), eTop(0.f), diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 7f976fa2b3ace..b78c385cee6e4 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -376,18 +376,16 @@ namespace reco { int nTrkSolidCone; //Number of tracks in a hollow cone of outer radius, inner radius int nTrkHollowCone; - IsolationVariables() : - ecalRecHitSumEt(0), + ecalRecHitSumEt(0.f), hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - trkSumPtSolidCone(0), - trkSumPtHollowCone(0), + trkSumPtSolidCone(0.f), + trkSumPtHollowCone(0.f), nTrkSolidCone(0), nTrkHollowCone(0) - {} }; diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 858531ae4320e..3adea900848e2 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -44,6 +44,18 @@ + + + hcalOverEcal[0] = onfile.hcalDepth1OverEcal; + hcalOverEcal[1] = onfile.hcalDepth2OverEcal; + + + + + hcalOverEcalBc[0] = onfile.hcalDepth1OverEcalBc; + hcalOverEcalBc[1] = onfile.hcalDepth2OverEcalBc; + + @@ -55,6 +67,18 @@ + + + + + + @@ -167,18 +191,43 @@ - + + + + + + + + + + + + + + From b99d27bad04c8d4aef5032296c829d4508ebfbaa Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Sat, 8 May 2021 00:47:08 +0200 Subject: [PATCH 09/27] code patch --- DQMOffline/EGamma/plugins/ElectronAnalyzer.cc | 16 +- .../plugins/ElectronTagProbeAnalyzer.cc | 16 +- DQMOffline/Trigger/src/FunctionDefs.cc | 4 +- .../EgammaCandidates/interface/GsfElectron.h | 53 ++++--- .../EgammaCandidates/interface/Photon.h | 52 ++++--- .../EgammaCandidates/src/GsfElectron.cc | 8 +- DataFormats/EgammaCandidates/src/Photon.cc | 8 +- .../src/ElectronHcalHelper.cc | 15 +- .../src/GsfElectronAlgo.cc | 142 +++++++++++------ .../plugins/GsfElectronProducer.cc | 2 +- .../interface/EgammaHcalIsolation.h | 52 +++++-- .../src/EgammaHcalIsolation.cc | 112 +++++++------ .../src/GEDPhotonProducer.cc | 4 +- .../src/PhotonProducer.cc | 10 +- .../interface/PhotonIsolationCalculator.h | 10 +- .../plugins/cuts/PhotonHcalOverEcalCut.cc | 8 +- .../src/PhotonIsolationCalculator.cc | 147 +++++++++++------- 17 files changed, 393 insertions(+), 266 deletions(-) diff --git a/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc b/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc index 814bec72a482b..9e89ce2118ba3 100644 --- a/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc @@ -441,14 +441,14 @@ void ElectronAnalyzer::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const "Events", "ELE_LOGY E1 P"); h1_hcalRecHitSumEt_dr03 = bookH1(iBooker, - "hcalRecHitSumEt_dr03", - "hcal isolation sum, dR=0.3", - 100, - 0.0, - 20., - "HcalIsoSum (GeV)", - "Events", - "ELE_LOGY E1 P"); + "hcalRecHitSumEt_dr03", + "hcal isolation sum, dR=0.3", + 100, + 0.0, + 20., + "HcalIsoSum (GeV)", + "Events", + "ELE_LOGY E1 P"); // pf isolation h1_PFch_dr03 = bookH1(iBooker, diff --git a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc index ab188dc226c7b..a5c55531c7900 100644 --- a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc @@ -305,14 +305,14 @@ void ElectronTagProbeAnalyzer::bookHistograms(DQMStore::IBooker& iBooker, edm::R "Events", "ELE_LOGY E1 P"); h1_hcalRecHitSumEt_dr03 = bookH1(iBooker, - "hcalRecHitSumEt_dr03", - "hcal isolation sum, dR=0.3", - 100, - 0.0, - 20., - "HcalIsoSum, cone 0.3 (GeV)", - "Events", - "ELE_LOGY E1 P"); + "hcalRecHitSumEt_dr03", + "hcal isolation sum, dR=0.3", + 100, + 0.0, + 20., + "HcalIsoSum, cone 0.3 (GeV)", + "Events", + "ELE_LOGY E1 P"); // di-electron mass setBookIndex(200); diff --git a/DQMOffline/Trigger/src/FunctionDefs.cc b/DQMOffline/Trigger/src/FunctionDefs.cc index 9dabef524d212..334052cc3c83c 100644 --- a/DQMOffline/Trigger/src/FunctionDefs.cc +++ b/DQMOffline/Trigger/src/FunctionDefs.cc @@ -7,7 +7,7 @@ std::function hltdqm::getUnaryFuncExtraFloat; else if (varName == "hOverE") - varFunc = [] (const reco::GsfElectron &ele) -> float { return ele.hcalOverEcal(); }; + varFunc = [](const reco::GsfElectron& ele) -> float { return ele.hcalOverEcal(); }; return varFunc; } @@ -17,6 +17,6 @@ std::function hltdqm::getUnaryFuncExtraFloat; else if (varName == "hOverE") - varFunc = [] (const reco::Photon &pho) -> float { return pho.hadTowOverEm(); }; + varFunc = [](const reco::Photon& pho) -> float { return pho.hadTowOverEm(); }; return varFunc; } diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index 9837db24c3a98..f37025c6ae659 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -356,15 +356,16 @@ namespace reco { public: struct ShowerShape { - float sigmaEtaEta; // weighted cluster rms along eta and inside 5x5 (absolute eta) - float sigmaIetaIeta; // weighted cluster rms along eta and inside 5x5 (Xtal eta) - float sigmaIphiIphi; // weighted cluster rms along phi and inside 5x5 (Xtal phi) - float e1x5; // energy inside 1x5 in etaxphi around the seed Xtal - float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) - float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal - float r9; // ratio of the 3x3 energy and supercluster energy - std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) - std::array hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) + float sigmaEtaEta; // weighted cluster rms along eta and inside 5x5 (absolute eta) + float sigmaIetaIeta; // weighted cluster rms along eta and inside 5x5 (Xtal eta) + float sigmaIphiIphi; // weighted cluster rms along phi and inside 5x5 (Xtal phi) + float e1x5; // energy inside 1x5 in etaxphi around the seed Xtal + float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) + float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal + float r9; // ratio of the 3x3 energy and supercluster energy + std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array + hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) float sigmaIetaIphi; @@ -412,11 +413,13 @@ namespace reco { float r9() const { return showerShape_.r9; } float hcalOverEcal(int depth = 0) const { const auto &hovere = showerShape_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } float hcalOverEcalBc(int depth = 0) const { const auto &hovere = showerShape_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } const std::vector &hcalTowersBehindClusters() const { return showerShape_.hcalTowersBehindClusters; @@ -438,11 +441,13 @@ namespace reco { float full5x5_r9() const { return full5x5_showerShape_.r9; } float full5x5_hcalOverEcal(int depth = 0) const { const auto &hovere = full5x5_showerShape_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } float full5x5_hcalOverEcalBc(int depth = 0) const { const auto &hovere = full5x5_showerShape_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } bool full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } float full5x5_e2x5Left() const { return full5x5_showerShape_.e2x5Left; } @@ -498,11 +503,11 @@ namespace reco { public: struct IsolationVariables { - float tkSumPt; // track iso with electron footprint removed - float tkSumPtHEEP; // track iso used for the HEEP ID - float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed - std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed - std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed + float tkSumPt; // track iso with electron footprint removed + float tkSumPtHEEP; // track iso used for the HEEP ID + float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed + std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed IsolationVariables() : tkSumPt(0.), tkSumPtHEEP(0.), @@ -517,11 +522,13 @@ namespace reco { float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt; } float dr03HcalTowerSumEt(int depth = 0) const { const auto &hcaliso = dr03_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } float dr03HcalTowerSumEtBc(int depth = 0) const { const auto &hcaliso = dr03_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } const IsolationVariables &dr03IsolationVariables() const { return dr03_; } @@ -531,11 +538,13 @@ namespace reco { float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt; } float dr04HcalTowerSumEt(int depth = 0) const { const auto &hcaliso = dr04_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } float dr04HcalTowerSumEtBc(int depth = 0) const { const auto &hcaliso = dr04_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } const IsolationVariables &dr04IsolationVariables() const { return dr04_; } diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index b78c385cee6e4..54e717b33d1db 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -143,8 +143,9 @@ namespace reco { float e3x3; float e5x5; float maxEnergyXtal; - std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) - std::array hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) + std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array + hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; float effSigmaRR; @@ -203,15 +204,17 @@ namespace reco { /// the total hadronic over electromagnetic fraction float hcalOverEcal(int depth = 0) const { - const auto &hovere = showerShapeBlock_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + const auto& hovere = showerShapeBlock_.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } float hadronicOverEm(int depth = 0) const { return hcalOverEcal(depth); } /// the ratio of total energy of hcal rechits behind the SC and the SC energy float hcalOverEcalBc(int depth = 0) const { - const auto &hovere = showerShapeBlock_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + const auto& hovere = showerShapeBlock_.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } float hadTowOverEm(int depth = 0) const { return hcalOverEcalBc(depth); } @@ -225,12 +228,14 @@ namespace reco { /// as above, but using 5x5 energy in the ecal float full5x5_hcalOverEcal(int depth = 0) const { - const auto &hovere = full5x5_showerShapeBlock_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + const auto& hovere = full5x5_showerShapeBlock_.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } float full5x5_hcalOverEcalBc(int depth = 0) const { - const auto &hovere = full5x5_showerShapeBlock_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) : hovere[depth - 1]; + const auto& hovere = full5x5_showerShapeBlock_.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; } /// Shower shape variables @@ -366,8 +371,8 @@ namespace reco { //EcalRecHit isolation float ecalRecHitSumEt; - std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed - std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed + std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed + std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed //Sum of track pT in a cone of dR float trkSumPtSolidCone; //Sum of track pT in a hollow cone of outer radius, inner radius @@ -385,8 +390,7 @@ namespace reco { trkSumPtSolidCone(0.f), trkSumPtHollowCone(0.f), nTrkSolidCone(0), - nTrkHollowCone(0) - {} + nTrkHollowCone(0) {} }; /// set relevant isolation variables @@ -400,13 +404,15 @@ namespace reco { float ecalRecHitSumEtConeDR04() const { return isolationR04_.ecalRecHitSumEt; } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() float hcalTowerSumEtConeDR04(int depth = 0) const { - const auto &hcaliso = isolationR04_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + const auto& hcaliso = isolationR04_.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() float hcalTowerSumEtBcConeDR04(int depth = 0) const { - const auto &hcaliso = isolationR04_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + const auto& hcaliso = isolationR04_.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } // Track pT sum float trkSumPtSolidConeDR04() const { return isolationR04_.trkSumPtSolidCone; } @@ -421,13 +427,15 @@ namespace reco { float ecalRecHitSumEtConeDR03() const { return isolationR03_.ecalRecHitSumEt; } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() float hcalTowerSumEtConeDR03(int depth = 0) const { - const auto &hcaliso = isolationR03_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + const auto& hcaliso = isolationR03_.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() float hcalTowerSumEtBcConeDR03(int depth = 0) const { - const auto &hcaliso = isolationR03_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) : hcaliso[depth - 1]; + const auto& hcaliso = isolationR03_.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; } // Track pT sum c float trkSumPtSolidConeDR03() const { return isolationR03_.trkSumPtSolidCone; } diff --git a/DataFormats/EgammaCandidates/src/GsfElectron.cc b/DataFormats/EgammaCandidates/src/GsfElectron.cc index a9357b426446b..d7b98f84bfb2f 100644 --- a/DataFormats/EgammaCandidates/src/GsfElectron.cc +++ b/DataFormats/EgammaCandidates/src/GsfElectron.cc @@ -241,10 +241,10 @@ float GsfElectron::p4Error(P4Kind kind) const { } void GsfElectron::hcalToRun2EffDepth() { - auto &ss1 = showerShape_; - auto &ss2 = full5x5_showerShape_; - auto &iv1 = dr03_; - auto &iv2 = dr04_; + auto& ss1 = showerShape_; + auto& ss2 = full5x5_showerShape_; + auto& iv1 = dr03_; + auto& iv2 = dr04_; for (uint id = 2u; id < ss1.hcalOverEcal.size(); ++id) { ss1.hcalOverEcal[1] += ss1.hcalOverEcal[id]; diff --git a/DataFormats/EgammaCandidates/src/Photon.cc b/DataFormats/EgammaCandidates/src/Photon.cc index f0fade28a3cb3..f1ac9770a17fe 100644 --- a/DataFormats/EgammaCandidates/src/Photon.cc +++ b/DataFormats/EgammaCandidates/src/Photon.cc @@ -181,10 +181,10 @@ const Candidate::LorentzVector& Photon::p4(P4type type) const { } void Photon::hcalToRun2EffDepth() { - auto &ss1 = showerShapeBlock_; - auto &ss2 = full5x5_showerShapeBlock_; - auto &iv1 = isolationR03_; - auto &iv2 = isolationR04_; + auto& ss1 = showerShapeBlock_; + auto& ss2 = full5x5_showerShapeBlock_; + auto& iv1 = isolationR03_; + auto& iv2 = isolationR04_; for (uint id = 2u; id < ss1.hcalOverEcal.size(); ++id) { ss1.hcalOverEcal[1] += ss1.hcalOverEcal[id]; diff --git a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc index 5db266568ddf1..aa2edca7a3b10 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc @@ -44,8 +44,7 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup eventSetup.getHandle(hcalChannelQualityToken_), eventSetup.getHandle(hcalSevLvlComputerToken_), towerMap_); - } - else { + } else { hcalIso_ = std::make_unique(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, cfg_.hOverEConeSize, EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, @@ -65,10 +64,14 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup } } -bool ElectronHcalHelper::hasActiveHcal(const reco::SuperCluster &sc) const { - return (cfg_.checkHcalStatus) ? egamma::hasActiveHcal(hcalTowersBehindClusters(sc), *towerMap_, *hcalChannelQuality_, *hcalTopology_) : true; +bool ElectronHcalHelper::hasActiveHcal(const reco::SuperCluster& sc) const { + return (cfg_.checkHcalStatus) + ? egamma::hasActiveHcal(hcalTowersBehindClusters(sc), *towerMap_, *hcalChannelQuality_, *hcalTopology_) + : true; } -double ElectronHcalHelper::hcalESum(const SuperCluster &sc, int depth) const { - return (cfg_.onlyBehindCluster) ? hcalIso_->getHcalESumBc(&sc, depth) : (cfg_.hOverEConeSize > 0.) ? hcalIso_->getHcalESum(&sc, depth) : 0.; +double ElectronHcalHelper::hcalESum(const SuperCluster& sc, int depth) const { + return (cfg_.onlyBehindCluster) ? hcalIso_->getHcalESumBc(&sc, depth) + : (cfg_.hOverEConeSize > 0.) ? hcalIso_->getHcalESum(&sc, depth) + : 0.; } diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index 4cbbc2371c64c..dc9a2d915c774 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -326,7 +326,7 @@ reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco: &thresholds, cfg_.cuts.multThresEB, cfg_.cuts.multThresEE) - : ClusterTools::localCovariances(seedCluster, recHits, &topology); + : ClusterTools::localCovariances(seedCluster, recHits, &topology); showerShape.sigmaEtaEta = sqrt(covariances[0]); showerShape.sigmaIetaIeta = sqrt(localCovariances[0]); @@ -448,57 +448,97 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, : edm::Handle(), .hadIsolation03 = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutSmall, - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeIn, - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, caloGeometry, - *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutSmall, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeIn, + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), .hadIsolation04 = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutLarge, - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeIn, - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, caloGeometry, - *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutLarge, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeIn, + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), .hadIsolation03Bc = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutSmall, - EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, 0., - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, caloGeometry, - *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutSmall, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, + 0., + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), .hadIsolation04Bc = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeOutLarge, - EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, 0., - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, - egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, caloGeometry, - *hcalHelperCone_.hcalTopology(), *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), *hcalHelperCone_.towerMap()), + EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutLarge, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, + 0., + std::array{{0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + std::array{{0., 0., 0., 0., 0., 0., 0.}}, + std::array{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), .ecalBarrelIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall, egIsoConeSizeInBarrel, @@ -1061,10 +1101,10 @@ void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons, if (!EcalTools::isHGCalDet((DetId::Detector)region)) { for (int id = 0; id < 7; ++id) { - dr03.hcalRecHitSumEt[id] = eventData.hadIsolation03.getHcalEtSum(&ele, id + 1); + dr03.hcalRecHitSumEt[id] = eventData.hadIsolation03.getHcalEtSum(&ele, id + 1); dr03.hcalRecHitSumEtBc[id] = eventData.hadIsolation03Bc.getHcalEtSumBc(&ele, id + 1); - dr04.hcalRecHitSumEt[id] = eventData.hadIsolation04.getHcalEtSum(&ele, id + 1); + dr04.hcalRecHitSumEt[id] = eventData.hadIsolation04.getHcalEtSum(&ele, id + 1); dr04.hcalRecHitSumEtBc[id] = eventData.hadIsolation04Bc.getHcalEtSumBc(&ele, id + 1); } diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index 06f19a0fd19b1..4b9cb3d9dd54b 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -608,7 +608,7 @@ void GsfElectronProducer::produce(edm::Event& event, const edm::EventSetup& setu } // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest if (hcalRun2EffDepth_) { - for (auto &ele : electrons) + for (auto& ele : electrons) ele.hcalToRun2EffDepth(); } // final filling diff --git a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h index 5f3303ddb8008..b571a9c6fdb92 100644 --- a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h +++ b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h @@ -37,10 +37,7 @@ double scaleToEt(const double &eta); class EgammaHcalIsolation { public: - enum class InclusionRule : int { - withinConeAroundCluster = 0, - isBehindClusterSeed = 1 - }; + enum class InclusionRule : int { withinConeAroundCluster = 0, isBehindClusterSeed = 1 }; // constructors EgammaHcalIsolation(InclusionRule extIncRule, @@ -77,23 +74,36 @@ class EgammaHcalIsolation { const HcalSeverityLevelComputer &hcalSevLvlComputer, const CaloTowerConstituentsMap &towerMap); - double getHcalESum(const reco::Candidate *c, int depth) const { return getHcalESum(c->get().get(), depth); } - double getHcalEtSum(const reco::Candidate *c, int depth) const { return getHcalEtSum(c->get().get(), depth); } + double getHcalESum(const reco::Candidate *c, int depth) const { + return getHcalESum(c->get().get(), depth); + } + double getHcalEtSum(const reco::Candidate *c, int depth) const { + return getHcalEtSum(c->get().get(), depth); + } double getHcalESum(const reco::SuperCluster *sc, int depth) const { return getHcalESum(sc->position(), depth); } double getHcalEtSum(const reco::SuperCluster *sc, int depth) const { return getHcalEtSum(sc->position(), depth); } - double getHcalESum(const math::XYZPoint &p, int depth) const { return getHcalESum(GlobalPoint(p.x(), p.y(), p.z()), depth); } - double getHcalEtSum(const math::XYZPoint &p, int depth) const { return getHcalEtSum(GlobalPoint(p.x(), p.y(), p.z()), depth); } + double getHcalESum(const math::XYZPoint &p, int depth) const { + return getHcalESum(GlobalPoint(p.x(), p.y(), p.z()), depth); + } + double getHcalEtSum(const math::XYZPoint &p, int depth) const { + return getHcalEtSum(GlobalPoint(p.x(), p.y(), p.z()), depth); + } double getHcalESum(const GlobalPoint &pclu, int depth) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToE); } double getHcalEtSum(const GlobalPoint &pclu, int depth) const { return getHcalSum(pclu, depth, 0, 0, 0, &scaleToEt); } - double getHcalESumBc(const reco::Candidate *c, int depth) const { return getHcalESumBc(c->get().get(), depth); } - double getHcalEtSumBc(const reco::Candidate *c, int depth) const { return getHcalEtSumBc(c->get().get(), depth); } + double getHcalESumBc(const reco::Candidate *c, int depth) const { + return getHcalESumBc(c->get().get(), depth); + } + double getHcalEtSumBc(const reco::Candidate *c, int depth) const { + return getHcalEtSumBc(c->get().get(), depth); + } double getHcalESumBc(const reco::SuperCluster *sc, int depth) const { const auto tower = egamma::towerOf(*(sc->seed()), towerMap_); if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) return getHcalESumBc(sc->position(), depth, tower.ieta(), tower.iphi(), -1); - else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) + else if (extIncRule_ == InclusionRule::withinConeAroundCluster and + intIncRule_ == InclusionRule::isBehindClusterSeed) return getHcalESumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 1); return getHcalESumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 0); @@ -103,7 +113,8 @@ class EgammaHcalIsolation { if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) return getHcalEtSumBc(sc->position(), depth, tower.ieta(), tower.iphi(), -1); - else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) + else if (extIncRule_ == InclusionRule::withinConeAroundCluster and + intIncRule_ == InclusionRule::isBehindClusterSeed) return getHcalEtSumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 1); return getHcalEtSumBc(sc->position(), depth, tower.ieta(), tower.iphi(), 0); @@ -122,9 +133,20 @@ class EgammaHcalIsolation { } private: - double goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; - - double getHcalSum(const GlobalPoint &pclu, int depth, int ieta, int iphi, int include_or_exclude, double (*scale)(const double &)) const; + double goodHitEnergy(const GlobalPoint &pclu, + const HBHERecHit &hit, + int depth, + int ieta, + int iphi, + int include_or_exclude, + double (*scale)(const double &)) const; + + double getHcalSum(const GlobalPoint &pclu, + int depth, + int ieta, + int iphi, + int include_or_exclude, + double (*scale)(const double &)) const; InclusionRule extIncRule_; double extRadius_; diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc index 43c09767de244..0957722d5f515 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc @@ -17,8 +17,8 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/Math/interface/deltaR.h" -double scaleToE(const double& eta) { return 1.; } -double scaleToEt(const double& eta) { return std::sin(2. * std::atan(std::exp(-eta))); } +double scaleToE(const double &eta) { return 1.; } +double scaleToEt(const double &eta) { return std::sin(2. * std::atan(std::exp(-eta))); } EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, double extRadius, @@ -30,24 +30,24 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, - const HBHERecHitCollection& mhbhe, + const HBHERecHitCollection &mhbhe, edm::ESHandle caloGeometry, edm::ESHandle hcalTopology, edm::ESHandle hcalChStatus, edm::ESHandle hcalSevLvlComputer, - edm::ESHandle towerMap) : extIncRule_(extIncRule), - extRadius_(extRadius * extRadius), - intIncRule_(intIncRule), - intRadius_(intRadius * intRadius), - maxSeverityHB_(maxSeverityHB), - maxSeverityHE_(maxSeverityHE), - mhbhe_(mhbhe), - caloGeometry_(*caloGeometry.product()), - hcalTopology_(*hcalTopology.product()), - hcalChStatus_(*hcalChStatus.product()), - hcalSevLvlComputer_(*hcalSevLvlComputer.product()), - towerMap_(*towerMap.product()) -{ + edm::ESHandle towerMap) + : extIncRule_(extIncRule), + extRadius_(extRadius * extRadius), + intIncRule_(intIncRule), + intRadius_(intRadius * intRadius), + maxSeverityHB_(maxSeverityHB), + maxSeverityHE_(maxSeverityHE), + mhbhe_(mhbhe), + caloGeometry_(*caloGeometry.product()), + hcalTopology_(*hcalTopology.product()), + hcalChStatus_(*hcalChStatus.product()), + hcalSevLvlComputer_(*hcalSevLvlComputer.product()), + towerMap_(*towerMap.product()) { eThresHB_ = eThresHB; etThresHB_ = etThresHB; eThresHE_ = eThresHE; @@ -57,13 +57,13 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { extRadius_ = 0.; intRadius_ = 0.; - } - else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) { + } else if (extIncRule_ == InclusionRule::withinConeAroundCluster and + intIncRule_ == InclusionRule::isBehindClusterSeed) { intRadius_ = 0.; - } - else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) { - edm::LogWarning("EgammaHcalIsolation") << " external and internal rechit inclusion rules can't both be isBehindClusterSeed." - << " Setting both to withinConeAroundCluster!"; + } else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) { + edm::LogWarning("EgammaHcalIsolation") + << " external and internal rechit inclusion rules can't both be isBehindClusterSeed." + << " Setting both to withinConeAroundCluster!"; extIncRule_ = InclusionRule::withinConeAroundCluster; intIncRule_ = InclusionRule::withinConeAroundCluster; } @@ -79,24 +79,24 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, const std::array &eThresHE, const std::array &etThresHE, int maxSeverityHE, - const HBHERecHitCollection& mhbhe, + const HBHERecHitCollection &mhbhe, const CaloGeometry &caloGeometry, const HcalTopology &hcalTopology, const HcalChannelQuality &hcalChStatus, const HcalSeverityLevelComputer &hcalSevLvlComputer, - const CaloTowerConstituentsMap &towerMap) : extIncRule_(extIncRule), - extRadius_(extRadius * extRadius), - intIncRule_(intIncRule), - intRadius_(intRadius * intRadius), - maxSeverityHB_(maxSeverityHB), - maxSeverityHE_(maxSeverityHE), - mhbhe_(mhbhe), - caloGeometry_(caloGeometry), - hcalTopology_(hcalTopology), - hcalChStatus_(hcalChStatus), - hcalSevLvlComputer_(hcalSevLvlComputer), - towerMap_(towerMap) -{ + const CaloTowerConstituentsMap &towerMap) + : extIncRule_(extIncRule), + extRadius_(extRadius * extRadius), + intIncRule_(intIncRule), + intRadius_(intRadius * intRadius), + maxSeverityHB_(maxSeverityHB), + maxSeverityHE_(maxSeverityHE), + mhbhe_(mhbhe), + caloGeometry_(caloGeometry), + hcalTopology_(hcalTopology), + hcalChStatus_(hcalChStatus), + hcalSevLvlComputer_(hcalSevLvlComputer), + towerMap_(towerMap) { eThresHB_ = eThresHB; etThresHB_ = etThresHB; eThresHE_ = eThresHE; @@ -106,20 +106,25 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) { extRadius_ = 0.; intRadius_ = 0.; - } - else if (extIncRule_ == InclusionRule::withinConeAroundCluster and intIncRule_ == InclusionRule::isBehindClusterSeed) { + } else if (extIncRule_ == InclusionRule::withinConeAroundCluster and + intIncRule_ == InclusionRule::isBehindClusterSeed) { intRadius_ = 0.; - } - else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) { - edm::LogWarning("EgammaHcalIsolation") << " external and internal rechit inclusion rules can't both be isBehindClusterSeed." - << " Setting both to withinConeAroundCluster!"; + } else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) { + edm::LogWarning("EgammaHcalIsolation") + << " external and internal rechit inclusion rules can't both be isBehindClusterSeed." + << " Setting both to withinConeAroundCluster!"; extIncRule_ = InclusionRule::withinConeAroundCluster; intIncRule_ = InclusionRule::withinConeAroundCluster; } } -double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, - double (*scale)(const double&)) const { +double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, + const HBHERecHit &hit, + int depth, + int ieta, + int iphi, + int include_or_exclude, + double (*scale)(const double &)) const { const auto phit = caloGeometry_.getPosition(hit.detid()); if ((extIncRule_ == InclusionRule::withinConeAroundCluster and deltaR2(pclu, phit) > extRadius_) or @@ -130,9 +135,9 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERec const int hd = hid.depth(), he = hid.ieta(), hp = hid.iphi(); const int h1 = hd - 1; - if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > 4)) or - (hid.subdet() == HcalEndcap and (hd < 1 or hd > 7))) - edm::LogWarning("EgammaHcalIsolation") << " hit in subdet " << hid.subdet() << " has an unaccounted for depth of " << hd << "!!"; + if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > 4)) or (hid.subdet() == HcalEndcap and (hd < 1 or hd > 7))) + edm::LogWarning("EgammaHcalIsolation") + << " hit in subdet " << hid.subdet() << " has an unaccounted for depth of " << hd << "!!"; if (include_or_exclude == -1 and (he != ieta or hp != iphi)) return 0.; @@ -151,8 +156,10 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERec bool recovered = hcalSevLvlComputer_.recoveredRecHit(did, flag); const double het = hit.energy() * scaleToEt(phit.eta()); - const bool goodHB = hid.subdet() == HcalBarrel and (severity <= maxSeverityHB_ or recovered) and hit.energy() > eThresHB_[h1] and het > etThresHB_[h1]; - const bool goodHE = hid.subdet() == HcalEndcap and (severity <= maxSeverityHE_ or recovered) and hit.energy() > eThresHE_[h1] and het > etThresHE_[h1]; + const bool goodHB = hid.subdet() == HcalBarrel and (severity <= maxSeverityHB_ or recovered) and + hit.energy() > eThresHB_[h1] and het > etThresHB_[h1]; + const bool goodHE = hid.subdet() == HcalEndcap and (severity <= maxSeverityHE_ or recovered) and + hit.energy() > eThresHE_[h1] and het > etThresHE_[h1]; if (goodHB or goodHE) return hit.energy() * scale(phit.eta()); @@ -161,8 +168,11 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const HBHERec } double EgammaHcalIsolation::getHcalSum(const GlobalPoint &pclu, - int depth, int ieta, int iphi, int include_or_exclude, - double (*scale)(const double&)) const { + int depth, + int ieta, + int iphi, + int include_or_exclude, + double (*scale)(const double &)) const { double sum = 0.; for (const auto &hit : mhbhe_) sum += goodHitEnergy(pclu, hit, depth, ieta, iphi, include_or_exclude, scale); diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 0db4332c1b854..ca979b00a2dce 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -507,7 +507,7 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& eve // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest if (hcalRun2EffDepth_) { - for (auto &pho : *outputPhotonCollection_p) + for (auto& pho : *outputPhotonCollection_p) pho.hcalToRun2EffDepth(); } const auto photonOrphHandle = theEvent.put(std::move(outputPhotonCollection_p), photonCollection_); @@ -628,7 +628,7 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, &thresholds, multThresEB_, multThresEE_) - : std::array({{0.f, 0.f, 0.f}})); + : std::array({{0.f, 0.f, 0.f}})); float full5x5_sigmaEtaEta = sqrt(full5x5_cov[0]); float full5x5_sigmaIetaIeta = sqrt(full5x5_locCov[0]); diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index c25f57799be5f..bca3651875d7b 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -134,22 +134,22 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo //AA //Flags and Severities to be excluded from photon calculations const std::vector flagnamesEB = - config.getParameter >("RecHitFlagToBeExcludedEB"); + config.getParameter>("RecHitFlagToBeExcludedEB"); const std::vector flagnamesEE = - config.getParameter >("RecHitFlagToBeExcludedEE"); + config.getParameter>("RecHitFlagToBeExcludedEE"); flagsexclEB_ = StringToEnumValue(flagnamesEB); flagsexclEE_ = StringToEnumValue(flagnamesEE); const std::vector severitynamesEB = - config.getParameter >("RecHitSeverityToBeExcludedEB"); + config.getParameter>("RecHitSeverityToBeExcludedEB"); severitiesexclEB_ = StringToEnumValue(severitynamesEB); const std::vector severitynamesEE = - config.getParameter >("RecHitSeverityToBeExcludedEE"); + config.getParameter>("RecHitSeverityToBeExcludedEE"); severitiesexclEE_ = StringToEnumValue(severitynamesEE); @@ -322,7 +322,7 @@ void PhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& theEve // go back to run2-like 2 effective depths if desired - depth 1 is the normal depth 1, depth 2 is the sum over the rest if (hcalRun2EffDepth_) { - for (auto &pho : *outputPhotonCollection_p) + for (auto& pho : *outputPhotonCollection_p) pho.hcalToRun2EffDepth(); } diff --git a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h index 12e2045acfcab..64c4bdc3b8f8d 100644 --- a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h +++ b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h @@ -80,11 +80,11 @@ class PhotonIsolationCalculator { template double calculateHcalRecHitIso(const reco::Photon* photon, const CaloGeometry& geometry, - const HcalTopology &hcalTopology, - const HcalChannelQuality &hcalChStatus, - const HcalSeverityLevelComputer &hcalSevLvlComputer, - const CaloTowerConstituentsMap &towerMap, - const HBHERecHitCollection &hbheRecHits, + const HcalTopology& hcalTopology, + const HcalChannelQuality& hcalChStatus, + const HcalSeverityLevelComputer& hcalSevLvlComputer, + const CaloTowerConstituentsMap& towerMap, + const HBHERecHitCollection& hbheRecHits, double RCone, double RConeInner, int depth) const dso_internal; diff --git a/RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc b/RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc index a3f564be12812..0ee52c92d757f 100644 --- a/RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc +++ b/RecoEgamma/PhotonIdentification/plugins/cuts/PhotonHcalOverEcalCut.cc @@ -29,16 +29,16 @@ CutApplicatorBase::result_type PhotonHcalOverEcalCut::operator()(const rec (std::abs(cand->superCluster()->eta()) < _barrelCutOff ? _hcalOverEcalCutValueEB : _hcalOverEcalCutValueEE); if constexpr (isBC) - return cand->hcalOverEcalBc() < hcalOverEcalCutValue; + return cand->hcalOverEcalBc() < hcalOverEcalCutValue; else - return cand->hcalOverEcal() < hcalOverEcalCutValue; + return cand->hcalOverEcal() < hcalOverEcalCutValue; } template double PhotonHcalOverEcalCut::value(const reco::CandidatePtr& cand) const { reco::PhotonPtr pho(cand); if constexpr (isBC) - return pho->hcalOverEcalBc(); + return pho->hcalOverEcalBc(); else - return pho->hcalOverEcal(); + return pho->hcalOverEcal(); } diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 573d754325bba..3329ad93d329c 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -51,7 +51,7 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, // gsfRecoInputTag_ = conf.getParameter("GsfRecoCollection"); modulePhiBoundary_ = conf.getParameter("modulePhiBoundary"); - moduleEtaBoundary_ = conf.getParameter >("moduleEtaBoundary"); + moduleEtaBoundary_ = conf.getParameter>("moduleEtaBoundary"); // vetoClusteredEcalHits_ = conf.getParameter("vetoClustered"); useNumCrystals_ = conf.getParameter("useNumCrystals"); @@ -353,31 +353,53 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, phoisolR2.ecalRecHitSumEt = EcalRecHitIsoB; for (size_t id = 0; id < 7; ++id) { - phoisolR1.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, - *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id], - detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id], - id + 1); - - phoisolR2.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, - *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id], - id + 1); - - phoisolR1.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, - *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - 0., id + 1); - - phoisolR2.hcalRecHitSumEtBc[id] = calculateHcalRecHitIso(pho, caloGeometry, - *hcalTopology, *hcalChannelQuality, *hcalSevLvlComputer, - towerMap, hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - 0., id + 1); + phoisolR1.hcalRecHitSumEt[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id], + detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id], + id + 1); + + phoisolR2.hcalRecHitSumEt[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id], + id + 1); + + phoisolR1.hcalRecHitSumEtBc[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + 0., + id + 1); + + phoisolR2.hcalRecHitSumEtBc[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + 0., + id + 1); } } @@ -517,12 +539,12 @@ double PhotonIsolationCalculator::calculateEcalRecHitIso(const reco::Photon* pho template double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* photon, - const CaloGeometry &geometry, - const HcalTopology &hcalTopology, - const HcalChannelQuality &hcalChStatus, - const HcalSeverityLevelComputer &hcalSevLvlComputer, - const CaloTowerConstituentsMap &towerMap, - const HBHERecHitCollection &hbheRecHits, + const CaloGeometry& geometry, + const HcalTopology& hcalTopology, + const HcalChannelQuality& hcalChStatus, + const HcalSeverityLevelComputer& hcalSevLvlComputer, + const CaloTowerConstituentsMap& towerMap, + const HBHERecHitCollection& hbheRecHits, double RCone, double RConeInner, int depth) const { @@ -530,29 +552,42 @@ double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* pho const std::array e07{{0., 0., 0., 0., 0., 0., 0.}}; if constexpr (isoBC) { - auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RCone, - EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, RConeInner, - hcalIsoEThresHB_, - e04, - maxHcalSeverity_, - hcalIsoEThresHE_, - e07, - maxHcalSeverity_, - hbheRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); - - return hcaliso.getHcalEtSumBc(photon, depth); - } - else { - auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RCone, - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, RConeInner, - hcalIsoEThresHB_, - e04, - maxHcalSeverity_, - hcalIsoEThresHE_, - e07, - maxHcalSeverity_, - hbheRecHits, geometry, hcalTopology, hcalChStatus, hcalSevLvlComputer, towerMap); - - return hcaliso.getHcalEtSum(photon, depth); + auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + RCone, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, + RConeInner, + hcalIsoEThresHB_, + e04, + maxHcalSeverity_, + hcalIsoEThresHE_, + e07, + maxHcalSeverity_, + hbheRecHits, + geometry, + hcalTopology, + hcalChStatus, + hcalSevLvlComputer, + towerMap); + + return hcaliso.getHcalEtSumBc(photon, depth); + } else { + auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + RCone, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + RConeInner, + hcalIsoEThresHB_, + e04, + maxHcalSeverity_, + hcalIsoEThresHE_, + e07, + maxHcalSeverity_, + hbheRecHits, + geometry, + hcalTopology, + hcalChStatus, + hcalSevLvlComputer, + towerMap); + + return hcaliso.getHcalEtSum(photon, depth); } } From 5e505ff28191452389c824da37c09bce09ce2b01 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Sat, 8 May 2021 01:43:20 +0200 Subject: [PATCH 10/27] explicitly zero out other depths --- .../EgammaCandidates/src/classes_def.xml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 3adea900848e2..2fa98477de595 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -48,12 +48,18 @@ @@ -71,12 +77,18 @@ @@ -203,12 +215,18 @@ @@ -220,12 +238,18 @@ From 3f3b09ab6f0ff0a96208bebd6cc6956147326ca1 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Mon, 10 May 2021 23:01:16 +0200 Subject: [PATCH 11/27] update conversions to use rechits too --- .../python/conversions_cfi.py | 13 ++-- .../src/ConversionTrackCandidateProducer.cc | 44 +++++++++--- .../src/ConvertedPhotonProducer.cc | 72 ++++++++++++------- 3 files changed, 86 insertions(+), 43 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/python/conversions_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/conversions_cfi.py index 565032fa04d95..c85d5b66bb5e8 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/conversions_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/conversions_cfi.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms - +from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit #from RecoEgamma.EgammaTools.PhotonConversionMVAComputer_cfi import * # # configuration for producer of converted photons @@ -18,14 +18,17 @@ outInTrackSCAssociation = cms.string('outInTrackSCAssociationCollection'), convertedPhotonCollection = cms.string('uncleanedConversions'), generalTracksSrc = cms.InputTag("generalTracks"), - hcalTowers = cms.InputTag("towerMaker"), - cleanedConvertedPhotonCollection = cms.string(''), + cleanedConvertedPhotonCollection = cms.string(''), AlgorithmName = cms.string('ecalSeeded'), minSCEt = cms.double(20.0), hOverEConeSize = cms.double(0.15), - maxHOverE = cms.double(0.15), + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + maxHOverE = cms.double(0.15), recoverOneTrackCase = cms.bool(True), - dRForConversionRecovery = cms.double(0.3), + dRForConversionRecovery = cms.double(0.3), deltaCotCut = cms.double(0.05), minApproachDisCut = cms.double(0.), maxNumOfCandidates = cms.int32(3), diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc index 86af9fd7a9f71..9b6ec5c17efb0 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc @@ -28,7 +28,6 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaRecHitIsolation.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h" #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionSeedFinder.h" #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackFinder.h" #include "RecoEgamma/EgammaPhotonAlgos/interface/InOutConversionSeedFinder.h" @@ -43,6 +42,7 @@ #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" #include "RecoTracker/Record/interface/NavigationSchoolRecord.h" #include "TrackingTools/DetLayers/interface/NavigationSchool.h" +#include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h" #include @@ -69,7 +69,7 @@ class ConversionTrackCandidateProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT> bcEndcapCollection_; edm::EDGetTokenT> scHybridBarrelProducer_; edm::EDGetTokenT> scIslandEndcapProducer_; - edm::EDGetTokenT hcalTowers_; + edm::EDGetTokenT hbheRecHits_; edm::EDGetTokenT barrelecalCollection_; edm::EDGetTokenT endcapecalCollection_; edm::EDGetTokenT measurementTrkEvtToken_; @@ -108,12 +108,14 @@ class ConversionTrackCandidateProducer : public edm::stream::EDProducer<> { std::vector> vecOfSCRefForOutIn; std::vector> vecOfSCRefForInOut; + std::unique_ptr hcalHelper_; + void buildCollections(bool detector, const edm::Handle>& scHandle, const edm::Handle>& bcHandle, const EcalRecHitCollection& ecalRecHits, const EcalSeverityLevelAlgo* sevLev, - CaloTowerCollection const& hcalTowers, + ElectronHcalHelper const& hcalHelper, TrackCandidateCollection& outInTracks, TrackCandidateCollection& inOutTracks, std::vector>& vecRecOI, @@ -135,7 +137,7 @@ ConversionTrackCandidateProducer::ConversionTrackCandidateProducer(const edm::Pa scHybridBarrelProducer_{consumes(config.getParameter("scHybridBarrelProducer"))}, scIslandEndcapProducer_{consumes(config.getParameter("scIslandEndcapProducer"))}, - hcalTowers_{consumes(config.getParameter("hcalTowers"))}, + hbheRecHits_{consumes(config.getParameter("hbheRecHits"))}, barrelecalCollection_{consumes(config.getParameter("barrelEcalRecHitCollection"))}, endcapecalCollection_{consumes(config.getParameter("endcapEcalRecHitCollection"))}, measurementTrkEvtToken_{consumes(edm::InputTag("MeasurementTrackerEvent"))}, @@ -184,6 +186,22 @@ ConversionTrackCandidateProducer::ConversionTrackCandidateProducer(const edm::Pa produces(OutInTrackSCAssociationCollection_); produces(InOutTrackSCAssociationCollection_); + + ElectronHcalHelper::Configuration cfgCone; + cfgCone.hOverEConeSize = hOverEConeSize_; + if (cfgCone.hOverEConeSize > 0) { + cfgCone.onlyBehindCluster = false; + cfgCone.checkHcalStatus = false; + + cfgCone.hbheRecHits = hbheRecHits_; + + cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; + } + + hcalHelper_ = std::make_unique(cfgCone, consumesCollector()); } void ConversionTrackCandidateProducer::setEventSetup(const edm::EventSetup& theEventSetup) { @@ -258,7 +276,7 @@ void ConversionTrackCandidateProducer::produce(edm::Event& theEvent, const edm:: // get the geometry from the event setup: theEventSetup.get().get(theCaloGeom_); - auto const& hcalTowers = theEvent.get(hcalTowers_); + hcalHelper_->beginEvent(theEvent, theEventSetup); auto const& ecalhitsCollEB = theEvent.get(barrelecalCollection_); auto const& ecalhitsCollEE = theEvent.get(endcapecalCollection_); @@ -277,7 +295,7 @@ void ConversionTrackCandidateProducer::produce(edm::Event& theEvent, const edm:: bcBarrelHandle, ecalhitsCollEB, sevLevel, - hcalTowers, + *hcalHelper_, *outInTrackCandidate_p, *inOutTrackCandidate_p, caloPtrVecOutIn_, @@ -290,7 +308,7 @@ void ConversionTrackCandidateProducer::produce(edm::Event& theEvent, const edm:: bcEndcapHandle, ecalhitsCollEE, sevLevel, - hcalTowers, + *hcalHelper_, *outInTrackCandidate_p, *inOutTrackCandidate_p, caloPtrVecOutIn_, @@ -331,7 +349,7 @@ void ConversionTrackCandidateProducer::buildCollections(bool isBarrel, const edm::Handle>& bcHandle, EcalRecHitCollection const& ecalRecHits, const EcalSeverityLevelAlgo* sevLevel, - CaloTowerCollection const& hcalTowers, + ElectronHcalHelper const& hcalHelper, TrackCandidateCollection& outInTrackCandidates, TrackCandidateCollection& inOutTrackCandidates, std::vector>& vecRecOI, @@ -349,8 +367,7 @@ void ConversionTrackCandidateProducer::buildCollections(bool isBarrel, const reco::CaloCluster* pClus = &(*aClus); const reco::SuperCluster* sc = dynamic_cast(pClus); double scEt = sc->energy() / cosh(sc->eta()); - EgammaTowerIsolation towerIso(hOverEConeSize_, 0., 0., -1, &hcalTowers); - double HoE = towerIso.getTowerESum(sc) / sc->energy(); + double HoE = hcalHelper.hcalESum(*sc, 0) / sc->energy(); if (HoE >= maxHOverE_) continue; @@ -429,7 +446,12 @@ void ConversionTrackCandidateProducer::fillDescriptions(edm::ConfigurationDescri desc.add("bcEtCut", 1.5); desc.add("bcECut", 1.5); desc.add("useEtCut", true); - desc.add("hcalTowers", {"towerMaker"}); + + desc.add("hbheRecHits", {"hbhereco"}); + desc.add>("recHitEThresholdHB", {0., 0., 0., 0.}); + desc.add>("recHitEThresholdHE", {0., 0., 0., 0., 0., 0., 0.}); + desc.add("maxHcalRecHitSeverity", 999999); + desc.add("minSCEt", 20.0); desc.add("hOverEConeSize", 0.15); desc.add("maxHOverE", 0.15); diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc index dc87d5143c515..d6873eee94ea1 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc @@ -16,6 +16,8 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/VertexReco/interface/Vertex.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/stream/EDProducer.h" @@ -28,7 +30,6 @@ #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" #include "MagneticField/Engine/interface/MagneticField.h" #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" -#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h" #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackEcalImpactPoint.h" #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionTrackPairFinder.h" #include "RecoEgamma/EgammaPhotonAlgos/interface/ConversionVertexFinder.h" @@ -37,6 +38,7 @@ #include "TrackingTools/TransientTrack/interface/TrackTransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h" #include @@ -50,13 +52,13 @@ class ConvertedPhotonProducer : public edm::stream::EDProducer<> { private: void buildCollections( edm::EventSetup const& es, - const edm::Handle >& scHandle, - const edm::Handle >& bcHandle, - CaloTowerCollection const& hcalTowers, + const edm::Handle>& scHandle, + const edm::Handle>& bcHandle, + ElectronHcalHelper const& hcalHelper, const edm::Handle& trkHandle, std::map, reco::CaloClusterPtr, CompareTwoTracksVectors>& allPairs, reco::ConversionCollection& outputConvPhotonCollection); - void cleanCollections(const edm::Handle >& scHandle, + void cleanCollections(const edm::Handle>& scHandle, const edm::OrphanHandle& conversionHandle, reco::ConversionCollection& outputCollection); @@ -78,11 +80,11 @@ class ConvertedPhotonProducer : public edm::stream::EDProducer<> { edm::EDPutTokenT convertedPhotonCollectionPutToken_; edm::EDPutTokenT cleanedConvertedPhotonCollectionPutToken_; - edm::EDGetTokenT > bcBarrelCollection_; - edm::EDGetTokenT > bcEndcapCollection_; - edm::EDGetTokenT > scHybridBarrelProducer_; - edm::EDGetTokenT > scIslandEndcapProducer_; - edm::EDGetTokenT hcalTowers_; + edm::EDGetTokenT> bcBarrelCollection_; + edm::EDGetTokenT> bcEndcapCollection_; + edm::EDGetTokenT> scHybridBarrelProducer_; + edm::EDGetTokenT> scIslandEndcapProducer_; + edm::EDGetTokenT hbheRecHits_; MagneticField const* magneticField_; TransientTrackBuilder const* transientTrackBuilder_; @@ -105,6 +107,8 @@ class ConvertedPhotonProducer : public edm::stream::EDProducer<> { int maxNumOfCandidates_; bool risolveAmbiguity_; + std::unique_ptr hcalHelper_; + ConversionLikelihoodCalculator likelihoodCalc_; std::string likelihoodWeights_; @@ -134,7 +138,7 @@ ConvertedPhotonProducer::ConvertedPhotonProducer(const edm::ParameterSet& config bcEndcapCollection_{consumes(config.getParameter("bcEndcapCollection"))}, scHybridBarrelProducer_{consumes(config.getParameter("scHybridBarrelProducer"))}, scIslandEndcapProducer_{consumes(config.getParameter("scIslandEndcapProducer"))}, - hcalTowers_{consumes(config.getParameter("hcalTowers"))}, + hbheRecHits_{consumes(config.getParameter("hbheRechits_"))}, caloGeomToken_{esConsumes()}, mFToken_{esConsumes()}, transientTrackToken_{esConsumes( @@ -155,6 +159,22 @@ ConvertedPhotonProducer::ConvertedPhotonProducer(const edm::ParameterSet& config likelihoodWeights_{config.getParameter("MVA_weights_location")} { // instantiate the Track Pair Finder algorithm likelihoodCalc_.setWeightsFile(edm::FileInPath{likelihoodWeights_.c_str()}.fullPath().c_str()); + + ElectronHcalHelper::Configuration cfgCone; + cfgCone.hOverEConeSize = hOverEConeSize_; + if (cfgCone.hOverEConeSize > 0) { + cfgCone.onlyBehindCluster = false; + cfgCone.checkHcalStatus = false; + + cfgCone.hbheRecHits = hbheRecHits_; + + cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; + } + + hcalHelper_ = std::make_unique(cfgCone, consumesCollector()); } void ConvertedPhotonProducer::beginRun(edm::Run const& r, edm::EventSetup const& theEventSetup) { @@ -183,7 +203,7 @@ void ConvertedPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetu // Get the Super Cluster collection in the Endcap bool validEndcapSCHandle = true; - edm::Handle > scEndcapHandle; + edm::Handle> scEndcapHandle; theEvent.getByToken(scIslandEndcapProducer_, scEndcapHandle); if (!scEndcapHandle.isValid()) { edm::LogError("ConvertedPhotonProducer") << "Error! Can't get the scIslandEndcapProducer"; @@ -240,22 +260,19 @@ void ConvertedPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetu } // Get the basic cluster collection in the Barrel - edm::Handle > bcBarrelHandle; + edm::Handle> bcBarrelHandle; theEvent.getByToken(bcBarrelCollection_, bcBarrelHandle); if (!bcBarrelHandle.isValid()) { edm::LogError("ConvertedPhotonProducer") << "Error! Can't get the bcBarrelCollection"; } // Get the basic cluster collection in the Endcap - edm::Handle > bcEndcapHandle; + edm::Handle> bcEndcapHandle; theEvent.getByToken(bcEndcapCollection_, bcEndcapHandle); if (!bcEndcapHandle.isValid()) { edm::LogError("ConvertedPhotonProducer") << "Error! Can't get the bcEndcapCollection"; } - // get Hcal towers collection - auto const& hcalTowers = theEvent.get(hcalTowers_); - if (validTrackInputs) { //do the conversion: std::vector t_outInTrk = transientTrackBuilder_->build(outInTrkHandle); @@ -267,17 +284,19 @@ void ConvertedPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetu t_outInTrk, outInTrkHandle, outInTrkSCAssocHandle, t_inOutTrk, inOutTrkHandle, inOutTrkSCAssocHandle); //LogDebug("ConvertedPhotonProducer") << "ConvertedPhotonProducer allPairs.size " << allPairs.size() << "\n"; + hcalHelper_->beginEvent(theEvent, theEventSetup); + buildCollections(theEventSetup, scBarrelHandle, bcBarrelHandle, - hcalTowers, + *hcalHelper_, generalTrkHandle, allPairs, outputConvPhotonCollection); buildCollections(theEventSetup, scEndcapHandle, bcEndcapHandle, - hcalTowers, + *hcalHelper_, generalTrkHandle, allPairs, outputConvPhotonCollection); @@ -298,9 +317,9 @@ void ConvertedPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetu void ConvertedPhotonProducer::buildCollections( edm::EventSetup const& es, - const edm::Handle >& scHandle, - const edm::Handle >& bcHandle, - CaloTowerCollection const& hcalTowers, + const edm::Handle>& scHandle, + const edm::Handle>& bcHandle, + ElectronHcalHelper const& hcalHelper, const edm::Handle& generalTrkHandle, std::map, reco::CaloClusterPtr, CompareTwoTracksVectors>& allPairs, reco::ConversionCollection& outputConvPhotonCollection) @@ -324,13 +343,12 @@ void ConvertedPhotonProducer::buildCollections( continue; const reco::CaloCluster* pClus = &(*aClus); auto const* sc = dynamic_cast(pClus); - EgammaTowerIsolation towerIso(hOverEConeSize_, 0., 0., -1, &hcalTowers); - double HoE = towerIso.getTowerESum(sc) / sc->energy(); + double HoE = hcalHelper.hcalESum(*sc, 0) / sc->energy(); if (HoE >= maxHOverE_) continue; ///// - std::vector > trackPairRef; + std::vector> trackPairRef; std::vector trackInnPos; std::vector trackPin; std::vector trackPout; @@ -529,7 +547,7 @@ void ConvertedPhotonProducer::buildCollections( } } -void ConvertedPhotonProducer::cleanCollections(const edm::Handle >& scHandle, +void ConvertedPhotonProducer::cleanCollections(const edm::Handle>& scHandle, const edm::OrphanHandle& conversionHandle, reco::ConversionCollection& outputConversionCollection) { reco::Conversion* newCandidate = nullptr; @@ -571,7 +589,7 @@ void ConvertedPhotonProducer::cleanCollections(const edm::Handle ConvertedPhotonProducer::solveAmbiguity( const edm::OrphanHandle& conversionHandle, reco::CaloClusterPtr const& scRef) { - std::multimap > convMap; + std::multimap> convMap; for (unsigned int icp = 0; icp < conversionHandle->size(); icp++) { reco::ConversionRef cpRef{conversionHandle, icp}; From 5f1bd702185b3952a0083a2bfff09edda9a86176 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Mon, 10 May 2021 23:01:47 +0200 Subject: [PATCH 12/27] another conversion file escaped attention --- .../python/conversionTrackCandidates_cfi.py | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py diff --git a/RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py new file mode 100644 index 0000000000000..06788d4a247fe --- /dev/null +++ b/RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py @@ -0,0 +1,56 @@ +import FWCore.ParameterSet.Config as cms +from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit + +conversionTrackCandidates = cms.EDProducer('ConversionTrackCandidateProducer', + bcBarrelCollection = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowBasicClusterECALBarrel'), + bcEndcapCollection = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowBasicClusterECALEndcap'), + scHybridBarrelProducer = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALBarrel'), + scIslandEndcapProducer = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALEndcapWithPreshower'), + outInTrackCandidateSCAssociationCollection = cms.string('outInTrackCandidateSCAssociationCollection'), + inOutTrackCandidateSCAssociationCollection = cms.string('inOutTrackCandidateSCAssociationCollection'), + outInTrackCandidateCollection = cms.string('outInTracksFromConversions'), + inOutTrackCandidateCollection = cms.string('inOutTracksFromConversions'), + barrelEcalRecHitCollection = cms.InputTag('ecalRecHit', 'EcalRecHitsEB'), + endcapEcalRecHitCollection = cms.InputTag('ecalRecHit', 'EcalRecHitsEE'), + MeasurementTrackerName = cms.string(''), + OutInRedundantSeedCleaner = cms.string('CachingSeedCleanerBySharedInput'), + InOutRedundantSeedCleaner = cms.string('CachingSeedCleanerBySharedInput'), + useHitsSplitting = cms.bool(False), + maxNumOfSeedsOutIn = cms.int32(50), + maxNumOfSeedsInOut = cms.int32(50), + bcEtCut = cms.double(1.5), + bcECut = cms.double(1.5), + useEtCut = cms.bool(True), + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, + minSCEt = cms.double(20), + hOverEConeSize = cms.double(0.15), + maxHOverE = cms.double(0.15), + isoInnerConeR = cms.double(3.5), + isoConeR = cms.double(0.4), + isoEtaSlice = cms.double(2.5), + isoEtMin = cms.double(0), + isoEMin = cms.double(0.08), + vetoClusteredHits = cms.bool(False), + useNumXstals = cms.bool(True), + ecalIsoCut_offset = cms.double(999999999), + ecalIsoCut_slope = cms.double(0), + RecHitFlagToBeExcludedEB = cms.vstring(), + RecHitSeverityToBeExcludedEB = cms.vstring(), + RecHitFlagToBeExcludedEE = cms.vstring(), + RecHitSeverityToBeExcludedEE = cms.vstring(), + fractionShared = cms.double(0.5), + TrajectoryBuilder = cms.string('TrajectoryBuilderForConversions'), + TrajectoryBuilderPSet = cms.PSet(), + TransientInitialStateEstimatorParameters = cms.PSet( + propagatorAlongTISE = cms.string('alongMomElePropagator'), + numberMeasurementsForFit = cms.int32(4), + propagatorOppositeTISE = cms.string('oppositeToMomElePropagator') + ), + allowSharedFirstHit = cms.bool(True), + ValidHitBonus = cms.double(5), + MissingHitPenalty = cms.double(20), + mightGet = cms.optional.untracked.vstring +) From c4bd20178c7e8b967ed9f75798d76594a72ee887 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Mon, 10 May 2021 23:02:47 +0200 Subject: [PATCH 13/27] add null-hcal capability as required by ootphotons --- .../python/ootPhotons_cff.py | 6 +- .../src/GEDPhotonProducer.cc | 92 ++++++++------- .../src/PhotonIsolationCalculator.cc | 105 +++++++++--------- 3 files changed, 110 insertions(+), 93 deletions(-) diff --git a/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py b/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py index ee7c468fea38b..75a6ef25f6493 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py +++ b/RecoEgamma/EgammaPhotonProducers/python/ootPhotons_cff.py @@ -38,14 +38,14 @@ barrelEcalHits = "reducedEcalRecHitsEB", endcapEcalHits = "reducedEcalRecHitsEE", preshowerHits = "reducedEcalRecHitsES", - hcalTowers = "" + hbheRecHits = "" ) run2_miniAOD_80XLegacy.toModify( ootPhotons, barrelEcalHits = "reducedEcalRecHitsEB", endcapEcalHits = "reducedEcalRecHitsEE", preshowerHits = "reducedEcalRecHitsES", - hcalTowers = "", + hbheRecHits = "", pfECALClusIsolation = None, pfHCALClusIsolation = None ) @@ -53,7 +53,7 @@ ootPhotonsTmp.isolationSumsCalculatorSet, barrelEcalRecHitCollection = "reducedEcalRecHitsEB", endcapEcalRecHitCollection = "reducedEcalRecHitsEE", - HcalRecHitCollection = "" + HBHERecHitCollection = "" ) run2_miniAOD_80XLegacy.toModify( ootPhotonsTmp.mipVariableSet, diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index ca979b00a2dce..56b8804d7b058 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -75,8 +75,8 @@ class GEDPhotonProducer : public edm::stream::EDProducer<> { const EcalRecHitCollection* ecalBarrelHits, const EcalRecHitCollection* ecalEndcapHits, const EcalRecHitCollection* preshowerHits, - ElectronHcalHelper const& hcalHelperCone, - ElectronHcalHelper const& hcalHelperBc, + const ElectronHcalHelper* hcalHelperCone, + const ElectronHcalHelper* hcalHelperBc, const reco::VertexCollection& pvVertices, reco::PhotonCollection& outputCollection, int& iSC, @@ -204,7 +204,9 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) recoStep_(config.getParameter("reconstructionStep")), caloTopologyToken_{esConsumes()}, caloGeometryToken_{esConsumes()}, - ecalPFRechitThresholdsToken_{esConsumes()} { + ecalPFRechitThresholdsToken_{esConsumes()}, + hcalHelperCone_(nullptr), + hcalHelperBc_(nullptr) { if (recoStep_.isFinal()) { photonProducerT_ = consumes(photonProducer_); pfCandidates_ = consumes(config.getParameter("pfCandidates")); @@ -241,7 +243,9 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) preshowerHits_ = consumes(config.getParameter("preshowerHits")); vertexProducer_ = consumes(config.getParameter("primaryVertexProducer")); - hbheRecHits_ = consumes(config.getParameter("hbheRecHits")); + auto hbhetag = config.getParameter("hbheRecHits"); + if (not hbhetag.label().empty()) + hbheRecHits_ = consumes(hbhetag); // photonCollection_ = config.getParameter("outputPhotonCollection"); @@ -275,33 +279,34 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) photonEnergyCorrector_ = std::make_unique(config, consumesCollector()); checkHcalStatus_ = config.getParameter("checkHcalStatus"); - ElectronHcalHelper::Configuration cfgCone, cfgBc; - cfgCone.hOverEConeSize = hOverEConeSize_; - if (cfgCone.hOverEConeSize > 0) { - cfgCone.onlyBehindCluster = false; - cfgCone.checkHcalStatus = checkHcalStatus_; - - cfgCone.hbheRecHits = hbheRecHits_; - - cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); - cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); - cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; - } - - cfgBc.hOverEConeSize = 0.; - cfgBc.onlyBehindCluster = true; - cfgBc.checkHcalStatus = checkHcalStatus_; + if (not hbheRecHits_.isUninitialized()) { + ElectronHcalHelper::Configuration cfgCone, cfgBc; + cfgCone.hOverEConeSize = hOverEConeSize_; + if (cfgCone.hOverEConeSize > 0) { + cfgCone.onlyBehindCluster = false; + cfgCone.checkHcalStatus = checkHcalStatus_; + + cfgCone.hbheRecHits = hbheRecHits_; + + cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; + } + cfgBc.hOverEConeSize = 0.; + cfgBc.onlyBehindCluster = true; + cfgBc.checkHcalStatus = checkHcalStatus_; - cfgBc.hbheRecHits = hbheRecHits_; + cfgBc.hbheRecHits = hbheRecHits_; - cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); - cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); - cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; + cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); + cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; - hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); - hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); + hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); + hcalHelperBc_ = std::make_unique(cfgBc, consumesCollector()); + } hcalRun2EffDepth_ = config.getParameter("hcalRun2EffDepth"); @@ -445,8 +450,10 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& eve caloGeom_ = &eventSetup.getData(caloGeometryToken_); // prepare access to hcal data - hcalHelperCone_->beginEvent(theEvent, eventSetup); - hcalHelperBc_->beginEvent(theEvent, eventSetup); + if (hcalHelperCone_ != nullptr and hcalHelperBc_ != nullptr) { + hcalHelperCone_->beginEvent(theEvent, eventSetup); + hcalHelperBc_->beginEvent(theEvent, eventSetup); + } auto const& topology = eventSetup.getData(caloTopologyToken_); auto const& thresholds = eventSetup.getData(ecalPFRechitThresholdsToken_); @@ -475,8 +482,8 @@ void GEDPhotonProducer::produce(edm::Event& theEvent, const edm::EventSetup& eve &barrelRecHits, &endcapRecHits, &preshowerRecHits, - *hcalHelperCone_, - *hcalHelperBc_, + hcalHelperCone_.get(), + hcalHelperBc_.get(), //vtx, vertexCollection, *outputPhotonCollection_p, @@ -545,8 +552,8 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, const EcalRecHitCollection* ecalBarrelHits, const EcalRecHitCollection* ecalEndcapHits, const EcalRecHitCollection* preshowerHits, - ElectronHcalHelper const& hcalHelperCone, - ElectronHcalHelper const& hcalHelperBc, + const ElectronHcalHelper* hcalHelperCone, + const ElectronHcalHelper* hcalHelperBc, const reco::VertexCollection& vertexCollection, reco::PhotonCollection& outputPhotonCollection, int& iSC, @@ -672,11 +679,14 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.sigmaEtaEta = sigmaEtaEta; showerShape.sigmaIetaIeta = sigmaIetaIeta; for (int id = 0; id < 7; ++id) { - showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / scRef->energy(); - showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / scRef->energy(); + showerShape.hcalOverEcal[id] = + (hcalHelperCone != nullptr) ? hcalHelperCone->hcalESum(*scRef, id + 1) / scRef->energy() : 0.f; + showerShape.hcalOverEcalBc[id] = + (hcalHelperBc != nullptr) ? hcalHelperBc->hcalESum(*scRef, id + 1) / scRef->energy() : 0.f; } - showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*scRef); - showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); + showerShape.invalidHcal = (hcalHelperBc != nullptr) ? !hcalHelperBc->hasActiveHcal(*scRef) : false; + if (hcalHelperBc != nullptr) + showerShape.hcalTowersBehindClusters = hcalHelperBc->hcalTowersBehindClusters(*scRef); /// fill extra shower shapes const float spp = (!edm::isFinite(locCov[2]) ? 0. : sqrt(locCov[2])); @@ -782,8 +792,10 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, // fill preshower shapes full5x5_showerShape.effSigmaRR = sigmaRR; for (int id = 0; id < 7; ++id) { - full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / full5x5_e5x5; - full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / full5x5_e5x5; + full5x5_showerShape.hcalOverEcal[id] = + (hcalHelperCone != nullptr) ? hcalHelperCone->hcalESum(*scRef, id + 1) / full5x5_e5x5 : 0.f; + full5x5_showerShape.hcalOverEcalBc[id] = + (hcalHelperBc != nullptr) ? hcalHelperBc->hcalESum(*scRef, id + 1) / full5x5_e5x5 : 0.f; } newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape); diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 3329ad93d329c..c63afbfe3982c 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -41,7 +41,9 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, endcapecalCollection_ = iC.consumes(conf.getParameter("endcapEcalRecHitCollection")); - hbheRecHitsTag_ = iC.consumes(conf.getParameter("HBHERecHitCollection")); + auto hbhetag = conf.getParameter("HBHERecHitCollection"); + if (not hbhetag.label().empty()) + hbheRecHitsTag_ = iC.consumes(hbhetag); caloGeometryToken_ = decltype(caloGeometryToken_){iC.esConsumes()}; hcalTopologyToken_ = decltype(hcalTopologyToken_){iC.esConsumes()}; @@ -164,7 +166,6 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, phofid.isEEDeeGap = isEEDeeGap; phofid.isEBEEGap = isEBEEGap; - auto const& hbheRecHits = e.get(hbheRecHitsTag_); auto const& caloGeometry = es.getData(caloGeometryToken_); auto const& hcalTopology = &es.getData(hcalTopologyToken_); auto const& hcalChannelQuality = &es.getData(hcalChannelQualityToken_); @@ -352,54 +353,58 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, useNumCrystals_); phoisolR2.ecalRecHitSumEt = EcalRecHitIsoB; - for (size_t id = 0; id < 7; ++id) { - phoisolR1.hcalRecHitSumEt[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id], - detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id], - id + 1); - - phoisolR2.hcalRecHitSumEt[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id], - id + 1); - - phoisolR1.hcalRecHitSumEtBc[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - 0., - id + 1); - - phoisolR2.hcalRecHitSumEtBc[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - 0., - id + 1); + if (not hbheRecHitsTag_.isUninitialized()) { + auto const& hbheRecHits = e.get(hbheRecHitsTag_); + + for (size_t id = 0; id < 7; ++id) { + phoisolR1.hcalRecHitSumEt[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id], + detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id], + id + 1); + + phoisolR2.hcalRecHitSumEt[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id], + id + 1); + + phoisolR1.hcalRecHitSumEtBc[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + 0., + id + 1); + + phoisolR2.hcalRecHitSumEtBc[id] = + calculateHcalRecHitIso(pho, + caloGeometry, + *hcalTopology, + *hcalChannelQuality, + *hcalSevLvlComputer, + towerMap, + hbheRecHits, + detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], + 0., + id + 1); + } } } From c99b4d150ba96fdcaa54a513c590b173d49f7463 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Mon, 10 May 2021 23:03:37 +0200 Subject: [PATCH 14/27] fix remaining non-running WFs by cmsbuild test --- RecoHI/Configuration/python/Reconstruction_hiPF_cff.py | 4 ++-- RecoHI/HiEgammaAlgos/python/HiElectronSequence_cff.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py b/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py index 0c1ce267f1b11..ee53f9d35e293 100644 --- a/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py +++ b/RecoHI/Configuration/python/Reconstruction_hiPF_cff.py @@ -26,8 +26,8 @@ #These are set for consistency w/ HiElectronSequence, but these cuts need to be studied gedGsfElectronsTmp.preselection.maxHOverEBarrelCone = 0.25 gedGsfElectronsTmp.preselection.maxHOverEEndcapsCone = 0.25 -gedGsfElectronsTmp.preselection.maxHOverEBarrelTower = 0.0 -gedGsfElectronsTmp.preselection.maxHOverEEndcapsTower = 0.0 +gedGsfElectronsTmp.preselection.maxHOverEBarrelBc = 0.0 +gedGsfElectronsTmp.preselection.maxHOverEEndcapsBc = 0.0 gedGsfElectronsTmp.preselection.maxEOverPBarrel = 2. gedGsfElectronsTmp.preselection.maxEOverPEndcaps = 2. diff --git a/RecoHI/HiEgammaAlgos/python/HiElectronSequence_cff.py b/RecoHI/HiEgammaAlgos/python/HiElectronSequence_cff.py index 51bcb1acce6b6..259fd7f9f714c 100644 --- a/RecoHI/HiEgammaAlgos/python/HiElectronSequence_cff.py +++ b/RecoHI/HiEgammaAlgos/python/HiElectronSequence_cff.py @@ -21,8 +21,8 @@ ecalDrivenGsfElectrons.preselection.maxHOverEBarrelCone = 0.25 ecalDrivenGsfElectrons.preselection.maxHOverEEndcapsCone = 0.25 -ecalDrivenGsfElectrons.preselection.maxHOverEBarrelTower = 0. -ecalDrivenGsfElectrons.preselection.maxHOverEEndcapsTower = 0. +ecalDrivenGsfElectrons.preselection.maxHOverEBarrelBc = 0. +ecalDrivenGsfElectrons.preselection.maxHOverEEndcapsBc = 0. ecalDrivenGsfElectrons.fillConvVtxFitProb = False From ffa720810e29a1aff2f60712afb037ee60282ef2 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Mon, 10 May 2021 23:17:47 +0200 Subject: [PATCH 15/27] fix typo --- RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc index d6873eee94ea1..147da0c948570 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc @@ -138,7 +138,7 @@ ConvertedPhotonProducer::ConvertedPhotonProducer(const edm::ParameterSet& config bcEndcapCollection_{consumes(config.getParameter("bcEndcapCollection"))}, scHybridBarrelProducer_{consumes(config.getParameter("scHybridBarrelProducer"))}, scIslandEndcapProducer_{consumes(config.getParameter("scIslandEndcapProducer"))}, - hbheRecHits_{consumes(config.getParameter("hbheRechits_"))}, + hbheRecHits_{consumes(config.getParameter("hbheRechits"))}, caloGeomToken_{esConsumes()}, mFToken_{esConsumes()}, transientTrackToken_{esConsumes( From c06de33a1c051f4af7021dad12ec6c94c36d198c Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 11 May 2021 00:21:16 +0200 Subject: [PATCH 16/27] typos on typos really??? --- RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc index 147da0c948570..cd45b8757e8f8 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc @@ -138,7 +138,7 @@ ConvertedPhotonProducer::ConvertedPhotonProducer(const edm::ParameterSet& config bcEndcapCollection_{consumes(config.getParameter("bcEndcapCollection"))}, scHybridBarrelProducer_{consumes(config.getParameter("scHybridBarrelProducer"))}, scIslandEndcapProducer_{consumes(config.getParameter("scIslandEndcapProducer"))}, - hbheRecHits_{consumes(config.getParameter("hbheRechits"))}, + hbheRecHits_{consumes(config.getParameter("hbheRecHits"))}, caloGeomToken_{esConsumes()}, mFToken_{esConsumes()}, transientTrackToken_{esConsumes( From bccd4810b927ddf1184a25c6c5cd7af8920e7940 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Thu, 20 May 2021 00:25:03 +0200 Subject: [PATCH 17/27] 7 -> size() --- RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc | 4 ++-- RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc | 4 ++-- RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc | 4 ++-- RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index dc9a2d915c774..c3d0d3e8bde03 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -339,7 +339,7 @@ reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco: const float scale = full5x5 ? showerShape.e5x5 : theClus->energy(); - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < showerShape.hcalOverEcal.size(); ++id) { showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*theClus, id + 1) / scale; showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*theClus, id + 1) / scale; } @@ -1100,7 +1100,7 @@ void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons, dr04.tkSumPtHEEP = eventData.tkIsolHEEP04Calc(*ele.gsfTrack()).ptSum; if (!EcalTools::isHGCalDet((DetId::Detector)region)) { - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < dr03.hcalRecHitSumEt.size(); ++id) { dr03.hcalRecHitSumEt[id] = eventData.hadIsolation03.getHcalEtSum(&ele, id + 1); dr03.hcalRecHitSumEtBc[id] = eventData.hadIsolation03Bc.getHcalEtSumBc(&ele, id + 1); diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 56b8804d7b058..35653ae0ab842 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -678,7 +678,7 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.maxEnergyXtal = maxXtal; showerShape.sigmaEtaEta = sigmaEtaEta; showerShape.sigmaIetaIeta = sigmaIetaIeta; - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < showerShape.hcalOverEcal.size(); ++id) { showerShape.hcalOverEcal[id] = (hcalHelperCone != nullptr) ? hcalHelperCone->hcalESum(*scRef, id + 1) / scRef->energy() : 0.f; showerShape.hcalOverEcalBc[id] = @@ -791,7 +791,7 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, } // fill preshower shapes full5x5_showerShape.effSigmaRR = sigmaRR; - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < full5x5_showerShape.hcalOverEcal.size(); ++id) { full5x5_showerShape.hcalOverEcal[id] = (hcalHelperCone != nullptr) ? hcalHelperCone->hcalESum(*scRef, id + 1) / full5x5_e5x5 : 0.f; full5x5_showerShape.hcalOverEcalBc[id] = diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index bca3651875d7b..664dadacf43f0 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -454,7 +454,7 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.maxEnergyXtal = maxXtal; showerShape.sigmaEtaEta = sigmaEtaEta; showerShape.sigmaIetaIeta = sigmaIetaIeta; - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < showerShape.hcalOverEcal.size(); ++id) { showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / scRef->energy(); showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / scRef->energy(); } @@ -470,7 +470,7 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, full5x5_showerShape.maxEnergyXtal = full5x5_maxXtal; full5x5_showerShape.sigmaEtaEta = full5x5_sigmaEtaEta; full5x5_showerShape.sigmaIetaIeta = full5x5_sigmaIetaIeta; - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < full5x5_showerShape.hcalOverEcal.size(); ++id) { full5x5_showerShape.hcalOverEcal[id] = hcalHelperCone.hcalESum(*scRef, id + 1) / full5x5_e5x5; full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / full5x5_e5x5; } diff --git a/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc b/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc index 5118608a414f9..f128e0dbe6a6a 100644 --- a/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc +++ b/RecoParticleFlow/PFProducer/plugins/PFPhotonTranslator.cc @@ -962,7 +962,7 @@ void PFPhotonTranslator::createPhotons(reco::VertexCollection &vertexCollection, showerShape.maxEnergyXtal = egPhotonRef_[iphot]->maxEnergyXtal(); showerShape.sigmaEtaEta = egPhotonRef_[iphot]->sigmaEtaEta(); showerShape.sigmaIetaIeta = egPhotonRef_[iphot]->sigmaIetaIeta(); - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < showerShape.hcalOverEcal.size(); ++id) { showerShape.hcalOverEcal[id] = egPhotonRef_[iphot]->hcalOverEcal(id + 1); } myPhoton.setShowerShapeVariables(showerShape); @@ -981,7 +981,7 @@ void PFPhotonTranslator::createPhotons(reco::VertexCollection &vertexCollection, myPhoton.setFiducialVolumeFlags(fiducialFlags); isolationVariables03.ecalRecHitSumEt = egPhotonRef_[iphot]->ecalRecHitSumEtConeDR03(); - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < isolationVariables03.hcalRecHitSumEt.size(); ++id) { isolationVariables03.hcalRecHitSumEt[id] = egPhotonRef_[iphot]->hcalTowerSumEtConeDR03(id + 1); } isolationVariables03.trkSumPtSolidCone = egPhotonRef_[iphot]->trkSumPtSolidConeDR03(); @@ -989,7 +989,7 @@ void PFPhotonTranslator::createPhotons(reco::VertexCollection &vertexCollection, isolationVariables03.nTrkSolidCone = egPhotonRef_[iphot]->nTrkSolidConeDR03(); isolationVariables03.nTrkHollowCone = egPhotonRef_[iphot]->nTrkHollowConeDR03(); isolationVariables04.ecalRecHitSumEt = egPhotonRef_[iphot]->ecalRecHitSumEtConeDR04(); - for (int id = 0; id < 7; ++id) { + for (uint id = 0; id < isolationVariables04.hcalRecHitSumEt.size(); ++id) { isolationVariables04.hcalRecHitSumEt[id] = egPhotonRef_[iphot]->hcalTowerSumEtConeDR04(id + 1); } isolationVariables04.trkSumPtSolidCone = egPhotonRef_[iphot]->trkSumPtSolidConeDR04(); From 81856fa545a1b5b031028902ad6d076187b4bb20 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Thu, 20 May 2021 00:41:42 +0200 Subject: [PATCH 18/27] duplicate include --- RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc index cd45b8757e8f8..d38011fcceaad 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc @@ -17,7 +17,6 @@ #include "DataFormats/TrackReco/interface/TrackExtra.h" #include "DataFormats/VertexReco/interface/Vertex.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/stream/EDProducer.h" From 41bbe4d84a2c09b06db1d048bdc1b27f6b688f43 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Thu, 20 May 2021 00:46:25 +0200 Subject: [PATCH 19/27] add missing dependencies for newly introduced includes --- RecoEgamma/EgammaElectronAlgos/BuildFile.xml | 1 + RecoEgamma/EgammaIsolationAlgos/BuildFile.xml | 2 ++ RecoEgamma/PhotonIdentification/BuildFile.xml | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/RecoEgamma/EgammaElectronAlgos/BuildFile.xml b/RecoEgamma/EgammaElectronAlgos/BuildFile.xml index 5f317a9fc5f8b..744ca199e537c 100644 --- a/RecoEgamma/EgammaElectronAlgos/BuildFile.xml +++ b/RecoEgamma/EgammaElectronAlgos/BuildFile.xml @@ -13,6 +13,7 @@ + diff --git a/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml b/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml index 99851dede1113..0e0ddaa7c8867 100644 --- a/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml +++ b/RecoEgamma/EgammaIsolationAlgos/BuildFile.xml @@ -1,5 +1,6 @@ + @@ -13,6 +14,7 @@ + diff --git a/RecoEgamma/PhotonIdentification/BuildFile.xml b/RecoEgamma/PhotonIdentification/BuildFile.xml index 29d94586d1bed..df2125cded3cc 100644 --- a/RecoEgamma/PhotonIdentification/BuildFile.xml +++ b/RecoEgamma/PhotonIdentification/BuildFile.xml @@ -2,6 +2,8 @@ + + @@ -14,10 +16,12 @@ + + From 55f1012b54c8b9c170beb142ee03c430e2afdd3f Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Mon, 31 May 2021 17:15:01 +0200 Subject: [PATCH 20/27] remove duplicate line --- .../EgammaElectronProducers/plugins/ElectronSeedProducer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc index c0119281bf6e3..ec5fa1e0cabcf 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc @@ -83,7 +83,6 @@ ElectronSeedProducer::ElectronSeedProducer(const edm::ParameterSet& conf) hcalCfg.onlyBehindCluster = false; hcalCfg.checkHcalStatus = false; - //hcalCfg.hbheRecHits = consumes(conf.getParameter("hbheRecHits")); hcalCfg.hbheRecHits = consumes(conf.getParameter("hbheRecHits")); hcalCfg.eThresHB = conf.getParameter>("recHitEThresholdHB"); From 0046171b357737387dff98fbbaab26b1c002fe5b Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Mon, 31 May 2021 19:20:46 +0200 Subject: [PATCH 21/27] remove 4, 7 and add typedef in EgammaHcalIso --- .../interface/ElectronHcalHelper.h | 4 +-- .../src/ElectronHcalHelper.cc | 8 ++--- .../src/GsfElectronAlgo.cc | 32 +++++++++---------- .../plugins/ElectronSeedProducer.cc | 4 +-- .../plugins/GsfElectronProducer.cc | 8 ++--- .../interface/EgammaHcalIsolation.h | 26 ++++++++------- .../src/EgammaHcalIsolation.cc | 18 +++++------ .../src/ConversionTrackCandidateProducer.cc | 4 +-- .../src/ConvertedPhotonProducer.cc | 4 +-- .../src/GEDPhotonProducer.cc | 8 ++--- .../src/PhotonProducer.cc | 8 ++--- .../interface/PhotonIsolationCalculator.h | 4 +-- .../src/PhotonIsolationCalculator.cc | 8 ++--- 13 files changed, 69 insertions(+), 67 deletions(-) diff --git a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h index 5a9306914876d..dbbf38d172694 100644 --- a/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h +++ b/RecoEgamma/EgammaElectronAlgos/interface/ElectronHcalHelper.h @@ -32,9 +32,9 @@ class ElectronHcalHelper { // specific parameters if use rechits edm::EDGetTokenT hbheRecHits; - std::array eThresHB; + EgammaHcalIsolation::arrayHB eThresHB; int maxSeverityHB; - std::array eThresHE; + EgammaHcalIsolation::arrayHE eThresHE; int maxSeverityHE; }; diff --git a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc index aa2edca7a3b10..44ecc256bc4b1 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/ElectronHcalHelper.cc @@ -33,10 +33,10 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, 0., cfg_.eThresHB, - std::array{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, cfg_.maxSeverityHB, cfg_.eThresHE, - std::array{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, cfg_.maxSeverityHE, evt.get(cfg_.hbheRecHits), eventSetup.getHandle(caloGeometryToken_), @@ -50,10 +50,10 @@ void ElectronHcalHelper::beginEvent(const edm::Event& evt, const edm::EventSetup EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, 0., cfg_.eThresHB, - std::array{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, cfg_.maxSeverityHB, cfg_.eThresHE, - std::array{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, cfg_.maxSeverityHE, evt.get(cfg_.hbheRecHits), eventSetup.getHandle(caloGeometryToken_), diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index c3d0d3e8bde03..d70506f110a71 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -452,11 +452,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, egHcalIsoConeSizeOutSmall, EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeIn, - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, @@ -475,11 +475,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, egHcalIsoConeSizeOutLarge, EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, egHcalIsoConeSizeIn, - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, @@ -498,11 +498,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, egHcalIsoConeSizeOutSmall, EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, 0., - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, @@ -521,11 +521,11 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, egHcalIsoConeSizeOutLarge, EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, 0., - std::array{{0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, hcalHelperCone_.maxSeverityHB(), - std::array{{0., 0., 0., 0., 0., 0., 0.}}, - std::array{{egHcalIsoPtMin, + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, diff --git a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc index ec5fa1e0cabcf..158f5856147ad 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc @@ -85,9 +85,9 @@ ElectronSeedProducer::ElectronSeedProducer(const edm::ParameterSet& conf) hcalCfg.hbheRecHits = consumes(conf.getParameter("hbheRecHits")); - hcalCfg.eThresHB = conf.getParameter>("recHitEThresholdHB"); + hcalCfg.eThresHB = conf.getParameter("recHitEThresholdHB"); hcalCfg.maxSeverityHB = conf.getParameter("maxHcalRecHitSeverity"); - hcalCfg.eThresHE = conf.getParameter>("recHitEThresholdHE"); + hcalCfg.eThresHE = conf.getParameter("recHitEThresholdHE"); hcalCfg.maxSeverityHE = hcalCfg.maxSeverityHB; } hcalHelper_ = std::make_unique(hcalCfg, consumesCollector()); diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index 4b9cb3d9dd54b..a38b10481c3e8 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -341,9 +341,9 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf //hcalCfg_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); hcalCfg_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); - hcalCfg_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); + hcalCfg_.eThresHB = cfg.getParameter("recHitEThresholdHB"); hcalCfg_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); - hcalCfg_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); + hcalCfg_.eThresHE = cfg.getParameter("recHitEThresholdHE"); hcalCfg_.maxSeverityHE = hcalCfg_.maxSeverityHB; } @@ -354,9 +354,9 @@ GsfElectronProducer::GsfElectronProducer(const edm::ParameterSet& cfg, const Gsf //hcalCfgBc_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); hcalCfgBc_.hbheRecHits = consumes(cfg.getParameter("hbheRecHits")); - hcalCfgBc_.eThresHB = cfg.getParameter>("recHitEThresholdHB"); + hcalCfgBc_.eThresHB = cfg.getParameter("recHitEThresholdHB"); hcalCfgBc_.maxSeverityHB = cfg.getParameter("maxHcalRecHitSeverity"); - hcalCfgBc_.eThresHE = cfg.getParameter>("recHitEThresholdHE"); + hcalCfgBc_.eThresHE = cfg.getParameter("recHitEThresholdHE"); hcalCfgBc_.maxSeverityHE = hcalCfgBc_.maxSeverityHB; hcalRun2EffDepth_ = cfg.getParameter("hcalRun2EffDepth"); diff --git a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h index b571a9c6fdb92..a7d138ec4ace5 100644 --- a/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h +++ b/RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h @@ -38,17 +38,19 @@ double scaleToEt(const double &eta); class EgammaHcalIsolation { public: enum class InclusionRule : int { withinConeAroundCluster = 0, isBehindClusterSeed = 1 }; + using arrayHB = std::array; + using arrayHE = std::array; // constructors EgammaHcalIsolation(InclusionRule extIncRule, double extRadius, InclusionRule intIncRule, double intRadius, - const std::array &eThresHB, - const std::array &etThresHB, + const arrayHB &eThresHB, + const arrayHB &etThresHB, int maxSeverityHB, - const std::array &eThresHE, - const std::array &etThresHE, + const arrayHE &eThresHE, + const arrayHE &etThresHE, int maxSeverityHE, const HBHERecHitCollection &mhbhe, edm::ESHandle caloGeometry, @@ -61,11 +63,11 @@ class EgammaHcalIsolation { double extRadius, InclusionRule intIncRule, double intRadius, - const std::array &eThresHB, - const std::array &etThresHB, + const arrayHB &eThresHB, + const arrayHB &etThresHB, int maxSeverityHB, - const std::array &eThresHE, - const std::array &etThresHE, + const arrayHE &eThresHE, + const arrayHE &etThresHE, int maxSeverityHE, const HBHERecHitCollection &mhbhe, const CaloGeometry &caloGeometry, @@ -153,12 +155,12 @@ class EgammaHcalIsolation { InclusionRule intIncRule_; double intRadius_; - std::array eThresHB_; - std::array etThresHB_; + arrayHB eThresHB_; + arrayHB etThresHB_; int maxSeverityHB_; - std::array eThresHE_; - std::array etThresHE_; + arrayHE eThresHE_; + arrayHE etThresHE_; int maxSeverityHE_; const HBHERecHitCollection &mhbhe_; diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc index 0957722d5f515..2e12821e618fe 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc @@ -24,11 +24,11 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, double extRadius, InclusionRule intIncRule, double intRadius, - const std::array &eThresHB, - const std::array &etThresHB, + const arrayHB &eThresHB, + const arrayHB &etThresHB, int maxSeverityHB, - const std::array &eThresHE, - const std::array &etThresHE, + const arrayHE &eThresHE, + const arrayHE &etThresHE, int maxSeverityHE, const HBHERecHitCollection &mhbhe, edm::ESHandle caloGeometry, @@ -73,11 +73,11 @@ EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule, double extRadius, InclusionRule intIncRule, double intRadius, - const std::array &eThresHB, - const std::array &etThresHB, + const arrayHB &eThresHB, + const arrayHB &etThresHB, int maxSeverityHB, - const std::array &eThresHE, - const std::array &etThresHE, + const arrayHE &eThresHE, + const arrayHE &etThresHE, int maxSeverityHE, const HBHERecHitCollection &mhbhe, const CaloGeometry &caloGeometry, @@ -135,7 +135,7 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const int hd = hid.depth(), he = hid.ieta(), hp = hid.iphi(); const int h1 = hd - 1; - if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > 4)) or (hid.subdet() == HcalEndcap and (hd < 1 or hd > 7))) + if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > int(eThresHB_.size()))) or (hid.subdet() == HcalEndcap and (hd < 1 or hd > int(eThresHE_.size())))) edm::LogWarning("EgammaHcalIsolation") << " hit in subdet " << hid.subdet() << " has an unaccounted for depth of " << hd << "!!"; diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc index 9b6ec5c17efb0..18d88edaea9e4 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc @@ -195,9 +195,9 @@ ConversionTrackCandidateProducer::ConversionTrackCandidateProducer(const edm::Pa cfgCone.hbheRecHits = hbheRecHits_; - cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.eThresHB = config.getParameter("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.eThresHE = config.getParameter("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; } diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc index d38011fcceaad..4007962119c4b 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConvertedPhotonProducer.cc @@ -167,9 +167,9 @@ ConvertedPhotonProducer::ConvertedPhotonProducer(const edm::ParameterSet& config cfgCone.hbheRecHits = hbheRecHits_; - cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.eThresHB = config.getParameter("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.eThresHE = config.getParameter("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; } diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 35653ae0ab842..1599d763b0e03 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -288,9 +288,9 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) cfgCone.hbheRecHits = hbheRecHits_; - cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.eThresHB = config.getParameter("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.eThresHE = config.getParameter("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; } cfgBc.hOverEConeSize = 0.; @@ -299,9 +299,9 @@ GEDPhotonProducer::GEDPhotonProducer(const edm::ParameterSet& config) cfgBc.hbheRecHits = hbheRecHits_; - cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgBc.eThresHB = config.getParameter("recHitEThresholdHB"); cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgBc.eThresHE = config.getParameter("recHitEThresholdHE"); cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index 664dadacf43f0..3b1b303f6217b 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -161,9 +161,9 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo cfgCone.hbheRecHits = hbheRecHits_; - cfgCone.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgCone.eThresHB = config.getParameter("recHitEThresholdHB"); cfgCone.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgCone.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgCone.eThresHE = config.getParameter("recHitEThresholdHE"); cfgCone.maxSeverityHE = cfgCone.maxSeverityHB; } @@ -173,9 +173,9 @@ PhotonProducer::PhotonProducer(const edm::ParameterSet& config) : photonEnergyCo cfgBc.hbheRecHits = hbheRecHits_; - cfgBc.eThresHB = config.getParameter>("recHitEThresholdHB"); + cfgBc.eThresHB = config.getParameter("recHitEThresholdHB"); cfgBc.maxSeverityHB = config.getParameter("maxHcalRecHitSeverity"); - cfgBc.eThresHE = config.getParameter>("recHitEThresholdHE"); + cfgBc.eThresHE = config.getParameter("recHitEThresholdHE"); cfgBc.maxSeverityHE = cfgBc.maxSeverityHB; hcalHelperCone_ = std::make_unique(cfgCone, consumesCollector()); diff --git a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h index 64c4bdc3b8f8d..437ae038f2f5b 100644 --- a/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h +++ b/RecoEgamma/PhotonIdentification/interface/PhotonIsolationCalculator.h @@ -129,8 +129,8 @@ class PhotonIsolationCalculator { std::array hcalIsoInnerRadBEE_; std::array hcalIsoOuterRadBEE_; - std::array hcalIsoEThresHB_; - std::array hcalIsoEThresHE_; + EgammaHcalIsolation::arrayHB hcalIsoEThresHB_; + EgammaHcalIsolation::arrayHE hcalIsoEThresHE_; int maxHcalSeverity_; std::vector flagsEB_; diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index c63afbfe3982c..05a2a5432940c 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -138,8 +138,8 @@ void PhotonIsolationCalculator::setup(const edm::ParameterSet& conf, severityExclEB_ = severitiesEB; severityExclEE_ = severitiesEE; - hcalIsoEThresHB_ = conf.getParameter>("recHitEThresholdHB"); - hcalIsoEThresHE_ = conf.getParameter>("recHitEThresholdHE"); + hcalIsoEThresHB_ = conf.getParameter("recHitEThresholdHB"); + hcalIsoEThresHE_ = conf.getParameter("recHitEThresholdHE"); maxHcalSeverity_ = conf.getParameter("maxHcalRecHitSeverity"); } @@ -553,8 +553,8 @@ double PhotonIsolationCalculator::calculateHcalRecHitIso(const reco::Photon* pho double RCone, double RConeInner, int depth) const { - const std::array e04{{0., 0., 0., 0.}}; - const std::array e07{{0., 0., 0., 0., 0., 0., 0.}}; + const EgammaHcalIsolation::arrayHB e04{{0., 0., 0., 0.}}; + const EgammaHcalIsolation::arrayHE e07{{0., 0., 0., 0., 0., 0., 0.}}; if constexpr (isoBC) { auto hcaliso = EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, From 6663fd59f1e6fea90283eff671abcaf6f939535f Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 1 Jun 2021 00:50:46 +0200 Subject: [PATCH 22/27] revert histogram name change so that DQM can compare pre and post PR --- DQMOffline/EGamma/plugins/ElectronAnalyzer.cc | 20 +++--- DQMOffline/EGamma/plugins/ElectronAnalyzer.h | 12 ++-- .../plugins/ElectronTagProbeAnalyzer.cc | 20 +++--- .../EGamma/plugins/ElectronTagProbeAnalyzer.h | 12 ++-- RecoEgamma/Examples/plugins/DQMAnalyzer.cc | 56 ++++++++-------- .../plugins/GsfElectronDataAnalyzer.cc | 58 ++++++++--------- .../plugins/GsfElectronFakeAnalyzer.cc | 56 ++++++++-------- .../Examples/plugins/GsfElectronMCAnalyzer.cc | 64 +++++++++---------- .../plugins/GsfElectronMCFakeAnalyzer.cc | 56 ++++++++-------- 9 files changed, 177 insertions(+), 177 deletions(-) diff --git a/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc b/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc index 9e89ce2118ba3..5d77263fff6b8 100644 --- a/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ElectronAnalyzer.cc @@ -440,15 +440,15 @@ void ElectronAnalyzer::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const "EcalIsoSum (GeV)", "Events", "ELE_LOGY E1 P"); - h1_hcalRecHitSumEt_dr03 = bookH1(iBooker, - "hcalRecHitSumEt_dr03", - "hcal isolation sum, dR=0.3", - 100, - 0.0, - 20., - "HcalIsoSum (GeV)", - "Events", - "ELE_LOGY E1 P"); + h1_hcalTowerSumEt_dr03 = bookH1(iBooker, + "hcalTowerSumEt_dr03", + "hcal isolation sum, dR=0.3", + 100, + 0.0, + 20., + "HcalIsoSum (GeV)", + "Events", + "ELE_LOGY E1 P"); // pf isolation h1_PFch_dr03 = bookH1(iBooker, @@ -691,7 +691,7 @@ void ElectronAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& // isolation h1_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt()); h1_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt()); - h1_hcalRecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt()); + h1_hcalTowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt()); // PF isolation GsfElectron::PflowIsolationVariables pfIso = gsfIter->pfIsolationVariables(); diff --git a/DQMOffline/EGamma/plugins/ElectronAnalyzer.h b/DQMOffline/EGamma/plugins/ElectronAnalyzer.h index 46b82959f2a40..5468afc8f2a11 100644 --- a/DQMOffline/EGamma/plugins/ElectronAnalyzer.h +++ b/DQMOffline/EGamma/plugins/ElectronAnalyzer.h @@ -313,17 +313,17 @@ class ElectronAnalyzer : public ElectronDqmAnalyzerBase { // isolation MonitorElement *h1_tkSumPt_dr03; MonitorElement *h1_ecalRecHitSumEt_dr03; - MonitorElement *h1_hcalRecHitSumEt_dr03; + MonitorElement *h1_hcalTowerSumEt_dr03; MonitorElement *h1_PFch_dr03; MonitorElement *h1_PFem_dr03; MonitorElement *h1_PFnh_dr03; - // MonitorElement * h1_hcalDepth1RecHitSumEt_dr03 ; - // MonitorElement * h1_hcalDepth2RecHitSumEt_dr03 ; + // MonitorElement * h1_hcalDepth1TowerSumEt_dr03 ; + // MonitorElement * h1_hcalDepth2TowerSumEt_dr03 ; // MonitorElement * h1_tkSumPt_dr04 ; // MonitorElement * h1_ecalRecHitSumEt_dr04 ; - // MonitorElement * h1_hcalRecHitSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth1RecHitSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth2RecHitSumEt_dr04 ; + // MonitorElement * h1_hcalTowerSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth1TowerSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth2TowerSumEt_dr04 ; // di-electron mass MonitorElement *h1_mee; diff --git a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc index a5c55531c7900..885bb0f982249 100644 --- a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc +++ b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.cc @@ -304,15 +304,15 @@ void ElectronTagProbeAnalyzer::bookHistograms(DQMStore::IBooker& iBooker, edm::R "EcalIsoSum, cone 0.3 (GeV)", "Events", "ELE_LOGY E1 P"); - h1_hcalRecHitSumEt_dr03 = bookH1(iBooker, - "hcalRecHitSumEt_dr03", - "hcal isolation sum, dR=0.3", - 100, - 0.0, - 20., - "HcalIsoSum, cone 0.3 (GeV)", - "Events", - "ELE_LOGY E1 P"); + h1_hcalTowerSumEt_dr03 = bookH1(iBooker, + "hcalTowerSumEt_dr03", + "hcal isolation sum, dR=0.3", + 100, + 0.0, + 20., + "HcalIsoSum, cone 0.3 (GeV)", + "Events", + "ELE_LOGY E1 P"); // di-electron mass setBookIndex(200); @@ -555,7 +555,7 @@ void ElectronTagProbeAnalyzer::analyze(const edm::Event& iEvent, const edm::Even // isolation h1_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h1_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h1_hcalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt()); + h1_hcalTowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt()); // inv Mass with opposite sign bool invMassTTAlreadyFilled = false; diff --git a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h index cf41bcef377f7..62e4671e6b686 100644 --- a/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h +++ b/DQMOffline/EGamma/plugins/ElectronTagProbeAnalyzer.h @@ -303,14 +303,14 @@ class ElectronTagProbeAnalyzer : public ElectronDqmAnalyzerBase { // isolation MonitorElement *h1_tkSumPt_dr03; MonitorElement *h1_ecalRecHitSumEt_dr03; - MonitorElement *h1_hcalRecHitSumEt_dr03; - // MonitorElement * h1_hcalDepth1RecHitSumEt_dr03 ; - // MonitorElement * h1_hcalDepth2RecHitSumEt_dr03 ; + MonitorElement *h1_hcalTowerSumEt_dr03; + // MonitorElement * h1_hcalDepth1TowerSumEt_dr03 ; + // MonitorElement * h1_hcalDepth2TowerSumEt_dr03 ; // MonitorElement * h1_tkSumPt_dr04 ; // MonitorElement * h1_ecalRecHitSumEt_dr04 ; - // MonitorElement * h1_hcalRecHitSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth1RecHitSumEt_dr04 ; - //// MonitorElement * h1_hcalDepth2RecHitSumEt_dr04 ; + // MonitorElement * h1_hcalTowerSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth1TowerSumEt_dr04 ; + //// MonitorElement * h1_hcalDepth2TowerSumEt_dr04 ; // di-electron mass MonitorElement *h1_mee; diff --git a/RecoEgamma/Examples/plugins/DQMAnalyzer.cc b/RecoEgamma/Examples/plugins/DQMAnalyzer.cc index 1c2af96df2529..0419e7cf0a677 100644 --- a/RecoEgamma/Examples/plugins/DQMAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/DQMAnalyzer.cc @@ -273,12 +273,12 @@ class DQMAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth1TowerSumEt_dr03; + TH1F *h_ele_hcalDepth2TowerSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth1TowerSumEt_dr04; + TH1F *h_ele_hcalDepth2TowerSumEt_dr04; TH1F *h_ele_mee_os; }; @@ -650,16 +650,16 @@ void DQMAnalyzer::beginJob() { h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); //================================================== // T&P @@ -830,27 +830,27 @@ void DQMAnalyzer::endJob() { h_ele_tkSumPt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr03->Write(); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1RecHitSumEt_dr03->Write(); - h_ele_hcalDepth2RecHitSumEt_dr03->Write(); + h_ele_hcalDepth1TowerSumEt_dr03->Write(); + h_ele_hcalDepth2TowerSumEt_dr03->Write(); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1RecHitSumEt_dr04->Write(); - h_ele_hcalDepth2RecHitSumEt_dr04->Write(); + h_ele_hcalDepth1TowerSumEt_dr04->Write(); + h_ele_hcalDepth2TowerSumEt_dr04->Write(); } void DQMAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -967,12 +967,12 @@ void DQMAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetu h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(2)); } // association matching object-reco electrons diff --git a/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc index 48b4ac200fc5e..0a8d5d34857aa 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronDataAnalyzer.cc @@ -335,12 +335,12 @@ class GsfElectronDataAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth1TowerSumEt_dr03; + TH1F *h_ele_hcalDepth2TowerSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth1TowerSumEt_dr04; + TH1F *h_ele_hcalDepth2TowerSumEt_dr04; // electron selection double minEt_; @@ -1222,16 +1222,16 @@ void GsfElectronDataAnalyzer::beginJob() { // isolation h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "trk isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.); @@ -1835,24 +1835,24 @@ void GsfElectronDataAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr03->Write(); - h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr03->Write(); + h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr03->Write(); + h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr04->Write(); - h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr04->Write(); + h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr04->Write(); + h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr04->Write(); } void GsfElectronDataAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -2190,12 +2190,12 @@ void GsfElectronDataAnalyzer::analyze(const edm::Event &iEvent, const edm::Event h_ele_tkSumPt_dr03->Fill(gsfIter->dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(gsfIter->dr03EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr03->Fill(gsfIter->dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(gsfIter->dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(gsfIter->dr04EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr04->Fill(gsfIter->dr04HcalTowerSumEt(2)); float enrj1 = gsfIter->superCluster()->energy(); // mee diff --git a/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc index 08c74649f9c4c..3a23b54e65d85 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronFakeAnalyzer.cc @@ -364,12 +364,12 @@ class GsfElectronFakeAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth1TowerSumEt_dr03; + TH1F *h_ele_hcalDepth2TowerSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth1TowerSumEt_dr04; + TH1F *h_ele_hcalDepth2TowerSumEt_dr04; std::string outputFile_; edm::InputTag electronCollection_; @@ -1366,16 +1366,16 @@ void GsfElectronFakeAnalyzer::beginJob() { // isolation h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.); @@ -2096,24 +2096,24 @@ void GsfElectronFakeAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr03->Write(); - h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr03->Write(); + h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr03->Write(); + h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr04->Write(); - h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr04->Write(); + h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr04->Write(); + h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr04->Write(); } void GsfElectronFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -2592,12 +2592,12 @@ void GsfElectronFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::Event h_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); } // gsf electron found diff --git a/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc index 06693961a9238..efceb89903023 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronMCAnalyzer.cc @@ -429,12 +429,12 @@ class GsfElectronMCAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth1TowerSumEt_dr03; + TH1F *h_ele_hcalDepth2TowerSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth1TowerSumEt_dr04; + TH1F *h_ele_hcalDepth2TowerSumEt_dr04; std::string outputFile_; edm::InputTag electronCollection_; @@ -1836,22 +1836,22 @@ void GsfElectronMCAnalyzer::beginJob() { h_ele_tkSumPt_dr03->Sumw2(); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03->Sumw2(); - h_ele_hcalDepth1RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr03->Sumw2(); - h_ele_hcalDepth2RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr03->Sumw2(); + h_ele_hcalDepth1TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr03->Sumw2(); + h_ele_hcalDepth2TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr03->Sumw2(); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "tk isolation sum, dR=0.4", 100, 0.0, 20.); h_ele_tkSumPt_dr04->Sumw2(); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04->Sumw2(); - h_ele_hcalDepth1RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr04->Sumw2(); - h_ele_hcalDepth2RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr04->Sumw2(); + h_ele_hcalDepth1TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr04->Sumw2(); + h_ele_hcalDepth2TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr04->Sumw2(); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode of GSF components", 100, 0., 1.); @@ -2840,24 +2840,24 @@ void GsfElectronMCAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr03->Write(); - h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr03->Write(); + h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr03->Write(); + h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr04->Write(); - h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr04->Write(); + h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr04->Write(); + h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr04->Write(); } GsfElectronMCAnalyzer::~GsfElectronMCAnalyzer() { @@ -3581,12 +3581,12 @@ void GsfElectronMCAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSe h_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); } // gsf electron found diff --git a/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc b/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc index b3498acb04cda..9c0d5fbaea162 100644 --- a/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc +++ b/RecoEgamma/Examples/plugins/GsfElectronMCFakeAnalyzer.cc @@ -404,12 +404,12 @@ class GsfElectronMCFakeAnalyzer : public edm::one::EDAnalyzer<> { TH1F *h_ele_tkSumPt_dr03; TH1F *h_ele_ecalRecHitSumEt_dr03; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr03; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr03; + TH1F *h_ele_hcalDepth1TowerSumEt_dr03; + TH1F *h_ele_hcalDepth2TowerSumEt_dr03; TH1F *h_ele_tkSumPt_dr04; TH1F *h_ele_ecalRecHitSumEt_dr04; - TH1F *h_ele_hcalDepth1RecHitSumEt_dr04; - TH1F *h_ele_hcalDepth2RecHitSumEt_dr04; + TH1F *h_ele_hcalDepth1TowerSumEt_dr04; + TH1F *h_ele_hcalDepth2TowerSumEt_dr04; }; #include "FWCore/Framework/interface/MakerMacros.h" @@ -1352,16 +1352,16 @@ void GsfElectronMCFakeAnalyzer::beginJob() { // isolation h_ele_tkSumPt_dr03 = new TH1F("h_ele_tkSumPt_dr03", "tk isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr03 = new TH1F("h_ele_ecalRecHitSumEt_dr03", "ecal isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr03 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr03", "hcal depth1 isolation sum, dR=0.3", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr03 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr03", "hcal depth2 isolation sum, dR=0.3", 100, 0.0, 20.); h_ele_tkSumPt_dr04 = new TH1F("h_ele_tkSumPt_dr04", "hcal isolation sum", 100, 0.0, 20.); h_ele_ecalRecHitSumEt_dr04 = new TH1F("h_ele_ecalRecHitSumEt_dr04", "ecal isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth1RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth1RecHitSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); - h_ele_hcalDepth2RecHitSumEt_dr04 = - new TH1F("h_ele_hcalDepth2RecHitSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth1TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth1TowerSumEt_dr04", "hcal depth1 isolation sum, dR=0.4", 100, 0.0, 20.); + h_ele_hcalDepth2TowerSumEt_dr04 = + new TH1F("h_ele_hcalDepth2TowerSumEt_dr04", "hcal depth2 isolation sum, dR=0.4", 100, 0.0, 20.); // fbrem h_ele_fbrem = new TH1F("h_ele_fbrem", "ele brem fraction, mode", 100, 0., 1.); @@ -2083,24 +2083,24 @@ void GsfElectronMCFakeAnalyzer::endJob() { h_ele_ecalRecHitSumEt_dr03->GetXaxis()->SetTitle("EcalIsoSum, cone 0.3 (GeV)"); h_ele_ecalRecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr03->Write(); - h_ele_hcalDepth1RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr03->Write(); - h_ele_hcalDepth2RecHitSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr03->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr03->Write(); + h_ele_hcalDepth1TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr03->Write(); + h_ele_hcalDepth2TowerSumEt_dr03->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.3 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr03->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr03->Write(); h_ele_tkSumPt_dr04->GetXaxis()->SetTitle("TkIsoSum, cone 0.4 (GeV/c)"); h_ele_tkSumPt_dr04->GetYaxis()->SetTitle("Events"); h_ele_tkSumPt_dr04->Write(); h_ele_ecalRecHitSumEt_dr04->GetXaxis()->SetTitle("EcalIsoSum, cone 0.4 (GeV)"); h_ele_ecalRecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); h_ele_ecalRecHitSumEt_dr04->Write(); - h_ele_hcalDepth1RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth1RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth1RecHitSumEt_dr04->Write(); - h_ele_hcalDepth2RecHitSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); - h_ele_hcalDepth2RecHitSumEt_dr04->GetYaxis()->SetTitle("Events"); - h_ele_hcalDepth2RecHitSumEt_dr04->Write(); + h_ele_hcalDepth1TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal1IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth1TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth1TowerSumEt_dr04->Write(); + h_ele_hcalDepth2TowerSumEt_dr04->GetXaxis()->SetTitle("Hcal2IsoSum, cone 0.4 (GeV)"); + h_ele_hcalDepth2TowerSumEt_dr04->GetYaxis()->SetTitle("Events"); + h_ele_hcalDepth2TowerSumEt_dr04->Write(); } void GsfElectronMCFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { @@ -2578,12 +2578,12 @@ void GsfElectronMCFakeAnalyzer::analyze(const edm::Event &iEvent, const edm::Eve h_ele_tkSumPt_dr03->Fill(bestGsfElectron.dr03TkSumPt()); h_ele_ecalRecHitSumEt_dr03->Fill(bestGsfElectron.dr03EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr03->Fill(bestGsfElectron.dr03HcalTowerSumEt(2)); h_ele_tkSumPt_dr04->Fill(bestGsfElectron.dr04TkSumPt()); h_ele_ecalRecHitSumEt_dr04->Fill(bestGsfElectron.dr04EcalRecHitSumEt()); - h_ele_hcalDepth1RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); - h_ele_hcalDepth2RecHitSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); + h_ele_hcalDepth1TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(1)); + h_ele_hcalDepth2TowerSumEt_dr04->Fill(bestGsfElectron.dr04HcalTowerSumEt(2)); } // gsf electron found From abdc6249a77a53c5ae6331622014719e8caa9095 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 1 Jun 2021 00:52:36 +0200 Subject: [PATCH 23/27] even less 4, 7 --- RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc index 2e12821e618fe..285b8d479e903 100644 --- a/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc +++ b/RecoEgamma/EgammaIsolationAlgos/src/EgammaHcalIsolation.cc @@ -135,7 +135,8 @@ double EgammaHcalIsolation::goodHitEnergy(const GlobalPoint &pclu, const int hd = hid.depth(), he = hid.ieta(), hp = hid.iphi(); const int h1 = hd - 1; - if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > int(eThresHB_.size()))) or (hid.subdet() == HcalEndcap and (hd < 1 or hd > int(eThresHE_.size())))) + if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > int(eThresHB_.size()))) or + (hid.subdet() == HcalEndcap and (hd < 1 or hd > int(eThresHE_.size())))) edm::LogWarning("EgammaHcalIsolation") << " hit in subdet " << hid.subdet() << " has an unaccounted for depth of " << hd << "!!"; From c34db11227f5c0004cc9ab6d6a75a613d32a9968 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 1 Jun 2021 00:55:35 +0200 Subject: [PATCH 24/27] backward compatibility without ioread --- .../EgammaCandidates/interface/GsfElectron.h | 131 ++++++++---- .../EgammaCandidates/interface/Photon.h | 142 +++++++++---- .../EgammaCandidates/src/classes_def.xml | 83 +------- .../src/GsfElectronAlgo.cc | 189 +++++++++--------- .../src/GEDPhotonProducer.cc | 2 + .../src/PhotonProducer.cc | 2 + .../src/PhotonIsolationCalculator.cc | 3 + 7 files changed, 305 insertions(+), 247 deletions(-) diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index f37025c6ae659..6e3efd1151aeb 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -363,11 +363,17 @@ namespace reco { float e2x5Max; // energy inside 2x5 in etaxphi around the seed Xtal (max bwt the 2 possible sums) float e5x5; // energy inside 5x5 in etaxphi around the seed Xtal float r9; // ratio of the 3x3 energy and supercluster energy - std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) + float hcalDepth1OverEcal; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers within a cone) + float hcalDepth2OverEcal; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers within a cone) + float hcalDepth1OverEcalBc; // run2 hcal over ecal seed cluster energy using 1st hcal depth (using hcal towers behind clusters) + float hcalDepth2OverEcalBc; // run2 hcal over ecal seed cluster energy using 2nd hcal depth (using hcal towers behind clusters) std::array - hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) + hcalOverEcal; // run3 hcal over ecal seed cluster energy per depth (using rechits within a cone) + std::array + hcalOverEcalBc; // run3 hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) + bool pre7DepthHcal; float sigmaIetaIphi; float eMax; float e2nd; @@ -387,9 +393,14 @@ namespace reco { e2x5Max(0.f), e5x5(0.f), r9(-std::numeric_limits::max()), + hcalDepth1OverEcal(0.f), + hcalDepth2OverEcal(0.f), + hcalDepth1OverEcalBc(0.f), + hcalDepth2OverEcalBc(0.f), hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, invalidHcal(false), + pre7DepthHcal(true), sigmaIetaIphi(0.f), eMax(0.f), e2nd(0.f), @@ -411,16 +422,40 @@ namespace reco { float e2x5Max() const { return showerShape_.e2x5Max; } float e5x5() const { return showerShape_.e5x5; } float r9() const { return showerShape_.r9; } - float hcalOverEcal(int depth = 0) const { - const auto &hovere = showerShape_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + float hcalOverEcal(const ShowerShape &ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; + else if (depth == 1) + return ss.hcalDepth1OverEcal; + else if (depth == 2) + return ss.hcalDepth2OverEcal; + + return 0.f; + } else { + const auto &hovere = ss.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } - float hcalOverEcalBc(int depth = 0) const { - const auto &hovere = showerShape_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShape_, depth); } + float hcalOverEcalBc(const ShowerShape &ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; + else if (depth == 1) + return ss.hcalDepth1OverEcalBc; + else if (depth == 2) + return ss.hcalDepth2OverEcalBc; + + return 0.f; + } else { + const auto &hovere = ss.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } + float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShape_, depth); } const std::vector &hcalTowersBehindClusters() const { return showerShape_.hcalTowersBehindClusters; } @@ -439,16 +474,8 @@ namespace reco { float full5x5_e2x5Max() const { return full5x5_showerShape_.e2x5Max; } float full5x5_e5x5() const { return full5x5_showerShape_.e5x5; } float full5x5_r9() const { return full5x5_showerShape_.r9; } - float full5x5_hcalOverEcal(int depth = 0) const { - const auto &hovere = full5x5_showerShape_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; - } - float full5x5_hcalOverEcalBc(int depth = 0) const { - const auto &hovere = full5x5_showerShape_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; - } + float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShape_, depth); } + float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShape_, depth); } bool full5x5_hcalOverEcalValid() const { return !full5x5_showerShape_.invalidHcal; } float full5x5_e2x5Left() const { return full5x5_showerShape_.e2x5Left; } float full5x5_e2x5Right() const { return full5x5_showerShape_.e2x5Right; } @@ -506,46 +533,72 @@ namespace reco { float tkSumPt; // track iso with electron footprint removed float tkSumPtHEEP; // track iso used for the HEEP ID float ecalRecHitSumEt; // ecal iso deposit with electron footprint removed + float hcalDepth1TowerSumEt; // hcal depth 1 iso deposit with electron footprint removed + float hcalDepth2TowerSumEt; // hcal depth 2 iso deposit with electron footprint removed + float hcalDepth1TowerSumEtBc; // hcal depth 1 iso deposit without towers behind clusters + float hcalDepth2TowerSumEtBc; // hcal depth 2 iso deposit without towers behind clusters std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed + bool pre7DepthHcal; IsolationVariables() : tkSumPt(0.), tkSumPtHEEP(0.), ecalRecHitSumEt(0.), + hcalDepth1TowerSumEt(0.f), + hcalDepth2TowerSumEt(0.f), + hcalDepth1TowerSumEtBc(0.f), + hcalDepth2TowerSumEtBc(0.f), hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, - hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}} {} + hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + pre7DepthHcal(true) {} }; // 03 accessors float dr03TkSumPt() const { return dr03_.tkSumPt; } float dr03TkSumPtHEEP() const { return dr03_.tkSumPtHEEP; } float dr03EcalRecHitSumEt() const { return dr03_.ecalRecHitSumEt; } - float dr03HcalTowerSumEt(int depth = 0) const { - const auto &hcaliso = dr03_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + float hcalTowerSumEt(const IsolationVariables &iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalDepth1TowerSumEt + iv.hcalDepth1TowerSumEt; + else if (depth == 1) + return iv.hcalDepth1TowerSumEt; + else if (depth == 2) + return iv.hcalDepth2TowerSumEt; + + return 0.f; + } else { + const auto &hcaliso = iv.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } } - float dr03HcalTowerSumEtBc(int depth = 0) const { - const auto &hcaliso = dr03_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + float dr03HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr03_, depth); } + float hcalTowerSumEtBc(const IsolationVariables &iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalDepth1TowerSumEtBc + iv.hcalDepth1TowerSumEtBc; + else if (depth == 1) + return iv.hcalDepth1TowerSumEtBc; + else if (depth == 2) + return iv.hcalDepth2TowerSumEtBc; + + return 0.f; + } else { + const auto &hcaliso = iv.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } } + float dr03HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr03_, depth); } const IsolationVariables &dr03IsolationVariables() const { return dr03_; } // 04 accessors float dr04TkSumPt() const { return dr04_.tkSumPt; } float dr04TkSumPtHEEP() const { return dr04_.tkSumPtHEEP; } float dr04EcalRecHitSumEt() const { return dr04_.ecalRecHitSumEt; } - float dr04HcalTowerSumEt(int depth = 0) const { - const auto &hcaliso = dr04_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; - } - float dr04HcalTowerSumEtBc(int depth = 0) const { - const auto &hcaliso = dr04_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; - } + float dr04HcalTowerSumEt(int depth = 0) const { return hcalTowerSumEt(dr04_, depth); } + float dr04HcalTowerSumEtBc(int depth = 0) const { return hcalTowerSumEtBc(dr04_, depth); } const IsolationVariables &dr04IsolationVariables() const { return dr04_; } // setters ?!? diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 54e717b33d1db..2fe210b422b5f 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -143,11 +143,16 @@ namespace reco { float e3x3; float e5x5; float maxEnergyXtal; + float hcalDepth1OverEcal; // hcal over ecal energy using first hcal depth + float hcalDepth2OverEcal; // hcal over ecal energy using 2nd hcal depth + float hcalDepth1OverEcalBc; + float hcalDepth2OverEcalBc; std::array hcalOverEcal; // hcal over ecal seed cluster energy per depth (using rechits within a cone) std::array hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; + bool pre7DepthHcal; float effSigmaRR; float sigmaIetaIphi; float sigmaIphiIphi; @@ -174,9 +179,14 @@ namespace reco { e3x3(0.f), e5x5(0.f), maxEnergyXtal(0.f), + hcalDepth1OverEcal(0.f), + hcalDepth2OverEcal(0.f), + hcalDepth1OverEcalBc(0.f), + hcalDepth2OverEcalBc(0.f), hcalOverEcal{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, hcalOverEcalBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, invalidHcal(false), + pre7DepthHcal(true), effSigmaRR(std::numeric_limits::max()), sigmaIetaIphi(std::numeric_limits::max()), sigmaIphiIphi(std::numeric_limits::max()), @@ -203,19 +213,43 @@ namespace reco { void full5x5_setShowerShapeVariables(const ShowerShape& a) { full5x5_showerShapeBlock_ = a; } /// the total hadronic over electromagnetic fraction - float hcalOverEcal(int depth = 0) const { - const auto& hovere = showerShapeBlock_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + float hcalOverEcal(const ShowerShape& ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcal + ss.hcalDepth2OverEcal; + else if (depth == 1) + return ss.hcalDepth1OverEcal; + else if (depth == 2) + return ss.hcalDepth2OverEcal; + + return 0.f; + } else { + const auto& hovere = ss.hcalOverEcal; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } + float hcalOverEcal(int depth = 0) const { return hcalOverEcal(showerShapeBlock_, depth); } float hadronicOverEm(int depth = 0) const { return hcalOverEcal(depth); } /// the ratio of total energy of hcal rechits behind the SC and the SC energy - float hcalOverEcalBc(int depth = 0) const { - const auto& hovere = showerShapeBlock_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; + float hcalOverEcalBc(const ShowerShape& ss, int depth) const { + if (ss.pre7DepthHcal) { + if (depth == 0) + return ss.hcalDepth1OverEcalBc + ss.hcalDepth2OverEcalBc; + else if (depth == 1) + return ss.hcalDepth1OverEcalBc; + else if (depth == 2) + return ss.hcalDepth2OverEcalBc; + + return 0.f; + } else { + const auto& hovere = ss.hcalOverEcalBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) + : hovere[depth - 1]; + } } + float hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(showerShapeBlock_, depth); } float hadTowOverEm(int depth = 0) const { return hcalOverEcalBc(depth); } const std::vector& hcalTowersBehindClusters() const { @@ -226,18 +260,6 @@ namespace reco { bool hadronicOverEmValid() const { return !showerShapeBlock_.invalidHcal; } bool hadTowOverEmValid() const { return !showerShapeBlock_.invalidHcal; } - /// as above, but using 5x5 energy in the ecal - float full5x5_hcalOverEcal(int depth = 0) const { - const auto& hovere = full5x5_showerShapeBlock_.hcalOverEcal; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; - } - float full5x5_hcalOverEcalBc(int depth = 0) const { - const auto& hovere = full5x5_showerShapeBlock_.hcalOverEcalBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hovere), std::end(hovere), 0.f) - : hovere[depth - 1]; - } - /// Shower shape variables float e1x5() const { return showerShapeBlock_.e1x5; } float e2x5() const { return showerShapeBlock_.e2x5; } @@ -262,6 +284,14 @@ namespace reco { float full5x5_r2x5() const { return full5x5_showerShapeBlock_.e2x5 / full5x5_showerShapeBlock_.e5x5; } float full5x5_r9() const { return full5x5_showerShapeBlock_.e3x3 / this->superCluster()->rawEnergy(); } + /// the total hadronic over electromagnetic fraction + float full5x5_hcalOverEcal(int depth = 0) const { return hcalOverEcal(full5x5_showerShapeBlock_, depth); } + float full5x5_hadronicOverEm(int depth = 0) const { return full5x5_hcalOverEcal(depth); } + + /// the ratio of total energy of hcal rechits behind the SC and the SC energy + float full5x5_hcalOverEcalBc(int depth = 0) const { return hcalOverEcalBc(full5x5_showerShapeBlock_, depth); } + float full5x5_hadTowOverEm(int depth = 0) const { return full5x5_hcalOverEcalBc(depth); } + //======================================================= // SaturationInfo //======================================================= @@ -371,8 +401,21 @@ namespace reco { //EcalRecHit isolation float ecalRecHitSumEt; + //HcalTower isolation + float hcalTowerSumEt; + //HcalDepth1Tower isolation + float hcalDepth1TowerSumEt; + //HcalDepth2Tower isolation + float hcalDepth2TowerSumEt; + //HcalTower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalTowerSumEtBc; + //HcalDepth1Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalDepth1TowerSumEtBc; + //HcalDepth2Tower isolation subtracting the hadronic energy in towers behind the BCs in the SC + float hcalDepth2TowerSumEtBc; std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed + bool pre7DepthHcal; //Sum of track pT in a cone of dR float trkSumPtSolidCone; //Sum of track pT in a hollow cone of outer radius, inner radius @@ -385,8 +428,15 @@ namespace reco { : ecalRecHitSumEt(0.f), + hcalTowerSumEt(0.f), + hcalDepth1TowerSumEt(0.f), + hcalDepth2TowerSumEt(0.f), + hcalTowerSumEtBc(0.f), + hcalDepth1TowerSumEtBc(0.f), + hcalDepth2TowerSumEtBc(0.f), hcalRecHitSumEt{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, hcalRecHitSumEtBc{{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}}, + pre7DepthHcal(true), trkSumPtSolidCone(0.f), trkSumPtHollowCone(0.f), nTrkSolidCone(0), @@ -403,17 +453,41 @@ namespace reco { ///Ecal isolation sum calculated from recHits float ecalRecHitSumEtConeDR04() const { return isolationR04_.ecalRecHitSumEt; } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() - float hcalTowerSumEtConeDR04(int depth = 0) const { - const auto& hcaliso = isolationR04_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + float hcalTowerSumEt(const IsolationVariables& iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalTowerSumEt; + else if (depth == 1) + return iv.hcalDepth1TowerSumEt; + else if (depth == 2) + return iv.hcalDepth2TowerSumEt; + + return 0.f; + } else { + const auto& hcaliso = iv.hcalRecHitSumEt; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } } + float hcalTowerSumEtConeDR04(int depth = 0) const { return hcalTowerSumEt(isolationR04_, depth); } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() - float hcalTowerSumEtBcConeDR04(int depth = 0) const { - const auto& hcaliso = isolationR04_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; + float hcalTowerSumEtBc(const IsolationVariables& iv, int depth) const { + if (iv.pre7DepthHcal) { + if (depth == 0) + return iv.hcalTowerSumEtBc; + else if (depth == 1) + return iv.hcalDepth1TowerSumEtBc; + else if (depth == 2) + return iv.hcalDepth2TowerSumEtBc; + + return 0.f; + } else { + const auto& hcaliso = iv.hcalRecHitSumEtBc; + return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) + : hcaliso[depth - 1]; + } } + float hcalTowerSumEtBcConeDR04(int depth = 0) const { return hcalTowerSumEtBc(isolationR04_, depth); } // Track pT sum float trkSumPtSolidConeDR04() const { return isolationR04_.trkSumPtSolidCone; } //As above, excluding the core at the center of the cone @@ -426,17 +500,9 @@ namespace reco { /// Isolation variables in cone dR=0.3 float ecalRecHitSumEtConeDR03() const { return isolationR03_.ecalRecHitSumEt; } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcal() - float hcalTowerSumEtConeDR03(int depth = 0) const { - const auto& hcaliso = isolationR03_.hcalRecHitSumEt; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; - } + float hcalTowerSumEtConeDR03(int depth = 0) const { return hcalTowerSumEt(isolationR03_, depth); } /// Hcal isolation sum for each depth excluding the region containing the rechits used for hcalOverEcalBc() - float hcalTowerSumEtBcConeDR03(int depth = 0) const { - const auto& hcaliso = isolationR03_.hcalRecHitSumEtBc; - return (!(depth > 0 and depth < 8)) ? std::accumulate(std::begin(hcaliso), std::end(hcaliso), 0.f) - : hcaliso[depth - 1]; - } + float hcalTowerSumEtBcConeDR03(int depth = 0) const { return hcalTowerSumEtBc(isolationR03_, depth); } // Track pT sum c float trkSumPtSolidConeDR03() const { return isolationR03_.trkSumPtSolidCone; } //As above, excluding the core at the center of the cone diff --git a/DataFormats/EgammaCandidates/src/classes_def.xml b/DataFormats/EgammaCandidates/src/classes_def.xml index 2fa98477de595..7b93b9863aa35 100644 --- a/DataFormats/EgammaCandidates/src/classes_def.xml +++ b/DataFormats/EgammaCandidates/src/classes_def.xml @@ -39,29 +39,11 @@ - + - - - - - - @@ -70,27 +52,9 @@ - + - - - - - - @@ -203,55 +167,18 @@ - - - + + - - - - - - - + - - - - - - diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index d70506f110a71..694451ad19f3b 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -345,6 +345,7 @@ reco::GsfElectron::ShowerShape GsfElectronAlgo::calculateShowerShape(const reco: } showerShape.invalidHcal = !hcalHelperBc.hasActiveHcal(*theClus); showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*theClus); + showerShape.pre7DepthHcal = false; // extra shower shapes const float see_by_spp = showerShape.sigmaIetaIeta * showerShape.sigmaIphiIphi; @@ -447,98 +448,98 @@ GsfElectronAlgo::EventData GsfElectronAlgo::beginEvent(edm::Event const& event, .conversions = cfg_.strategy.fillConvVtxFitProb ? event.getHandle(cfg_.tokens.conversions) : edm::Handle(), - .hadIsolation03 = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - egHcalIsoConeSizeOutSmall, - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - egHcalIsoConeSizeIn, - EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, - caloGeometry, - *hcalHelperCone_.hcalTopology(), - *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), - *hcalHelperCone_.towerMap()), - .hadIsolation04 = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - egHcalIsoConeSizeOutLarge, - EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - egHcalIsoConeSizeIn, - EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, - caloGeometry, - *hcalHelperCone_.hcalTopology(), - *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), - *hcalHelperCone_.towerMap()), - .hadIsolation03Bc = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - egHcalIsoConeSizeOutSmall, - EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, - 0., - EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, - caloGeometry, - *hcalHelperCone_.hcalTopology(), - *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), - *hcalHelperCone_.towerMap()), - .hadIsolation04Bc = - EgammaHcalIsolation(EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, - egHcalIsoConeSizeOutLarge, - EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, - 0., - EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHB(), - EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, - EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin, - egHcalIsoPtMin}}, - hcalHelperCone_.maxSeverityHE(), - hbheRecHits, - caloGeometry, - *hcalHelperCone_.hcalTopology(), - *hcalHelperCone_.hcalChannelQuality(), - *hcalHelperCone_.hcalSevLvlComputer(), - *hcalHelperCone_.towerMap()), + .hadIsolation03 = EgammaHcalIsolation( + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutSmall, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeIn, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), + .hadIsolation04 = EgammaHcalIsolation( + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutLarge, + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeIn, + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), + .hadIsolation03Bc = EgammaHcalIsolation( + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutSmall, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, + 0., + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), + .hadIsolation04Bc = EgammaHcalIsolation( + EgammaHcalIsolation::InclusionRule::withinConeAroundCluster, + egHcalIsoConeSizeOutLarge, + EgammaHcalIsolation::InclusionRule::isBehindClusterSeed, + 0., + EgammaHcalIsolation::arrayHB{{0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHB{{egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin, egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHB(), + EgammaHcalIsolation::arrayHE{{0., 0., 0., 0., 0., 0., 0.}}, + EgammaHcalIsolation::arrayHE{{egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin, + egHcalIsoPtMin}}, + hcalHelperCone_.maxSeverityHE(), + hbheRecHits, + caloGeometry, + *hcalHelperCone_.hcalTopology(), + *hcalHelperCone_.hcalChannelQuality(), + *hcalHelperCone_.hcalSevLvlComputer(), + *hcalHelperCone_.towerMap()), .ecalBarrelIsol03 = EgammaRecHitIsolation(egIsoConeSizeOutSmall, egIsoConeSizeInBarrel, @@ -1114,6 +1115,10 @@ void GsfElectronAlgo::createElectron(reco::GsfElectronCollection& electrons, dr04.ecalRecHitSumEt = eventData.ecalBarrelIsol04.getEtSum(&ele); dr04.ecalRecHitSumEt += eventData.ecalEndcapIsol04.getEtSum(&ele); } + + dr03.pre7DepthHcal = false; + dr04.pre7DepthHcal = false; + ele.setIsolation03(dr03); ele.setIsolation04(dr04); diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 1599d763b0e03..8b80e31f244fd 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -687,6 +687,7 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.invalidHcal = (hcalHelperBc != nullptr) ? !hcalHelperBc->hasActiveHcal(*scRef) : false; if (hcalHelperBc != nullptr) showerShape.hcalTowersBehindClusters = hcalHelperBc->hcalTowersBehindClusters(*scRef); + showerShape.pre7DepthHcal = false; /// fill extra shower shapes const float spp = (!edm::isFinite(locCov[2]) ? 0. : sqrt(locCov[2])); @@ -797,6 +798,7 @@ void GEDPhotonProducer::fillPhotonCollection(edm::Event& evt, full5x5_showerShape.hcalOverEcalBc[id] = (hcalHelperBc != nullptr) ? hcalHelperBc->hcalESum(*scRef, id + 1) / full5x5_e5x5 : 0.f; } + full5x5_showerShape.pre7DepthHcal = false; newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape); /// get ecal photon specific corrected energy diff --git a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc index 3b1b303f6217b..d3d9edcf4e154 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/PhotonProducer.cc @@ -459,6 +459,7 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / scRef->energy(); } showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); + showerShape.pre7DepthHcal = false; newCandidate.setShowerShapeVariables(showerShape); /// fill full5x5 shower shape block @@ -475,6 +476,7 @@ void PhotonProducer::fillPhotonCollection(edm::Event& evt, full5x5_showerShape.hcalOverEcalBc[id] = hcalHelperBc.hcalESum(*scRef, id + 1) / full5x5_e5x5; } full5x5_showerShape.hcalTowersBehindClusters = hcalHelperBc.hcalTowersBehindClusters(*scRef); + full5x5_showerShape.pre7DepthHcal = false; newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape); /// get ecal photon specific corrected energy diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 05a2a5432940c..46b1c68599772 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -406,6 +406,9 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, id + 1); } } + + phoisolR1.pre7DepthHcal = false; + phoisolR2.pre7DepthHcal = false; } void PhotonIsolationCalculator::classify(const reco::Photon* photon, From 13dcc54cd29296ca60cfdd9b6d55d5b0e122c66a Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Tue, 1 Jun 2021 19:23:01 +0200 Subject: [PATCH 25/27] jpata comments --- DataFormats/EgammaCandidates/interface/GsfElectron.h | 4 ++-- DataFormats/EgammaCandidates/interface/Photon.h | 4 ++-- .../PhotonIdentification/src/PhotonIsolationCalculator.cc | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DataFormats/EgammaCandidates/interface/GsfElectron.h b/DataFormats/EgammaCandidates/interface/GsfElectron.h index 6e3efd1151aeb..b81bdf23d1974 100644 --- a/DataFormats/EgammaCandidates/interface/GsfElectron.h +++ b/DataFormats/EgammaCandidates/interface/GsfElectron.h @@ -373,7 +373,7 @@ namespace reco { hcalOverEcalBc; // run3 hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; // set to true if the hcal energy estimate is not valid (e.g. the corresponding tower was off or masked) - bool pre7DepthHcal; + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files float sigmaIetaIphi; float eMax; float e2nd; @@ -539,7 +539,7 @@ namespace reco { float hcalDepth2TowerSumEtBc; // hcal depth 2 iso deposit without towers behind clusters std::array hcalRecHitSumEt; // ...per depth, with electron footprint removed std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechit behind cluster removed - bool pre7DepthHcal; + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files IsolationVariables() : tkSumPt(0.), tkSumPtHEEP(0.), diff --git a/DataFormats/EgammaCandidates/interface/Photon.h b/DataFormats/EgammaCandidates/interface/Photon.h index 2fe210b422b5f..071f0329a03fb 100644 --- a/DataFormats/EgammaCandidates/interface/Photon.h +++ b/DataFormats/EgammaCandidates/interface/Photon.h @@ -152,7 +152,7 @@ namespace reco { hcalOverEcalBc; // hcal over ecal seed cluster energy per depth (using rechits behind clusters) std::vector hcalTowersBehindClusters; bool invalidHcal; - bool pre7DepthHcal; + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files float effSigmaRR; float sigmaIetaIphi; float sigmaIphiIphi; @@ -415,7 +415,7 @@ namespace reco { float hcalDepth2TowerSumEtBc; std::array hcalRecHitSumEt; // ...per depth, with photon footprint within a cone removed std::array hcalRecHitSumEtBc; // ...per depth, with hcal rechits behind cluster removed - bool pre7DepthHcal; + bool pre7DepthHcal; // to work around an ioread rule issue on legacy RECO files //Sum of track pT in a cone of dR float trkSumPtSolidCone; //Sum of track pT in a hollow cone of outer radius, inner radius diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 46b1c68599772..311b70e5e6ebf 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -356,7 +356,7 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, if (not hbheRecHitsTag_.isUninitialized()) { auto const& hbheRecHits = e.get(hbheRecHitsTag_); - for (size_t id = 0; id < 7; ++id) { + for (size_t id = 0; id < phoisolR1.hcalRecHitSumEt.size(); ++id) { phoisolR1.hcalRecHitSumEt[id] = calculateHcalRecHitIso(pho, caloGeometry, From dbfd31796441ddec61d752443132c509b72bc946 Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Thu, 3 Jun 2021 18:02:40 +0200 Subject: [PATCH 26/27] lambdas --- .../src/PhotonIsolationCalculator.cc | 81 ++++++++----------- 1 file changed, 34 insertions(+), 47 deletions(-) diff --git a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc index 311b70e5e6ebf..a4706143598d9 100644 --- a/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc +++ b/RecoEgamma/PhotonIdentification/src/PhotonIsolationCalculator.cc @@ -356,54 +356,41 @@ void PhotonIsolationCalculator::calculate(const reco::Photon* pho, if (not hbheRecHitsTag_.isUninitialized()) { auto const& hbheRecHits = e.get(hbheRecHitsTag_); + auto fcone = [this, + pho, + &caloGeometry, + &hcalTopo = *hcalTopology, + &hcalQual = *hcalChannelQuality, + &hcalSev = *hcalSevLvlComputer, + &towerMap, + &hbheRecHits](double outer, double inner, int depth) { + return calculateHcalRecHitIso( + pho, caloGeometry, hcalTopo, hcalQual, hcalSev, towerMap, hbheRecHits, outer, inner, depth); + }; + + auto fbc = [this, + pho, + &caloGeometry, + &hcalTopo = *hcalTopology, + &hcalQual = *hcalChannelQuality, + &hcalSev = *hcalSevLvlComputer, + &towerMap, + &hbheRecHits](double outer, int depth) { + return calculateHcalRecHitIso( + pho, caloGeometry, hcalTopo, hcalQual, hcalSev, towerMap, hbheRecHits, outer, 0., depth); + }; + for (size_t id = 0; id < phoisolR1.hcalRecHitSumEt.size(); ++id) { - phoisolR1.hcalRecHitSumEt[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id], - detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id], - id + 1); - - phoisolR2.hcalRecHitSumEt[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id], - id + 1); - - phoisolR1.hcalRecHitSumEtBc[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - 0., - id + 1); - - phoisolR2.hcalRecHitSumEtBc[id] = - calculateHcalRecHitIso(pho, - caloGeometry, - *hcalTopology, - *hcalChannelQuality, - *hcalSevLvlComputer, - towerMap, - hbheRecHits, - detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id], - 0., - id + 1); + const auto& outerA = detector == EcalBarrel ? hcalIsoOuterRadAEB_[id] : hcalIsoOuterRadAEE_[id]; + const auto& outerB = detector == EcalBarrel ? hcalIsoOuterRadBEB_[id] : hcalIsoOuterRadBEE_[id]; + const auto& innerA = detector == EcalBarrel ? hcalIsoInnerRadAEB_[id] : hcalIsoInnerRadAEE_[id]; + const auto& innerB = detector == EcalBarrel ? hcalIsoInnerRadBEB_[id] : hcalIsoInnerRadBEE_[id]; + + phoisolR1.hcalRecHitSumEt[id] = fcone(outerA, innerA, id + 1); + phoisolR2.hcalRecHitSumEt[id] = fcone(outerB, innerB, id + 1); + + phoisolR1.hcalRecHitSumEtBc[id] = fbc(outerA, id + 1); + phoisolR2.hcalRecHitSumEtBc[id] = fbc(outerB, id + 1); } } From 5ad8a107a1e95e5f590bf7edaaa364a4413a7c0d Mon Sep 17 00:00:00 2001 From: Afiq Anuar Date: Fri, 4 Jun 2021 22:15:49 +0200 Subject: [PATCH 27/27] filldesc default --- .../plugins/ElectronSeedProducer.cc | 2 +- .../plugins/GsfElectronProducer.cc | 2 +- .../python/ecalDrivenElectronSeeds_cfi.py | 46 +--- .../python/gsfElectronProducer_cfi.py | 206 +----------------- .../python/conversionTrackCandidates_cfi.py | 58 +---- .../src/ConversionTrackCandidateProducer.cc | 2 +- 6 files changed, 21 insertions(+), 295 deletions(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc index 158f5856147ad..362b8a4a59b01 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/ElectronSeedProducer.cc @@ -258,7 +258,7 @@ void ElectronSeedProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add("endcapSuperClusters", {"particleFlowSuperClusterECAL", "particleFlowSuperClusterECALEndcapWithPreshower"}); - descriptions.add("ecalDrivenElectronSeeds", desc); + descriptions.add("ecalDrivenElectronSeedsDefault", desc); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index a38b10481c3e8..28b6bcc789997 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -249,7 +249,7 @@ void GsfElectronProducer::fillDescriptions(edm::ConfigurationDescriptions& descr "RecoEgamma/ElectronIdentification/data/TMVA_BDTSoftElectrons_7Feb2014.weights.xml", }); - descriptions.add("gsfElectronProducer", desc); + descriptions.add("gsfElectronProducerDefault", desc); } namespace { diff --git a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py index ffd7c2c57997a..c9ebb201e81ed 100644 --- a/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py +++ b/RecoEgamma/EgammaElectronProducers/python/ecalDrivenElectronSeeds_cfi.py @@ -2,44 +2,10 @@ from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit -ecalDrivenElectronSeeds = cms.EDProducer('ElectronSeedProducer', - initialSeedsVector = cms.VInputTag(), - useRecoVertex = cms.bool(False), - vertices = cms.InputTag('offlinePrimaryVerticesWithBS'), - beamSpot = cms.InputTag('offlineBeamSpot'), - dynamicPhiRoad = cms.bool(True), - SCEtCut = cms.double(0), - applyHOverECut = cms.bool(True), - hOverEConeSize = cms.double(0.15), - maxHOverEBarrel = cms.double(0.15), - maxHOverEEndcaps = cms.double(0.15), - hbheRecHits = egammaHBHERecHit.hbheRecHits, - recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, - recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, - maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, - allowHGCal = cms.bool(False), - HGCalConfig = cms.PSet( - HGCEEInput = cms.InputTag('HGCalRecHit', 'HGCEERecHits'), - HGCFHInput = cms.InputTag('HGCalRecHit', 'HGCHEFRecHits'), - HGCBHInput = cms.InputTag('HGCalRecHit', 'HGCHEBRecHits') - ), - nSigmasDeltaZ1 = cms.double(5), - deltaZ1WithVertex = cms.double(25), - z2MaxB = cms.double(0.09), - r2MaxF = cms.double(0.15), - rMaxI = cms.double(0.2), - LowPtThreshold = cms.double(5), - HighPtThreshold = cms.double(35), - SizeWindowENeg = cms.double(0.675), - DeltaPhi1Low = cms.double(0.23), - DeltaPhi1High = cms.double(0.08), - DeltaPhi2B = cms.double(0.008), - DeltaPhi2F = cms.double(0.012), - ePhiMin1 = cms.double(-0.125), - ePhiMax1 = cms.double(0.075), - PhiMax2B = cms.double(0.002), - PhiMax2F = cms.double(0.003), - barrelSuperClusters = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALBarrel'), - endcapSuperClusters = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALEndcapWithPreshower'), - mightGet = cms.optional.untracked.vstring +import RecoEgamma.EgammaElectronProducers.ecalDrivenElectronSeedsDefault_cfi as _ecalSeeds +ecalDrivenElectronSeeds = _ecalSeeds.ecalDrivenElectronSeedsDefault.clone( + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity ) diff --git a/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py b/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py index be27caf8d6abf..7aa0ae0646090 100644 --- a/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py +++ b/RecoEgamma/EgammaElectronProducers/python/gsfElectronProducer_cfi.py @@ -2,204 +2,10 @@ from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit -gsfElectronProducer = cms.EDProducer('GsfElectronProducer', - gsfElectronCoresTag = cms.InputTag('ecalDrivenGsfElectronCores'), - vtxTag = cms.InputTag('offlinePrimaryVertices'), - conversionsTag = cms.InputTag('allConversions'), - gsfPfRecTracksTag = cms.InputTag('pfTrackElec'), - barrelRecHitCollectionTag = cms.InputTag('ecalRecHit', 'EcalRecHitsEB'), - endcapRecHitCollectionTag = cms.InputTag('ecalRecHit', 'EcalRecHitsEE'), - seedsTag = cms.InputTag('ecalDrivenElectronSeeds'), - beamSpotTag = cms.InputTag('offlineBeamSpot'), - egmPFCandidatesTag = cms.InputTag('particleFlowEGamma'), - useDefaultEnergyCorrection = cms.bool(True), - useCombinationRegression = cms.bool(False), - ecalDrivenEcalEnergyFromClassBasedParameterization = cms.bool(True), - ecalDrivenEcalErrorFromClassBasedParameterization = cms.bool(True), - applyPreselection = cms.bool(False), - useEcalRegression = cms.bool(False), - applyAmbResolution = cms.bool(False), - ignoreNotPreselected = cms.bool(True), - useGsfPfRecTracks = cms.bool(True), - pureTrackerDrivenEcalErrorFromSimpleParameterization = cms.bool(True), - ambSortingStrategy = cms.uint32(1), - ambClustersOverlapStrategy = cms.uint32(1), - fillConvVtxFitProb = cms.bool(True), - resetMvaValuesUsingPFCandidates = cms.bool(False), - recHitFlagsToBeExcludedBarrel = cms.required.vstring, - recHitFlagsToBeExcludedEndcaps = cms.required.vstring, - recHitSeverityToBeExcludedBarrel = cms.required.vstring, - recHitSeverityToBeExcludedEndcaps = cms.required.vstring, - checkHcalStatus = cms.bool(True), - hbheRecHits = egammaHBHERecHit.hbheRecHits, - recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, - recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, - maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, - hcalRun2EffDepth = cms.bool(False), - trkIsol03Cfg = cms.PSet( - barrelCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ), - endcapCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ) - ), - trkIsol04Cfg = cms.PSet( - barrelCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ), - endcapCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ) - ), - trkIsolHEEP03Cfg = cms.PSet( - barrelCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ), - endcapCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ) - ), - trkIsolHEEP04Cfg = cms.PSet( - barrelCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ), - endcapCuts = cms.PSet( - minPt = cms.double(1), - maxDR = cms.double(0.3), - minDR = cms.double(0), - minDEta = cms.double(0.005), - maxDZ = cms.double(0.1), - maxDPtPt = cms.double(-1), - minHits = cms.int32(8), - minPixelHits = cms.int32(1), - allowedQualities = cms.required.vstring, - algosToReject = cms.required.vstring - ) - ), - useNumCrystals = cms.bool(True), - etMinBarrel = cms.double(0), - etMinEndcaps = cms.double(0.11), - etMinHcal = cms.double(0), - eMinBarrel = cms.double(0.095), - eMinEndcaps = cms.double(0), - intRadiusEcalBarrel = cms.double(3), - intRadiusEcalEndcaps = cms.double(3), - intRadiusHcal = cms.double(0.15), - jurassicWidth = cms.double(1.5), - vetoClustered = cms.bool(False), - ctfTracksCheck = cms.bool(True), - ctfTracksTag = cms.InputTag('generalTracks'), - MaxElePtForOnlyMVA = cms.double(50), - PreSelectMVA = cms.double(-0.1), - preselection = cms.PSet( - minSCEtBarrel = cms.double(4), - minSCEtEndcaps = cms.double(4), - minEOverPBarrel = cms.double(0), - minEOverPEndcaps = cms.double(0), - maxEOverPBarrel = cms.double(999999999), - maxEOverPEndcaps = cms.double(999999999), - maxDeltaEtaBarrel = cms.double(0.02), - maxDeltaEtaEndcaps = cms.double(0.02), - maxDeltaPhiBarrel = cms.double(0.15), - maxDeltaPhiEndcaps = cms.double(0.15), - hOverEConeSize = cms.double(0.15), - maxHOverEBarrelCone = cms.double(0.15), - maxHOverEEndcapsCone = cms.double(0.15), - maxHBarrelCone = cms.double(0), - maxHEndcapsCone = cms.double(0), - maxHOverEBarrelBc = cms.double(0.15), - maxHOverEEndcapsBc = cms.double(0.15), - maxHBarrelBc = cms.double(0), - maxHEndcapsBc = cms.double(0), - maxSigmaIetaIetaBarrel = cms.double(999999999), - maxSigmaIetaIetaEndcaps = cms.double(999999999), - maxFbremBarrel = cms.double(999999999), - maxFbremEndcaps = cms.double(999999999), - isBarrel = cms.bool(False), - isEndcaps = cms.bool(False), - isFiducial = cms.bool(False), - seedFromTEC = cms.bool(True), - maxTIP = cms.double(999999999), - multThresEB = cms.double(1), - multThresEE = cms.double(1.25) - ), - crackCorrectionFunction = cms.string('EcalClusterCrackCorrection'), - ecalWeightsFromDB = cms.bool(True), - ecalRefinedRegressionWeightFiles = cms.vstring(), - combinationWeightsFromDB = cms.bool(True), - combinationRegressionWeightFile = cms.vstring(), - ecalRefinedRegressionWeightLabels = cms.vstring(), - combinationRegressionWeightLabels = cms.vstring(), - ElecMVAFilesString = cms.vstring( - 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_10_17Feb2011.weights.xml', - 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_12_17Feb2011.weights.xml', - 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_20_17Feb2011.weights.xml', - 'RecoEgamma/ElectronIdentification/data/TMVA_Category_BDTSimpleCat_22_17Feb2011.weights.xml' - ), - SoftElecMVAFilesString = cms.vstring('RecoEgamma/ElectronIdentification/data/TMVA_BDTSoftElectrons_7Feb2014.weights.xml'), - mightGet = cms.optional.untracked.vstring +import RecoEgamma.EgammaElectronProducers.gsfElectronProducerDefault_cfi as _gsfProd +gsfElectronProducer = _gsfProd.gsfElectronProducerDefault.clone( + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity ) diff --git a/RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py b/RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py index 06788d4a247fe..d58e07faea9c2 100644 --- a/RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py +++ b/RecoEgamma/EgammaPhotonProducers/python/conversionTrackCandidates_cfi.py @@ -1,56 +1,10 @@ import FWCore.ParameterSet.Config as cms from RecoEgamma.EgammaIsolationAlgos.egammaHBHERecHitThreshold_cff import egammaHBHERecHit -conversionTrackCandidates = cms.EDProducer('ConversionTrackCandidateProducer', - bcBarrelCollection = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowBasicClusterECALBarrel'), - bcEndcapCollection = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowBasicClusterECALEndcap'), - scHybridBarrelProducer = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALBarrel'), - scIslandEndcapProducer = cms.InputTag('particleFlowSuperClusterECAL', 'particleFlowSuperClusterECALEndcapWithPreshower'), - outInTrackCandidateSCAssociationCollection = cms.string('outInTrackCandidateSCAssociationCollection'), - inOutTrackCandidateSCAssociationCollection = cms.string('inOutTrackCandidateSCAssociationCollection'), - outInTrackCandidateCollection = cms.string('outInTracksFromConversions'), - inOutTrackCandidateCollection = cms.string('inOutTracksFromConversions'), - barrelEcalRecHitCollection = cms.InputTag('ecalRecHit', 'EcalRecHitsEB'), - endcapEcalRecHitCollection = cms.InputTag('ecalRecHit', 'EcalRecHitsEE'), - MeasurementTrackerName = cms.string(''), - OutInRedundantSeedCleaner = cms.string('CachingSeedCleanerBySharedInput'), - InOutRedundantSeedCleaner = cms.string('CachingSeedCleanerBySharedInput'), - useHitsSplitting = cms.bool(False), - maxNumOfSeedsOutIn = cms.int32(50), - maxNumOfSeedsInOut = cms.int32(50), - bcEtCut = cms.double(1.5), - bcECut = cms.double(1.5), - useEtCut = cms.bool(True), - hbheRecHits = egammaHBHERecHit.hbheRecHits, - recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, - recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, - maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity, - minSCEt = cms.double(20), - hOverEConeSize = cms.double(0.15), - maxHOverE = cms.double(0.15), - isoInnerConeR = cms.double(3.5), - isoConeR = cms.double(0.4), - isoEtaSlice = cms.double(2.5), - isoEtMin = cms.double(0), - isoEMin = cms.double(0.08), - vetoClusteredHits = cms.bool(False), - useNumXstals = cms.bool(True), - ecalIsoCut_offset = cms.double(999999999), - ecalIsoCut_slope = cms.double(0), - RecHitFlagToBeExcludedEB = cms.vstring(), - RecHitSeverityToBeExcludedEB = cms.vstring(), - RecHitFlagToBeExcludedEE = cms.vstring(), - RecHitSeverityToBeExcludedEE = cms.vstring(), - fractionShared = cms.double(0.5), - TrajectoryBuilder = cms.string('TrajectoryBuilderForConversions'), - TrajectoryBuilderPSet = cms.PSet(), - TransientInitialStateEstimatorParameters = cms.PSet( - propagatorAlongTISE = cms.string('alongMomElePropagator'), - numberMeasurementsForFit = cms.int32(4), - propagatorOppositeTISE = cms.string('oppositeToMomElePropagator') - ), - allowSharedFirstHit = cms.bool(True), - ValidHitBonus = cms.double(5), - MissingHitPenalty = cms.double(20), - mightGet = cms.optional.untracked.vstring +import RecoEgamma.EgammaPhotonProducers.conversionTrackCandidatesDefault_cfi as _convTrkCand +conversionTrackCandidates = _convTrkCand.conversionTrackCandidatesDefault.clone( + hbheRecHits = egammaHBHERecHit.hbheRecHits, + recHitEThresholdHB = egammaHBHERecHit.recHitEThresholdHB, + recHitEThresholdHE = egammaHBHERecHit.recHitEThresholdHE, + maxHcalRecHitSeverity = egammaHBHERecHit.maxHcalRecHitSeverity ) diff --git a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc index 18d88edaea9e4..f95619b2f8817 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/ConversionTrackCandidateProducer.cc @@ -488,7 +488,7 @@ void ConversionTrackCandidateProducer::fillDescriptions(edm::ConfigurationDescri desc.add("ValidHitBonus", 5.0); desc.add("MissingHitPenalty", 20.0); - descriptions.add("conversionTrackCandidates", desc); + descriptions.add("conversionTrackCandidatesDefault", desc); // or use the following to generate the label from the module's C++ type //descriptions.addWithDefaultLabel(desc); }