PhysicsTools
Utilities
interface
Ratio.h
Go to the documentation of this file.
1
#ifndef PhysicsTools_Utilities_Ratio_h
2
#define PhysicsTools_Utilities_Ratio_h
3
4
namespace
funct
{
5
template
<
typename
A,
typename
B>
6
struct
RatioStruct
{
7
RatioStruct
(
const
A
&
a
,
const
B
&
b
) :
_1
(
a
),
_2
(
b
) {}
8
double
operator()
()
const
{
return
_1
() /
_2
(); }
9
operator
double()
const
{
return
_1
() /
_2
(); }
10
double
operator()
(
double
x)
const
{
return
_1
(x) /
_2
(x); }
11
double
operator()
(
double
x,
double
y)
const
{
return
_1
(x, y) /
_2
(x, y); }
12
A
_1
;
13
B
_2
;
14
};
15
16
template
<
typename
A,
typename
B>
17
struct
Ratio
{
18
typedef
RatioStruct<A, B>
type
;
19
static
type
combine
(
const
A
&
a
,
const
B
&
b
) {
return
type
(
a
,
b
); }
20
};
21
22
template
<
typename
A,
typename
B>
23
inline
typename
Ratio<A, B>::type
operator/
(
const
A
&
a
,
const
B
&
b
) {
24
return
Ratio<A, B>::combine
(
a
,
b
);
25
}
26
27
}
// namespace funct
28
29
#endif
funct::B
TEMPL(T2) struct Divides B
Definition:
Factorize.h:24
funct::RatioStruct::_2
B _2
Definition:
Ratio.h:13
funct::Ratio
Definition:
Ratio.h:17
b
double b
Definition:
hdecay.h:118
funct::RatioStruct::operator()
double operator()(double x, double y) const
Definition:
Ratio.h:11
a
double a
Definition:
hdecay.h:119
A
funct::RatioStruct::_1
A _1
Definition:
Ratio.h:12
funct::RatioStruct::operator()
double operator()(double x) const
Definition:
Ratio.h:10
funct::operator/
Ratio< A, B >::type operator/(const A &a, const B &b)
Definition:
Ratio.h:23
funct::Ratio::combine
static type combine(const A &a, const B &b)
Definition:
Ratio.h:19
funct::Ratio::type
RatioStruct< A, B > type
Definition:
Ratio.h:18
funct::RatioStruct
Definition:
Ratio.h:6
funct::RatioStruct::RatioStruct
RatioStruct(const A &a, const B &b)
Definition:
Ratio.h:7
funct::RatioStruct::operator()
double operator()() const
Definition:
Ratio.h:8
funct
Definition:
Abs.h:5
Generated for CMSSW Reference Manual by
1.8.16