CMS 3D CMS Logo

PiecewiseScalingPolynomial.cc
Go to the documentation of this file.
1 #include <climits>
2 
4 
5 PiecewiseScalingPolynomial::PiecewiseScalingPolynomial(const std::vector<std::vector<double> >& coeffs,
6  const std::vector<double>& limits)
7  : coeffs_(coeffs), limits_(limits) {
8  if (!validate())
9  throw cms::Exception("Invalid PiecewiseScalingPolynomial constructor arguments");
10 }
11 
13  const std::size_t nLimits(limits_.size());
14  if (!nLimits)
15  return false;
16  if (nLimits >= static_cast<std::size_t>(UINT_MAX))
17  return false;
18  if (limits_[0] <= 0.0)
19  return false;
20  for (std::size_t i = 0; i < nLimits - 1; ++i)
21  if (!(limits_[i] < limits_[i + 1]))
22  return false;
23  if (coeffs_.size() != nLimits + 1)
24  return false;
25  for (std::size_t i = 0; i <= nLimits; ++i) {
26  if (coeffs_[i].empty())
27  return false;
28  if (coeffs_[i].size() >= static_cast<std::size_t>(INT_MAX))
29  return false;
30  }
31  return true;
32 }
size
Write out results.
std::vector< std::vector< double > > coeffs_