Remove horizontal error bars in RooFit

Dear RooFit experts,
I am currently struggling with RooFit::DrawOption. I’d like to remove the horizontal error bars when plotting a RooDataset. If I do

data_dataset->plotOn(frame,Binning(25), DataError(RooAbsData::SumW2),Name("data"),RooFit::DrawOption("X0 P E1"));

I do get rid of the horizontal error bars, but also of the vertical error bars.



Would you know how to keep the vertical error bars ? The “E1” option seems to be ignored.
Best regards,

Elvire

1 Like

If gStyle->SetErrorX(kFALSE) does not work, I guess the only way will be to set the errors along X equal to 0.

1 Like

Hi Elvire,

This is probably too late for you, but someone else might have the same problem (at least I did). There is an XErrorSize option for drawing data histograms onto a RooPlot. Using something like

data->plotOn(frame, RooFit::XErrorSize(0));

should do the trick for plotting a histogram that only has vertical error bars. The drawback to this is that RooFit uses the x-errors to determine the value at which functions are evaluated when they are compared to the plotted data points. This can be a problem if you want to calculate the chi2 value between a function and the data points using

frame->chiSquare("pdf", "data", n_float_pars);

The workaround in my case for this problem was to simply plot the data twice, once with horizontal error bars (invisible) and once without. Then using the invisibly plotted data points with horizontal error bars to calculate the chi2 works as expected.

Cheers,
Thomas