Roofit: RooHisPdf Vs RooHistFunc

Dear Rooters

I have a basic code to perform a template fit using standard 1D histograms as inputs. To do this, I have created the different profiles using RooHistPdf. The construction has been done as (for each component):

RooDataHist *DH_hs1 = new RooDataHist("DH_hs1","hs1 Histogram",*x,hs1); RooHistPdf *PDF_hs1 = new RooHistPdf("PDF_hs1","PDF for DH_hs1",RooArgSet(*x),*DH_hs1);
After put everything in a WS, I construct the model as:

WS_PDF->factory("SUM::m_hs(fit_ratio_hs1*PDF_hs1,fit_ratio_hs2*PDF_hs2,PDF_hs3)"); WS_PDF->factory("SUM::model(kn_hs_var*m_hs,n_hb1_var*PDF_hb1,n_hb2_var*PDF_hb2)");
then, the fit over data produces a [color=#0040FF]result A[/color].

Now, In order to include some nuisance parameters I have to construct the same model but using RooHistFunc instead of RooHistPdf. The procedure is:

RooDataHist *DH_hs1_Norm = new RooDataHist("DH_hs1_Norm","hs1 Histogram", *x, hs1_Norm);
Where [color=#FF0000]hs1_Norm[/color] histogram is normalized to 1. Then the RooHistFunc:

WS_FUN->factory("HistFunc::f_hs1(x,DH_hs1_Norm)") ;
and finally, the new model using the RooHistFunc:

WS_FUN->factory("ASUM::m_fhs(fit_ratio_hs1*f_hs1,fit_ratio_hs2*f_hs2,f_hs3)"); WS_FUN->factory("ASUM::fmodel(kn_hs_var*m_fhs,n_hb1_var*f_hb1,n_hb2_var*f_hb2)");
This fit result over the same data is called [color=#0040FF]result B[/color]

The point is that both results are completely differents. [color=#0040FF]Result A[/color] makes sense but not [color=#0040FF]Result B[/color], where one of the parameters goes up to the limit. So, my questions are:

  • Does ASUM work for RooHistFunc as SUM works for RooHistPdf?
  • Any idea why the model constructed with RooHistFunc does not agree with the one constructed with RooHistPdf?

I have attached the full code with its corresponding input and the output. I will really appreciate all your help/comments/suggestions about this topic.
Output.txt (10.3 KB)
Input.root (6.71 KB)
roofitQuestion.C (5.22 KB)


This might be related to an existing open bug in RooHIstFunc,


Dear Lorenzo,

unfortunately I cannot access the link and I seem to be observing the same issue. Is the link URL correct?
Could you please update us on the progress, in case we just don’t have access?

Best regards,


sorry for the noise, it seems that the following link works. Adding it here for reference, for others.


Dear all,
I have posted a bugfix in the JIRA ticket. With it, this test macro works fine.