Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:15:44

0001 #ifndef PhysicsTools_Heppy_CMGMuonCleanerBySegmentsAlgo_h
0002 #define PhysicsTools_Heppy_CMGMuonCleanerBySegmentsAlgo_h
0003 
0004 #include "DataFormats/PatCandidates/interface/Muon.h"
0005 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0006 #include <vector>
0007 
0008 namespace heppy {
0009 
0010   class CMGMuonCleanerBySegmentsAlgo {
0011   public:
0012     CMGMuonCleanerBySegmentsAlgo(double sharedFraction = 0.499,
0013                                  const std::string &preselection = "track.isNonnull",
0014                                  const std::string &passthrough = "isGlobalMuon && numberOfMatches >= 2")
0015         : sharedFraction_(sharedFraction), preselection_(preselection, true), passthrough_(passthrough, true) {}
0016     ~CMGMuonCleanerBySegmentsAlgo();
0017 
0018     /// Return a vector of boolean marking the muons to be considered clean
0019     std::vector<bool> clean(const std::vector<pat::Muon> &muons) const;
0020 
0021   private:
0022     /// Fraction of shared segments
0023     double sharedFraction_;
0024 
0025     /// Preselection cut
0026     StringCutObjectSelector<pat::Muon> preselection_;
0027     /// Always-accept cut
0028     StringCutObjectSelector<pat::Muon> passthrough_;
0029 
0030     /// Methods
0031     bool isSameMuon(const pat::Muon &mu1, const pat::Muon &mu2) const;
0032     bool isBetterMuon(const pat::Muon &mu1, bool mu1PF, const pat::Muon &mu2, bool mu2PF) const;
0033   };
0034 
0035 }  // namespace heppy
0036 
0037 #endif