LArSoft
v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
|
Simple fitter abstract interface. More...
#include "SimpleFits.h"
Public Types | |
using | Data_t = T |
type of the data More... | |
using | MatrixOps = FastMatrixOperations< Data_t, NParams > |
using | FitParameters_t = std::array< Data_t, NParams > |
type of set of fit parameters More... | |
using | FitMatrix_t = typename MatrixOps::Matrix_t |
type of matrix for covariance (a std::array) More... | |
Public Member Functions | |
virtual | ~SimpleFitterInterface ()=default |
Virtual destructor: compiler's default. More... | |
virtual bool | isValid () const =0 |
Returns if the fit has valid results. More... | |
virtual bool | FillResults (FitParameters_t ¶ms, FitMatrix_t &Xmat, Data_t &det, FitMatrix_t &Smat) const =0 |
Fills the specified parameters. More... | |
virtual bool | FillResults (FitParameters_t ¶ms, FitParameters_t ¶merrors, FitMatrix_t &Xmat, Data_t &det, FitMatrix_t &Smat) const =0 |
Fills the specified parameters. More... | |
virtual bool | FillResults (FitParameters_t ¶ms, FitParameters_t ¶merrors) const =0 |
Fills the specified parameters. More... | |
virtual Data_t | Evaluate (Data_t x) const =0 |
Evaluates the fitted function at the specified point. More... | |
Data_t | operator() (Data_t x) const |
Evaluates the fitted function; alias of Evaluate() More... | |
Fitting | |
virtual FitParameters_t | FitParameters () const =0 |
Computes and returns all the parameters of the fit result. More... | |
virtual FitParameters_t | FitParameterErrors () const =0 |
Computes and returns all the parameter errors of the fit result. More... | |
virtual FitMatrix_t | FitParameterCovariance () const =0 |
Computes and returns all the covariance matrix of the fit result. More... | |
virtual Data_t | FitParameter (unsigned int n) const |
Returns the parameter n of the fit result. More... | |
virtual Data_t | FitParameterError (unsigned int n) const |
Returns the error on parameter n of the fit result. More... | |
virtual Data_t | ChiSquare () const =0 |
Returns the of the fit. More... | |
virtual int | NDF () const =0 |
Returns the degrees of freedom in the determination of the fit. More... | |
Static Public Member Functions | |
static constexpr Data_t | sqr (Data_t v) |
Returns the square of the specified data value. More... | |
static constexpr Data_t | cube (Data_t v) |
Returns the cube of the specified data value. More... | |
Static Public Attributes | |
static constexpr unsigned int | NParams = N |
Number of parameters in the fit. More... | |
Protected Member Functions | |
virtual Data_t | Determinant (FitMatrix_t const &mat) const |
Computes the determinant of a matrix. More... | |
virtual FitMatrix_t | InvertMatrix (FitMatrix_t const &mat, Data_t det) const |
Computes the inverse of a matrix (using provided determinant) More... | |
virtual FitMatrix_t | InvertMatrix (FitMatrix_t const &mat) const |
Computes the inverse of a matrix. More... | |
virtual FitParameters_t | MatrixProduct (FitMatrix_t const &mat, FitParameters_t const &vec) const |
Computes the product of a FitMatrix_t and a FitParameters_t. More... | |
Simple fitter abstract interface.
Definition at line 458 of file SimpleFits.h.
using lar::util::details::SimpleFitterInterface< T, N >::Data_t = T |
type of the data
Definition at line 464 of file SimpleFits.h.
using lar::util::details::SimpleFitterInterface< T, N >::FitMatrix_t = typename MatrixOps::Matrix_t |
type of matrix for covariance (a std::array)
Definition at line 472 of file SimpleFits.h.
using lar::util::details::SimpleFitterInterface< T, N >::FitParameters_t = std::array<Data_t, NParams> |
type of set of fit parameters
Definition at line 469 of file SimpleFits.h.
using lar::util::details::SimpleFitterInterface< T, N >::MatrixOps = FastMatrixOperations<Data_t, NParams> |
Definition at line 466 of file SimpleFits.h.
|
virtualdefault |
Virtual destructor: compiler's default.
|
pure virtual |
Returns the of the fit.
Implemented in lar::util::GaussianFit< T >, lar::util::QuadraticFit< T >, lar::util::LinearFit< T >, lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
|
inlinestatic |
Returns the cube of the specified data value.
Definition at line 610 of file SimpleFits.h.
|
inlineprotectedvirtual |
Computes the determinant of a matrix.
Definition at line 615 of file SimpleFits.h.
|
pure virtual |
Evaluates the fitted function at the specified point.
x | the point where to evaluate the fit function |
No check is performed whether the fit is valid.
|
pure virtual |
Fills the specified parameters.
params | the fitted values of the parameters |
Xmat | the matrix of the x^n/s^2 sums |
Smat | the covariance matrix |
det | the determinant of Xmat |
|
pure virtual |
Fills the specified parameters.
params | the fitted values of the parameters |
paramerrors | the uncertainty on the fitted parameters |
Xmat | the matrix of the x^n/s^2 sums |
Smat | the covariance matrix |
det | the determinant of Xmat |
|
pure virtual |
Fills the specified parameters.
params | the fitted values of the parameters |
paramerrors | the uncertainty on the fitted parameters |
Implemented in lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
|
inlinevirtual |
Returns the parameter n of the fit result.
n | degree of the parameter; must be no larger than Degree |
std::runtime_error | if there is no unique solution |
Reimplemented in lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
Definition at line 524 of file SimpleFits.h.
|
pure virtual |
Computes and returns all the covariance matrix of the fit result.
std::runtime_error | if there is no unique solution |
The matrix is symmetric, and stored in a linear way (say, first row, then second row).
Implemented in lar::util::GaussianFit< T >, lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
|
inlinevirtual |
Returns the error on parameter n of the fit result.
n | degree of the parameter; must be no larger than Degree |
std::runtime_error | if there is no unique solution |
Reimplemented in lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
Definition at line 533 of file SimpleFits.h.
|
pure virtual |
Computes and returns all the parameter errors of the fit result.
std::runtime_error | if there is no unique solution |
Implemented in lar::util::GaussianFit< T >, lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
|
pure virtual |
Computes and returns all the parameters of the fit result.
std::runtime_error | if there is no unique solution |
Implemented in lar::util::GaussianFit< T >, lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
|
inlineprotectedvirtual |
Computes the inverse of a matrix (using provided determinant)
Definition at line 620 of file SimpleFits.h.
|
inlineprotectedvirtual |
Computes the inverse of a matrix.
Definition at line 624 of file SimpleFits.h.
|
pure virtual |
Returns if the fit has valid results.
The fit has no valid results if:
Note that checking point 2 is expensive in terms of time.
Implemented in lar::util::GaussianFit< T >, lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
|
inlineprotectedvirtual |
Computes the product of a FitMatrix_t and a FitParameters_t.
Definition at line 629 of file SimpleFits.h.
|
pure virtual |
Returns the degrees of freedom in the determination of the fit.
The return value may be 0 or negative if insufficient points have been added.
Implemented in lar::util::GaussianFit< T >, lar::util::details::SimplePolyFitterBase< T, D >, lar::util::details::SimplePolyFitterBase< T, 1U >, and lar::util::details::SimplePolyFitterBase< T, 2U >.
|
inline |
Evaluates the fitted function; alias of Evaluate()
Definition at line 603 of file SimpleFits.h.
|
inlinestatic |
Returns the square of the specified data value.
Definition at line 607 of file SimpleFits.h.
|
static |
Number of parameters in the fit.
Definition at line 462 of file SimpleFits.h.