Event generation from 2D PDF class

Hi experts,
I wrote a RooFit 2D PDF class and I generated some events from this PDF
without problem (the distributions for each variable look as expected).
I have a problem in superimposing the model on the variable distributions.
I provided the class with the integrals over both and each single variable but
it doesn’t seem to work.

I created a small example reproducing what I’m doing and it can be found attached.
To compile type “make”. To run “root fit.C”.

Any hint or help on what I’m doing wrong is more than appreciated.
Thanks a lot in advance
test_2Dpdf.tar.gz (5.38 KB)