Main Page
Namespaces
Classes
Package Documentation
CondFormats
HcalObjects
src
HcalChebyshevFunctor.cc
Go to the documentation of this file.
1
#include "
FWCore/Utilities/interface/Exception.h
"
2
3
#include "
CondFormats/HcalObjects/interface/HcalChebyshevFunctor.h
"
4
5
HcalChebyshevFunctor::HcalChebyshevFunctor
()
6
: xmin_(-1.0), xmax_(1.0), outOfRangeValue_(0.0)
7
{
8
}
9
10
HcalChebyshevFunctor::HcalChebyshevFunctor
(
11
const
std::vector<double>& coeffs,
12
const
double
xmin
,
const
double
xmax
,
13
const
double
outOfRangeValue)
14
:
coeffs_
(coeffs),
15
xmin_
(xmin),
16
xmax_
(xmax),
17
outOfRangeValue_
(outOfRangeValue)
18
{
19
if
(
xmin_
>=
xmax_
)
throw
cms::Exception
(
20
"In HcalChebyshevFunctor constructor: invalid interval specification"
);
21
}
22
23
double
HcalChebyshevFunctor::operator()
(
const
double
y
)
const
24
{
25
if
(!(y >=
xmin_
&& y <=
xmax_
))
26
return
outOfRangeValue_
;
27
28
if
(
coeffs_
.empty())
29
return
0.0;
30
31
const
double
x
= 2.0*(y -
xmin_
)/(
xmax_
-
xmin_
) - 1.0;
32
const
double
*
a
= &
coeffs_
[0];
33
const
double
twox = 2.0*
x
;
34
35
// Clenshaw recursion
36
double
rp2 = 0.0, rp1 = 0.0,
r
= 0.0;
37
for
(
unsigned
k
=
coeffs_
.size()-1;
k
> 0
U
; --
k
)
38
{
39
r
= twox*rp1 - rp2 + a[
k
];
40
rp2 = rp1;
41
rp1 =
r
;
42
}
43
return
x*rp1 - rp2 + a[0];
44
}
45
46
BOOST_CLASS_EXPORT_IMPLEMENT(
HcalChebyshevFunctor
)
HcalChebyshevFunctor
Definition:
HcalChebyshevFunctor.h:17
HcalChebyshevFunctor::xmin
virtual double xmin() const override
Definition:
HcalChebyshevFunctor.h:33
HcalChebyshevFunctor::operator()
virtual double operator()(double x) const override
Definition:
HcalChebyshevFunctor.cc:23
Exception
Definition:
hltDiff.cc:292
mitigatedMETSequence_cff.U
U
Definition:
mitigatedMETSequence_cff.py:36
HcalChebyshevFunctor::xmin_
double xmin_
Definition:
HcalChebyshevFunctor.h:49
HcalChebyshevFunctor.h
HcalChebyshevFunctor::HcalChebyshevFunctor
HcalChebyshevFunctor()
Definition:
HcalChebyshevFunctor.cc:5
HcalChebyshevFunctor::xmax_
double xmax_
Definition:
HcalChebyshevFunctor.h:50
gen::k
int k[5][pyjets_maxn]
Definition:
Cascade2Hadronizer.cc:79
alignCSCRings.r
r
Definition:
alignCSCRings.py:92
Exception.h
HcalChebyshevFunctor::outOfRangeValue_
double outOfRangeValue_
Definition:
HcalChebyshevFunctor.h:51
HcalChebyshevFunctor::xmax
virtual double xmax() const override
Definition:
HcalChebyshevFunctor.h:34
DDAxes::y
a
double a
Definition:
hdecay.h:121
DDAxes::x
HcalChebyshevFunctor::coeffs_
std::vector< double > coeffs_
Definition:
HcalChebyshevFunctor.h:48
Generated for CMSSW Reference Manual by
1.8.11