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) );
146 Warning(
"TF1Helper::IntegralError",
"numerical error from integration is too large. Integral error = %g +/- %g - eps = %g",result,numError,
epsilon);
149 if (!oldParams.empty()) {
void Error(const char *location, const char *msgfmt,...)
void Warning(const char *location, const char *msgfmt,...)
const std::vector< double > & Errors() const
parameter errors (return st::vector)
void GetCovarianceMatrix(Matrix &mat) const
fill covariance matrix elements using a generic matrix class implementing operator(i,...
static unsigned int DefaultNCalls()
static double DefaultRelTolerance()
function class representing the derivative with respect a parameter of a given TF1
Backward compatible implementation of TVirtualFitter.
const ROOT::Fit::FitResult & GetFitResult() const
virtual Int_t GetNumberTotalParameters() const
Number of total parameters.
virtual Double_t GetParameter(Int_t ipar) const
Parameter value.
virtual Int_t GetNpar() const
virtual Double_t * GetParameters() const
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.
virtual void SetParameters(const Double_t *params)
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
TMatrixTSym< Element > & Use(Int_t row_lwb, Int_t row_upb, Element *data)
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.
static TVirtualFitter * GetFitter()
static: return the current Fitter
double IntegralError(TF1 *func, Int_t ndim, const double *a, const double *b, const double *params, const double *covmat, double epsilon)
Namespace for new ROOT classes and functions.
Short_t Min(Short_t a, Short_t b)