Error band on fitted RooCurve

Hello,

This is mostly a plotting issue: I have a fitted curve to come data.
The corresponding up and down uncertainties on the fit are two more RooCurve objects.
Is there a way to draw a fill area using the up/ down curves such that it shows up as an uncertainty band around the central fit?

Thanks.

Hi,

You can create a TGraphErrors from the two RooCurve with the graph lower/upper error corresponds to the down/up values of the RooCurve objects.
Then you can draw the TGraphErrors as an error band using option E3 or E4, see
https://root.cern.ch/doc/master/classTGraphPainter.html#GP03a

Cheers

Lorenzo

Hi,

thanks. this is exactly what I did.

I was expecting to use the RooCurve::makeErrorBand methods. But I could not figure out the passing of vector<RooCurve*> as arguments.
Seemed to me that the makeErrorBand does exactly the same as the TGraphErrors under the hood.
BTW, why does this method need a vector of pointers? It does not modify the original curve at all, right?

Hi,

The makeErrorBand computes the upper/down uncertainty in the curve. It needs a vector of curves representing a random sample of variations of the parameters. The parameter variations are obtained by sampling from the fit covariance matrix result.
Otherwise you can provide as input the upper and lower variations of the curve versus the parameters (so two vectors which have as size the number of parameters) and in addition the fit covariance matrix.

You can see how the methods are used internally in RooAbsReal::plotOnwithErrorBand

https://root.cern.ch/doc/master/classRooAbsReal.html#ace8c056713a182f534d3fa144895d37c

Lorenzo

Thanks. I could try this as well.

Like I said, the problem was to pass a vector of pointers to RooCurve.

Admittedly, this is probably more of a PyRoot problem than RooFit.

Hi,

Have you tried to create a vector of RooCurve pointers in PyROOT as following

v = ROOT.std.vector('RooCurve *')()

and then use push_back to fill it with the RooCurve objects

Lorenzo

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