File indexing completed on 2024-04-06 12:25:06
0001 #include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h"
0002 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0003 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0004
0005 class GsfEleMissingHitsCut : public CutApplicatorBase {
0006 public:
0007 GsfEleMissingHitsCut(const edm::ParameterSet& c)
0008 : CutApplicatorBase(c),
0009 _maxMissingHitsEB(c.getParameter<unsigned>("maxMissingHitsEB")),
0010 _maxMissingHitsEE(c.getParameter<unsigned>("maxMissingHitsEE")),
0011 _barrelCutOff(c.getParameter<double>("barrelCutOff")) {}
0012
0013 result_type operator()(const reco::GsfElectronPtr&) const final;
0014
0015 double value(const reco::CandidatePtr& cand) const final;
0016
0017 CandidateType candidateType() const final { return ELECTRON; }
0018
0019 private:
0020 const int _maxMissingHitsEB, _maxMissingHitsEE;
0021 const double _barrelCutOff;
0022 };
0023
0024 DEFINE_EDM_PLUGIN(CutApplicatorFactory, GsfEleMissingHitsCut, "GsfEleMissingHitsCut");
0025
0026 CutApplicatorBase::result_type GsfEleMissingHitsCut::operator()(const reco::GsfElectronPtr& cand) const {
0027 auto maxMissingHits =
0028 (std::abs(cand->superCluster()->position().eta()) < _barrelCutOff ? _maxMissingHitsEB : _maxMissingHitsEE);
0029 return cand->gsfTrack()->missingInnerHits() <= maxMissingHits;
0030 }
0031
0032 double GsfEleMissingHitsCut::value(const reco::CandidatePtr& cand) const {
0033 reco::GsfElectronPtr ele(cand);
0034 return ele->gsfTrack()->missingInnerHits();
0035 }