The problem is due to the generation of events from a RooHistPdf where you have set an interpolation for the bins.
I would rather not use an interpolation (by passing 0 instead of 1 as the last parameter of the RoohistPdf constructor), in that case a binned generation is performed by default or do a binned generation of your data using RooAbsPdf::generateBinned.
This is not a bug but it is caused by a wrong Foam configuration. By increasing the number of samples from 200 to 10000 fixes the problem.
The way to do it is to add this line before generate
This problem is caused, as described before, by the small sample number used by default in Foam.
In this case, you can increase the value by default for all pdf’s used by doing
This effect (the pi in the histogram) is caused when generating data from the pdf. As I explained before the effect is caused by a wrong configuration used by Foam to generate events for that PDF. Incresing the number of Foam samples cure the effects.
The pdf is fine, there should be no problem to use it when fitting or getting its value