Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:25

0001 #include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h"
0002 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0003 #include "DataFormats/EgammaCandidates/interface/ConversionFwd.h"
0004 #include "DataFormats/EgammaCandidates/interface/Conversion.h"
0005 #include "CommonTools/Egamma/interface/ConversionTools.h"
0006 #include "RecoEgamma/EgammaTools/interface/EBEECutValues.h"
0007 
0008 class GsfEleTrkPtIsoCut : public CutApplicatorBase {
0009 public:
0010   GsfEleTrkPtIsoCut(const edm::ParameterSet& c);
0011 
0012   result_type operator()(const reco::GsfElectronPtr&) const final;
0013 
0014   double value(const reco::CandidatePtr& cand) const final;
0015 
0016   CandidateType candidateType() const final { return ELECTRON; }
0017 
0018 private:
0019   EBEECutValues slopeTerm_;
0020   EBEECutValues slopeStart_;
0021   EBEECutValues constTerm_;
0022   bool useHEEPIso_;
0023 
0024   edm::Handle<double> rhoHandle_;
0025 };
0026 
0027 DEFINE_EDM_PLUGIN(CutApplicatorFactory, GsfEleTrkPtIsoCut, "GsfEleTrkPtIsoCut");
0028 
0029 GsfEleTrkPtIsoCut::GsfEleTrkPtIsoCut(const edm::ParameterSet& params)
0030     : CutApplicatorBase(params),
0031       slopeTerm_(params, "slopeTerm"),
0032       slopeStart_(params, "slopeStart"),
0033       constTerm_(params, "constTerm"),
0034       useHEEPIso_(params.getParameter<bool>("useHEEPIso")) {}
0035 
0036 CutApplicatorBase::result_type GsfEleTrkPtIsoCut::operator()(const reco::GsfElectronPtr& cand) const {
0037   const float isolTrkPt = useHEEPIso_ ? cand->dr03TkSumPtHEEP() : cand->dr03TkSumPt();
0038 
0039   const float et = cand->et();
0040   const float cutValue =
0041       et > slopeStart_(cand) ? slopeTerm_(cand) * (et - slopeStart_(cand)) + constTerm_(cand) : constTerm_(cand);
0042   return isolTrkPt < cutValue;
0043 }
0044 
0045 double GsfEleTrkPtIsoCut::value(const reco::CandidatePtr& cand) const {
0046   reco::GsfElectronPtr ele(cand);
0047   return useHEEPIso_ ? ele->dr03TkSumPtHEEP() : ele->dr03TkSumPt();
0048 }