Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-15 08:48:04

0001 #include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h"
0002 #include "DataFormats/EgammaCandidates/interface/Photon.h"
0003 
0004 template <bool isBC>
0005 class PhotonHcalOverEcalCut : public CutApplicatorBase {
0006 public:
0007   PhotonHcalOverEcalCut(const edm::ParameterSet& c)
0008       : CutApplicatorBase(c),
0009         _hcalOverEcalCutValueEB(c.getParameter<double>("hcalOverEcalCutValueEB")),
0010         _hcalOverEcalCutValueEE(c.getParameter<double>("hcalOverEcalCutValueEE")),
0011         _barrelCutOff(c.getParameter<double>("barrelCutOff")) {}
0012 
0013   result_type operator()(const reco::PhotonPtr&) const final;
0014 
0015   double value(const reco::CandidatePtr& cand) const final;
0016 
0017   CandidateType candidateType() const final { return PHOTON; }
0018 
0019 private:
0020   const float _hcalOverEcalCutValueEB, _hcalOverEcalCutValueEE, _barrelCutOff;
0021 };
0022 
0023 DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhotonHcalOverEcalCut<false>, "PhotonHcalOverEcalCut");
0024 DEFINE_EDM_PLUGIN(CutApplicatorFactory, PhotonHcalOverEcalCut<true>, "PhotonHcalOverEcalBcCut");
0025 
0026 template <bool isBC>
0027 CutApplicatorBase::result_type PhotonHcalOverEcalCut<isBC>::operator()(const reco::PhotonPtr& cand) const {
0028   const float hcalOverEcalCutValue =
0029       (std::abs(cand->superCluster()->eta()) < _barrelCutOff ? _hcalOverEcalCutValueEB : _hcalOverEcalCutValueEE);
0030 
0031   if constexpr (isBC)
0032     return cand->hcalOverEcalBc() < hcalOverEcalCutValue;
0033   else
0034     return cand->hcalOverEcal() < hcalOverEcalCutValue;
0035 }
0036 
0037 template <bool isBC>
0038 double PhotonHcalOverEcalCut<isBC>::value(const reco::CandidatePtr& cand) const {
0039   reco::PhotonPtr pho(cand);
0040   if constexpr (isBC)
0041     return pho->hcalOverEcalBc();
0042   else
0043     return pho->hcalOverEcal();
0044 }