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

#include <RandExponential.h>

+ Inheritance diagram for CLHEP::RandExponential:

Public Member Functions

 RandExponential (HepRandomEngine &anEngine, double mean=1.0)
 
 RandExponential (HepRandomEngine *anEngine, double mean=1.0)
 
virtual ~RandExponential ()
 
double fire ()
 
double fire (double mean)
 
void fireArray (const int size, double *vect)
 
void fireArray (const int size, double *vect, double mean)
 
double operator() ()
 
double operator() (double mean)
 
std::ostream & put (std::ostream &os) const
 
std::istream & get (std::istream &is)
 
std::string name () const
 
HepRandomEngineengine ()
 
- 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)
 
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 double shoot ()
 
static double shoot (double mean)
 
static void shootArray (const int size, double *vect, double mean=1.0)
 
static double shoot (HepRandomEngine *anEngine)
 
static double shoot (HepRandomEngine *anEngine, double mean)
 
static void shootArray (HepRandomEngine *anEngine, const int size, double *vect, double mean=1.0)
 
static std::string distributionName ()
 
- 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 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 ()
 

Additional Inherited Members

- Static Protected Attributes inherited from CLHEP::HepRandom
static const long seedTable [215][2]
 

Detailed Description

Constructor & Destructor Documentation

◆ RandExponential() [1/2]

CLHEP::RandExponential::RandExponential ( HepRandomEngine anEngine,
double  mean = 1.0 
)
inline

◆ RandExponential() [2/2]

CLHEP::RandExponential::RandExponential ( HepRandomEngine anEngine,
double  mean = 1.0 
)
inline

◆ ~RandExponential()

CLHEP::RandExponential::~RandExponential ( )
virtual

Definition at line 30 of file RandExponential.cc.

30 {
31}

Member Function Documentation

◆ distributionName()

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

Definition at line 93 of file RandExponential.h.

93{return "RandExponential";}

◆ engine()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 28 of file RandExponential.cc.

28{return *localEngine;}

◆ fire() [1/2]

double CLHEP::RandExponential::fire ( )
inline

Referenced by fireArray(), and operator()().

◆ fire() [2/2]

double CLHEP::RandExponential::fire ( double  mean)
inline

◆ fireArray() [1/2]

void CLHEP::RandExponential::fireArray ( const int  size,
double *  vect 
)

Definition at line 63 of file RandExponential.cc.

64{
65 for( double* v = vect; v != vect+size; ++v )
66 *v = fire( defaultMean );
67}

◆ fireArray() [2/2]

void CLHEP::RandExponential::fireArray ( const int  size,
double *  vect,
double  mean 
)

Definition at line 69 of file RandExponential.cc.

71{
72 for( double* v = vect; v != vect+size; ++v )
73 *v = fire( mean );
74}

◆ get()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 87 of file RandExponential.cc.

87 {
88 std::string inName;
89 is >> inName;
90 if (inName != name()) {
91 is.clear(std::ios::badbit | is.rdstate());
92 std::cerr << "Mismatch when expecting to read state of a "
93 << name() << " distribution\n"
94 << "Name found was " << inName
95 << "\nistream is left in the badbit state\n";
96 return is;
97 }
98 if (possibleKeywordInput(is, "Uvec", defaultMean)) {
99 std::vector<unsigned long> t(2);
100 is >> defaultMean >> t[0] >> t[1]; defaultMean = DoubConv::longs2double(t);
101 return is;
102 }
103 // is >> defaultMean encompassed by possibleKeywordInput
104 return is;
105}
static double longs2double(const std::vector< unsigned long > &v)
Definition: DoubConv.cc:114
std::string name() const
bool possibleKeywordInput(IS &is, const std::string &key, T &t)
Definition: RandomEngine.h:167

◆ name()

std::string CLHEP::RandExponential::name ( ) const
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 27 of file RandExponential.cc.

27{return "RandExponential";}

Referenced by get(), and put().

◆ operator()() [1/2]

double CLHEP::RandExponential::operator() ( )
virtual

Reimplemented from CLHEP::HepRandom.

Definition at line 33 of file RandExponential.cc.

33 {
34 return fire( defaultMean );
35}

◆ operator()() [2/2]

double CLHEP::RandExponential::operator() ( double  mean)

Definition at line 37 of file RandExponential.cc.

37 {
38 return fire( mean );
39}

◆ put()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 76 of file RandExponential.cc.

76 {
77 int pr=os.precision(20);
78 std::vector<unsigned long> t(2);
79 os << " " << name() << "\n";
80 os << "Uvec" << "\n";
81 t = DoubConv::dto2longs(defaultMean);
82 os << defaultMean << " " << t[0] << " " << t[1] << "\n";
83 os.precision(pr);
84 return os;
85}
static std::vector< unsigned long > dto2longs(double d)
Definition: DoubConv.cc:98

◆ shoot() [1/4]

double CLHEP::RandExponential::shoot ( )
static

◆ shoot() [2/4]

double CLHEP::RandExponential::shoot ( double  mean)
static

Definition at line 45 of file RandExponential.cc.

45 {
46 return -std::log(HepRandom::getTheEngine()->flat())*mean;
47}

◆ shoot() [3/4]

static double CLHEP::RandExponential::shoot ( HepRandomEngine anEngine)
inlinestatic

◆ shoot() [4/4]

static double CLHEP::RandExponential::shoot ( HepRandomEngine anEngine,
double  mean 
)
inlinestatic

◆ shootArray() [1/2]

void CLHEP::RandExponential::shootArray ( const int  size,
double *  vect,
double  mean = 1.0 
)
static

Definition at line 49 of file RandExponential.cc.

51{
52 for( double* v = vect; v != vect+size; ++v )
53 *v = shoot(mean);
54}

◆ shootArray() [2/2]

void CLHEP::RandExponential::shootArray ( HepRandomEngine anEngine,
const int  size,
double *  vect,
double  mean = 1.0 
)
static

Definition at line 56 of file RandExponential.cc.

58{
59 for( double* v = vect; v != vect+size; ++v )
60 *v = shoot(anEngine, mean);
61}

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