Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
CLHEP::HepRandomEngine Class Referenceabstract

#include <RandomEngine.h>

+ Inheritance diagram for CLHEP::HepRandomEngine:

Public Member Functions

 HepRandomEngine ()
 
virtual ~HepRandomEngine ()
 
bool operator== (const HepRandomEngine &engine)
 
bool operator!= (const HepRandomEngine &engine)
 
virtual double flat ()=0
 
virtual void flatArray (const int size, double *vect)=0
 
virtual void setSeed (long seed, int)=0
 
virtual void setSeeds (const long *seeds, int)=0
 
virtual void saveStatus (const char filename[]="Config.conf") const =0
 
virtual void restoreStatus (const char filename[]="Config.conf")=0
 
virtual void showStatus () const =0
 
virtual std::string name () const =0
 
virtual std::ostream & put (std::ostream &os) const
 
virtual std::istream & get (std::istream &is)
 
virtual std::istream & getState (std::istream &is)
 
virtual std::vector< unsigned long > put () const
 
virtual bool get (const std::vector< unsigned long > &v)
 
virtual bool getState (const std::vector< unsigned long > &v)
 
long getSeed () const
 
const long * getSeeds () const
 
virtual operator double ()
 
virtual operator float ()
 
virtual operator unsigned int ()
 

Static Public Member Functions

static std::string beginTag ()
 
static HepRandomEnginenewEngine (std::istream &is)
 
static HepRandomEnginenewEngine (const std::vector< unsigned long > &v)
 

Static Protected Member Functions

static double exponent_bit_32 ()
 
static double mantissa_bit_12 ()
 
static double mantissa_bit_24 ()
 
static double mantissa_bit_32 ()
 
static double twoToMinus_32 ()
 
static double twoToMinus_48 ()
 
static double twoToMinus_49 ()
 
static double twoToMinus_53 ()
 
static double nearlyTwoToMinus_54 ()
 
static bool checkFile (std::istream &file, const std::string &filename, const std::string &classname, const std::string &methodname)
 

Protected Attributes

long theSeed
 
const long * theSeeds
 

Detailed Description

Constructor & Destructor Documentation

◆ HepRandomEngine()

CLHEP::HepRandomEngine::HepRandomEngine ( )

Definition at line 25 of file RandomEngine.cc.

26: theSeed (19780503L)
28{ }

◆ ~HepRandomEngine()

CLHEP::HepRandomEngine::~HepRandomEngine ( )
virtual

Definition at line 30 of file RandomEngine.cc.

30{}

Member Function Documentation

◆ beginTag()

std::string CLHEP::HepRandomEngine::beginTag ( )
static

Definition at line 66 of file RandomEngine.cc.

66 {
67 return "HepRandomEngine-begin";
68}

◆ checkFile()

bool CLHEP::HepRandomEngine::checkFile ( std::istream &  file,
const std::string &  filename,
const std::string &  classname,
const std::string &  methodname 
)
staticprotected

Definition at line 45 of file RandomEngine.cc.

48 {
49 if (!file) {
50 std::cerr << "Failure to find or open file " << filename <<
51 " in " << classname << "::" << methodname << "()\n";
52 return false;
53 }
54 return true;
55}

Referenced by CLHEP::DualRand::restoreStatus(), CLHEP::HepJamesRandom::restoreStatus(), CLHEP::MTwistEngine::restoreStatus(), CLHEP::RanecuEngine::restoreStatus(), CLHEP::RanluxEngine::restoreStatus(), CLHEP::Ranlux64Engine::restoreStatus(), and CLHEP::RanshiEngine::restoreStatus().

◆ exponent_bit_32()

static double CLHEP::HepRandomEngine::exponent_bit_32 ( )
inlinestaticprotected

◆ flat()

◆ flatArray()

virtual void CLHEP::HepRandomEngine::flatArray ( const int  size,
double *  vect 
)
pure virtual

◆ get() [1/2]

bool CLHEP::HepRandomEngine::get ( const std::vector< unsigned long > &  v)
virtual

Reimplemented in CLHEP::DualRand, CLHEP::HepJamesRandom, CLHEP::MTwistEngine, CLHEP::NonRandomEngine, CLHEP::RanecuEngine, CLHEP::Ranlux64Engine, CLHEP::RanluxEngine, and CLHEP::RanshiEngine.

Definition at line 80 of file RandomEngine.cc.

80 {
81 std::cerr << "HepRandomEngine::get(v) called -- no effect!\n";
82 return false;
83}

◆ get() [2/2]

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

Reimplemented in CLHEP::DualRand, CLHEP::HepJamesRandom, CLHEP::MTwistEngine, CLHEP::NonRandomEngine, CLHEP::RanecuEngine, CLHEP::Ranlux64Engine, CLHEP::RanluxEngine, and CLHEP::RanshiEngine.

Definition at line 61 of file RandomEngine.cc.

61 {
62 std::cerr << "HepRandomEngine::get called -- no effect!\n";
63 return is;
64}

Referenced by CLHEP::HepRandom::engine(), CLHEP::HepRandom::getTheEngine(), and CLHEP::operator>>().

◆ getSeed()

long CLHEP::HepRandomEngine::getSeed ( ) const
inline

Definition at line 113 of file RandomEngine.h.

113{ return theSeed; }

◆ getSeeds()

const long * CLHEP::HepRandomEngine::getSeeds ( ) const
inline

Definition at line 116 of file RandomEngine.h.

116{ return theSeeds; }

◆ getState() [1/2]

bool CLHEP::HepRandomEngine::getState ( const std::vector< unsigned long > &  v)
virtual

Reimplemented in CLHEP::DualRand, CLHEP::HepJamesRandom, CLHEP::MTwistEngine, CLHEP::NonRandomEngine, CLHEP::RanecuEngine, CLHEP::Ranlux64Engine, CLHEP::RanluxEngine, and CLHEP::RanshiEngine.

Definition at line 84 of file RandomEngine.cc.

84 {
85 std::cerr << "HepRandomEngine::getState(v) called -- no effect!\n";
86 return false;
87}

◆ getState() [2/2]

std::istream & CLHEP::HepRandomEngine::getState ( std::istream &  is)
virtual

Reimplemented in CLHEP::DualRand, CLHEP::HepJamesRandom, CLHEP::MTwistEngine, CLHEP::NonRandomEngine, CLHEP::RanecuEngine, CLHEP::Ranlux64Engine, CLHEP::RanluxEngine, and CLHEP::RanshiEngine.

Definition at line 70 of file RandomEngine.cc.

70 {
71 std::cerr << "HepRandomEngine::getState called -- no effect!\n";
72 return is;
73}

◆ mantissa_bit_12()

static double CLHEP::HepRandomEngine::mantissa_bit_12 ( )
inlinestaticprotected

◆ mantissa_bit_24()

◆ mantissa_bit_32()

static double CLHEP::HepRandomEngine::mantissa_bit_32 ( )
inlinestaticprotected

◆ name()

◆ nearlyTwoToMinus_54()

static double CLHEP::HepRandomEngine::nearlyTwoToMinus_54 ( )
inlinestaticprotected

◆ newEngine() [1/2]

HepRandomEngine * CLHEP::HepRandomEngine::newEngine ( const std::vector< unsigned long > &  v)
static

Definition at line 94 of file RandomEngine.cc.

94 {
96}
static HepRandomEngine * newEngine(std::istream &is)

◆ newEngine() [2/2]

HepRandomEngine * CLHEP::HepRandomEngine::newEngine ( std::istream &  is)
static

Definition at line 89 of file RandomEngine.cc.

89 {
90 return EngineFactory::newEngine(is);
91}

Referenced by CLHEP::StaticRandomStates::restore().

◆ operator double()

CLHEP::HepRandomEngine::operator double ( )
virtual

Definition at line 32 of file RandomEngine.cc.

32 {
33 return flat();
34}
virtual double flat()=0

◆ operator float()

CLHEP::HepRandomEngine::operator float ( )
virtual

Reimplemented in CLHEP::DualRand, CLHEP::MTwistEngine, and CLHEP::RanshiEngine.

Definition at line 36 of file RandomEngine.cc.

36 {
37 return float( flat() );
38}

◆ operator unsigned int()

CLHEP::HepRandomEngine::operator unsigned int ( )
virtual

Reimplemented in CLHEP::DualRand, CLHEP::HepJamesRandom, CLHEP::MTwistEngine, CLHEP::RanecuEngine, CLHEP::RanluxEngine, and CLHEP::RanshiEngine.

Definition at line 40 of file RandomEngine.cc.

40 {
41 return (unsigned int)( flat() * exponent_bit_32() );
42}
static double exponent_bit_32()

◆ operator!=()

bool CLHEP::HepRandomEngine::operator!= ( const HepRandomEngine engine)
inline

◆ operator==()

bool CLHEP::HepRandomEngine::operator== ( const HepRandomEngine engine)
inline

◆ put() [1/2]

std::vector< unsigned long > CLHEP::HepRandomEngine::put ( ) const
virtual

Reimplemented in CLHEP::DualRand, CLHEP::HepJamesRandom, CLHEP::MTwistEngine, CLHEP::NonRandomEngine, CLHEP::RanecuEngine, CLHEP::Ranlux64Engine, CLHEP::RanluxEngine, and CLHEP::RanshiEngine.

Definition at line 75 of file RandomEngine.cc.

75 {
76 std::cerr << "v=HepRandomEngine::put() called -- no data!\n";
77 std::vector<unsigned long> v;
78 return v;
79}

◆ put() [2/2]

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

Reimplemented in CLHEP::DualRand, CLHEP::HepJamesRandom, CLHEP::MTwistEngine, CLHEP::NonRandomEngine, CLHEP::RanecuEngine, CLHEP::Ranlux64Engine, CLHEP::RanluxEngine, and CLHEP::RanshiEngine.

Definition at line 57 of file RandomEngine.cc.

57 {
58 std::cerr << "HepRandomEngine::put called -- no effect!\n";
59 return os;
60}

Referenced by CLHEP::operator<<().

◆ restoreStatus()

virtual void CLHEP::HepRandomEngine::restoreStatus ( const char  filename[] = "Config.conf")
pure virtual

◆ saveStatus()

virtual void CLHEP::HepRandomEngine::saveStatus ( const char  filename[] = "Config.conf") const
pure virtual

◆ setSeed()

virtual void CLHEP::HepRandomEngine::setSeed ( long  seed,
int   
)
pure virtual

◆ setSeeds()

virtual void CLHEP::HepRandomEngine::setSeeds ( const long *  seeds,
int   
)
pure virtual

◆ showStatus()

virtual void CLHEP::HepRandomEngine::showStatus ( ) const
pure virtual

◆ twoToMinus_32()

static double CLHEP::HepRandomEngine::twoToMinus_32 ( )
inlinestaticprotected

◆ twoToMinus_48()

static double CLHEP::HepRandomEngine::twoToMinus_48 ( )
inlinestaticprotected

◆ twoToMinus_49()

static double CLHEP::HepRandomEngine::twoToMinus_49 ( )
inlinestaticprotected

◆ twoToMinus_53()

static double CLHEP::HepRandomEngine::twoToMinus_53 ( )
inlinestaticprotected

Member Data Documentation

◆ theSeed

◆ theSeeds


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