Converting histogram to pdf for fitting


My problem is I have three histograms that each have a distinct shape and when added together give a histogram that I would measure in the lab. Is there a function in Roofit that can convert a histogram to a pdf such that I can use it to fit other histograms? I would like to do this so I can convert my three base histograms into pdfs and then use those to fit my experiment results.


I hope I’ve understood correctly what your problem is.
You must first convert your TH1 into a RooDataHist and then use a RooHistPdf. The result will be the pdf you’re looking for.

Here’s an example:

RooRealVar x("x","your observable",0,300);
TH1D *Histogram=new TH1D(.....); 

RooDataHist datahist("datahist","datahist",x, Histogram);   
RooHistPdf pdf("pdf","your pdf",x,datahist,2);

Then you can procede with the fit


Thanks that was the function I was looking for.