PYTHIA
8.312
|
#include <Basics.h>
Public Member Functions | |
Rndm () | |
Constructors. | |
Rndm (int seedIn) | |
bool | rndmEnginePtr (RndmEnginePtr rndmEngPtrIn) |
Possibility to pass in pointer for external random number generation. More... | |
void | init (int seedIn=0) |
Initialize, normally at construction or in first call. More... | |
double | flat () |
Generate next random number uniformly between 0 and 1. More... | |
double | exp () |
Generate random numbers according to exp(-x). More... | |
double | xexp () |
Generate random numbers according to x * exp(-x). | |
double | gauss () |
Generate random numbers according to exp(-x^2/2). | |
pair< double, double > | gauss2 () |
Generate two random numbers according to exp(-x^2/2-y^2/2). | |
double | gamma (double k0, double r0) |
Generate a random number according to a Gamma-distribution. | |
pair< Vec4, Vec4 > | phaseSpace2 (double eCM, double m1, double m2) |
Generate two random vectors according to the phase space distribution. More... | |
int | pick (const vector< double > &prob) |
Pick one option among vector of (positive) probabilities. More... | |
template<typename T > | |
void | shuffle (vector< T > &vec) |
Randomly shuffle a vector, standard Fisher-Yates algorithm. More... | |
bool | dumpState (string fileName) |
Save or read current state to or from a binary file. More... | |
bool | readState (string fileName) |
Read in the state of the random number generator from a binary file. More... | |
RndmState | getState () const |
Get or set the state of the random number generator. | |
void | setState (const RndmState &state) |
Static Public Attributes | |
static constexpr int | DEFAULTSEED = 19780503 |
The default seed, i.e. the Marsaglia-Zaman random number sequence. | |
Rndm class. This class handles random number generation according to the Marsaglia-Zaman-Tsang algorithm.
bool dumpState | ( | string | fileName | ) |
Save or read current state to or from a binary file.
Save current state of the random number generator to a binary file.
Open file as output stream.
Write the state of the generator on the file.
Write confirmation on cout.
double exp | ( | ) |
Generate random numbers according to exp(-x).
Generate random numbers according to exp(-x). Must be defined before possible RNG debugging methods.
double flat | ( | ) |
Generate next random number uniformly between 0 and 1.
Use standard random number generation, rather than debug versions.
Define debug random number calls. Generate next random number uniformly between 0 and 1.
Use external random number generator if such has been linked.
Ensure that already initialized.
Find next random number and update saved state.
void init | ( | int | seedIn = 0 | ) |
Initialize, normally at construction or in first call.
Pick seed in convenient way. Assure it to be non-negative.
Unpack seed.
Initialize random number array.
Initialize other variables.
Finished.
Generate two random vectors according to the phase space distribution.
Calculate phase space configuration.
Isotropic angles give three-momentum.
int pick | ( | const vector< double > & | prob | ) |
Pick one option among vector of (positive) probabilities.
Pick one option among vector of (positive) probabilities. Must be defined before possible RNG debugging methods.
bool readState | ( | string | fileName | ) |
Read in the state of the random number generator from a binary file.
Open file as input stream.
Read the state of the generator from the file.
Write confirmation on cout.
bool rndmEnginePtr | ( | RndmEnginePtr | rndmEngPtrIn | ) |
Possibility to pass in pointer for external random number generation.
Method to pass in pointer for external random number generation.
Rndm class. This class handles random number generation according to the Marsaglia-Zaman-Tsang algorithm
Save pointer.
Done.
void shuffle | ( | vector< T > & | vec | ) |
Randomly shuffle a vector, standard Fisher-Yates algorithm.
Methods used for debugging random number sequences.
Randomly shuffle a vector, standard Fisher-Yates algorithm. This must be defined after possible RNG debugging.