Read and draw RooDataHist

Hi experts,
I have a RooWorkSpace “w” storied in a root file and inside the RooWorkSpace it has several RooDataHist, How can I read and draw these RooDataHist? I try as following, but it can’t work.
Thank you
Best regards

RooAbsData *aterm_hist=w->data(“ttbar_Atermdatahist”);
RooPlot *plotmhist=w->var(“mass_tt”)->frame();
aterm_hist->plotOn(plotmhist, RooFit::LineColor(kBlack),RooFit::LineWidth(1));
image

Why doesn’t it work? Any error messages?

What you do looks correct at first sight, but you also need something like
plotmhist->Draw().

Hi,
when run the code it encounter error, it says:
warning: null passed to a callee that requires a non-null argument [-Wnonnull].
It seems the code didn’t read the RooDataHist in.

Ok, you got a nullptr from one of the functions. Please check which pointer is invalid before you use it.

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