CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CommonTools/UtilAlgos/interface/MatchLessByDPt.h

Go to the documentation of this file.
00001 #ifndef MatchLessByDPt_h_
00002 #define MatchLessByDPt_h_
00003 
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 // #include "CommonTools/UtilAlgos/interface/DeltaR.h"
00009 
00010 namespace reco {
00011   template <typename C1, typename C2> struct MatchLessByDPt {
00012   public: 
00013     MatchLessByDPt ( const edm::ParameterSet& cfg,
00014                      const C1& c1, const C2& c2) :
00015 //       deltaR_(cfg), 
00016       c1_(c1), c2_(c2) {}
00017     bool operator() (const std::pair<size_t,size_t>& p1,
00018                      const std::pair<size_t,size_t>& p2) const {
00019       typedef typename C1::value_type T1;
00020       typedef typename C2::value_type T2;
00021       const T1& p1_1 = c1_[p1.first];
00022       const T2& p1_2 = c2_[p1.second];
00023       const T1& p2_1 = c1_[p2.first];
00024       const T2& p2_2 = c2_[p2.second];
00025       if ( fabs(p1_1.pt()-p1_2.pt())/p1_2.pt() <
00026            fabs(p2_1.pt()-p2_2.pt())/p2_2.pt() )  return true;
00027       return false;
00028     }
00029   private:
00030     //     DeltaR deltaR_;
00031     const C1& c1_;
00032     const C2& c2_;
00033   };
00034 }
00035 
00036 #endif