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
#include <boost/static_assert.hpp>
4
5
namespace
funct
{
6
template
<
typename
A,
typename
B>
7
struct
RatioStruct
{
8
RatioStruct
(
const
A
&
a
,
const
B
&
b
) :
_1
(
a
),
_2
(
b
) {}
9
double
operator()
()
const
{
return
_1
() /
_2
(); }
10
operator
double()
const
{
return
_1
() /
_2
(); }
11
double
operator()
(
double
x)
const
{
return
_1
(x) /
_2
(x); }
12
double
operator()
(
double
x,
double
y)
const
{
return
_1
(x, y) /
_2
(x, y); }
13
A
_1
;
14
B
_2
;
15
};
16
17
template
<
typename
A,
typename
B>
18
struct
Ratio
{
19
typedef
RatioStruct<A, B>
type
;
20
static
type
combine
(
const
A
&
a
,
const
B
&
b
) {
return
type
(
a
,
b
); }
21
};
22
23
template
<
typename
A,
typename
B>
24
inline
typename
Ratio<A, B>::type
operator/
(
const
A
&
a
,
const
B
&
b
) {
25
return
Ratio<A, B>::combine
(
a
,
b
);
26
}
27
28
}
// namespace funct
29
30
#endif
funct::B
TEMPL(T2) struct Divides B
Definition:
Factorize.h:29
funct::RatioStruct::_2
B _2
Definition:
Ratio.h:14
funct::Ratio
Definition:
Ratio.h:18
b
double b
Definition:
hdecay.h:118
funct::RatioStruct::operator()
double operator()(double x, double y) const
Definition:
Ratio.h:12
a
double a
Definition:
hdecay.h:119
A
funct::RatioStruct::_1
A _1
Definition:
Ratio.h:13
funct::RatioStruct::operator()
double operator()(double x) const
Definition:
Ratio.h:11
funct::operator/
Ratio< A, B >::type operator/(const A &a, const B &b)
Definition:
Ratio.h:24
funct::Ratio::combine
static type combine(const A &a, const B &b)
Definition:
Ratio.h:20
funct::Ratio::type
RatioStruct< A, B > type
Definition:
Ratio.h:19
funct::RatioStruct
Definition:
Ratio.h:7
funct::RatioStruct::RatioStruct
RatioStruct(const A &a, const B &b)
Definition:
Ratio.h:8
funct::RatioStruct::operator()
double operator()() const
Definition:
Ratio.h:9
funct
Definition:
Abs.h:5
Generated for CMSSW Reference Manual by
1.8.16