CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
20  return t1.et() < t2.et();
21  }
22 };
23 
24 template<typename T>
25 struct GreaterByEt {
28  bool operator()( const T & t1, const T & t2 ) const {
29  return t1.et() > t2.et();
30  }
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.et()-a2.et()) > std::numeric_limits<double>::epsilon() ? a1.et() < a2.et() :
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.et()-a2.et()) > std::numeric_limits<double>::epsilon() ? a1.et() > a2.et() :
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: EtComparator.h:53
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:28
T second_argument_type
Definition: EtComparator.h:27
bool operator()(const T &t1, const T &t2) const
Definition: EtComparator.h:19
T first_argument_type
Definition: EtComparator.h:26
const double epsilon
long double T
bool operator()(const T &a1, const T &a2)
Definition: EtComparator.h:41