How to convert fitted pdf function to histogram?

Dear all:

I have a histogram, which includes signal and background events. I used a sum pdf function, which also includes signal pdf and background pdf. Then I used sum pdf to fit the histogram from data. After the fit, how could I convert the fitted sum pdf to a histogram ? I would like to see the difference between the data and fitted sum pdf function?

Thanks in advance!


Could you clarify if you are working within the RooFit package?

If yes:

  1. You don’t need to get a TH1 of the function to visualaise the fit result. RooFit comes with powerful plotting tools. You can do:

RooPlot* plot = variable.frame();

  1. But if you nevertheless want the TH1 corresponding to the pdf there is a function (but I’m not sure of the name): RooAbsPdf::GetTH1();


– Gregory