CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PtComparator.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_PtComparator_h
2 #define CommonTools_Utils_PtComparator_h
3 
16 template<typename T>
17 struct LessByPt {
20  bool operator()( const T & t1, const T & t2 ) const {
21  return t1.pt() < t2.pt();
22  }
23 };
24 
25 template<typename T>
26 struct GreaterByPt {
29  bool operator()( const T & t1, const T & t2 ) const {
30  return t1.pt() > t2.pt();
31  }
32 };
33 
34 #include<limits>
35 #include <cmath>
36 
37 template <class T>
41  bool operator()(const T& a1, const T& a2) {
42  return
43  fabs (a1.pt()-a2.pt()) > std::numeric_limits<double>::epsilon() ? a1.pt() < a2.pt() :
44  fabs (a1.px()-a2.px()) > std::numeric_limits<double>::epsilon() ? a1.px() < a2.px() :
45  a1.pz() < a2.pz();
46  }
47 };
48 
49 template <class T>
53  bool operator()(const T& a1, const T& a2) {
54  return
55  fabs (a1.pt()-a2.pt()) > std::numeric_limits<double>::epsilon() ? a1.pt() > a2.pt() :
56  fabs (a1.px()-a2.px()) > std::numeric_limits<double>::epsilon() ? a1.px() > a2.px() :
57  a1.pz() > a2.pz();
58  }
59 };
60 
61 #endif
bool operator()(const T &a1, const T &a2)
Definition: PtComparator.h:41
bool operator()(const T &t1, const T &t2) const
Definition: PtComparator.h:29
T first_argument_type
Definition: PtComparator.h:18
bool operator()(const T &a1, const T &a2)
Definition: PtComparator.h:53
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:18
T second_argument_type
Definition: PtComparator.h:28
T first_argument_type
Definition: PtComparator.h:27
T second_argument_type
Definition: PtComparator.h:19
const double epsilon
long double T
bool operator()(const T &t1, const T &t2) const
Definition: PtComparator.h:20