[RooFit] How to get error band value of fit in each bin?

Hi all,

I want to ask in RooFit how to extract the values of propagated error of a pdf. Since we can use VisualizeError(*fitResults), there should be a way to get those values.(the error band value in each bin shown in plot)

Thanks for answering :slight_smile:

Hi, also clarity one thing, if the visualizing error band in RooFit can be a obtained with a function or RooFit object? If yes, then I can obtain it then know the value in each bin.

The attached show how the visualizing error band(the light blue band) looks like.

Hi, we get the solution finally:

The band is store in RooPlot frame as RooCurve object. So just get the object from the frame, and using Eval(x) to get the value.

Below are the sample code to archive it.

RooCurve* central = frame->getCurve("name_of_the_object");
RooCurve* curve = frame->getCurve("name_of_the_object");
TGraph* upBound = new TGraph(central->GetN());
TGraph* loBound = new TGraph(central->GetN());

for( int j = 0; j < curve->GetN(); ++j ){
  if( j < central->GetN() )
      upBound->SetPoint(j, curve->GetX()[j], curve->GetY()[j]);
      loBound->SetPoint(j, curve->GetX()[j], curve->GetY()[j]);

float upperValue = upBound->Eval(x);