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