A Bug of Plotting ConfidenceIntervals?

Hi,
I have the codes to plot ConfidenceIntervals band, actually, it is abstracted from tutorial code : ConfidenceIntervals.C:

void TestConfidenceIntervals() {

   //Create, fill and fit a histogram
   Int_t nh=5000;
   TH1D *h = new TH1D("h", 
      "Fitted gaussian with .95 conf.band", 100, -3, 3);
   h->FillRandom("gaus", nh);
   TF1 *f = new TF1("fgaus", "gaus", -3, 3);
   f->SetLineWidth(2);
   h->Fit(f, "Q");
   h->Draw();
   
   //Create a histogram to hold the confidence intervals
   TH1D *hint = new TH1D("hint", 
      "Fitted gaussian with .95 conf.band", 400, -3, 3); // <---
   (TVirtualFitter::GetFitter())->GetConfidenceIntervals(hint);
   //Now the "hint" histogram has the fitted function values as the 
   //bin contents and the confidence intervals as bin errors
   hint->SetStats(kFALSE);
   hint->SetFillColor(2);
   hint->Draw("e3 same");

}

The default number of bins in the line below is not 400, it is 100 same as its original histogram:

   TH1D *hint = new TH1D("hint", 
      "Fitted gaussian with .95 conf.band", 400, -3, 3); 

Then I change it to 400. For ROOT v5.20, it is working like 100. However, in ROOT v5.22 and v5.23, it is not working: 400 is too fine to be filled between bins. Please see the 2 graphs attached which names contain ROOT versions. I guess ROOT v5.22 was induced a bug.

Cheers,
Zhiyi.



Okay, since it seems that no body worked on my problem. I have to dig into it and looked into related code. Here is my comments:

I found in the line

code->GetConfidenceIntervals(hband_eta, 0.68);
[/code]
, the method [quote]GetConfidenceIntervals[/quote] is from class [quote]TBackCompFitter[/quote]. In the code of [quote]hist/hist/src/TBackCompFitter.cxx[/quote], there is a description about the class: Backward comparible implementation of TVirtualFitter using the the class ROOT::Fit::Fitter. Sorry, I don’t know what that means. And the method GetConfidenceIntervals in the class provides the band with a problem (TestConfidenceIntervals_v5.23.png) that I show above. So, experts, please consider this is normal or not? This is a bug? Why not call the corresponding method in TFitter or TLinearFitter unlike ROOT v5.20. By the way, the class TBackCompFitter is not existing in ROOT v5.20.

Cheers,
Zhiyi.

Hello,

there was a bug in 5.22 for drawing the confidence intervals when the number of bins was different compared to the bins of the fit object.
Now it is fixed in the latest trunk revision.

From 5.22, this new class, TBackCompFitter, calculates the confidence intervals for all the fitting methods (Minuit, Fumili, Minuit2, etcc…).
Before an implementation was instead existing for each one of them.

Thank you very much for reporting this problem

Lorenzo