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() ? a1.et() < a2.et()
38  : fabs(a1.px() - a2.px()) > std::numeric_limits<double>::epsilon() ? a1.px() < a2.px()
39  : a1.pz() < a2.pz();
40  }
41 };
42 
43 template <class T>
47  bool operator()(const T& a1, const T& a2) {
48  return fabs(a1.et() - a2.et()) > std::numeric_limits<double>::epsilon() ? a1.et() > a2.et()
49  : fabs(a1.px() - a2.px()) > std::numeric_limits<double>::epsilon() ? a1.px() > a2.px()
50  : a1.pz() > a2.pz();
51  }
52 };
53 
54 #endif
bool operator()(const T &a1, const T &a2)
Definition: EtComparator.h:47
bool operator()(const T &t1, const T &t2) const
Definition: EtComparator.h:26
T second_argument_type
Definition: EtComparator.h:18
T first_argument_type
Definition: EtComparator.h:17
T second_argument_type
Definition: EtComparator.h:25
T first_argument_type
Definition: EtComparator.h:24
bool operator()(const T &t1, const T &t2) const
Definition: EtComparator.h:19
long double T
bool operator()(const T &a1, const T &a2)
Definition: EtComparator.h:36