CommonTools
Utils
interface
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
{
17
typedef
T
first_argument_type
;
18
typedef
T
second_argument_type
;
19
bool
operator()
(
const
T
&
t1
,
const
T
&
t2
)
const
{
return
t1
.et() <
t2
.et(); }
20
};
21
22
template
<
typename
T>
23
struct
GreaterByEt
{
24
typedef
T
first_argument_type
;
25
typedef
T
second_argument_type
;
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>
33
struct
NumericSafeLessByEt
{
34
typedef
T
first_argument_type
;
35
typedef
T
second_argument_type
;
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>
44
struct
NumericSafeGreaterByEt
{
45
typedef
T
first_argument_type
;
46
typedef
T
second_argument_type
;
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
NumericSafeGreaterByEt::operator()
bool operator()(const T &a1, const T &a2)
Definition:
EtComparator.h:47
RandomServiceHelper.t2
t2
Definition:
RandomServiceHelper.py:257
NumericSafeGreaterByEt::first_argument_type
T first_argument_type
Definition:
EtComparator.h:45
GreaterByEt::second_argument_type
T second_argument_type
Definition:
EtComparator.h:25
LessByEt::second_argument_type
T second_argument_type
Definition:
EtComparator.h:18
NumericSafeGreaterByEt
Definition:
EtComparator.h:44
NumericSafeGreaterByEt::second_argument_type
T second_argument_type
Definition:
EtComparator.h:46
NumericSafeLessByEt::second_argument_type
T second_argument_type
Definition:
EtComparator.h:35
geometryDiff.epsilon
int epsilon
Definition:
geometryDiff.py:26
testProducerWithPsetDescEmpty_cfi.a2
a2
Definition:
testProducerWithPsetDescEmpty_cfi.py:35
GreaterByEt
Definition:
EtComparator.h:23
LessByEt::first_argument_type
T first_argument_type
Definition:
EtComparator.h:17
RandomServiceHelper.t1
t1
Definition:
RandomServiceHelper.py:256
NumericSafeLessByEt
Definition:
EtComparator.h:33
NumericSafeLessByEt::operator()
bool operator()(const T &a1, const T &a2)
Definition:
EtComparator.h:36
GreaterByEt::first_argument_type
T first_argument_type
Definition:
EtComparator.h:24
GreaterByEt::operator()
bool operator()(const T &t1, const T &t2) const
Definition:
EtComparator.h:26
NumericSafeLessByEt::first_argument_type
T first_argument_type
Definition:
EtComparator.h:34
T
long double T
Definition:
Basic3DVectorLD.h:48
LessByEt::operator()
bool operator()(const T &t1, const T &t2) const
Definition:
EtComparator.h:19
LessByEt
Definition:
EtComparator.h:16
Generated for CMSSW Reference Manual by
1.8.16