CMS 3D CMS Logo

HcalPolynomialFunctor.cc
Go to the documentation of this file.
1 #include <algorithm>
3 
5 
6 HcalPolynomialFunctor::HcalPolynomialFunctor() : shift_(0.0), xmin_(-DBL_MAX), xmax_(DBL_MAX), outOfRangeValue_(0.0) {}
7 
8 HcalPolynomialFunctor::HcalPolynomialFunctor(const std::vector<double>& coeffs,
9  const double shift,
10  const double xmin,
11  const double xmax,
12  const double outOfRangeValue)
13  : coeffs_(coeffs), shift_(shift), xmin_(xmin), xmax_(xmax), outOfRangeValue_(outOfRangeValue) {}
14 
15 double HcalPolynomialFunctor::operator()(const double x) const {
16  double result = outOfRangeValue_;
17  if (x >= xmin_ && x <= xmax_) {
18  result = 0.0;
19  if (!coeffs_.empty()) {
20  const double* a = &coeffs_[0];
21  const double y = x + shift_;
22  for (int deg = coeffs_.size() - 1; deg >= 0; --deg) {
23  result *= y;
24  result += a[deg];
25  }
26  }
27  }
28  return result;
29 }
30 
31 BOOST_CLASS_EXPORT_IMPLEMENT(HcalPolynomialFunctor)
DDAxes::y
HcalPolynomialFunctor::operator()
double operator()(double x) const override
Definition: HcalPolynomialFunctor.cc:15
HcalPolynomialFunctor::coeffs_
std::vector< double > coeffs_
Definition: HcalPolynomialFunctor.h:46
DDAxes::x
HcalPolynomialFunctor
Definition: HcalPolynomialFunctor.h:16
vertices_cff.x
x
Definition: vertices_cff.py:29
HcalPolynomialFunctor::xmax_
double xmax_
Definition: HcalPolynomialFunctor.h:49
a
double a
Definition: hdecay.h:119
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
HcalPolynomialFunctor::HcalPolynomialFunctor
HcalPolynomialFunctor()
Definition: HcalPolynomialFunctor.cc:6
HcalPolynomialFunctor::shift_
double shift_
Definition: HcalPolynomialFunctor.h:47
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
Exception.h
HcalPolynomialFunctor::outOfRangeValue_
double outOfRangeValue_
Definition: HcalPolynomialFunctor.h:50
mps_fire.result
result
Definition: mps_fire.py:303
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
HcalPolynomialFunctor.h
HcalPolynomialFunctor::xmin_
double xmin_
Definition: HcalPolynomialFunctor.h:48