How to use ROOT::Math::DistSampler?

I have to do sampling from a few distributions like NBD and Gamma distribution. I tried declaring the pdf as a TF1 function and then obtained the samples by TF1::GetRandom() method. Then I plotted TH1D for the generated samples(~1E7 samples).
The problem is that I never get back the mean and variance, that I put into the pdf, in the TH1D that I plot. The mean is always larger.

Then I also tried acceptance and rejection method. And got the same results.
So now I wanted to try using DistSampler Class of ROOT. But I do not know how to use it.

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Maybe @moneta can give more details, but did you check the multidimSampling.C tutorial?


You can look also at the program:

and at the reference documentation

It is mainly an abstract class which is re-implemented for example by the sampler based on unuran, which provide several sampling algorithms (class TUnuranSampler)
You can see then for the list of anuran algorithms in the anuran documentation,

If you have more questions, please let us know
Best regards

Thank you for prompt replies. I’ll look into these soon.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.