CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Namespaces | Classes | Typedefs | Functions
npstat Namespace Reference

Namespaces

 Private
 

Classes

struct  AbsArrayProjector
 
struct  AbsMultivariateFunctor
 
struct  AbsVisitor
 
struct  addmul_left
 
struct  addmul_right
 
class  ArrayND
 
class  ArrayNDScanner
 
struct  ArrayRange
 
struct  assign_left
 
struct  assign_right
 
struct  BoxND
 
class  BoxNDScanner
 
struct  CastingCopyConstructor
 
class  CircularMapper1d
 
struct  ComplexComparesAbs
 
struct  ComplexComparesAbs< std::complex< T > >
 
struct  ComplexComparesFalse
 
struct  ComplexComparesFalse< std::complex< T > >
 
class  CoordinateSelector
 
struct  DefaultConstructor0
 
struct  DefaultConstructor1
 
struct  DefaultConstructor2
 
struct  DefaultConstructor3
 
struct  diveq_left
 
struct  diveq_left_0by0isC
 
struct  diveq_right
 
struct  diveq_right_0by0isC
 
class  DualAxis
 
class  DualHistoAxis
 
struct  Element1D
 
struct  Element1DAt
 
class  EquidistantInLinearSpace
 
class  EquidistantInLogSpace
 
struct  FcnFunctor0
 
struct  FcnFunctor1
 
struct  FcnFunctor2
 
struct  FcnFunctor3
 
struct  Functor0
 
struct  Functor1
 
struct  Functor2
 
struct  Functor3
 
class  GridAxis
 
class  HistoAxis
 
class  HistoND
 
class  Interval
 
class  LinearMapper1d
 
class  LinInterpolatedTableND
 
struct  minuseq_left
 
struct  minuseq_right
 
struct  multeq_left
 
struct  multeq_right
 
class  MultivariateFunctorScanner
 
struct  NpstatDomainError
 
struct  NpstatException
 
struct  NpstatInvalidArgument
 
struct  NpstatOutOfRange
 
struct  NpstatRuntimeError
 
class  NUHistoAxis
 
struct  pluseq_left
 
struct  pluseq_right
 
struct  PreciseType
 
struct  PreciseType< const std::complex< T > >
 
struct  PreciseType< const volatile std::complex< T > >
 
struct  PreciseType< std::complex< T > >
 
struct  PreciseType< volatile std::complex< T > >
 
struct  PreciseTypeHelper
 
struct  PreciseTypeHelper< T, 1 >
 
struct  ProperDblFromCmpl
 
struct  ProperDblFromCmpl< const std::complex< T > >
 
struct  ProperDblFromCmpl< const volatile std::complex< T > >
 
struct  ProperDblFromCmpl< std::complex< T > >
 
struct  ProperDblFromCmpl< volatile std::complex< T > >
 
struct  Same
 
struct  SameRef
 
struct  scast_assign_left
 
struct  scast_assign_right
 
struct  scast_minuseq_left
 
struct  scast_minuseq_right
 
struct  scast_pluseq_left
 
struct  scast_pluseq_right
 
class  StorableHistoNDFunctor
 
class  StorableInterpolationFunctor
 
class  StorableMultivariateFunctor
 
class  StorableMultivariateFunctorReader
 
class  UniformAxis
 
class  VisitCounter
 

Typedefs

typedef std::vector< unsigned > ArrayShape
 
typedef StorableHistoNDFunctor
< double, DualHistoAxis
DoubleHistoNDFunctor
 
typedef
StorableInterpolationFunctor
< double, DualAxis
DoubleInterpolationFunctor
 
typedef StorableHistoNDFunctor
< double, NUHistoAxis
DoubleNUHistoNDFunctor
 
typedef
StorableInterpolationFunctor
< double, GridAxis
DoubleNUInterpolationFunctor
 
typedef StorableHistoNDFunctor
< double, HistoAxis
DoubleUAHistoNDFunctor
 
typedef
StorableInterpolationFunctor
< double, UniformAxis
DoubleUAInterpolationFunctor
 
typedef StorableHistoNDFunctor
< float, DualHistoAxis
FloatHistoNDFunctor
 
typedef
StorableInterpolationFunctor
< float, DualAxis
FloatInterpolationFunctor
 
typedef StorableHistoNDFunctor
< float, NUHistoAxis
FloatNUHistoNDFunctor
 
typedef
StorableInterpolationFunctor
< float, GridAxis
FloatNUInterpolationFunctor
 
typedef StorableHistoNDFunctor
< float, HistoAxis
FloatUAHistoNDFunctor
 
typedef
StorableInterpolationFunctor
< float, UniformAxis
FloatUAInterpolationFunctor
 
typedef gs::StaticReader
< StorableMultivariateFunctorReader
StaticStorableMultivariateFunctorReader
 

Functions

template<typename T >
Private::AbsReturnType< T >::type absDifference (const T &v1, const T &v2)
 
template<typename T >
Private::AbsReturnType< T >::type absValue (const T &v1)
 
template<typename T >
void clearBuffer (T *buf, const unsigned long len)
 
bool closeWithinTolerance (const double &a, const double &b, const double &tol)
 
template<typename Histo >
void convertHistoToDensity (Histo *histogram, bool knownNonNegative=false)
 
UniformAxis convertToGridAxis (const HistoAxis &histoAxis)
 
GridAxis convertToGridAxis (const NUHistoAxis &histoAxis)
 
HistoAxis convertToHistoAxis (const UniformAxis &gridAxis)
 
NUHistoAxis convertToHistoAxis (const GridAxis &gridAxis, double xMin)
 
template<typename Histo >
std::vector< CircularMapper1dconvolutionHistoMap (const Histo &histo, bool doubleDataRange)
 
template<typename T1 , typename T2 >
void copyBuffer (T1 *dest, const T2 *source, const unsigned long len)
 
template<typename Histo >
std::vector< LinearMapper1ddensityScanHistoMap (const Histo &histo)
 
template<typename T >
void destroyBuffer (T *thisBuffer, const T *stackBuffer)
 
ArrayShape doubleShape (const ArrayShape &inputShape)
 
ArrayShape halfShape (const ArrayShape &inputShape)
 
template<typename T >
T interpolate_cubic (const double x, const T &f0, const T &f1, const T &f2, const T &f3)
 
template<typename T >
T interpolate_linear (const double x, const T &f0, const T &f1)
 
template<typename T >
T interpolate_quadratic (const double x, const T &f0, const T &f1, const T &f2)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, const double *coords, unsigned coordsDim, unsigned interpolationDegree)
 
template<class Iter >
bool isMonotonous (Iter const begin, Iter const end)
 
template<class Iter >
bool isNonDecreasing (Iter begin, Iter const end)
 
template<class Iter >
bool isNonIncreasing (Iter begin, Iter const end)
 
template<class Iter >
bool isStrictlyDecreasing (Iter begin, Iter const end)
 
template<class Iter >
bool isStrictlyIncreasing (Iter begin, Iter const end)
 
template<class Iter >
bool isStrictlyMonotonous (Iter const begin, Iter const end)
 
bool isSubShape (const ArrayShape &sh1, const ArrayShape &sh2)
 
template<typename T >
TmakeBuffer (unsigned sizeNeeded, T *stackBuffer, unsigned sizeofStackBuffer)
 
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
void rescanArray (const ArrayND< Num1, Len1, Dim1 > &from, ArrayND< Num2, Len2, Dim2 > *to, unsigned interpolationDegree=0)
 
ArrayShape makeShape ()
 
ArrayShape makeShape (unsigned i0)
 
ArrayShape makeShape (unsigned i0, unsigned i1)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2, unsigned i3)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8)
 
ArrayShape makeShape (unsigned i0, unsigned i1, unsigned i2, unsigned i3, unsigned i4, unsigned i5, unsigned i6, unsigned i7, unsigned i8, unsigned i9)
 
ArrayShape makeShape (const unsigned *indices, unsigned nIndices)
 
template<typename T >
unsigned interpolation_coefficients (T *buffer, unsigned bufLen, const T &f0, const T &f1)
 
template<typename T >
unsigned interpolation_coefficients (T *buffer, unsigned bufLen, const T &f0, const T &f1, const T &f2)
 
template<typename T >
unsigned interpolation_coefficients (T *buffer, unsigned bufLen, const T &f0, const T &f1, const T &f2, const T &f3)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, double x3, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, double x3, double x4, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, double x3, double x4, double x5, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, double x3, double x4, double x5, double x6, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, unsigned interpolationDegree)
 
template<typename Float , class Axis >
Float interpolateHistoND (const HistoND< Float, Axis > &histo, double x0, double x1, double x2, double x3, double x4, double x5, double x6, double x7, double x8, double x9, unsigned interpolationDegree)
 

Typedef Documentation

typedef std::vector<unsigned> npstat::ArrayShape

This type will be used to specify array length in each dimension

Definition at line 21 of file ArrayShape.h.

Definition at line 18 of file HistoNDFunctorInstances.h.

Definition at line 20 of file InterpolationFunctorInstances.h.

Definition at line 22 of file HistoNDFunctorInstances.h.

Definition at line 26 of file InterpolationFunctorInstances.h.

Definition at line 20 of file HistoNDFunctorInstances.h.

Definition at line 23 of file InterpolationFunctorInstances.h.

Definition at line 24 of file HistoNDFunctorInstances.h.

Definition at line 29 of file InterpolationFunctorInstances.h.

Definition at line 28 of file HistoNDFunctorInstances.h.

Definition at line 35 of file InterpolationFunctorInstances.h.

Definition at line 26 of file HistoNDFunctorInstances.h.

Definition at line 32 of file InterpolationFunctorInstances.h.

The reader factory for descendants of StorableMultivariateFunctor

Definition at line 33 of file StorableMultivariateFunctorReader.h.

Function Documentation

template<typename T >
Private::AbsReturnType<T>::type npstat::absDifference ( const T v1,
const T v2 
)
inline

Absolute value of the difference between two numbers. Works for all standard numeric types, including unsigned and complex.

Definition at line 85 of file absDifference.h.

References delta.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::isClose(), npstat::ArrayND< Numeric, StackLen, StackDim >::makeCopulaSteps(), and npstat::ArrayND< Numeric, StackLen, StackDim >::maxAbsDifference().

86  {
88  }
dbl * delta
Definition: mlp_gen.cc:36
template<typename T >
Private::AbsReturnType<T>::type npstat::absValue ( const T v1)
inline

Absolute value of a number. Works for all standard numeric types, including unsigned and complex.

Definition at line 96 of file absDifference.h.

References relativeConstraints::value.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::sumsq().

template<typename T >
void npstat::clearBuffer ( T buf,
const unsigned long  len 
)
inline

Clear a buffer (set all elements to the value produced by the default constructor)

Definition at line 57 of file allocators.h.

References i, and zero.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::exportSubrange(), npstat::ArrayND< Numeric, StackLen, StackDim >::importSubrange(), and npstat::ArrayND< Numeric, StackLen, StackDim >::rotate().

58  {
59  if (len)
60  {
61  assert(buf);
62  const T zero = T();
63  for (unsigned long i=0; i<len; ++i)
64  *buf++ = zero;
65  }
66  }
int i
Definition: DBlmapReader.cc:9
long double T
bool npstat::closeWithinTolerance ( const double &  a,
const double &  b,
const double &  tol 
)
inline

Check if two doubles are within certain relative tolerance from each other. The "tol" argument which specifies the tolerance must be non-negative.

Definition at line 25 of file closeWithinTolerance.h.

References max().

Referenced by npstat::UniformAxis::isClose(), npstat::NUHistoAxis::isClose(), npstat::GridAxis::isClose(), and npstat::HistoAxis::isClose().

27  {
28  if (tol < 0.0)
29  throw npstat::NpstatInvalidArgument("In npstat::closeWithinTolerance: "
30  "negative tolerance is not allowed");
31  if (a == b)
32  return true;
33  else
34  return fabs(a - b)/std::max(fabs(a), fabs(b)) <= tol;
35  }
const T & max(const T &a, const T &b)
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
template<typename Histo >
void npstat::convertHistoToDensity ( Histo *  histogram,
bool  knownNonNegative = false 
)

Reset negative histogram bins to zero and then divide histogram bin contents by the histogram integral. If the "knownNonNegative" argument is true, it will be assumed that there are no negative bins, and their explicit reset is unnecessary.

This function will throw npstat::NpstatRuntimeError in case the histogram is empty after all negative bins are reset.

This function is not a member of the HistoND class itself because these operations do not necessarily make sense for all bin types. Making such operation a member would make creation of HistoND scripting API (e.g., for python) more difficult.

Definition at line 3517 of file HistoND.h.

3518  {
3519  assert(h);
3520  if (!knownNonNegative)
3521  (const_cast<ArrayND<typename
3522  Histo::value_type>&>(h->binContents())).makeNonNegative();
3523  const double integ = h->integral();
3524  *h /= integ;
3525  }
Container::value_type value_type
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
UniformAxis npstat::convertToGridAxis ( const HistoAxis &  histoAxis)

Convert uniform histogram to uniform grid axis axis

Definition at line 16 of file convertAxis.cc.

References create_public_lumi_plots::ax, npstat::HistoAxis::binCenter(), npstat::HistoAxis::label(), npstat::HistoAxis::nBins(), SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

17  {
18  const unsigned nBins = histoAxis.nBins();
19  const double xmin = histoAxis.binCenter(0);
20  const double xmax = histoAxis.binCenter(nBins - 1);
21  UniformAxis ax(nBins, xmin, xmax, histoAxis.label().c_str());
22  return ax;
23  }
GridAxis npstat::convertToGridAxis ( const NUHistoAxis &  histoAxis)

Note that conversion from non-uniform histogram axis into the grid axis is always possible, but it is loosing information (we are writing the positions of bin centers only, not edges)

Definition at line 45 of file convertAxis.cc.

References create_public_lumi_plots::ax, npstat::NUHistoAxis::binCenter(), i, npstat::NUHistoAxis::label(), and npstat::NUHistoAxis::nBins().

46  {
47  const unsigned nBins = histoAxis.nBins();
48  std::vector<double> coords;
49  coords.reserve(nBins);
50  for (unsigned i=0; i<nBins; ++i)
51  coords.push_back(histoAxis.binCenter(i));
52  GridAxis ax(coords, histoAxis.label().c_str());
53  return ax;
54  }
int i
Definition: DBlmapReader.cc:9
HistoAxis npstat::convertToHistoAxis ( const UniformAxis &  gridAxis)

Convert uniform grid axis to uniform histogram axis

Definition at line 6 of file convertAxis.cc.

References create_public_lumi_plots::ax, npstat::UniformAxis::label(), npstat::UniformAxis::max(), npstat::UniformAxis::min(), npstat::UniformAxis::nCoords(), SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

7  {
8  const unsigned nBins = gridAxis.nCoords();
9  const double xmin = gridAxis.min();
10  const double xmax = gridAxis.max();
11  const double hbw = 0.5*(xmax - xmin)/(nBins - 1U);
12  HistoAxis ax(nBins, xmin-hbw, xmax+hbw, gridAxis.label().c_str());
13  return ax;
14  }
NUHistoAxis npstat::convertToHistoAxis ( const GridAxis &  gridAxis,
double  xMin 
)

The conversion from non-uniform grid axis to non-uniform histogram axis is only unambiguous when some additional info is available. Here, in particular, we are asking for the position of the axis minimum. This function will throw npstat::NpstatInvalidArgument in case the conversion is impossible.

Definition at line 25 of file convertAxis.cc.

References create_public_lumi_plots::ax, npstat::GridAxis::coordinate(), i, npstat::GridAxis::label(), npstat::GridAxis::nCoords(), and x.

26  {
27  const unsigned nCoords = gridAxis.nCoords();
28  std::vector<double> binEdges;
29  binEdges.reserve(nCoords + 1U);
30  binEdges.push_back(xMin);
31  for (unsigned i=0; i<nCoords; ++i)
32  {
33  const double x = gridAxis.coordinate(i);
34  if (x <= xMin)
35  throw npstat::NpstatInvalidArgument("In npstat::convertToHistoAxis: "
36  "conversion is impossible");
37  const double halfbin = x - xMin;
38  xMin = x + halfbin;
39  binEdges.push_back(xMin);
40  }
41  NUHistoAxis ax(binEdges, gridAxis.label().c_str());
42  return ax;
43  }
int i
Definition: DBlmapReader.cc:9
Definition: DDAxes.h:10
template<typename Histo >
std::vector< CircularMapper1d > npstat::convolutionHistoMap ( const Histo &  histo,
bool  doubleDataRange 
)

Generate a density scanning map for subsequent use with the "DensityScanND" template when a density is to be convolved with the histogram data. Only histograms with uniform binning can be used here.

The "doubleDataRange" should be set "true" in case the data will be mirrored (or just empty range added) to avoid circular spilling after convolution.

Definition at line 3542 of file HistoND.h.

References i, and query::result.

3544  {
3545  std::vector<CircularMapper1d> result;
3546  const unsigned d = histo.dim();
3547  result.reserve(d);
3548  for (unsigned i=0; i<d; ++i)
3549  result.push_back(histo.axis(i).kernelScanMapper(doubleRange));
3550  return result;
3551  }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
template<typename T1 , typename T2 >
void npstat::copyBuffer ( T1 *  dest,
const T2 *  source,
const unsigned long  len 
)
inline

Copy a buffer (with possible type conversion on the fly)

Definition at line 41 of file allocators.h.

References i.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::ArrayND(), npstat::ArrayND< Numeric, StackLen, StackDim >::dot(), npstat::ArrayND< Numeric, StackLen, StackDim >::operator=(), npstat::ArrayND< Numeric, StackLen, StackDim >::setData(), and npstat::ArrayND< Numeric, StackLen, StackDim >::transpose().

42  {
43  if (len)
44  {
45  assert(dest);
46  assert(source);
47  for (unsigned long i=0; i<len; ++i)
48  *dest++ = static_cast<T1>(*source++);
49  }
50  }
int i
Definition: DBlmapReader.cc:9
template<typename Histo >
std::vector< LinearMapper1d > npstat::densityScanHistoMap ( const Histo &  histo)

Generate a density scanning map for subsequent use with the "DensityScanND" template. Naturally, only histograms with uniform binning can be used here.

Definition at line 3528 of file HistoND.h.

References i, npstat::LinearMapper1d::inverse(), m, and query::result.

3529  {
3530  std::vector<LinearMapper1d> result;
3531  const unsigned d = histo.dim();
3532  result.reserve(d);
3533  for (unsigned i=0; i<d; ++i)
3534  {
3535  const LinearMapper1d& m = histo.axis(i).binNumberMapper(false);
3536  result.push_back(m.inverse());
3537  }
3538  return result;
3539  }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
template<typename T >
void npstat::destroyBuffer ( T thisBuffer,
const T stackBuffer 
)
inline
ArrayShape npstat::doubleShape ( const ArrayShape &  inputShape)

Multiply the sise in each dimension by 2

Definition at line 155 of file ArrayShape.cc.

References i, and alignCSCRings::s.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::multiMirror().

156  {
157  ArrayShape s(inputShape);
158  const unsigned len = s.size();
159  for (unsigned i=0; i<len; ++i)
160  s[i] *= 2U;
161  return s;
162  }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::halfShape ( const ArrayShape &  inputShape)

Divide the size in each dimension by 2 (generate dynamic fault if odd)

Definition at line 164 of file ArrayShape.cc.

References i, and alignCSCRings::s.

165  {
166  ArrayShape s(inputShape);
167  const unsigned len = s.size();
168  for (unsigned i=0; i<len; ++i)
169  {
170  if (!(s[i] % 2U == 0)) throw npstat::NpstatInvalidArgument(
171  "In npstat::halfShape: array span must be "
172  "even in each dimension");
173  s[i] /= 2U;
174  }
175  return s;
176  }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
template<typename T >
T npstat::interpolate_cubic ( const double  x,
const T f0,
const T f1,
const T f2,
const T f3 
)
inline

Cubic interpolation. Assume that the function values are given at 0, 1, 2, and 3.

Definition at line 47 of file interpolate.h.

References interpolate_linear().

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::interpolateLoop().

49  {
50  return interpolate_linear(x*(3.0 - x)/2.0,
51  interpolate_linear(x/3.0, f0, f3),
52  interpolate_linear(x - 1.0, f1, f2));
53  }
Definition: DDAxes.h:10
T interpolate_linear(const double x, const T &f0, const T &f1)
Definition: interpolate.h:23
template<typename T >
T npstat::interpolate_linear ( const double  x,
const T f0,
const T f1 
)
inline

Linear interpolation. Assumes that the function values are given at 0 and 1.

Definition at line 23 of file interpolate.h.

References x.

Referenced by interpolate_cubic(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolateLoop().

24  {
25  const typename ProperDblFromCmpl<T>::type dx = 1.0 - x;
26  return f0*dx + f1*static_cast<typename ProperDblFromCmpl<T>::type>(x);
27  }
type
Definition: HCALResponse.h:21
Definition: DDAxes.h:10
template<typename T >
T npstat::interpolate_quadratic ( const double  x,
const T f0,
const T f1,
const T f2 
)
inline

Quadratic interpolation. Assume that the function values are given at 0, 1, and 2.

Definition at line 34 of file interpolate.h.

References python.connectstrParser::f1.

Referenced by npstat::ArrayND< Numeric, StackLen, StackDim >::interpolateLoop().

36  {
37  static const typename ProperDblFromCmpl<T>::type two = 2.0;
38  const typename ProperDblFromCmpl<T>::type dx = x - 1.0;
39  return f1 + ((f2 - f0)/two + ((f2 - f1) + (f0 - f1))*(dx/two))*dx;
40  }
type
Definition: HCALResponse.h:21
Definition: DDAxes.h:10
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
const double *  coords,
unsigned  coordsDim,
unsigned  interpolationDegree 
)

The interpolation degree in this method can be set to 0, 1, or 3 which results, respectively, in closest bin lookup, multilinear interpolation, or multicubic interpolation. Value of the closest bin inside the histogram range is used if some coordinate is outside of the corresponding axis limits.

Definition at line 129 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), i, npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

Referenced by npstat::StorableHistoNDFunctor< Numeric, Axis, Converter >::operator()().

132  {
133  Private::iHND_checkArgs(histo, xDim, interpolationDegree);
134  assert(x);
135  const Axis* ax = &histo.axes()[0];
136  double coords[CHAR_BIT*sizeof(unsigned long)];
137  for (unsigned i=0; i<xDim; ++i)
138  coords[i] = ax[i].fltBinNumber(x[i], false);
139  const ArrayND<Float>& bins(histo.binContents());
140  switch (interpolationDegree)
141  {
142  case 1U:
143  return bins.interpolate1(coords, xDim);
144  case 3U:
145  return bins.interpolate3(coords, xDim);
146  default:
147  return bins.closest(coords, xDim);
148  }
149  }
int i
Definition: DBlmapReader.cc:9
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
Definition: DDAxes.h:10
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
unsigned  interpolationDegree 
)

Convenience function for interpolating histograms, with an explicit coordinate argument for each histogram dimension

Definition at line 152 of file interpolateHistoND.h.

References npstat::HistoND< Numeric, Axis >::axis(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

155  {
156  const unsigned expDim = 1U;
157  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
158  const double coords = histo.axis(0).fltBinNumber(x0, false);
159  const ArrayND<Float>& bins(histo.binContents());
160  switch (interpolationDegree)
161  {
162  case 1U:
163  return bins.interpolate1(&coords, expDim);
164  case 3U:
165  return bins.interpolate3(&coords, expDim);
166  default:
167  return bins.closest(&coords, expDim);
168  }
169  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
unsigned  interpolationDegree 
)

Definition at line 172 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

176  {
177  const unsigned expDim = 2U;
178  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
179  const Axis* ax = &histo.axes()[0];
180  double coords[expDim];
181  coords[0] = ax[0].fltBinNumber(x0, false);
182  coords[1] = ax[1].fltBinNumber(x1, false);
183  const ArrayND<Float>& bins(histo.binContents());
184  switch (interpolationDegree)
185  {
186  case 1U:
187  return bins.interpolate1(coords, expDim);
188  case 3U:
189  return bins.interpolate3(coords, expDim);
190  default:
191  return bins.closest(coords, expDim);
192  }
193  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
unsigned  interpolationDegree 
)

Definition at line 196 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

201  {
202  const unsigned expDim = 3U;
203  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
204  const Axis* ax = &histo.axes()[0];
205  double coords[expDim];
206  coords[0] = ax[0].fltBinNumber(x0, false);
207  coords[1] = ax[1].fltBinNumber(x1, false);
208  coords[2] = ax[2].fltBinNumber(x2, false);
209  const ArrayND<Float>& bins(histo.binContents());
210  switch (interpolationDegree)
211  {
212  case 1U:
213  return bins.interpolate1(coords, expDim);
214  case 3U:
215  return bins.interpolate3(coords, expDim);
216  default:
217  return bins.closest(coords, expDim);
218  }
219  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
double  x3,
unsigned  interpolationDegree 
)

Definition at line 222 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

228  {
229  const unsigned expDim = 4U;
230  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
231  const Axis* ax = &histo.axes()[0];
232  double coords[expDim];
233  coords[0] = ax[0].fltBinNumber(x0, false);
234  coords[1] = ax[1].fltBinNumber(x1, false);
235  coords[2] = ax[2].fltBinNumber(x2, false);
236  coords[3] = ax[3].fltBinNumber(x3, false);
237  const ArrayND<Float>& bins(histo.binContents());
238  switch (interpolationDegree)
239  {
240  case 1U:
241  return bins.interpolate1(coords, expDim);
242  case 3U:
243  return bins.interpolate3(coords, expDim);
244  default:
245  return bins.closest(coords, expDim);
246  }
247  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
unsigned  interpolationDegree 
)

Definition at line 250 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

257  {
258  const unsigned expDim = 5U;
259  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
260  const Axis* ax = &histo.axes()[0];
261  double coords[expDim];
262  coords[0] = ax[0].fltBinNumber(x0, false);
263  coords[1] = ax[1].fltBinNumber(x1, false);
264  coords[2] = ax[2].fltBinNumber(x2, false);
265  coords[3] = ax[3].fltBinNumber(x3, false);
266  coords[4] = ax[4].fltBinNumber(x4, false);
267  const ArrayND<Float>& bins(histo.binContents());
268  switch (interpolationDegree)
269  {
270  case 1U:
271  return bins.interpolate1(coords, expDim);
272  case 3U:
273  return bins.interpolate3(coords, expDim);
274  default:
275  return bins.closest(coords, expDim);
276  }
277  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
unsigned  interpolationDegree 
)

Definition at line 280 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

288  {
289  const unsigned expDim = 6U;
290  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
291  const Axis* ax = &histo.axes()[0];
292  double coords[expDim];
293  coords[0] = ax[0].fltBinNumber(x0, false);
294  coords[1] = ax[1].fltBinNumber(x1, false);
295  coords[2] = ax[2].fltBinNumber(x2, false);
296  coords[3] = ax[3].fltBinNumber(x3, false);
297  coords[4] = ax[4].fltBinNumber(x4, false);
298  coords[5] = ax[5].fltBinNumber(x5, false);
299  const ArrayND<Float>& bins(histo.binContents());
300  switch (interpolationDegree)
301  {
302  case 1U:
303  return bins.interpolate1(coords, expDim);
304  case 3U:
305  return bins.interpolate3(coords, expDim);
306  default:
307  return bins.closest(coords, expDim);
308  }
309  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
unsigned  interpolationDegree 
)

Definition at line 312 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

321  {
322  const unsigned expDim = 7U;
323  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
324  const Axis* ax = &histo.axes()[0];
325  double coords[expDim];
326  coords[0] = ax[0].fltBinNumber(x0, false);
327  coords[1] = ax[1].fltBinNumber(x1, false);
328  coords[2] = ax[2].fltBinNumber(x2, false);
329  coords[3] = ax[3].fltBinNumber(x3, false);
330  coords[4] = ax[4].fltBinNumber(x4, false);
331  coords[5] = ax[5].fltBinNumber(x5, false);
332  coords[6] = ax[6].fltBinNumber(x6, false);
333  const ArrayND<Float>& bins(histo.binContents());
334  switch (interpolationDegree)
335  {
336  case 1U:
337  return bins.interpolate1(coords, expDim);
338  case 3U:
339  return bins.interpolate3(coords, expDim);
340  default:
341  return bins.closest(coords, expDim);
342  }
343  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7,
unsigned  interpolationDegree 
)

Definition at line 346 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

356  {
357  const unsigned expDim = 8U;
358  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
359  const Axis* ax = &histo.axes()[0];
360  double coords[expDim];
361  coords[0] = ax[0].fltBinNumber(x0, false);
362  coords[1] = ax[1].fltBinNumber(x1, false);
363  coords[2] = ax[2].fltBinNumber(x2, false);
364  coords[3] = ax[3].fltBinNumber(x3, false);
365  coords[4] = ax[4].fltBinNumber(x4, false);
366  coords[5] = ax[5].fltBinNumber(x5, false);
367  coords[6] = ax[6].fltBinNumber(x6, false);
368  coords[7] = ax[7].fltBinNumber(x7, false);
369  const ArrayND<Float>& bins(histo.binContents());
370  switch (interpolationDegree)
371  {
372  case 1U:
373  return bins.interpolate1(coords, expDim);
374  case 3U:
375  return bins.interpolate3(coords, expDim);
376  default:
377  return bins.closest(coords, expDim);
378  }
379  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7,
double  x8,
unsigned  interpolationDegree 
)

Definition at line 382 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

393  {
394  const unsigned expDim = 9U;
395  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
396  const Axis* ax = &histo.axes()[0];
397  double coords[expDim];
398  coords[0] = ax[0].fltBinNumber(x0, false);
399  coords[1] = ax[1].fltBinNumber(x1, false);
400  coords[2] = ax[2].fltBinNumber(x2, false);
401  coords[3] = ax[3].fltBinNumber(x3, false);
402  coords[4] = ax[4].fltBinNumber(x4, false);
403  coords[5] = ax[5].fltBinNumber(x5, false);
404  coords[6] = ax[6].fltBinNumber(x6, false);
405  coords[7] = ax[7].fltBinNumber(x7, false);
406  coords[8] = ax[8].fltBinNumber(x8, false);
407  const ArrayND<Float>& bins(histo.binContents());
408  switch (interpolationDegree)
409  {
410  case 1U:
411  return bins.interpolate1(coords, expDim);
412  case 3U:
413  return bins.interpolate3(coords, expDim);
414  default:
415  return bins.closest(coords, expDim);
416  }
417  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename Float , class Axis >
Float npstat::interpolateHistoND ( const HistoND< Float, Axis > &  histo,
double  x0,
double  x1,
double  x2,
double  x3,
double  x4,
double  x5,
double  x6,
double  x7,
double  x8,
double  x9,
unsigned  interpolationDegree 
)

Definition at line 420 of file interpolateHistoND.h.

References create_public_lumi_plots::ax, npstat::HistoND< Numeric, Axis >::axes(), npstat::HistoND< Numeric, Axis >::binContents(), npstat::Private::iHND_checkArgs(), and npstat::ArrayND< Numeric, StackLen, StackDim >::interpolate1().

432  {
433  const unsigned expDim = 10U;
434  Private::iHND_checkArgs(histo, expDim, interpolationDegree);
435  const Axis* ax = &histo.axes()[0];
436  double coords[expDim];
437  coords[0] = ax[0].fltBinNumber(x0, false);
438  coords[1] = ax[1].fltBinNumber(x1, false);
439  coords[2] = ax[2].fltBinNumber(x2, false);
440  coords[3] = ax[3].fltBinNumber(x3, false);
441  coords[4] = ax[4].fltBinNumber(x4, false);
442  coords[5] = ax[5].fltBinNumber(x5, false);
443  coords[6] = ax[6].fltBinNumber(x6, false);
444  coords[7] = ax[7].fltBinNumber(x7, false);
445  coords[8] = ax[8].fltBinNumber(x8, false);
446  coords[9] = ax[9].fltBinNumber(x9, false);
447  const ArrayND<Float>& bins(histo.binContents());
448  switch (interpolationDegree)
449  {
450  case 1U:
451  return bins.interpolate1(coords, expDim);
452  case 3U:
453  return bins.interpolate3(coords, expDim);
454  default:
455  return bins.closest(coords, expDim);
456  }
457  }
void iHND_checkArgs(const HistoND< Float, Axis > &histo, const unsigned xDim, const unsigned interpolationDegree)
template<typename T >
unsigned npstat::interpolation_coefficients ( T buffer,
unsigned  bufLen,
const T f0,
const T f1 
)

Get the coefficients of the interpolating polynomial. The interpolated function values are provided at 0, 1, ... The return value of the function is the number of coefficients (i.e., the polynomial degree plus one). On exit, the coefficients are placed into the "buffer" array in the order of increasing monomial degree. The length of the provided buffer must be sufficient to hold all these coefficients.

Definition at line 83 of file interpolate.h.

85  {
86  if (bufLen <= 1U) throw npstat::NpstatInvalidArgument(
87  "In npstat::interpolation_coefficients: "
88  "insufficient length of the output buffer");
89  buffer[0] = f0;
90  buffer[1] = f1 - f0;
91  return 2U;
92  }
template<typename T >
unsigned npstat::interpolation_coefficients ( T buffer,
unsigned  bufLen,
const T f0,
const T f1,
const T f2 
)

Definition at line 95 of file interpolate.h.

References python.connectstrParser::f1.

97  {
98  if (bufLen <= 2U) throw npstat::NpstatInvalidArgument(
99  "In npstat::interpolation_coefficients: "
100  "insufficient length of the output buffer");
101  buffer[0] = f0;
102  buffer[1] = static_cast<T>((f1 - f2 + 3*(f1 - f0))/2.0);
103  buffer[2] = static_cast<T>(((f0 - f1) + (f2 - f1))/2.0);
104  return 3U;
105  }
long double T
template<typename T >
unsigned npstat::interpolation_coefficients ( T buffer,
unsigned  bufLen,
const T f0,
const T f1,
const T f2,
const T f3 
)

Definition at line 108 of file interpolate.h.

References python.connectstrParser::f1, python.connectstrParser::f2, and python.connectstrParser::f3.

111  {
112  if (bufLen <= 3U) throw npstat::NpstatInvalidArgument(
113  "In npstat::interpolation_coefficients: "
114  "insufficient length of the output buffer");
115  buffer[0] = f0;
116  buffer[1] = static_cast<T>((11*(f1 - f0)+7*(f1 - f2)+2*(f3 - f2))/6.0);
117  buffer[2] = static_cast<T>((2*(f0 - f1)+3*(f2 - f1)+(f2 - f3))/2.0);
118  buffer[3] = static_cast<T>(((f3 - f0) + 3*(f1 - f2))/6.0);
119  return 4U;
120  }
long double T
template<class Iter >
bool npstat::isMonotonous ( Iter const  begin,
Iter const  end 
)
inline

Check if the sequence of values is either non-increasing or non-decreasing

Definition at line 85 of file isMonotonous.h.

References isNonDecreasing(), and isNonIncreasing().

86  {
88  }
#define end
Definition: vmac.h:38
bool isNonDecreasing(Iter begin, Iter const end)
Definition: isMonotonous.h:54
#define begin
Definition: vmac.h:31
bool isNonIncreasing(Iter begin, Iter const end)
Definition: isMonotonous.h:68
template<class Iter >
bool npstat::isNonDecreasing ( Iter  begin,
Iter const  end 
)
inline

Check if the sequence of values is not decreasing

Definition at line 54 of file isMonotonous.h.

References begin, end, first, and ntuplemaker::status.

Referenced by isMonotonous().

55  {
56  if (begin == end)
57  return false;
58  Iter first(begin);
59  bool status = ++begin != end;
60  for (; begin != end && status; ++begin, ++first)
61  if (*begin < *first)
62  status = false;
63  return status;
64  }
#define end
Definition: vmac.h:38
bool first
Definition: L1TdeRCT.cc:94
#define begin
Definition: vmac.h:31
tuple status
Definition: ntuplemaker.py:245
template<class Iter >
bool npstat::isNonIncreasing ( Iter  begin,
Iter const  end 
)
inline

Check if the sequence of values is not increasing

Definition at line 68 of file isMonotonous.h.

References begin, end, first, and ntuplemaker::status.

Referenced by isMonotonous().

69  {
70  if (begin == end)
71  return false;
72  Iter first(begin);
73  bool status = ++begin != end;
74  for (; begin != end && status; ++begin, ++first)
75  if (*begin > *first)
76  status = false;
77  return status;
78  }
#define end
Definition: vmac.h:38
bool first
Definition: L1TdeRCT.cc:94
#define begin
Definition: vmac.h:31
tuple status
Definition: ntuplemaker.py:245
template<class Iter >
bool npstat::isStrictlyDecreasing ( Iter  begin,
Iter const  end 
)
inline

Check if the sequence of values is strictly decreasing

Definition at line 32 of file isMonotonous.h.

References begin, end, first, and ntuplemaker::status.

Referenced by isStrictlyMonotonous().

33  {
34  if (begin == end)
35  return false;
36  Iter first(begin);
37  bool status = ++begin != end;
38  for (; begin != end && status; ++begin, ++first)
39  if (!(*begin < *first))
40  status = false;
41  return status;
42  }
#define end
Definition: vmac.h:38
bool first
Definition: L1TdeRCT.cc:94
#define begin
Definition: vmac.h:31
tuple status
Definition: ntuplemaker.py:245
template<class Iter >
bool npstat::isStrictlyIncreasing ( Iter  begin,
Iter const  end 
)
inline

Check if the sequence of values is strictly increasing

Definition at line 18 of file isMonotonous.h.

References begin, end, first, and ntuplemaker::status.

Referenced by isStrictlyMonotonous().

19  {
20  if (begin == end)
21  return false;
22  Iter first(begin);
23  bool status = ++begin != end;
24  for (; begin != end && status; ++begin, ++first)
25  if (!(*first < *begin))
26  status = false;
27  return status;
28  }
#define end
Definition: vmac.h:38
bool first
Definition: L1TdeRCT.cc:94
#define begin
Definition: vmac.h:31
tuple status
Definition: ntuplemaker.py:245
template<class Iter >
bool npstat::isStrictlyMonotonous ( Iter const  begin,
Iter const  end 
)
inline

Check if the sequence of values is strictly increasing or decreasing

Definition at line 46 of file isMonotonous.h.

References isStrictlyDecreasing(), and isStrictlyIncreasing().

Referenced by npstat::Private::lind_invert1DSlice().

47  {
48  return isStrictlyIncreasing(begin, end) ||
50  }
bool isStrictlyIncreasing(Iter begin, Iter const end)
Definition: isMonotonous.h:18
bool isStrictlyDecreasing(Iter begin, Iter const end)
Definition: isMonotonous.h:32
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
bool npstat::isSubShape ( const ArrayShape &  sh1,
const ArrayShape &  sh2 
)

This function returns true if the number of elements is the same in both vectors and every element of the first vector does not exceed corresponding element of the second

Definition at line 178 of file ArrayShape.cc.

References i.

179  {
180  const unsigned len = sh1.size();
181  if (len != sh2.size())
182  return false;
183  for (unsigned i=0; i<len; ++i)
184  if (sh1[i] > sh2[i])
185  return false;
186  return true;
187  }
int i
Definition: DBlmapReader.cc:9
template<typename T >
T* npstat::makeBuffer ( unsigned  sizeNeeded,
T stackBuffer,
unsigned  sizeofStackBuffer 
)
inline
ArrayShape npstat::makeShape ( )

This convenience function will construct an array shape using an explicit list of indices

Definition at line 7 of file ArrayShape.cc.

8  {
9  return ArrayShape();
10  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0)

Definition at line 12 of file ArrayShape.cc.

13  {
14  return ArrayShape(1, i0);
15  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1 
)

Definition at line 17 of file ArrayShape.cc.

References alignCSCRings::s.

18  {
19  ArrayShape s;
20  s.reserve(2);
21  s.push_back(i0);
22  s.push_back(i1);
23  return s;
24  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2 
)

Definition at line 26 of file ArrayShape.cc.

References alignCSCRings::s.

27  {
28  ArrayShape s;
29  s.reserve(3);
30  s.push_back(i0);
31  s.push_back(i1);
32  s.push_back(i2);
33  return s;
34  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3 
)

Definition at line 36 of file ArrayShape.cc.

References alignCSCRings::s.

37  {
38  ArrayShape s;
39  s.reserve(4);
40  s.push_back(i0);
41  s.push_back(i1);
42  s.push_back(i2);
43  s.push_back(i3);
44  return s;
45  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4 
)

Definition at line 47 of file ArrayShape.cc.

References alignCSCRings::s.

49  {
50  ArrayShape s;
51  s.reserve(5);
52  s.push_back(i0);
53  s.push_back(i1);
54  s.push_back(i2);
55  s.push_back(i3);
56  s.push_back(i4);
57  return s;
58  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5 
)

Definition at line 60 of file ArrayShape.cc.

References alignCSCRings::s.

62  {
63  ArrayShape s;
64  s.reserve(6);
65  s.push_back(i0);
66  s.push_back(i1);
67  s.push_back(i2);
68  s.push_back(i3);
69  s.push_back(i4);
70  s.push_back(i5);
71  return s;
72  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6 
)

Definition at line 74 of file ArrayShape.cc.

References alignCSCRings::s.

76  {
77  ArrayShape s;
78  s.reserve(7);
79  s.push_back(i0);
80  s.push_back(i1);
81  s.push_back(i2);
82  s.push_back(i3);
83  s.push_back(i4);
84  s.push_back(i5);
85  s.push_back(i6);
86  return s;
87  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7 
)

Definition at line 89 of file ArrayShape.cc.

References alignCSCRings::s.

91  {
92  ArrayShape s;
93  s.reserve(8);
94  s.push_back(i0);
95  s.push_back(i1);
96  s.push_back(i2);
97  s.push_back(i3);
98  s.push_back(i4);
99  s.push_back(i5);
100  s.push_back(i6);
101  s.push_back(i7);
102  return s;
103  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8 
)

Definition at line 105 of file ArrayShape.cc.

References alignCSCRings::s.

108  {
109  ArrayShape s;
110  s.reserve(9);
111  s.push_back(i0);
112  s.push_back(i1);
113  s.push_back(i2);
114  s.push_back(i3);
115  s.push_back(i4);
116  s.push_back(i5);
117  s.push_back(i6);
118  s.push_back(i7);
119  s.push_back(i8);
120  return s;
121  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( unsigned  i0,
unsigned  i1,
unsigned  i2,
unsigned  i3,
unsigned  i4,
unsigned  i5,
unsigned  i6,
unsigned  i7,
unsigned  i8,
unsigned  i9 
)

Definition at line 123 of file ArrayShape.cc.

References alignCSCRings::s.

126  {
127  ArrayShape s;
128  s.reserve(10);
129  s.push_back(i0);
130  s.push_back(i1);
131  s.push_back(i2);
132  s.push_back(i3);
133  s.push_back(i4);
134  s.push_back(i5);
135  s.push_back(i6);
136  s.push_back(i7);
137  s.push_back(i8);
138  s.push_back(i9);
139  return s;
140  }
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
ArrayShape npstat::makeShape ( const unsigned *  indices,
unsigned  nIndices 
)

Definition at line 142 of file ArrayShape.cc.

References i, and alignCSCRings::s.

143  {
144  ArrayShape s;
145  if (nIndices)
146  {
147  assert(indices);
148  s.reserve(nIndices);
149  for (unsigned i=0; i<nIndices; ++i)
150  s.push_back(indices[i]);
151  }
152  return s;
153  }
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned > ArrayShape
Definition: ArrayShape.h:21
template<typename Num1 , unsigned Len1, unsigned Dim1, typename Num2 , unsigned Len2, unsigned Dim2>
void npstat::rescanArray ( const ArrayND< Num1, Len1, Dim1 > &  from,
ArrayND< Num2, Len2, Dim2 > *  to,
unsigned  interpolationDegree = 0 
)

A utility for filling one array using values of another. The array shapes do not have to be the same but the ranks have to be. Roughly, the arrays are treated as values of histogram bins inside the unit box. The array "to" is filled either with the closest bin value of the array "from" or with an interpolated value (if "interpolationDegree" parameter is not 0).

interpolationDegree parameter must be one of 0, 1, or 3.

Definition at line 103 of file rescanArray.h.

References npstat::ArrayND< Numeric, StackLen, StackDim >::functorFill(), and npstat::ArrayND< Numeric, StackLen, StackDim >::rank().

106  {
107  assert(to);
108  if (from.rank() != to->rank()) throw npstat::NpstatInvalidArgument(
109  "In npstat::rescanArray: incompatible dimensionalities "
110  "of input and output arrays");
111  if (!(interpolationDegree == 0U ||
112  interpolationDegree == 1U ||
113  interpolationDegree == 3U)) throw npstat::NpstatInvalidArgument(
114  "In npstat::rescanArray: unsupported interpolation degree");
115  to->functorFill(Private::ArrayMapper<Num1,Len1,Dim1,Num2,Len2,Dim2>(
116  from, *to, interpolationDegree));
117  }
unsigned rank() const
Definition: ArrayND.h:240