Integral form a TF1 object

Hello ROOTers
1.) I have a gr object, gr1*.
2.) I have two TF1* objects, fGaussLin and fGaussOnly defined as:
fGaussLin = new TF1(“mygr1”,“pol1(0)+gaus(2)”);
fGaussOnly = new TF1(“peakSingleton”,“gaus”);
3.) I set the range on my fGaussLin as a subrange of gr1 defined by
double xl
double xh
fGaussLin->SetRange(xl,xh);
4.) I call gr1->Fit(“mygr1”,“BR+”,“A”);
5.) I set the parameters (and their errors) of fGaussOnly obj based on fGaussLin obj:
fGaussOnly->SetAmplitudePar(fGaussLin->GetParameter(2),fGaussLin->GetParError(2));
fGaussOnly->SetMeanPar(fGaussLin->GetParameter(3),fGaussLin->GetParError(3));
fGaussOnly->SetSigmaPar(fGaussLin->GetParameter(4),fGaussLin->GetParError(4));
fGaussOnly->SetRange(xl,xh);
6.) If I call fGaussLin->IntegrateError(xl,xh); WORKS!!!
7.) If I call fGaussOnly->IntegrateError(xl,xh); FAILS!!! Returns zero and the following error message:

From the TF1 online documentation:

I would like to use an auxiliar TF1 object to contain the parameters of a peak of interest which is defined by another function (in my example a linear+gauss function). I am able to perform the integration on my auxiliar function but I cannot retrieve the error of the integration because as you can see from my algorithm, I have not fitted my auxiliar function on data points. I guess the error is because some covariance error matrix has not been initialized properly (my assumption, probly wrong). My question is, is there any way to initialized my auxiliar function properly so to be able to retrieve the error of the integration???

Thank you,
Cristian

Hi,

IntegralError uses the covariance matrix from the last fit, which it is taken from a static fitter object.
I will need to update the TF1::IntegralError function to be able to pass a covariance matrix given by the user.
I’ll let you know when this will be available in ROOT

Best Regards

Lorenzo

Hi Lorenzo,

I can see this has been added for ROOT, but not for PyROOT:

help(TF1.IntegralError)
IntegralError(self, Int_t n, const Double_t* a, const Double_t* b, Double_t epsilon=9.9999999999999998e-13) method of PyLHCb.Physics.RadiativeDecays.KStarGamma.TF1 instance
Double_t TF1::IntegralError(Double_t a, Double_t b, Double_t epsilon = 1e-12)
Double_t TF1::IntegralError(Int_t n, const Double_t* a, const Double_t* b, Double_t epsilon = 1e-12)

Is there any way to access the underlying ROOT class, I need to do the same as Cristian from PyROOT.

Thanks a lot,
Albert

Hi Albert,

Please post this item in the PyROOT forum,
Regards

Lorenzo

Albert,

most likely that you have an older version of ROOT that does not contain the updated parameter list. It’s fine in trunk AFAICS.

Cheers,
Wim