CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PiecewiseScalingPolynomial.cc
Go to the documentation of this file.
1 #include <climits>
2 
4 
6  const std::vector<std::vector<double> >& coeffs,
7  const std::vector<double>& limits)
8  : coeffs_(coeffs),
9  limits_(limits)
10 {
11  if (!validate()) throw cms::Exception(
12  "Invalid PiecewiseScalingPolynomial constructor arguments");
13 }
14 
16 {
17  const std::size_t nLimits(limits_.size());
18  if (!nLimits)
19  return false;
20  if (nLimits >= static_cast<std::size_t>(UINT_MAX))
21  return false;
22  if (limits_[0] <= 0.0)
23  return false;
24  for (std::size_t i=0; i<nLimits-1; ++i)
25  if (!(limits_[i] < limits_[i+1]))
26  return false;
27  if (coeffs_.size() != nLimits + 1)
28  return false;
29  for (std::size_t i=0; i<=nLimits; ++i)
30  {
31  if (coeffs_[i].empty())
32  return false;
33  if (coeffs_[i].size() >= static_cast<std::size_t>(INT_MAX))
34  return false;
35  }
36  return true;
37 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< double > > coeffs_
tuple size
Write out results.