#include <random.h>
The intention of this class is to efficiently sample \( (N_1, N_2) \) from the Bessel distribution \( p(N_1,N_2) \sim \mathrm{Poi}(\nu_1) \mathrm{Poi}(\nu_2) \delta(N_1 - N_2 = N)\), where \(\mathrm{Poi}(\nu)\) denotes Poisson distribution with mean \(\nu\).
In other words, this class samples two Poisson numbers with a given mean and a fixed difference. The intended use is to sample the number of baryons and antibaryons, given their means and net baryon number.
The distribution of \( min(N_1,N_2) \) is a so-called Bessel distribution. Denoting \( a = \sqrt{\nu_1 \nu_2}\), \( p(N_{smaller} = k) = \frac{(a/2)^{2k+N}}{I_N(a) k! (N+k)!} \). We sample this distribution using the method suggested by Yuan and Kalbfleisch [63] : if \( m = \frac{1}{2} (\sqrt{a^2 + N^2} - N) > 6\), then the distribution is approximated well by a Gaussian, else probabilities are computed explicitely and a table sampling is applied.
Public Member Functions | |
BesselSampler (const double poisson_mean1, const double poisson_mean2, const int fixed_difference) | |
Construct a BesselSampler. More... | |
std::pair< int, int > | sample () |
Sample two numbers from given Poissonians with a fixed difference. More... | |
Static Private Member Functions | |
static double | r_ (int n, double a) |
Compute the ratio of two Bessel functions r(n,a) = bessel_I(n+1,a)/bessel_I(n,a) using the continued fraction representation (see [63]). More... | |
Private Attributes | |
random::discrete_dist< double > | dist_ |
Vector to store tabulated values of probabilities for small m case (m <6). More... | |
double | m_ |
Mode of the Bessel function, see [63] for details. More... | |
const double | a_ |
Second parameter of Bessel distribution, see [63] for details. More... | |
const int | N_ |
First parameter of Bessel distribution (= \( \nu \) in [63]). More... | |
const bool | N_is_positive_ |
Boolean variable to verify that N > 0. More... | |
double | mu_ |
Mean of the Bessel distribution. More... | |
double | sigma_ |
Standard deviation of the Bessel distribution. More... | |
Static Private Attributes | |
static constexpr double | m_switch_method_ = 6.0 |
Switching mode to normal approximation. More... | |
static constexpr double | negligible_probability_ = 1.e-12 |
Probabilities smaller than negligibly_probability are neglected. More... | |
smash::random::BesselSampler::BesselSampler | ( | const double | poisson_mean1, |
const double | poisson_mean2, | ||
const int | fixed_difference | ||
) |
Construct a BesselSampler.
[in] | poisson_mean1 | Mean of the first number's Poisson distribution. |
[in] | poisson_mean2 | Mean of the second number's Poisson distribution. |
[in] | fixed_difference | Difference between the sampled numbers. |
Definition at line 31 of file random.cc.
std::pair< int, int > smash::random::BesselSampler::sample | ( | ) |
Sample two numbers from given Poissonians with a fixed difference.
Definition at line 73 of file random.cc.
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticconstexprprivate |
|
staticconstexprprivate |
|
private |
|
private |