TVirtualFitter::GetFitter error

Dear Experts,

  I am trying to fit a histogram with a function TF1 *f  for a range minXfit to maxXfit. Within this range histogram has zero entries also (those have zero error bars only). Then I check the status as given below and I see that it is 0 which I think tells me that everything is okay and fit converge.

  TFitResultPtr r=0;
   r = fake_histo->Fit(f,"L R Q S","",minXFit,maxXFit);
   double likelihood_value = r->MinFcnValue();
   Int_t fitStatus = r;

But when I tried to compute the 0.95cl confidence interval for the fit using :
TH1F *h_fitError=new TH1F(“h_fitError”,“0.95cl fit error”,nx, xbins); //similar as fake_histo above

I don’t get anything in h_fitError histo. I tried to print Integral() of h_fitError and its -nan. Can someone help me what is the possible cause? OR if I am missing something in my implementation.
(Also before fake_histo->Fit() above I do some other fitting using different TF1 function but not sure how TVrirtualFitter picks the fit function to evaluate 0.95cl. I assume its the last one I fitted before calling TVirtualFitter::GeFitter(), right?)

Thanks in advance for your help.


Hi sushil,

Could you post a running piece of code showing the issue?

Cheers, Bertrand.

Hi Bertrand,

    My apology for replying late. Actually I managed to run the code as there was an issue with my script. So everything works fine :slight_smile: Though I still have one question about errors. Does the following includes  uncertainty due to parameters which describes the shape I fit using f ?  

 f->IntegralError(xl, xh, fitpara,r->GetCovarianceMatrix().GetMatrixArray());

here xl-xh is fit range and fitpara are parameter array while r is TFitResultPtr.



Yes the IntegralError function computes the error on the integral of the function due to the fit parameter uncertainties. The error is computed using error propagation and using the fit covariance matrix



Thanks Lorenzo!

Best regards,