# In few cases RooAbsPdf::generate() fails to create correct distributions

Dear Rooters,

I have a model with 3 variables

- variable mass (Gaussian)
- variable Vgg (Gaussian)
- variable Vexex (exponential)

and a pdf sketched as

- Nsig*Gauss(mass)*Gauss(Vgg)*Exponential(Vexex)

I am generating data sets using `RooAbsPdf::generate()`

with the `Extended`

flag set. I do this ~1e5 times and check the generation by calculating the mean value of mass and Vexex (I forgot to include vgg mean, but I can add this on demand). I get the following plot with logarithmic y axis, showing some outliers for the mean vaule:

A similar plot is obtained for the mean values of Vexex distributions:

A correlation plot of Vexex and mass mean values shows, that the outliers of both are not correlated:

Looking into one data set with a mean among the mass outliers, one can see the following correlation plot of generated mass and vgg events:

(Who stole the piece of the pie? )

- Instead of
`TRandom3`

which is the default in RooFit I checked it with`TRandomMixMax`

. The same problem was found. - Using a smaller value (0.0125 instead of 0.1) for the lamda of the signal exponential in vexex
`vexexSigLam`

does not cause the problem. So the problem is somehow sensitive to this parameter. - Am I’m doing something wrong or running into a known problem?
- As a workaround I will simply generate the data myself, but somehow it would be convenient to use the
`generate`

method.

## On the Example

- Basically the same as I used in previous posts
- The Configurator class holds the Parameter values. The model is then build via the ModelBuilder class. The main macro is checkRooAbsPdfGenerate.C

checkRooAbsPdfGenerate.C (3.2 KB) Config.C (3.9 KB) modelBuilder.C (13.8 KB) - If an outlier in mean of mass is found the RooDataSet is saved

## How to reproduce

- Either run the macro
`checkRooAbsPdfGenerate.C`

on a batch system with ~10^5 pseudo experiments - Or check running
`root -q "checkRooAbsPdfGenerate.C(1,kTRUE,\"test.root\", 109238706, kFALSE)"`

this I used to produce the pie plot above - If you want to look at a strange data set, you can find the data set to generate the pie plot above here: test.root (443.1 KB)

## ROOT version / platform

- Tested with ROOT 6.20.06 (gcc-4.9) and 6.20.04 (gcc-4.9) on Debian 8 (jessie)
- Ubuntu 18.04 ROOT 6.20.04 (gcc-7.5)