CondFormats
HcalObjects
interface
HcalInterpolatedTableFunctor.h
Go to the documentation of this file.
1
#ifndef CondFormats_HcalObjects_HcalInterpolatedTableFunctor_h
2
#define CondFormats_HcalObjects_HcalInterpolatedTableFunctor_h
3
4
#include "
CondFormats/HcalObjects/interface/HcalPiecewiseLinearFunctor.h
"
5
6
//
7
// Simple linear interpolator from equidistant points.
8
// Need O(1) operations no matter how many points are used.
9
//
10
class
HcalInterpolatedTableFunctor
:
public
AbsHcalFunctor
{
11
public
:
12
// Dummy constructor, to be used for deserialization only
13
HcalInterpolatedTableFunctor
();
14
15
// The vector of values must have at least two elements
16
// (for xmin and xmax).
17
//
18
// Argument "leftExtrapolationLinear" determines
19
// whether the extrapolation to the left of xmin
20
// is going to be constant or linear.
21
//
22
// Argument "rightExtrapolationLinear" determines
23
// whether the extrapolation to the right of xmax
24
// is going to be constant or linear.
25
//
26
HcalInterpolatedTableFunctor
(
const
std::vector<double>&
values
,
27
double
xmin
,
28
double
xmax
,
29
bool
leftExtrapolationLinear
,
30
bool
rightExtrapolationLinear
);
31
32
inline
~HcalInterpolatedTableFunctor
()
override
{}
33
34
double
operator()
(
double
x
)
const override
;
35
inline
double
xmin
()
const override
{
return
xmin_
; }
36
inline
double
xmax
()
const override
{
return
xmax_
; }
37
38
// Check if the interpolated values are strictly increasing or decreasing
39
bool
isStrictlyMonotonous
()
const
;
40
41
// For strictly monotonous functors,
42
// we will be able to generate the inverse
43
HcalPiecewiseLinearFunctor
inverse
()
const
;
44
45
protected
:
46
inline
bool
isEqual
(
const
AbsHcalFunctor
&
other
)
const override
{
47
const
HcalInterpolatedTableFunctor
&
r
= static_cast<const HcalInterpolatedTableFunctor&>(
other
);
48
return
values_
==
r
.values_ &&
xmin_
==
r
.xmin_ &&
xmax_
==
r
.xmax_ &&
49
leftExtrapolationLinear_
==
r
.leftExtrapolationLinear_ &&
50
rightExtrapolationLinear_
==
r
.rightExtrapolationLinear_;
51
}
52
53
private
:
54
std::vector<double>
values_
;
55
double
xmin_
;
56
double
xmax_
;
57
bool
leftExtrapolationLinear_
;
58
bool
rightExtrapolationLinear_
;
59
60
friend
class
boost::serialization::access
;
61
62
template
<
class
Archive>
63
inline
void
serialize
(Archive& ar,
unsigned
/* version */
) {
64
boost::serialization::base_object<AbsHcalFunctor>(*
this
);
65
ar&
values_
&
xmin_
&
xmax_
&
leftExtrapolationLinear_
&
rightExtrapolationLinear_
;
66
}
67
};
68
69
BOOST_CLASS_VERSION(
HcalInterpolatedTableFunctor
, 1)
70
BOOST_CLASS_EXPORT_KEY(
HcalInterpolatedTableFunctor
)
71
72
#endif // CondFormats_HcalObjects_HcalInterpolatedTableFunctor_h
HcalInterpolatedTableFunctor::xmin
double xmin() const override
Definition:
HcalInterpolatedTableFunctor.h:35
AbsHcalFunctor
Definition:
AbsHcalFunctor.h:19
HcalInterpolatedTableFunctor
Definition:
HcalInterpolatedTableFunctor.h:10
HcalInterpolatedTableFunctor::access
friend class boost::serialization::access
Definition:
HcalInterpolatedTableFunctor.h:60
HcalInterpolatedTableFunctor::xmin_
double xmin_
Definition:
HcalInterpolatedTableFunctor.h:55
HcalInterpolatedTableFunctor::isEqual
bool isEqual(const AbsHcalFunctor &other) const override
Definition:
HcalInterpolatedTableFunctor.h:46
HcalInterpolatedTableFunctor::leftExtrapolationLinear_
bool leftExtrapolationLinear_
Definition:
HcalInterpolatedTableFunctor.h:57
DDAxes::x
HcalPiecewiseLinearFunctor
Definition:
HcalPiecewiseLinearFunctor.h:17
HcalInterpolatedTableFunctor::operator()
double operator()(double x) const override
Definition:
HcalInterpolatedTableFunctor.cc:34
HcalInterpolatedTableFunctor::~HcalInterpolatedTableFunctor
~HcalInterpolatedTableFunctor() override
Definition:
HcalInterpolatedTableFunctor.h:32
contentValuesCheck.values
values
Definition:
contentValuesCheck.py:38
HcalInterpolatedTableFunctor::values_
std::vector< double > values_
Definition:
HcalInterpolatedTableFunctor.h:54
trackingPlots.other
other
Definition:
trackingPlots.py:1464
HcalInterpolatedTableFunctor::xmax_
double xmax_
Definition:
HcalInterpolatedTableFunctor.h:56
HcalInterpolatedTableFunctor::inverse
HcalPiecewiseLinearFunctor inverse() const
Definition:
HcalInterpolatedTableFunctor.cc:64
mixed_calib_calo_ttbar_result.leftExtrapolationLinear
leftExtrapolationLinear
Definition:
mixed_calib_calo_ttbar_result.py:10
HcalPiecewiseLinearFunctor.h
alignCSCRings.r
r
Definition:
alignCSCRings.py:93
HcalInterpolatedTableFunctor::serialize
void serialize(Archive &ar, unsigned)
Definition:
HcalInterpolatedTableFunctor.h:63
HcalInterpolatedTableFunctor::HcalInterpolatedTableFunctor
HcalInterpolatedTableFunctor()
Definition:
HcalInterpolatedTableFunctor.cc:11
HcalInterpolatedTableFunctor::rightExtrapolationLinear_
bool rightExtrapolationLinear_
Definition:
HcalInterpolatedTableFunctor.h:58
mixed_calib_calo_ttbar_result.rightExtrapolationLinear
rightExtrapolationLinear
Definition:
mixed_calib_calo_ttbar_result.py:11
HcalInterpolatedTableFunctor::isStrictlyMonotonous
bool isStrictlyMonotonous() const
Definition:
HcalInterpolatedTableFunctor.cc:60
HcalInterpolatedTableFunctor::xmax
double xmax() const override
Definition:
HcalInterpolatedTableFunctor.h:36
Generated for CMSSW Reference Manual by
1.8.16