CommonTools
Utils
interface
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
{
18
typedef
T
first_argument_type
;
19
typedef
T
second_argument_type
;
20
bool
operator()
(
const
T
&
t1
,
const
T
&
t2
)
const
{
return
t1
.pt() <
t2
.pt(); }
21
};
22
23
template
<
typename
T>
24
struct
GreaterByPt
{
25
typedef
T
first_argument_type
;
26
typedef
T
second_argument_type
;
27
bool
operator()
(
const
T
&
t1
,
const
T
&
t2
)
const
{
return
t1
.pt() >
t2
.pt(); }
28
};
29
30
#include <limits>
31
#include <cmath>
32
33
template
<
class
T>
34
struct
NumericSafeLessByPt
{
35
typedef
T
first_argument_type
;
36
typedef
T
second_argument_type
;
37
bool
operator()
(
const
T
& a1,
const
T
&
a2
) {
38
return
fabs(a1.pt() -
a2
.pt()) >
std::numeric_limits<double>::epsilon
() ? a1.pt() <
a2
.pt()
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>
45
struct
NumericSafeGreaterByPt
{
46
typedef
T
first_argument_type
;
47
typedef
T
second_argument_type
;
48
bool
operator()
(
const
T
& a1,
const
T
&
a2
) {
49
return
fabs(a1.pt() -
a2
.pt()) >
std::numeric_limits<double>::epsilon
() ? a1.pt() >
a2
.pt()
50
: fabs(a1.px() -
a2
.px()) >
std::numeric_limits<double>::epsilon
() ? a1.px() >
a2
.px()
51
: a1.pz() >
a2
.pz();
52
}
53
};
54
55
#endif
RandomServiceHelper.t2
t2
Definition:
RandomServiceHelper.py:257
GreaterByPt
Definition:
PtComparator.h:24
NumericSafeGreaterByPt::second_argument_type
T second_argument_type
Definition:
PtComparator.h:47
GreaterByPt::operator()
bool operator()(const T &t1, const T &t2) const
Definition:
PtComparator.h:27
GreaterByPt::second_argument_type
T second_argument_type
Definition:
PtComparator.h:26
geometryDiff.epsilon
int epsilon
Definition:
geometryDiff.py:26
testProducerWithPsetDescEmpty_cfi.a2
a2
Definition:
testProducerWithPsetDescEmpty_cfi.py:35
RandomServiceHelper.t1
t1
Definition:
RandomServiceHelper.py:256
NumericSafeGreaterByPt
Definition:
PtComparator.h:45
LessByPt::second_argument_type
T second_argument_type
Definition:
PtComparator.h:19
NumericSafeGreaterByPt::operator()
bool operator()(const T &a1, const T &a2)
Definition:
PtComparator.h:48
NumericSafeLessByPt::first_argument_type
T first_argument_type
Definition:
PtComparator.h:35
NumericSafeLessByPt
Definition:
PtComparator.h:34
NumericSafeLessByPt::second_argument_type
T second_argument_type
Definition:
PtComparator.h:36
NumericSafeLessByPt::operator()
bool operator()(const T &a1, const T &a2)
Definition:
PtComparator.h:37
LessByPt::first_argument_type
T first_argument_type
Definition:
PtComparator.h:18
T
long double T
Definition:
Basic3DVectorLD.h:48
GreaterByPt::first_argument_type
T first_argument_type
Definition:
PtComparator.h:25
NumericSafeGreaterByPt::first_argument_type
T first_argument_type
Definition:
PtComparator.h:46
LessByPt::operator()
bool operator()(const T &t1, const T &t2) const
Definition:
PtComparator.h:20
LessByPt
Definition:
PtComparator.h:17
Generated for CMSSW Reference Manual by
1.8.16