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 
0004 class GsfEleMinEcalEtCut : public CutApplicatorBase {
0005 public:
0006   GsfEleMinEcalEtCut(const edm::ParameterSet& c);
0007 
0008   result_type operator()(const reco::GsfElectronPtr&) const final;
0009 
0010   double value(const reco::CandidatePtr& cand) const final;
0011 
0012   CandidateType candidateType() const final { return ELECTRON; }
0013 
0014 private:
0015   const double minEt_;
0016 };
0017 
0018 DEFINE_EDM_PLUGIN(CutApplicatorFactory, GsfEleMinEcalEtCut, "GsfEleMinEcalEtCut");
0019 
0020 GsfEleMinEcalEtCut::GsfEleMinEcalEtCut(const edm::ParameterSet& c)
0021     : CutApplicatorBase(c), minEt_(c.getParameter<double>("minEt")) {}
0022 
0023 CutApplicatorBase::result_type GsfEleMinEcalEtCut::operator()(const reco::GsfElectronPtr& cand) const {
0024   const reco::GsfElectron& ele = *cand;
0025   const float sinTheta = ele.p() != 0 ? ele.pt() / ele.p() : 0.;
0026   const float et = ele.ecalEnergy() * sinTheta;
0027   return et > minEt_;
0028 }
0029 
0030 double GsfEleMinEcalEtCut::value(const reco::CandidatePtr& cand) const {
0031   const reco::GsfElectronPtr elePtr(cand);
0032   const reco::GsfElectron& ele = *elePtr;
0033   const float sinTheta = ele.p() != 0 ? ele.pt() / ele.p() : 0.;
0034   const float et = ele.ecalEnergy() * sinTheta;
0035   return et;
0036 }