Implementation class for the RandomFunction for all the engined that derives from TRandomEngine class, which defines an interface which has TRandomEngine::Rndm() In this way we can have a common implementation for the RandomFunctions.
Definition at line 70 of file RandomFunctions.h.
Public Member Functions | |
RandomFunctionsImpl () | |
class constructor | |
int | Binomial (int ntot, double prob) |
Generate binomial numbers. | |
double | BreitWigner (double mean, double gamma) |
Return a number distributed following a BreitWigner function with mean and gamma. | |
void | Circle (double &x, double &y, double r) |
Generates random vectors, uniformly distributed over a circle of given radius. | |
double | Exp (double tau) |
Returns an exponential deviate. | |
double | GausACR (double mean, double sigma) |
generate random numbers according to the Acceptance-Complement-Ratio method | |
double | GausBM (double mean, double sigma) |
generate Gaussian number using Box-Muller method | |
double | Landau (double mu, double sigma) |
Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma ) | |
int | Poisson (double mean) |
Generates a random integer N according to a Poisson law. | |
double | PoissonD (double mean) |
Generates a random number according to a Poisson law. | |
void | Rannor (double &a, double &b) |
Generate numbers distributed following a gaussian with mean=0 and sigma=1. | |
void | SetEngine (void *r) |
void | Sphere (double &x, double &y, double &z, double r) |
Generates random vectors, uniformly distributed over the surface of a sphere of given radius. | |
double | Uniform (double a) |
Returns a uniform deviate on the interval (0, x1). | |
double | Uniform (double a, double b) |
generate random numbers following a Uniform distribution in the [a,b] interval | |
Protected Attributes | |
TRandomEngine * | fBaseEngine |
Private Member Functions | |
double | Gaus (double mean, double sigma) |
double | Rndm () |
#include <Math/RandomFunctions.h>
|
inline |
class constructor
Definition at line 75 of file RandomFunctions.h.
Int_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Binomial | ( | int | ntot, |
double | prob | ||
) |
Generate binomial numbers.
Definition at line 27 of file RandomFunctions.cxx.
Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::BreitWigner | ( | double | mean, |
double | gamma | ||
) |
Return a number distributed following a BreitWigner function with mean and gamma.
Definition at line 41 of file RandomFunctions.cxx.
void ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Circle | ( | double & | x, |
double & | y, | ||
double | r | ||
) |
Generates random vectors, uniformly distributed over a circle of given radius.
Input : r = circle radius Output: x,y a random 2-d vector of length r
Definition at line 55 of file RandomFunctions.cxx.
Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Exp | ( | double | tau | ) |
Returns an exponential deviate.
exp( -t/tau )
exp( -t/tau )
Definition at line 67 of file RandomFunctions.cxx.
|
inlineprivate |
Definition at line 133 of file RandomFunctions.h.
double ROOT::Math::RandomFunctionsImpl< TRandomEngine >::GausACR | ( | double | mean, |
double | sigma | ||
) |
generate random numbers according to the Acceptance-Complement-Ratio method
Definition at line 96 of file RandomFunctions.cxx.
double ROOT::Math::RandomFunctionsImpl< TRandomEngine >::GausBM | ( | double | mean, |
double | sigma | ||
) |
generate Gaussian number using Box-Muller method
Definition at line 77 of file RandomFunctions.cxx.
Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Landau | ( | double | mu, |
double | sigma | ||
) |
Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma )
Generate a random number following a Landau distribution with location parameter mu and scale parameter sigma: Landau( (x-mu)/sigma ) Note that mu is not the mpv(most probable value) of the Landa distribution and sigma is not the standard deviation of the distribution which is not defined.
For mu =0 and sigma=1, the mpv = -0.22278
The Landau random number generation is implemented using the function landau_quantile(x,sigma), which provides the inverse of the landau cumulative distribution. landau_quantile has been converted from CERNLIB ranlan(G110).
Definition at line 191 of file RandomFunctions.cxx.
Int_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Poisson | ( | double | mean | ) |
Generates a random integer N according to a Poisson law.
Prob(N) = exp(-mean)*mean^N/Factorial(N)
Prob(N) = exp(-mean)*mean^N/Factorial(N)
Use a different procedure according to the mean value. The algorithm is the same used by CLHEP. For lower value (mean < 25) use the rejection method based on the exponential. For higher values use a rejection method comparing with a Lorentzian distribution, as suggested by several authors. This routine since is returning 32 bits integer will not work for values larger than 2*10**9. One should then use the Trandom::PoissonD for such large values.
Definition at line 213 of file RandomFunctions.cxx.
Double_t ROOT::Math::RandomFunctionsImpl< TRandomEngine >::PoissonD | ( | double | mean | ) |
Generates a random number according to a Poisson law.
Prob(N) = exp(-mean)*mean^N/Factorial(N)
This function is a variant of RandomFunctionsImpl<TRandomEngine>::Poisson returning a double instead of an integer.
Definition at line 265 of file RandomFunctions.cxx.
void ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Rannor | ( | double & | a, |
double & | b | ||
) |
Generate numbers distributed following a gaussian with mean=0 and sigma=1.
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
Using the Box-Muller method
Definition at line 312 of file RandomFunctions.cxx.
|
inlineprivate |
Definition at line 131 of file RandomFunctions.h.
|
inline |
Definition at line 77 of file RandomFunctions.h.
void ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Sphere | ( | double & | x, |
double & | y, | ||
double & | z, | ||
double | r | ||
) |
Generates random vectors, uniformly distributed over the surface of a sphere of given radius.
Input : r = sphere radius Output: x,y,z a random 3-d vector of length r Method: (based on algorithm suggested by Knuth and attributed to Robert E Knop) which uses less random numbers than the CERNLIB RN23DIM algorithm
Definition at line 332 of file RandomFunctions.cxx.
double ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Uniform | ( | double | a | ) |
Returns a uniform deviate on the interval (0, x1).
Definition at line 350 of file RandomFunctions.cxx.
double ROOT::Math::RandomFunctionsImpl< TRandomEngine >::Uniform | ( | double | a, |
double | b | ||
) |
generate random numbers following a Uniform distribution in the [a,b] interval
Returns a uniform deviate on the interval (x1, x2).
Definition at line 359 of file RandomFunctions.cxx.
|
protected |
Definition at line 127 of file RandomFunctions.h.