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
)
DDAxes::y
HcalChebyshevFunctor::outOfRangeValue_
double outOfRangeValue_
Definition:
HcalChebyshevFunctor.h:46
DDAxes::x
HcalChebyshevFunctor::coeffs_
std::vector< double > coeffs_
Definition:
HcalChebyshevFunctor.h:43
dqmdumpme.k
k
Definition:
dqmdumpme.py:60
mitigatedMETSequence_cff.U
U
Definition:
mitigatedMETSequence_cff.py:36
a
double a
Definition:
hdecay.h:119
alignCSCRings.r
r
Definition:
alignCSCRings.py:93
HcalChebyshevFunctor
Definition:
HcalChebyshevFunctor.h:17
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition:
TrackerOfflineValidation_Dqm_cff.py:11
Exception
Definition:
hltDiff.cc:246
HcalChebyshevFunctor::HcalChebyshevFunctor
HcalChebyshevFunctor()
Definition:
HcalChebyshevFunctor.cc:5
detailsBasic3DVector::y
float float y
Definition:
extBasic3DVector.h:14
HcalChebyshevFunctor.h
Exception.h
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition:
TrackerOfflineValidation_Dqm_cff.py:10
HcalChebyshevFunctor::xmax_
double xmax_
Definition:
HcalChebyshevFunctor.h:45
HcalChebyshevFunctor::xmin_
double xmin_
Definition:
HcalChebyshevFunctor.h:44
HcalChebyshevFunctor::operator()
double operator()(double x) const override
Definition:
HcalChebyshevFunctor.cc:16
Generated for CMSSW Reference Manual by
1.8.16