"GetBinContents" function for RooHist?

How can I take a histogram of the values of a roohist histogram. I have:

RooHist* pull_distrubution;

pull_distrubution = fit_frame->pullHist();

which works but now I would like to take a histogram of the bincontents of “pull_distrubution”.

I have been looking for a way to do this and could not find a way to access the bin contents of a roohist. Is their a “GetBinContents” function for RooHist?

I was able to do this using the GetHistogram() function

EDIT: I thought doing:

pull_distrubution->GetHistogram()->GetBinContent(j+1);

was working but it keeps returning 0 even though the roohist pull_distrubution is non-zero.

I got the same question, but couldn’t find a way to extract the values from RooHist. In the RooHist class, couldn’t find a useful function to do it either.

Hi! The object returned by fit_frame->pullHist() is a RooHist, and as such it inherits from TGraph. You should use the TGraph interface to retrieve the contents, e.g.:

   double *xArr = pull_distrubution->GetX();
   double *yArr = pull_distrubution->GetY();
   for (int i = 0; i < pull_distrubution->GetN(); ++i) {
       std::cout << xArr[i] << ", " << yArr[i] << std::endl;
   }

I hope that helps for the future!

Cheers,
Jonas