48 bool onedim = ndim == 1;
51 Error(
"TF1Helper",
"Function has no parameters");
55 std::vector<double> oldParams;
58 oldParams.resize(npar);
70 Error(
"TF1Helper::IntegralError",
"No existing fitter can be used for computing the integral error");
75 Error(
"TF1Helper::IntegralError",
"Last used fitter is not compatible with the current TF1");
80 Warning(
"TF1Helper::INtegralError",
"Last used fitter does no provide parameter errors and a covariance matrix");
85 for (
int i = 0; i < npar; ++i) {
87 Error(
"TF1Helper::IntegralError",
"Last used Fitter has different parameter values");
96 covMatrix.
Use(npar,covmat);
106 double numError2 = 0;
107 for (
int i=0; i < npar; ++i) {
111 double epsabs = epsrel;
117 if (covMatrix(i,i) > 0 ) {
128 integral = gradFunc.
IntegralMultiple(ndim,a,b,maxpts,epsrel,epsabs,relerr,nfnevl,ifail);
130 error = relerr*std::abs(integral);
138 numError2 += covMatrix(i,i)*covMatrix(i,i) * integral * integral * error * error;
141 double result =
sqrt(err2);
142 double numError =
sqrt( numError2/
sqrt(err2) );
145 if ( result > epsilon && numError > 2*epsilon*result )
146 Warning(
"TF1Helper::IntegralError",
"numerical error from integration is too large. Integral error = %g +/- %g - eps = %g",result,numError,epsilon);
149 if (!oldParams.empty()) {
virtual void SetParameters(const Double_t *params)
TMatrixTSym< Element > & Use(Int_t row_lwb, Int_t row_upb, Element *data)
Namespace for new ROOT classes and functions.
const std::vector< double > & Errors() const
parameter errors (return st::vector)
virtual Double_t IntegralMultiple(Int_t n, const Double_t *a, const Double_t *b, Int_t maxpts, Double_t epsrel, Double_t epsabs, Double_t &relerr, Int_t &nfnevl, Int_t &ifail)
This function computes, to an attempted specified accuracy, the value of the integral.
Backward compatible implementation of TVirtualFitter.
Short_t Min(Short_t a, Short_t b)
virtual Int_t GetNumberTotalParameters() const
Number of total parameters.
const ROOT::Fit::FitResult & GetFitResult() const
function class representing the derivative with respect a parameter of a given TF1 ...
double IntegralError(TF1 *func, Int_t ndim, const double *a, const double *b, const double *params, const double *covmat, double epsilon)
static TVirtualFitter * GetFitter()
static: return the current Fitter
void Warning(const char *location, const char *msgfmt,...)
void GetCovarianceMatrix(Matrix &mat) const
fill covariance matrix elements using a generic matrix class implementing operator(i,j) the matrix must be previously allocates with right size (npar * npar)
TMatrixTSym< Element > & Similarity(const TMatrixT< Element > &n)
Calculate B * (*this) * B^T , final matrix will be (nrowsb x nrowsb) This is a similarity transform w...
Abstract Base Class for Fitting.
virtual Int_t GetNpar() const
virtual Double_t IntegralOneDim(Double_t a, Double_t b, Double_t epsrel, Double_t epsabs, Double_t &err)
Return Integral of function between a and b using the given parameter values and relative and absolut...
virtual Double_t GetParameter(Int_t ipar) const
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual Double_t * GetParameters() const
static double DefaultRelTolerance()
void Error(ErrorHandler_t func, int code, const char *va_(fmt),...)
Write error message and call a handler, if required.
static unsigned int DefaultNCalls()
virtual Double_t GetParameter(Int_t ipar) const
Parameter value.