CMS 3D CMS Logo

EtComparator.h
Go to the documentation of this file.
1 #ifndef CommonTools_Utils_EtComparator_h
2 #define CommonTools_Utils_EtComparator_h
3 
15 template <typename T>
16 struct LessByEt {
19  bool operator()(const T& t1, const T& t2) const { return t1.et() < t2.et(); }
20 };
21 
22 template <typename T>
23 struct GreaterByEt {
26  bool operator()(const T& t1, const T& t2) const { return t1.et() > t2.et(); }
27 };
28 
29 #include <limits>
30 #include <cmath>
31 
32 template <class T>
36  bool operator()(const T& a1, const T& a2) {
37  return fabs(a1.et() - a2.et()) > std::numeric_limits<double>::epsilon()
38  ? a1.et() < a2.et()
39  : fabs(a1.px() - a2.px()) > std::numeric_limits<double>::epsilon() ? a1.px() < a2.px()
40  : a1.pz() < a2.pz();
41  }
42 };
43 
44 template <class T>
48  bool operator()(const T& a1, const T& a2) {
49  return fabs(a1.et() - a2.et()) > std::numeric_limits<double>::epsilon()
50  ? a1.et() > a2.et()
51  : fabs(a1.px() - a2.px()) > std::numeric_limits<double>::epsilon() ? a1.px() > a2.px()
52  : a1.pz() > a2.pz();
53  }
54 };
55 
56 #endif
bool operator()(const T &a1, const T &a2)
Definition: EtComparator.h:48
T second_argument_type
Definition: EtComparator.h:18
T first_argument_type
Definition: EtComparator.h:17
bool operator()(const T &t1, const T &t2) const
Definition: EtComparator.h:26
T second_argument_type
Definition: EtComparator.h:25
bool operator()(const T &t1, const T &t2) const
Definition: EtComparator.h:19
T first_argument_type
Definition: EtComparator.h:24
long double T
bool operator()(const T &a1, const T &a2)
Definition: EtComparator.h:36