Geant4  10.02.p03
CLHEP::HepRandom Class Reference

#include <Random.h>

Inheritance diagram for CLHEP::HepRandom:
Collaboration diagram for CLHEP::HepRandom:

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

Constructor & Destructor Documentation

◆ HepRandom() [1/4]

CLHEP::HepRandom::HepRandom ( )

Definition at line 76 of file Random.cc.

77 { }

◆ HepRandom() [2/4]

CLHEP::HepRandom::HepRandom ( long  seed)

Definition at line 79 of file Random.cc.

80 {
81  setTheSeed(seed);
82 }
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:132

◆ HepRandom() [3/4]

CLHEP::HepRandom::HepRandom ( HepRandomEngine algorithm)

Definition at line 84 of file Random.cc.

85 {
86  theDefaults().resetEngine( algorithm );
87 }

◆ HepRandom() [4/4]

CLHEP::HepRandom::HepRandom ( HepRandomEngine algorithm)

Definition at line 89 of file Random.cc.

90 {
91  theDefaults().resetEngine( algorithm );
92 }

◆ ~HepRandom()

CLHEP::HepRandom::~HepRandom ( )
virtual

Definition at line 94 of file Random.cc.

95 { }

Member Function Documentation

◆ createInstance()

int CLHEP::HepRandom::createInstance ( )
static

Definition at line 209 of file Random.cc.

210 {
211  return static_cast<int>( theDefaults().ensureInitialized() );
212 }
Here is the caller graph for this function:

◆ distributionName()

static std::string CLHEP::HepRandom::distributionName ( )
inlinestatic

Definition at line 152 of file Random.h.

152 {return "HepRandomEngine";}

◆ engine()

HepRandomEngine & CLHEP::HepRandom::engine ( )
virtual

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

Definition at line 112 of file Random.cc.

112  {
113  std::cerr << "HepRandom::engine() called -- there is no assigned engine!\n";
114  return *theDefaults().theEngine.get();
115 }
Here is the call graph for this function:

◆ flat() [1/2]

double CLHEP::HepRandom::flat ( )

Definition at line 97 of file Random.cc.

98 {
99  return theDefaults().theEngine->flat();
100 }
Here is the caller graph for this function:

◆ flat() [2/2]

double CLHEP::HepRandom::flat ( HepRandomEngine theNewEngine)
inline

◆ flatArray() [1/2]

void CLHEP::HepRandom::flatArray ( const int  size,
double *  vect 
)

Definition at line 102 of file Random.cc.

103 {
104  theDefaults().theEngine->flatArray(size,vect);
105 }

◆ flatArray() [2/2]

void CLHEP::HepRandom::flatArray ( HepRandomEngine theNewEngine,
const int  size,
double *  vect 
)
inline

◆ get()

std::istream & CLHEP::HepRandom::get ( std::istream &  is)
virtual

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

Definition at line 126 of file Random.cc.

126 {return is;}
Here is the caller graph for this function:

◆ getTheEngine()

HepRandomEngine * CLHEP::HepRandom::getTheEngine ( )
static

Definition at line 166 of file Random.cc.

167 {
168  return theDefaults().theEngine.get();
169 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTheGenerator()

HepRandom * CLHEP::HepRandom::getTheGenerator ( )
static

Definition at line 161 of file Random.cc.

162 {
163  return theDefaults().theGenerator.get();
164 }
Here is the call graph for this function:

◆ getTheSeed()

long CLHEP::HepRandom::getTheSeed ( )
static

Definition at line 137 of file Random.cc.

138 {
139  return theDefaults().theEngine->getSeed();
140 }

◆ getTheSeeds()

const long * CLHEP::HepRandom::getTheSeeds ( )
static

Definition at line 147 of file Random.cc.

148 {
149  return theDefaults().theEngine->getSeeds();
150 }

◆ getTheTableSeeds()

void CLHEP::HepRandom::getTheTableSeeds ( long *  seeds,
int  index 
)
static

Definition at line 152 of file Random.cc.

153 {
154  if ((index >= 0) && (index < 215)) {
155  seeds[0] = seedTable[index][0];
156  seeds[1] = seedTable[index][1];
157  }
158  else seeds = NULL;
159 }
Int_t index
static const long seedTable[215][2]
Definition: Random.h:157
Here is the caller graph for this function:

◆ name()

◆ operator()()

double CLHEP::HepRandom::operator() ( )
virtual

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

Definition at line 107 of file Random.cc.

107  {
108  return flat();
109 }
double flat()
Definition: Random.cc:97
Here is the call graph for this function:

◆ put()

std::ostream & CLHEP::HepRandom::put ( std::ostream &  os) const
virtual

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

Definition at line 125 of file Random.cc.

125 {return os;}
Here is the caller graph for this function:

◆ restoreDistState()

static std::istream& CLHEP::HepRandom::restoreDistState ( std::istream &  is)
inlinestatic

Definition at line 137 of file Random.h.

137 {return is;}
Here is the call graph for this function:

◆ restoreEngineStatus()

void CLHEP::HepRandom::restoreEngineStatus ( const char  filename[] = "Config.conf")
static

Definition at line 181 of file Random.cc.

182 {
183  theDefaults().theEngine->restoreStatus( filename );
184 }
Here is the caller graph for this function:

◆ restoreFullState()

std::istream & CLHEP::HepRandom::restoreFullState ( std::istream &  is)
static

Definition at line 191 of file Random.cc.

191  {
192  is >> *getTheEngine();
193  return is;
194 }
static HepRandomEngine * getTheEngine()
Definition: Random.cc:166
Here is the caller graph for this function:

◆ restoreStaticRandomStates()

std::istream & CLHEP::HepRandom::restoreStaticRandomStates ( std::istream &  is)
static

Definition at line 200 of file Random.cc.

200  {
201  return StaticRandomStates::restore(is);
202 }
static std::istream & restore(std::istream &is)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveDistState()

static std::ostream& CLHEP::HepRandom::saveDistState ( std::ostream &  os)
inlinestatic

Definition at line 134 of file Random.h.

134 {return os;}

◆ saveEngineStatus()

void CLHEP::HepRandom::saveEngineStatus ( const char  filename[] = "Config.conf")
static

Definition at line 176 of file Random.cc.

177 {
178  theDefaults().theEngine->saveStatus( filename );
179 }
Here is the caller graph for this function:

◆ saveFullState()

std::ostream & CLHEP::HepRandom::saveFullState ( std::ostream &  os)
static

Definition at line 186 of file Random.cc.

186  {
187  os << *getTheEngine();
188  return os;
189 }
static HepRandomEngine * getTheEngine()
Definition: Random.cc:166
Here is the caller graph for this function:

◆ saveStaticRandomStates()

std::ostream & CLHEP::HepRandom::saveStaticRandomStates ( std::ostream &  os)
static

Definition at line 196 of file Random.cc.

196  {
197  return StaticRandomStates::save(os);
198 }
static std::ostream & save(std::ostream &os)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTheEngine()

void CLHEP::HepRandom::setTheEngine ( HepRandomEngine theNewEngine)
static

Definition at line 171 of file Random.cc.

172 {
173  theDefaults().theEngine.reset( theNewEngine, do_nothing_deleter() );
174 }
Here is the caller graph for this function:

◆ setTheSeed()

void CLHEP::HepRandom::setTheSeed ( long  seed,
int  lux = 3 
)
static

Definition at line 132 of file Random.cc.

133 {
134  theDefaults().theEngine->setSeed(seed,lux);
135 }
static const double lux
Here is the caller graph for this function:

◆ setTheSeeds()

void CLHEP::HepRandom::setTheSeeds ( const long *  seeds,
int  aux = -1 
)
static

Definition at line 142 of file Random.cc.

143 {
144  theDefaults().theEngine->setSeeds(seeds,aux);
145 }
Here is the caller graph for this function:

◆ showEngineStatus()

void CLHEP::HepRandom::showEngineStatus ( )
static

Definition at line 204 of file Random.cc.

205 {
206  theDefaults().theEngine->showStatus();
207 }
Here is the caller graph for this function:

Member Data Documentation

◆ seedTable

const long CLHEP::HepRandom::seedTable
staticprotected

Definition at line 157 of file Random.h.


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