Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef MatchByDR_h_
0002 #define MatchByDR_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/DeltaR.h"
0009 
0010 namespace reco {
0011   template <typename T1, typename T2>
0012   class MatchByDR {
0013   public:
0014     MatchByDR(const edm::ParameterSet& cfg) : maxDR_(cfg.getParameter<double>("maxDeltaR")) {}
0015     bool operator()(const T1& t1, const T2& t2) const { return deltaR_(t1, t2) < maxDR_; }
0016 
0017   private:
0018     DeltaR<T1, T2> deltaR_;
0019     double maxDR_;
0020   };
0021 }  // namespace reco
0022 
0023 #endif