RooHist -> GetHistogram returns empty Histogram


To plot a TLine in the same canvas as a histogram, I would like to convert a RooHist to a TH1F. I requested a pull from an RooPlot frame that returned a RooHist. This RooHist has a function GetHistogram() that returns a TH1F. Unfortunately, this histogram has zero entries, even if the RooHist itself is nonzero.

  1. Is there another way to plot a TLine over a RooHist?
  2. What is the purpose of GetHistogram() if there are no data points inside?
  3. Also I couldn’t find out how to plot error bars with RooHist. The Drawing option “E” does produce a blank canvas.
  4. Why does the residHist() even return a RooHist? :blush: This class is not as easily accessable as RooDataHist or TH1.

This is the basic code:

RooHist* res_hist = xframe->residHist();
RooPlot* res_frame = x.frame(Title(""));
TH1F* temp = res_hist->GetHistogram();

Thanks for your help.


A RooHist is a TGraph … you can draw a TLine over any Tgraph … I do not understand why you need to convert The RooHist into a TH1F in order to plot a line on top.

I didn’t realize you had to plot the frame before the RooHist. I am dumb :blush:

Thank you, Sir.