File indexing completed on 2024-04-06 12:01:16
0001 #ifndef MatchLessByDEta_h_
0002 #define MatchLessByDEta_h_
0003
0004
0005
0006
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008
0009 namespace reco {
0010 template <typename C1, typename C2>
0011 struct MatchLessByDEta {
0012 public:
0013 MatchLessByDEta(const edm::ParameterSet& cfg, const C1& c1, const C2& c2) : c1_(c1), c2_(c2) {}
0014 bool operator()(const std::pair<size_t, size_t>& p1, const std::pair<size_t, size_t>& p2) const {
0015 typedef typename C1::value_type T1;
0016 typedef typename C2::value_type T2;
0017 const T1& p1_1 = c1_[p1.first];
0018 const T2& p1_2 = c2_[p1.second];
0019 const T1& p2_1 = c1_[p2.first];
0020 const T2& p2_2 = c2_[p2.second];
0021 if (fabs(p1_1.eta() - p1_2.eta()) < fabs(p2_1.eta() - p2_2.eta()))
0022 return true;
0023 return false;
0024 }
0025
0026 private:
0027 const C1& c1_;
0028 const C2& c2_;
0029 };
0030 }
0031
0032 #endif