RooPlot - GetPlottedObject problem

Hi root experts,

I’m trying to deal with a simple likelihood problem in roofit/roostats and I’m facing a problem (code is also attached).

What I do is to construct a model and call the ProfileLikelihoodCalculator on it. After that I SetConfidenceLevel and I plot using the LikelihoodIntervalPlot, until now everything fine. As a next step I want to further manipulate what I plotted, so I use the GetPlottedObject in this way:

RooPlot rh = (RooPlot) plot.GetPlottedObject();

How can I further use this RooPlot as a histogram or function? I have tried getHist in numerous ways but I always end up with “segmentation violation”.

Thanks in advance,
Vangelis
loglike.C (1.11 KB)

Hi,

The LIkelihoodintervalPlot allows you to draw the likelihood plot using either RooPlot or by using a (TF1/histogram). In the first case there is no histogram created, but a RooCurve object, while in the second case the histogram is retired directly in the function GetPLottedObject.

If you want to get the histogram do:

plot.Draw("tf1");

TH1 *rh = (TH1*) plot.GetPlottedObject();

Cheers

Lorenzo