File indexing completed on 2024-04-06 12:26:59
0001 #include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h"
0002 #include "DataFormats/MuonReco/interface/Muon.h"
0003 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
0004
0005 class MuonMatchCut : public CutApplicatorBase {
0006 public:
0007 MuonMatchCut(const edm::ParameterSet& c);
0008
0009 result_type operator()(const reco::MuonPtr&) const final;
0010 CandidateType candidateType() const final { return MUON; }
0011 double value(const reco::CandidatePtr&) const final;
0012
0013 private:
0014 const int minNumberOfMatchedStations_;
0015 };
0016 DEFINE_EDM_PLUGIN(CutApplicatorFactory, MuonMatchCut, "MuonMatchCut");
0017
0018
0019 MuonMatchCut::MuonMatchCut(const edm::ParameterSet& c)
0020 : CutApplicatorBase(c), minNumberOfMatchedStations_(c.getParameter<int>("minNumberOfMatchedStations")) {}
0021
0022
0023 CutApplicatorBase::result_type MuonMatchCut::operator()(const reco::MuonPtr& muon) const {
0024 return muon->numberOfMatchedStations() >= minNumberOfMatchedStations_;
0025 }
0026
0027 double MuonMatchCut::value(const reco::CandidatePtr& cand) const {
0028 const reco::MuonPtr muon(cand);
0029 return muon->numberOfMatchedStations();
0030 }