Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Static Protected Attributes
CLHEP::HepRandom Class Reference

#include <Random.h>

Inheritance diagram for CLHEP::HepRandom:
CLHEP::RandBinomial CLHEP::RandBreitWigner CLHEP::RandChiSquare CLHEP::RandExponential CLHEP::RandExpZiggurat CLHEP::RandFlat CLHEP::RandGamma CLHEP::RandGauss CLHEP::RandGeneral CLHEP::RandLandau CLHEP::RandPoisson CLHEP::RandStudentT

Public Member Functions

 HepRandom ()
 
 HepRandom (long seed)
 
 HepRandom (HepRandomEngine &algorithm)
 
 HepRandom (HepRandomEngine *algorithm)
 
virtual ~HepRandom ()
 
double flat ()
 
void flatArray (const int size, double *vect)
 
double flat (HepRandomEngine *theNewEngine)
 
void flatArray (HepRandomEngine *theNewEngine, const int size, double *vect)
 
virtual double operator() ()
 
virtual std::string name () const
 
virtual HepRandomEngineengine ()
 
virtual std::ostream & put (std::ostream &os) const
 
virtual std::istream & get (std::istream &is)
 

Static Public Member Functions

static void setTheSeed (long seed, int lux=3)
 
static long getTheSeed ()
 
static void setTheSeeds (const long *seeds, int aux=-1)
 
static const long * getTheSeeds ()
 
static void getTheTableSeeds (long *seeds, int index)
 
static HepRandomgetTheGenerator ()
 
static void setTheEngine (HepRandomEngine *theNewEngine)
 
static HepRandomEnginegetTheEngine ()
 
static void saveEngineStatus (const char filename[]="Config.conf")
 
static void restoreEngineStatus (const char filename[]="Config.conf")
 
static std::ostream & saveFullState (std::ostream &os)
 
static std::istream & restoreFullState (std::istream &is)
 
static std::ostream & saveDistState (std::ostream &os)
 
static std::istream & restoreDistState (std::istream &is)
 
static std::ostream & saveStaticRandomStates (std::ostream &os)
 
static std::istream & restoreStaticRandomStates (std::istream &is)
 
static void showEngineStatus ()
 
static int createInstance ()
 
static std::string distributionName ()
 

Static Protected Attributes

static const long seedTable [215][2]
 

Detailed Description

Author
Gabri.nosp@m.ele..nosp@m.Cosmo.nosp@m.@cer.nosp@m.n.ch

Definition at line 49 of file Random.h.

Constructor & Destructor Documentation

CLHEP::HepRandom::HepRandom ( )

Definition at line 75 of file Random.cc.

76 { }
CLHEP::HepRandom::HepRandom ( long  seed)

Definition at line 78 of file Random.cc.

References setTheSeed().

79 {
80  setTheSeed(seed);
81 }
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:131
CLHEP::HepRandom::HepRandom ( HepRandomEngine algorithm)

Definition at line 83 of file Random.cc.

84 {
85  theDefaults().resetEngine( algorithm );
86 }
CLHEP::HepRandom::HepRandom ( HepRandomEngine algorithm)

Definition at line 88 of file Random.cc.

89 {
90  theDefaults().resetEngine( algorithm );
91 }
CLHEP::HepRandom::~HepRandom ( )
virtual

Definition at line 93 of file Random.cc.

94 { }

Member Function Documentation

int CLHEP::HepRandom::createInstance ( )
static

Definition at line 208 of file Random.cc.

209 {
210  return static_cast<int>( theDefaults().ensureInitialized() );
211 }
static std::string CLHEP::HepRandom::distributionName ( )
inlinestatic

Definition at line 152 of file Random.h.

152 {return "HepRandomEngine";}
HepRandomEngine & CLHEP::HepRandom::engine ( )
virtual

Reimplemented in CLHEP::RandFlat, CLHEP::RandBreitWigner, CLHEP::RandGeneral, CLHEP::RandExpZiggurat, CLHEP::RandGaussQ, CLHEP::RandPoissonQ, CLHEP::RandStudentT, CLHEP::RandBinomial, CLHEP::RandGamma, CLHEP::RandGauss, CLHEP::RandLandau, CLHEP::RandChiSquare, CLHEP::RandExponential, CLHEP::RandPoisson, and CLHEP::RandGaussZiggurat.

Definition at line 111 of file Random.cc.

References CLHEP::HepRandomEngine::get().

111  {
112  std::cerr << "HepRandom::engine() called -- there is no assigned engine!\n";
113  return *theDefaults().theEngine.get();
114 }
double CLHEP::HepRandom::flat ( )

Definition at line 96 of file Random.cc.

Referenced by operator()(), and CLHEP::RandExponential::shoot().

97 {
98  return theDefaults().theEngine->flat();
99 }
double CLHEP::HepRandom::flat ( HepRandomEngine theNewEngine)
inline
void CLHEP::HepRandom::flatArray ( const int  size,
double *  vect 
)

Definition at line 101 of file Random.cc.

102 {
103  theDefaults().theEngine->flatArray(size,vect);
104 }
void CLHEP::HepRandom::flatArray ( HepRandomEngine theNewEngine,
const int  size,
double *  vect 
)
inline
std::istream & CLHEP::HepRandom::get ( std::istream &  is)
virtual
HepRandomEngine * CLHEP::HepRandom::getTheEngine ( )
static
HepRandom * CLHEP::HepRandom::getTheGenerator ( )
static

Definition at line 160 of file Random.cc.

References get().

161 {
162  return theDefaults().theGenerator.get();
163 }
long CLHEP::HepRandom::getTheSeed ( )
static

Definition at line 136 of file Random.cc.

Referenced by G4MPImanager::ShowSeeds().

137 {
138  return theDefaults().theEngine->getSeed();
139 }
const long * CLHEP::HepRandom::getTheSeeds ( )
static

Definition at line 146 of file Random.cc.

Referenced by DMXPrimaryGeneratorAction::GeneratePrimaries().

147 {
148  return theDefaults().theEngine->getSeeds();
149 }
void CLHEP::HepRandom::getTheTableSeeds ( long *  seeds,
int  index 
)
static

Definition at line 151 of file Random.cc.

References seedTable.

Referenced by CLHEP::HepJamesRandom::HepJamesRandom(), CLHEP::MTwistEngine::MTwistEngine(), CLHEP::RanecuEngine::RanecuEngine(), CLHEP::Ranlux64Engine::Ranlux64Engine(), CLHEP::RanluxEngine::RanluxEngine(), and CLHEP::RanecuEngine::setSeed().

152 {
153  if ((index >= 0) && (index < 215)) {
154  seeds[0] = seedTable[index][0];
155  seeds[1] = seedTable[index][1];
156  }
157  else seeds = NULL;
158 }
static const long seedTable[215][2]
Definition: Random.h:157
std::string CLHEP::HepRandom::name ( ) const
virtual
double CLHEP::HepRandom::operator() ( )
virtual
std::ostream & CLHEP::HepRandom::put ( std::ostream &  os) const
virtual
static std::istream& CLHEP::HepRandom::restoreDistState ( std::istream &  is)
inlinestatic

Definition at line 137 of file Random.h.

137 {return is;}
void CLHEP::HepRandom::restoreEngineStatus ( const char  filename[] = "Config.conf")
static

Definition at line 180 of file Random.cc.

Referenced by ExG4RunAction01::BeginOfRunAction(), and Em10RunMessenger::SetNewValue().

181 {
182  theDefaults().theEngine->restoreStatus( filename );
183 }
std::istream & CLHEP::HepRandom::restoreFullState ( std::istream &  is)
static

Definition at line 190 of file Random.cc.

References getTheEngine().

Referenced by CLHEP::RandGauss::restoreFullState(), and CLHEP::RandFlat::restoreFullState().

190  {
191  is >> *getTheEngine();
192  return is;
193 }
static HepRandomEngine * getTheEngine()
Definition: Random.cc:165
std::istream & CLHEP::HepRandom::restoreStaticRandomStates ( std::istream &  is)
static

Definition at line 199 of file Random.cc.

References CLHEP::StaticRandomStates::restore().

199  {
200  return StaticRandomStates::restore(is);
201 }
static std::istream & restore(std::istream &is)
static std::ostream& CLHEP::HepRandom::saveDistState ( std::ostream &  os)
inlinestatic

Definition at line 134 of file Random.h.

134 {return os;}
void CLHEP::HepRandom::saveEngineStatus ( const char  filename[] = "Config.conf")
static
std::ostream & CLHEP::HepRandom::saveFullState ( std::ostream &  os)
static

Definition at line 185 of file Random.cc.

References getTheEngine().

Referenced by G4EventManager::ProcessOneEvent(), CLHEP::RandGauss::saveFullState(), and CLHEP::RandFlat::saveFullState().

185  {
186  os << *getTheEngine();
187  return os;
188 }
static HepRandomEngine * getTheEngine()
Definition: Random.cc:165
std::ostream & CLHEP::HepRandom::saveStaticRandomStates ( std::ostream &  os)
static

Definition at line 195 of file Random.cc.

References CLHEP::StaticRandomStates::save().

195  {
196  return StaticRandomStates::save(os);
197 }
static std::ostream & save(std::ostream &os)
void CLHEP::HepRandom::setTheEngine ( HepRandomEngine theNewEngine)
static

Definition at line 170 of file Random.cc.

Referenced by main(), CLHEP::StaticRandomStates::restore(), and XrayFluoSimulation::RunSimulation().

171 {
172  theDefaults().theEngine.reset( theNewEngine, do_nothing_deleter() );
173 }
void CLHEP::HepRandom::setTheSeed ( long  seed,
int  lux = 3 
)
static

Definition at line 131 of file Random.cc.

Referenced by G4MPImanager::DistributeSeeds(), HepRandom(), main(), XrayFluoSimulation::RunSimulation(), and G4MPImanager::SetSeed().

132 {
133  theDefaults().theEngine->setSeed(seed,lux);
134 }
void CLHEP::HepRandom::setTheSeeds ( const long *  seeds,
int  aux = -1 
)
static

Definition at line 141 of file Random.cc.

Referenced by ExG4RunAction01::BeginOfRunAction(), main(), and G4RunMessenger::SetNewValue().

142 {
143  theDefaults().theEngine->setSeeds(seeds,aux);
144 }
void CLHEP::HepRandom::showEngineStatus ( )
static

Field Documentation

const long CLHEP::HepRandom::seedTable
staticprotected

Definition at line 157 of file Random.h.

Referenced by getTheTableSeeds().


The documentation for this class was generated from the following files: