#include <RandGauss.h>
|
| RandGauss (HepRandomEngine &anEngine, double mean=0.0, double stdDev=1.0) |
|
| RandGauss (HepRandomEngine *anEngine, double mean=0.0, double stdDev=1.0) |
|
virtual | ~RandGauss () |
|
double | fire () |
|
double | fire (double mean, double stdDev) |
|
void | fireArray (const int size, double *vect) |
|
void | fireArray (const int size, double *vect, double mean, double stdDev) |
|
virtual double | operator() () |
|
virtual double | operator() (double mean, double stdDev) |
|
std::string | name () const |
|
HepRandomEngine & | engine () |
|
std::ostream & | put (std::ostream &os) const |
|
std::istream & | get (std::istream &is) |
|
bool | getF () const |
|
void | setF (bool val) |
|
Public Member Functions inherited from CLHEP::HepRandom |
| 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) |
|
|
static double | shoot () |
|
static double | shoot (double mean, double stdDev) |
|
static void | shootArray (const int size, double *vect, double mean=0.0, double stdDev=1.0) |
|
static double | shoot (HepRandomEngine *anEngine) |
|
static double | shoot (HepRandomEngine *anEngine, double mean, double stdDev) |
|
static void | shootArray (HepRandomEngine *anEngine, const int size, double *vect, double mean=0.0, double stdDev=1.0) |
|
static std::string | distributionName () |
|
static bool | getFlag () |
|
static void | setFlag (bool val) |
|
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 Public Member Functions inherited from CLHEP::HepRandom |
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 HepRandom * | getTheGenerator () |
|
static void | setTheEngine (HepRandomEngine *theNewEngine) |
|
static HepRandomEngine * | getTheEngine () |
|
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 () |
|
- Author
Definition at line 42 of file RandGauss.h.
CLHEP::RandGauss::RandGauss |
( |
HepRandomEngine & |
anEngine, |
|
|
double |
mean = 0.0 , |
|
|
double |
stdDev = 1.0 |
|
) |
| |
|
inline |
CLHEP::RandGauss::RandGauss |
( |
HepRandomEngine * |
anEngine, |
|
|
double |
mean = 0.0 , |
|
|
double |
stdDev = 1.0 |
|
) |
| |
|
inline |
CLHEP::RandGauss::~RandGauss |
( |
| ) |
|
|
virtual |
static std::string CLHEP::RandGauss::distributionName |
( |
| ) |
|
|
inlinestatic |
double CLHEP::RandGauss::fire |
( |
| ) |
|
double CLHEP::RandGauss::fire |
( |
double |
mean, |
|
|
double |
stdDev |
|
) |
| |
|
inline |
void CLHEP::RandGauss::fireArray |
( |
const int |
size, |
|
|
double * |
vect |
|
) |
| |
Definition at line 156 of file RandGauss.cc.
158 for(
double* v = vect; v != vect + size; ++v )
void CLHEP::RandGauss::fireArray |
( |
const int |
size, |
|
|
double * |
vect, |
|
|
double |
mean, |
|
|
double |
stdDev |
|
) |
| |
Definition at line 162 of file RandGauss.cc.
165 for(
double* v = vect; v != vect + size; ++v )
166 *v =
fire( mean, stdDev );
std::istream & CLHEP::RandGauss::get |
( |
std::istream & |
is | ) |
|
|
virtual |
Reimplemented from CLHEP::HepRandom.
Reimplemented in CLHEP::RandGaussQ, and CLHEP::RandGaussZiggurat.
Definition at line 275 of file RandGauss.cc.
278 if (inName !=
name()) {
279 is.clear(std::ios::badbit | is.rdstate());
280 std::cerr <<
"Mismatch when expecting to read state of a "
281 <<
name() <<
" distribution\n"
282 <<
"Name found was " << inName
283 <<
"\nistream is left in the badbit state\n";
289 std::vector<unsigned long> t(2);
295 if (ng ==
"nextGauss") {
303 if ( (!is) || (c1 !=
"Mean:") || (c2 !=
"Sigma:") ) {
304 std::cerr <<
"i/o problem while expecting to read state of a "
305 <<
name() <<
" distribution\n"
306 <<
"default mean and/or sigma could not be read\n";
309 is >> c1 >> c2 >> nextGauss;
310 if ( (!is) || (c1 !=
"RANDGAUSS") ) {
311 is.clear(std::ios::badbit | is.rdstate());
312 std::cerr <<
"Failure when reading caching state of RandGauss\n";
315 if (c2 ==
"CACHED_GAUSSIAN:") {
317 }
else if (c2 ==
"NO_CACHED_GAUSSIAN:") {
320 is.clear(std::ios::badbit | is.rdstate());
321 std::cerr <<
"Unexpected caching state keyword of RandGauss:" << c2
322 <<
"\nistream is left in the badbit state\n";
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
static double longs2double(const std::vector< unsigned long > &v)
bool CLHEP::RandGauss::getF |
( |
| ) |
const |
|
inline |
bool CLHEP::RandGauss::getFlag |
( |
| ) |
|
|
static |
double CLHEP::RandGauss::getVal |
( |
| ) |
|
|
staticprotected |
std::string CLHEP::RandGauss::name |
( |
| ) |
const |
|
virtual |
double CLHEP::RandGauss::normal |
( |
| ) |
|
|
protected |
Definition at line 130 of file RandGauss.cc.
141 double v1,v2,
fac,val;
149 fac = std::sqrt(-2.0*std::log(r)/r);
std::shared_ptr< HepRandomEngine > localEngine
static const G4double fac
double CLHEP::RandGauss::operator() |
( |
| ) |
|
|
virtual |
double CLHEP::RandGauss::operator() |
( |
double |
mean, |
|
|
double |
stdDev |
|
) |
| |
|
virtual |
std::ostream & CLHEP::RandGauss::put |
( |
std::ostream & |
os | ) |
const |
|
virtual |
Reimplemented from CLHEP::HepRandom.
Reimplemented in CLHEP::RandGaussQ, and CLHEP::RandGaussZiggurat.
Definition at line 256 of file RandGauss.cc.
257 os <<
name() <<
"\n";
258 int prec = os.precision(20);
259 std::vector<unsigned long> t(2);
262 os <<
defaultMean <<
" " << t[0] <<
" " << t[1] <<
"\n";
267 os <<
"nextGauss " << nextGauss <<
" " << t[0] <<
" " << t[1] <<
"\n";
269 os <<
"no_cached_nextGauss \n";
static std::vector< unsigned long > dto2longs(double d)
std::istream & CLHEP::RandGauss::restoreDistState |
( |
std::istream & |
is | ) |
|
|
static |
Definition at line 344 of file RandGauss.cc.
348 is.clear(std::ios::badbit | is.rdstate());
349 std::cerr <<
"Mismatch when expecting to read static state of a "
351 <<
"Name found was " << inName
352 <<
"\nistream is left in the badbit state\n";
358 std::vector<unsigned long> t(2);
362 if (ng ==
"nextGauss_st") {
363 is >> nextGauss_st >> t[0] >> t[1];
370 is >> c2 >> nextGauss_st;
371 if ( (!is) || (c1 !=
"RANDGAUSS") ) {
372 is.clear(std::ios::badbit | is.rdstate());
373 std::cerr <<
"Failure when reading caching state of static RandGauss\n";
376 if (c2 ==
"CACHED_GAUSSIAN:") {
378 }
else if (c2 ==
"NO_CACHED_GAUSSIAN:") {
381 is.clear(std::ios::badbit | is.rdstate());
382 std::cerr <<
"Unexpected caching state keyword of static RandGauss:" << c2
383 <<
"\nistream is left in the badbit state\n";
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
static std::string distributionName()
static void setFlag(bool val)
static double longs2double(const std::vector< unsigned long > &v)
void CLHEP::RandGauss::restoreEngineStatus |
( |
const char |
filename[] = "Config.conf" | ) |
|
|
static |
Definition at line 209 of file RandGauss.cc.
216 std::ifstream infile ( filename, std::ios::in );
219 char inputword[] =
"NO_KEYWORD ";
223 if (strcmp(inputword,
"RANDGAUSS")==0)
break;
224 if (infile.eof())
break;
232 if (strcmp(inputword,
"RANDGAUSS")==0) {
236 if (strcmp(setword,
"CACHED_GAUSSIAN:") ==0) {
238 std::vector<unsigned long> t(2);
239 infile >> nextGauss_st >> t[0] >> t[1];
246 infile >> nextGauss_st;
static HepRandomEngine * getTheEngine()
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
virtual void restoreStatus(const char filename[]="Config.conf")=0
static void setFlag(bool val)
static double longs2double(const std::vector< unsigned long > &v)
std::istream & CLHEP::RandGauss::restoreFullState |
( |
std::istream & |
is | ) |
|
|
static |
Definition at line 394 of file RandGauss.cc.
static std::istream & restoreDistState(std::istream &is)
static std::istream & restoreFullState(std::istream &is)
std::ostream & CLHEP::RandGauss::saveDistState |
( |
std::ostream & |
os | ) |
|
|
static |
Definition at line 329 of file RandGauss.cc.
330 int prec = os.precision(20);
331 std::vector<unsigned long> t(2);
336 os <<
"nextGauss_st " <<
getVal() <<
" " << t[0] <<
" " << t[1] <<
"\n";
338 os <<
"no_cached_nextGauss_st \n";
static std::string distributionName()
static std::vector< unsigned long > dto2longs(double d)
void CLHEP::RandGauss::saveEngineStatus |
( |
const char |
filename[] = "Config.conf" | ) |
|
|
static |
Definition at line 189 of file RandGauss.cc.
196 std::ofstream outfile ( filename, std::ios::app );
199 std::vector<unsigned long> t(2);
201 outfile <<
"RANDGAUSS CACHED_GAUSSIAN: Uvec "
202 <<
getVal() <<
" " << t[0] <<
" " << t[1] <<
"\n";
204 outfile <<
"RANDGAUSS NO_CACHED_GAUSSIAN: 0 \n" ;
static HepRandomEngine * getTheEngine()
static std::vector< unsigned long > dto2longs(double d)
virtual void saveStatus(const char filename[]="Config.conf") const =0
std::ostream & CLHEP::RandGauss::saveFullState |
( |
std::ostream & |
os | ) |
|
|
static |
Definition at line 388 of file RandGauss.cc.
static std::ostream & saveDistState(std::ostream &os)
static std::ostream & saveFullState(std::ostream &os)
void CLHEP::RandGauss::setF |
( |
bool |
val | ) |
|
|
inline |
void CLHEP::RandGauss::setFlag |
( |
bool |
val | ) |
|
|
static |
void CLHEP::RandGauss::setVal |
( |
double |
nextVal | ) |
|
|
staticprotected |
double CLHEP::RandGauss::shoot |
( |
| ) |
|
|
static |
Definition at line 60 of file RandGauss.cc.
77 v1 = 2.0 * anEngine->flat() - 1.0;
78 v2 = 2.0 * anEngine->flat() - 1.0;
82 fac = std::sqrt(-2.0*std::log(r)/r);
static HepRandomEngine * getTheEngine()
static void setVal(double nextVal)
static const G4double fac
static void setFlag(bool val)
static double CLHEP::RandGauss::shoot |
( |
double |
mean, |
|
|
double |
stdDev |
|
) |
| |
|
inlinestatic |
Definition at line 96 of file RandGauss.cc.
107 double v1,v2,
fac,val;
110 v1 = 2.0 * anEngine->flat() - 1.0;
111 v2 = 2.0 * anEngine->flat() - 1.0;
115 fac = std::sqrt( -2.0*std::log(r)/r);
static void setVal(double nextVal)
static const G4double fac
static void setFlag(bool val)
static double CLHEP::RandGauss::shoot |
( |
HepRandomEngine * |
anEngine, |
|
|
double |
mean, |
|
|
double |
stdDev |
|
) |
| |
|
inlinestatic |
void CLHEP::RandGauss::shootArray |
( |
const int |
size, |
|
|
double * |
vect, |
|
|
double |
mean = 0.0 , |
|
|
double |
stdDev = 1.0 |
|
) |
| |
|
static |
Definition at line 89 of file RandGauss.cc.
92 for(
double* v = vect; v != vect + size; ++v )
93 *v =
shoot(mean,stdDev);
void CLHEP::RandGauss::shootArray |
( |
HepRandomEngine * |
anEngine, |
|
|
const int |
size, |
|
|
double * |
vect, |
|
|
double |
mean = 0.0 , |
|
|
double |
stdDev = 1.0 |
|
) |
| |
|
static |
Definition at line 122 of file RandGauss.cc.
126 for(
double* v = vect; v != vect + size; ++v )
127 *v =
shoot(anEngine,mean,stdDev);
double CLHEP::RandGauss::defaultMean |
|
protected |
double CLHEP::RandGauss::defaultStdDev |
|
protected |
The documentation for this class was generated from the following files:
- geant4.10.03.p01/source/externals/clhep/include/CLHEP/Random/RandGauss.h
- geant4.10.03.p01/source/externals/clhep/src/RandGauss.cc