Public Member Functions

Spline::BSpline Class Reference

List of all members.

Public Member Functions

 BSpline (size_t degree=4)
void setKnotVector (const vector< double > &knots)
void setNCoefficientsUniform (size_t nCoeffs, double min, double max)
size_t nCoefficients () const
double basisFunction (size_t index, double affine) const
vector< double > basisFunctions (double affine) const
void fitLeastSquares (const DataSet &data)
void fitLeastSquares (const DataSet &data, const DataSet &signalTemplate)
double chi2 () const
double chi2_dof () const
DataPoint evaluate (double affine) const
const vector< double > & knots () const
const vector< double > & coefficients () const
double signalCoefficientSize () const
const Matrix< double > & covarianceMatrix () const
const PointSet & controlPoints () const

Constructor & Destructor Documentation

Spline::BSpline::BSpline ( size_t  degree = 4 )

Default constructor.

Parameters:
degreethe degree of the splines. Default 4

Member Function Documentation

double Spline::BSpline::basisFunction ( size_t  index,
double  affine 
) const

Evaluate one of the basis functions for a given affine parameter. For a normal 1D histogram the affine parameter is simply the distance along the x axis This method is less efficient than evaluating all of the functions simultaneously.

Parameters:
indexthe label of the basis function
affinethe value of the affine parameter
Returns:
the value of the basis function
vector<double> Spline::BSpline::basisFunctions ( double  affine ) const

Evaluate all of the basis functions at a give affine parameter. For a normal 1D histogram the affine parameter is simply the distance along the x axis. This method is more efficient that evaluating each basis function individually

Parameters:
affinethe affine parameter at which to evaluate the bases
Returns:
a vector of the function values
double Spline::BSpline::chi2 (  ) const
Returns:
the chi squared of this fitted curve compared to the input data
double Spline::BSpline::chi2_dof (  ) const
Returns:
the chi squared per degree of freedom of this fitted curve compared to the input data
const vector<double>& Spline::BSpline::coefficients (  ) const
Returns:
the coefficients describing this curve
const PointSet& Spline::BSpline::controlPoints (  ) const

The coefficients and knots describing this curve can be interpretted geometrically as a set of control points describing a polygon. The curve can be derived by interpolating between these control points using the de-boor algorithm

Returns:
The set of control points describing this curve
const Matrix<double>& Spline::BSpline::covarianceMatrix (  ) const

Give the covariance matrix of the fit coefficients

Returns:
a N*N vector<vector<double> >, where N is the number of coefficients
DataPoint Spline::BSpline::evaluate ( double  affine ) const

Evaluate the curve at the give affine parameter For a normal 1D histogram the affine parameter is simply the distance along the x axis.

Parameters:
affinethe affine parameter
Returns:
DataPoint giving the x and y value of the curve and the error on the y value
void Spline::BSpline::fitLeastSquares ( const DataSet &  data,
const DataSet &  signalTemplate 
)

Fit this B-spline curve to a set of data points and include a signal template in the fit

void Spline::BSpline::fitLeastSquares ( const DataSet &  data )

Fit this B-spline curve to a set of data points

const vector<double>& Spline::BSpline::knots (  ) const
Returns:
The knot vector of this B-spline
size_t Spline::BSpline::nCoefficients (  ) const
Returns:
The number of coefficients
void Spline::BSpline::setKnotVector ( const vector< double > &  knots )

Set the knot vector This allows for non-uniform knot placement

void Spline::BSpline::setNCoefficientsUniform ( size_t  nCoeffs,
double  min,
double  max 
)

Set the number of coefficients using a uniform knot vector in the range min to max The min and max values should tpically be min and max x range of the histogram to be fitted, or within that range if only a subset of the histogram is to be used.

Parameters:
nCoeffsthe number of coefficients
minthe minimum value of the affine parameter
maxthe maximum value of the affine parameter
double Spline::BSpline::signalCoefficientSize (  ) const

Give the estimate of the signal size if a signal template was included in the fit Will throw an error if no signal was included!

Returns:
the signal template contribution to the fit

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions