Geant4 10.7.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 33 of file RandExponential.cc.

33 {
34}

Member Function Documentation

◆ distributionName()

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

Definition at line 92 of file RandExponential.h.

92{return "RandExponential";}

◆ engine()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 31 of file RandExponential.cc.

31{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 66 of file RandExponential.cc.

67{
68 for( double* v = vect; v != vect+size; ++v )
69 *v = fire( defaultMean );
70}

◆ fireArray() [2/2]

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

Definition at line 72 of file RandExponential.cc.

74{
75 for( double* v = vect; v != vect+size; ++v )
76 *v = fire( mean );
77}

◆ get()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 90 of file RandExponential.cc.

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

◆ name()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 30 of file RandExponential.cc.

30{return "RandExponential";}

Referenced by get(), and put().

◆ operator()() [1/2]

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

Reimplemented from CLHEP::HepRandom.

Definition at line 36 of file RandExponential.cc.

36 {
37 return fire( defaultMean );
38}

◆ operator()() [2/2]

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

Definition at line 40 of file RandExponential.cc.

40 {
41 return fire( mean );
42}

◆ put()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 79 of file RandExponential.cc.

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

◆ shoot() [1/4]

double CLHEP::RandExponential::shoot ( )
static

Definition at line 44 of file RandExponential.cc.

44 {
45 return -std::log(HepRandom::getTheEngine()->flat());
46}
static HepRandomEngine * getTheEngine()
Definition: Random.cc:268
double flat()
Definition: Random.cc:199

Referenced by shootArray().

◆ shoot() [2/4]

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

Definition at line 48 of file RandExponential.cc.

48 {
49 return -std::log(HepRandom::getTheEngine()->flat())*mean;
50}

◆ 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 52 of file RandExponential.cc.

54{
55 for( double* v = vect; v != vect+size; ++v )
56 *v = shoot(mean);
57}

◆ shootArray() [2/2]

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

Definition at line 59 of file RandExponential.cc.

61{
62 for( double* v = vect; v != vect+size; ++v )
63 *v = shoot(anEngine, mean);
64}

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