src
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
() : xmin_(-1.0), xmax_(1.0), outOfRangeValue_(0.0) {}
6
7
HcalChebyshevFunctor::HcalChebyshevFunctor
(
const
std::vector<double>& coeffs,
8
const
double
xmin
,
9
const
double
xmax
,
10
const
double
outOfRangeValue)
11
: coeffs_(coeffs), xmin_(
xmin
), xmax_(
xmax
), outOfRangeValue_(outOfRangeValue) {
12
if
(
xmin_
>=
xmax_
)
13
throw
cms::Exception
(
"In HcalChebyshevFunctor constructor: invalid interval specification"
);
14
}
15
16
double
HcalChebyshevFunctor::operator()
(
const
double
y
)
const
{
17
if
(!(
y
>=
xmin_
&&
y
<=
xmax_
))
18
return
outOfRangeValue_
;
19
20
if
(
coeffs_
.empty())
21
return
0.0;
22
23
const
double
x
= 2.0 * (
y
-
xmin_
) / (
xmax_
-
xmin_
) - 1.0;
24
const
double
*
a
= &
coeffs_
[0];
25
const
double
twox = 2.0 *
x
;
26
27
// Clenshaw recursion
28
double
rp2 = 0.0, rp1 = 0.0,
r
= 0.0;
29
for
(
unsigned
k
=
coeffs_
.size() - 1;
k
> 0
U
; --
k
) {
30
r
= twox * rp1 - rp2 +
a
[
k
];
31
rp2 = rp1;
32
rp1 =
r
;
33
}
34
return
x
* rp1 - rp2 +
a
[0];
35
}
36
37
BOOST_CLASS_EXPORT_IMPLEMENT(
HcalChebyshevFunctor
)
HcalChebyshevFunctor
Definition:
HcalChebyshevFunctor.h:17
Exception
Definition:
hltDiff.cc:245
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition:
TrackerOfflineValidation_Dqm_cff.py:10
mitigatedMETSequence_cff.U
U
Definition:
mitigatedMETSequence_cff.py:36
HcalChebyshevFunctor::xmin_
double xmin_
Definition:
HcalChebyshevFunctor.h:44
HcalChebyshevFunctor.h
HcalChebyshevFunctor::HcalChebyshevFunctor
HcalChebyshevFunctor()
Definition:
HcalChebyshevFunctor.cc:5
HcalChebyshevFunctor::xmax_
double xmax_
Definition:
HcalChebyshevFunctor.h:45
alignCSCRings.r
r
Definition:
alignCSCRings.py:93
Exception.h
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition:
TrackerOfflineValidation_Dqm_cff.py:11
detailsBasic3DVector::y
float float y
Definition:
extBasic3DVector.h:15
HcalChebyshevFunctor::outOfRangeValue_
double outOfRangeValue_
Definition:
HcalChebyshevFunctor.h:46
DDAxes::y
a
double a
Definition:
hdecay.h:121
HcalChebyshevFunctor::operator()
double operator()(double x) const override
Definition:
HcalChebyshevFunctor.cc:16
DDAxes::x
dqmdumpme.k
k
Definition:
dqmdumpme.py:60
HcalChebyshevFunctor::coeffs_
std::vector< double > coeffs_
Definition:
HcalChebyshevFunctor.h:43
Generated for CMSSW Reference Manual by
1.8.14