Ndim fit using RooHistPdf

Dear RooFit experts,

I am a rookie with RooFit, so sorry if I ask something easy.

I would like to perform an extended maximum likelihood fit via the RooAddPdf class and non parametric pdfs. So far, I have been using RooHistPdf created from 1D histograms, and everything went smoothly.
Now I would like to try a multi-dimensional fit, where my dataset and pdfs are function of 2 (or more) observables.
I put down some toy test code, using the really same machinery I used so far. But, when I call the fit function to fit a toy RooDataSet, I get the following error

[code] **********
** 14 **MIGRAD 1000 1

[#0] WARNING:Minization – RooFitGlue: Minimized function has error status.
Returning maximum FCN so far (-1e+30) to force MIGRAD to back out of this region. Error log follows
Parameter values: n0=20000, n1=20000
RooAddPdf::model[ n0 * _roo_histpdf0 + n1 * _roo_histpdf1 ]
getLogVal() top-level p.d.f evaluates to zero @ !refCoefNorm=(), !pdfs=(_roo_histpdf0 = 0/100000,_roo_histpdf1 = 0/100000), !coefficients=(n0 = 20000,n1 = 20000)
and the fit fails.
If I instead fit not an independent RooDataSet, but a RooDataSet generated from the pdf function, the fit converges without any problem.

I suppose the problem is in the fact that I am creating RooHistPdf using TH2F histograms. If I instead try to create the same pdf using RooNDKeysPdf, everything works fine (but it is very time consuming, and since I have to perform a very big number of fits, I would stick to use a RooHistPdf pdf).

I attach you the code that you can use in order to reproduce the error.

Thank you very much for your help. Any suggestion will be extremely helpful!

Have a nice day,

test_NdimEML.C (4.36 KB)

Hi Valerio,

same problem here, any hints?

Hallo Rene,

I found the problem into my procedure. I used a 2Dim Histogram pdf generated with a histogram that had empty bins. Then I wanted to fit some data in which I had entries in that bin. This turned out to be an infinity loglikelihood during the minimization, which made the fit to fail. But this is clear: I wanted to fit the data with a model that was wrong (according to the model, the probability to have an event in that bin was zero!). Using Keys pdf this didn’t happen because the model was never zero in every bin.

Hope this is a correct and helpful interpretation.