Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
> 0U; --
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
isotrackApplyRegressor.k
int k
Definition:
isotrackApplyRegressor.py:91
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
Exception.h
hlt_dqm_clientPB-live_cfg.xmax
tuple xmax
Definition:
hlt_dqm_clientPB-live_cfg.py:52
detailsBasic3DVector::y
float float y
Definition:
extBasic3DVector.h:14
HcalChebyshevFunctor::outOfRangeValue_
double outOfRangeValue_
Definition:
HcalChebyshevFunctor.h:46
a
double a
Definition:
hdecay.h:119
HcalChebyshevFunctor::operator()
double operator()(double x) const override
Definition:
HcalChebyshevFunctor.cc:16
alignCSCRings.r
list r
Definition:
alignCSCRings.py:93
DDAxes::x
hlt_dqm_clientPB-live_cfg.xmin
tuple xmin
Definition:
hlt_dqm_clientPB-live_cfg.py:51
HcalChebyshevFunctor::coeffs_
std::vector< double > coeffs_
Definition:
HcalChebyshevFunctor.h:43
Generated for CMSSW Reference Manual by
1.8.5