JetMETCorrections
InterpolationTables
interface
CircularMapper1d.h
Go to the documentation of this file.
1
#ifndef NPSTAT_CIRCULARMAPPER1D_HH_
2
#define NPSTAT_CIRCULARMAPPER1D_HH_
3
14
#include <cmath>
15
16
#include "
JetMETCorrections/InterpolationTables/interface/LinearMapper1d.h
"
17
18
namespace
npstat
{
23
class
CircularMapper1d
{
24
public
:
25
inline
CircularMapper1d
() :
a_
(1.0),
b_
(0.0),
period_
(2.0 *
M_PI
) {}
26
27
inline
CircularMapper1d
(
const
double
ca,
const
double
cb,
const
double
cperiod)
28
:
a_
(ca),
b_
(cb),
period_
(
std
::
abs
(cperiod)) {
29
check
();
30
}
31
32
inline
CircularMapper1d
(
const
LinearMapper1d
& mapper,
const
double
cperiod)
33
:
a_
(mapper.
a
()),
b_
(mapper.
b
()),
period_
(
std
::
abs
(cperiod)) {
34
check
();
35
}
36
37
inline
double
operator()
(
const
double
& x)
const
{
38
double
value
=
a_
* x +
b_
;
39
value
-=
period_
* floor(
value
/
period_
);
40
if
(
value
>
period_
/ 2.0)
41
value
-=
period_
;
42
return
value
;
43
}
44
45
inline
double
a
()
const
{
return
a_
; }
46
inline
double
b
()
const
{
return
b_
; }
47
inline
double
period
()
const
{
return
period_
; }
48
inline
LinearMapper1d
linearMapper
()
const
{
return
LinearMapper1d
(
a_
,
b_
); }
49
50
private
:
51
inline
void
check
() {
52
if
(!
period_
)
53
throw
npstat::NpstatInvalidArgument
(
54
"In npstat::CircularMapper1d constructor: "
55
"invalid period argument (can not be 0)"
);
56
}
57
58
double
a_
;
59
double
b_
;
60
double
period_
;
61
};
62
}
// namespace npstat
63
64
#endif // NPSTAT_CIRCULARMAPPER1D_HH_
npstat::CircularMapper1d::CircularMapper1d
CircularMapper1d(const double ca, const double cb, const double cperiod)
Definition:
CircularMapper1d.h:27
npstat::CircularMapper1d::b
double b() const
Definition:
CircularMapper1d.h:46
npstat::CircularMapper1d::check
void check()
Definition:
CircularMapper1d.h:51
npstat::LinearMapper1d
Definition:
LinearMapper1d.h:18
npstat::CircularMapper1d::period_
double period_
Definition:
CircularMapper1d.h:60
LinearMapper1d.h
Linear transformation functor.
npstat
Definition:
AbsArrayProjector.h:14
npstat::CircularMapper1d::CircularMapper1d
CircularMapper1d(const LinearMapper1d &mapper, const double cperiod)
Definition:
CircularMapper1d.h:32
npstat::NpstatInvalidArgument
Definition:
NpstatException.h:38
npstat::CircularMapper1d::period
double period() const
Definition:
CircularMapper1d.h:47
value
Definition:
value.py:1
M_PI
#define M_PI
Definition:
BXVectorInputProducer.cc:50
npstat::CircularMapper1d::a_
double a_
Definition:
CircularMapper1d.h:58
npstat::CircularMapper1d::linearMapper
LinearMapper1d linearMapper() const
Definition:
CircularMapper1d.h:48
std
Definition:
JetResolutionObject.h:76
npstat::CircularMapper1d::operator()
double operator()(const double &x) const
Definition:
CircularMapper1d.h:37
relativeConstraints.value
value
Definition:
relativeConstraints.py:53
npstat::CircularMapper1d::CircularMapper1d
CircularMapper1d()
Definition:
CircularMapper1d.h:25
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
npstat::CircularMapper1d::a
double a() const
Definition:
CircularMapper1d.h:45
npstat::CircularMapper1d
Definition:
CircularMapper1d.h:23
npstat::CircularMapper1d::b_
double b_
Definition:
CircularMapper1d.h:59
Generated for CMSSW Reference Manual by
1.8.16