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.