49 bool onedim = ndim == 1;
52 Error(
"TF1Helper",
"Function has no parameters");
56 std::vector<double> oldParams;
59 oldParams.resize(npar);
66 if (covmat ==
nullptr) {
69 Error(
"TF1Helper::IntegralError",
"ROOT has enabled implicit MT. There is no existing lobal fitter, as shown in the documentation a pointer to the covariance matrix"
70 "from the TFitResult must be passed to TF1::IntegralError");
76 if (fitter ==
nullptr) {
77 Error(
"TF1Helper::IntegralError",
"No existing fitter can be used for computing the integral error");
82 Error(
"TF1Helper::IntegralError",
"Last used fitter is not compatible with the current TF1");
87 Warning(
"TF1Helper::INtegralError",
"Last used fitter does no provide parameter errors and a covariance matrix");
92 for (
int i = 0; i < npar; ++i) {
94 Error(
"TF1Helper::IntegralError",
"Last used Fitter has different parameter values");
103 covMatrix.
Use(npar,covmat);
113 double numError2 = 0;
114 for (
int i=0; i < npar; ++i) {
118 double epsabs = epsrel;
124 if (covMatrix(i,i) > 0 ) {
135 integral = gradFunc.
IntegralMultiple(ndim,
a,
b,maxpts,epsrel,epsabs,relerr,nfnevl,ifail);
137 error = relerr*std::abs(integral);
145 numError2 += covMatrix(i,i)*covMatrix(i,i) * integral * integral * error * error;
148 double result = sqrt(err2);
149 double numError = sqrt( numError2/sqrt(err2) );
153 Warning(
"TF1Helper::IntegralError",
"numerical error from integration is too large. Integral error = %g +/- %g - eps = %g",
result,numError,
epsilon);
156 if (!oldParams.empty()) {
162 return std::sqrt(err2);
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
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
Get reference to Fit Result object (NOTE: it will be invalid when class is deleted)
Int_t GetNumberTotalParameters() const override
Number of total parameters.
Double_t GetParameter(Int_t ipar) const override
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)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Bool_t IsImplicitMTEnabled()
Returns true if the implicit multi-threading in ROOT is enabled.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.