Plotting the error bands of the fit result

Hi,

I have saved the dataset (RooAbsData), the fit to this dataset (RooAbsPDF)
and the fit result (RooFitResult) to a root file.

How can I plot 1 sigma error band to this fit?

I am trying to do like this:

[code] RooWorkspace *ws = (RooWorkspace *)f->Get(“workspace”);
RooAbsData *data = ws->data(“data_obs_cat1”);

  RooRealVar *mass = ws->var("mass");

  RooAbsPdf *extbkg = ws->pdf("pdf_bgr_cat1");
  RooFitResult *r = (RooFitResult *)extbkg->fitTo(*data);
  RooPlot *plot = mass->frame();
  data->plotOn(plot);
  extbkg->plotOn(plot);
                                                                                                                                                           
  extbkg->plotOn(plot,VisualizeError(*r,1),FillColor(kCyan-6));
  extbkg->plotOn(plot,VisualizeError(*r,2),FillColor(kCyan-10));

[/code]

But it does not plot the error bands. What would you suggest?

Thanks in advance,
Shilpi

Hi,

Putting my question differently, if I save RooFitResults in a root file, how can I access it later from
the workspace?

I am saving the RooFitResult like this:

RooFitResult *r = bgrfit.fitTo(data); wspace.import(*r)

Thanks for any help,

Best regards,
Shilpi

Hi Shilpi,

    I think you could get the 1-sigma band like this:

 (TVirtualFitter::GetFitter())->GetConfidenceIntervals(h_fitError,0.68);

  where h_fittError will hold the errors and could superimpose it on the same canvas where you plot central values.

sushil

sorry Shilpi, I realized you are using RooFit. My reply will work for TF1 case.

sushil