#include <G4INCLRandom.hh>
Static Public Member Functions | |
static void | setGenerator (G4INCL::IRandomGenerator *aGenerator) |
static void | setSeeds (const SeedVector &sv) |
static SeedVector | getSeeds () |
static G4double | shoot () |
static G4double | shoot0 () |
static G4double | shoot1 () |
static G4double | gauss (G4double sigma=1.) |
static ThreeVector | normVector (G4double norm=1.) |
static ThreeVector | sphereVector (G4double rmax=1.) |
static ThreeVector | gaussVector (G4double sigma=1.) |
Generate Gaussianly-distributed ThreeVectors. | |
static void | deleteGenerator () |
static G4bool | isInitialized () |
Definition at line 56 of file G4INCLRandom.hh.
static void G4INCL::Random::deleteGenerator | ( | ) | [inline, static] |
Delete the generator
Definition at line 150 of file G4INCLRandom.hh.
Referenced by G4INCL::INCL::~INCL().
Generate random numbers using gaussian distribution.
Definition at line 51 of file G4INCLRandom.cc.
References shoot(), shoot0(), and G4INCL::Math::twoPi.
Referenced by gaussVector().
00051 { 00052 // generate a Gaussian random number with standard deviation sigma 00053 // uses the flat() and flat0() methods 00054 static G4bool generated = false; 00055 static G4double u, v; 00056 00057 if( !generated ) 00058 { 00059 u = shoot0(); 00060 v = Math::twoPi*shoot(); 00061 generated = true; 00062 return sigma*std::sqrt(-2*std::log(u))*std::cos(v); 00063 } 00064 else 00065 { 00066 generated = false; 00067 return sigma*std::sqrt(-2*std::log(u))*std::sin(v); 00068 } 00069 }
static ThreeVector G4INCL::Random::gaussVector | ( | G4double | sigma = 1. |
) | [inline, static] |
Generate Gaussianly-distributed ThreeVectors.
Generate ThreeVectors that are distributed as a three-dimensional Gaussian of the given sigma.
Definition at line 142 of file G4INCLRandom.hh.
References gauss(), and G4INCL::Math::oneOverSqrtThree.
Referenced by G4INCL::DeJongSpin::shoot().
00142 { 00143 const G4double sigmax = sigma * Math::oneOverSqrtThree; 00144 return ThreeVector(gauss(sigmax), gauss(sigmax), gauss(sigmax)); 00145 }
static SeedVector G4INCL::Random::getSeeds | ( | ) | [inline, static] |
Get the seeds of the current generator.
Definition at line 90 of file G4INCLRandom.hh.
References G4INCL::IRandomGenerator::getSeeds().
static G4bool G4INCL::Random::isInitialized | ( | ) | [inline, static] |
Check if the generator is initialized.
Definition at line 158 of file G4INCLRandom.hh.
Referenced by setGenerator().
ThreeVector G4INCL::Random::normVector | ( | G4double | norm = 1. |
) | [static] |
Generate isotropically-distributed ThreeVectors of given norm.
Definition at line 71 of file G4INCLRandom.cc.
References shoot(), and G4INCL::Math::twoPi.
Referenced by G4INCL::RecombinationChannel::getFinalState(), and sphereVector().
00071 { 00072 00073 const G4double ctheta = (1.-2.*shoot()); 00074 const G4double stheta = std::sqrt(1.-ctheta*ctheta); 00075 const G4double phi = Math::twoPi*shoot(); 00076 return ThreeVector( 00077 norm * stheta * std::cos(phi), 00078 norm * stheta * std::sin(phi), 00079 norm * ctheta); 00080 00081 }
static void G4INCL::Random::setGenerator | ( | G4INCL::IRandomGenerator * | aGenerator | ) | [inline, static] |
Set the random number generator implementation to be used globally by INCL.
Definition at line 70 of file G4INCLRandom.hh.
References ERROR, and isInitialized().
Referenced by G4INCL::INCL::INCL().
00070 { 00071 if(isInitialized()) { 00072 ERROR("INCL random number generator already initialized." << std::endl); 00073 } else { 00074 theGenerator = aGenerator; 00075 } 00076 };
static void G4INCL::Random::setSeeds | ( | const SeedVector & | sv | ) | [inline, static] |
Set the seeds of the current generator.
Definition at line 82 of file G4INCLRandom.hh.
References G4INCL::IRandomGenerator::setSeeds().
static G4double G4INCL::Random::shoot | ( | ) | [inline, static] |
Generate flat distribution of random numbers.
Definition at line 97 of file G4INCLRandom.hh.
References G4INCL::IRandomGenerator::flat().
Referenced by G4INCL::DeltaDecayChannel::computeDecayTime(), G4INCL::IsotopicDistribution::drawRandomIsotope(), gauss(), G4INCL::SurfaceAvatar::getChannel(), G4INCL::BinaryCollisionAvatar::getChannel(), G4INCL::ElasticChannel::getFinalState(), G4INCL::DeltaProductionChannel::getFinalState(), G4INCL::DeltaDecayChannel::getFinalState(), G4INCL::PauliStandard::isBlocked(), G4INCL::PauliGlobal::isBlocked(), normVector(), shoot0(), and shoot1().
static G4double G4INCL::Random::shoot0 | ( | ) | [inline, static] |
Return a random number in the ]0,1] interval
Definition at line 102 of file G4INCLRandom.hh.
References shoot().
Referenced by gauss(), and sphereVector().
static G4double G4INCL::Random::shoot1 | ( | ) | [inline, static] |
Return a random number in the [0,1[ interval
Definition at line 112 of file G4INCLRandom.hh.
References shoot().
Referenced by G4INCL::shuffleComponentsHelper().
static ThreeVector G4INCL::Random::sphereVector | ( | G4double | rmax = 1. |
) | [inline, static] |
Generate ThreeVectors that are uniformly distributed in a sphere of radius rmax.
Definition at line 133 of file G4INCLRandom.hh.
References normVector(), G4INCL::Math::pow13(), and shoot0().
00133 { 00134 return normVector( rmax*Math::pow13(shoot0()) ); 00135 }