Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:53

0001 #include "PhysicsTools/SelectorUtils/interface/CutApplicatorBase.h"
0002 #include "DataFormats/MuonReco/interface/Muon.h"
0003 #include "DataFormats/MuonReco/interface/MuonSelectors.h"
0004 
0005 class MuonSegmentCompatibilityCut : public CutApplicatorBase {
0006 public:
0007   MuonSegmentCompatibilityCut(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   double maxGlbNormChi2_, maxChi2LocalPos_, maxTrkKink_;
0015   const double minCompatGlb_, minCompatNonGlb_;
0016 };
0017 DEFINE_EDM_PLUGIN(CutApplicatorFactory, MuonSegmentCompatibilityCut, "MuonSegmentCompatibilityCut");
0018 
0019 // Define constructors and initialization routines
0020 MuonSegmentCompatibilityCut::MuonSegmentCompatibilityCut(const edm::ParameterSet& c)
0021     : CutApplicatorBase(c),
0022       minCompatGlb_(c.getParameter<double>("minCompatGlb")),
0023       minCompatNonGlb_(c.getParameter<double>("minCompatNonGlb")) {
0024   const edm::ParameterSet cc = c.getParameter<edm::ParameterSet>("goodGLB");
0025   maxGlbNormChi2_ = cc.getParameter<double>("maxGlbNormChi2");
0026   maxChi2LocalPos_ = cc.getParameter<double>("maxChi2LocalPos");
0027   maxTrkKink_ = cc.getParameter<double>("maxTrkKink");
0028 }
0029 
0030 // Functors for evaluation
0031 CutApplicatorBase::result_type MuonSegmentCompatibilityCut::operator()(const reco::MuonPtr& muon) const {
0032   const bool isGoodGlb =
0033       (muon->isGlobalMuon() and muon->globalTrack()->normalizedChi2() < maxGlbNormChi2_ and
0034        muon->combinedQuality().chi2LocalPosition < maxChi2LocalPos_ and muon->combinedQuality().trkKink < maxTrkKink_);
0035 
0036   const double compat = muon::segmentCompatibility(*muon);
0037 
0038   return compat > (isGoodGlb ? minCompatGlb_ : minCompatNonGlb_);
0039 }
0040 
0041 double MuonSegmentCompatibilityCut::value(const reco::CandidatePtr& cand) const {
0042   const reco::MuonPtr muon(cand);
0043   return muon::segmentCompatibility(*muon);
0044 }