In the following sample code I create a RooHistPdf and attempt to use the generate(const RooArgSet &whatVars, Int_t nEvents) method inherited from RooAbsPdf to create a RooDataSet*.

When doing so the data set created is always just a list of the different values used in creating the initial RooDataHist that was used to create the RooHistPdf (not the events in that set, but 1 entry for each unique value) instead of the expected data set sampled from the Pdf with nEvents.

I am still unsure as to why the previous method gave me the results it did, perhaps it returned a RooDataHist and the bin centers were located in the same spot in memory where the point values would have been for a RooHistPdf? Regardless, turning AutoBinned off gave me what I wanted.

it looks like the RooDataHist is taking a shortcut here. If you check here, you see “Datasets that are generated in binned mode are returned as weighted unbinned datasets”. So, instead of generating let’s say 10 events when you ask for 10, it generates one event per bin (note that you have only two bins!), but sets their weights such that the total sum of weights is equal to 10 (+/- Poisson fluctuations). Statistically speaking, you get the same result (two bins, sum of weights = 10), but it’s faster.

With the Gaussian, I assume, you didn’t ask for a binned dataset, so the Gaussian distribution is continuous. That’s why you get 10 different and unweighted values of x.