CMS 3D CMS Logo

MatchLessByDPt.h
Go to the documentation of this file.
1 #ifndef MatchLessByDPt_h_
2 #define MatchLessByDPt_h_
3 
8 // #include "CommonTools/UtilAlgos/interface/DeltaR.h"
9 
10 namespace reco {
11  template <typename C1, typename C2>
12  struct MatchLessByDPt {
13  public:
14  MatchLessByDPt(const edm::ParameterSet& cfg, const C1& c1, const C2& c2)
15  : // deltaR_(cfg),
16  c1_(c1),
17  c2_(c2) {}
18  bool operator()(const std::pair<size_t, size_t>& p1, const std::pair<size_t, size_t>& p2) const {
19  typedef typename C1::value_type T1;
20  typedef typename C2::value_type T2;
21  const T1& p1_1 = c1_[p1.first];
22  const T2& p1_2 = c2_[p1.second];
23  const T1& p2_1 = c1_[p2.first];
24  const T2& p2_2 = c2_[p2.second];
25  if (fabs(p1_1.pt() - p1_2.pt()) / p1_2.pt() < fabs(p2_1.pt() - p2_2.pt()) / p2_2.pt())
26  return true;
27  return false;
28  }
29 
30  private:
31  // DeltaR deltaR_;
32  const C1& c1_;
33  const C2& c2_;
34  };
35 } // namespace reco
36 
37 #endif
bool operator()(const std::pair< size_t, size_t > &p1, const std::pair< size_t, size_t > &p2) const
MatchLessByDPt(const edm::ParameterSet &cfg, const C1 &c1, const C2 &c2)
fixed size matrix