Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:11

0001 #ifndef MatchByDRDPt_h_
0002 #define MatchByDRDPt_h_
0003 
0004 /** Define match between two objects by deltaR and deltaPt.
0005  */
0006 
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "CommonTools/UtilAlgos/interface/MatchByDR.h"
0009 
0010 namespace reco {
0011   template <typename T1, typename T2>
0012   class MatchByDRDPt {
0013   public:
0014     MatchByDRDPt(const edm::ParameterSet& cfg) : deltaR_(cfg), maxDPtRel_(cfg.getParameter<double>("maxDPtRel")) {}
0015     bool operator()(const T1& t1, const T2& t2) const {
0016       return fabs(t1.pt() - t2.pt()) / t2.pt() < maxDPtRel_ && deltaR_(t1, t2);
0017     }
0018 
0019   private:
0020     reco::MatchByDR<T1, T2> deltaR_;
0021     double maxDPtRel_;
0022   };
0023 }  // namespace reco
0024 
0025 #endif