Confidence interval for an imported tf1

I have the parameters and errors on those parameters for a TF1. I want to draw that TF1 on a histogram with the confidence interval (or error band) of that fit as well.
There is a way to do this (as shown below from the ROOT tutorial on confidence intervals) but this requires a histogram to be fit with a function and then calculating the confidence interval. In my case Iā€™m not fitting a histogram but rather drawing a separate TF1 on top of a histogram. Is there a way to do this?

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", 100, -3, 3);
(TVirtualFitter::GetFitter())->GetConfidenceIntervals(hint);

For example if I have the following function, how can I draw its confidence interval (or error band)

TF1 * f1 = new TF1(ā€œf1ā€, ā€œ[0]+[1]*xā€);
f1->SetParameters(0,3);
f1->SetParErrors(1,1);

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.