Main Page
Namespaces
Classes
Package Documentation
GIT Directory
WorkBook
Offline Guide
Release schedule
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
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
()
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
> 0U; --
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
Exception
Definition:
hltDiff.cc:291
relval_2017.k
list k
Definition:
relval_2017.py:23
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
Exception.h
hlt_dqm_clientPB-live_cfg.xmax
tuple xmax
Definition:
hlt_dqm_clientPB-live_cfg.py:37
detailsBasic3DVector::y
float float y
Definition:
extBasic3DVector.h:15
HcalChebyshevFunctor::outOfRangeValue_
double outOfRangeValue_
Definition:
HcalChebyshevFunctor.h:51
a
double a
Definition:
hdecay.h:121
HcalChebyshevFunctor::operator()
virtual double operator()(double x) const override
Definition:
HcalChebyshevFunctor.cc:23
alignCSCRings.r
list r
Definition:
alignCSCRings.py:92
DDAxes::x
hlt_dqm_clientPB-live_cfg.xmin
tuple xmin
Definition:
hlt_dqm_clientPB-live_cfg.py:36
HcalChebyshevFunctor::coeffs_
std::vector< double > coeffs_
Definition:
HcalChebyshevFunctor.h:48
Generated for CMSSW Reference Manual by
1.8.5