CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
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 lxr=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 35 of file RandExponential.cc.

35 {
36}

Member Function Documentation

◆ distributionName()

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

Definition at line 94 of file RandExponential.h.

94{return "RandExponential";}

◆ engine()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 33 of file RandExponential.cc.

33{return *localEngine;}

◆ fire() [1/2]

double CLHEP::RandExponential::fire ( )
inline

Referenced by dist_layout(), 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 68 of file RandExponential.cc.

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

◆ fireArray() [2/2]

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

Definition at line 74 of file RandExponential.cc.

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

◆ get()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 99 of file RandExponential.cc.

99 {
100 std::string inName;
101 is >> inName;
102 if (inName != name()) {
103 is.clear(std::ios::badbit | is.rdstate());
104 std::cerr << "Mismatch when expecting to read state of a "
105 << name() << " distribution\n"
106 << "Name found was " << inName
107 << "\nistream is left in the badbit state\n";
108 return is;
109 }
110 if (possibleKeywordInput(is, "Uvec", defaultMean)) {
111 std::vector<unsigned long> t(2);
112 is >> defaultMean >> t[0] >> t[1]; defaultMean = DoubConv::longs2double(t);
113 return is;
114 }
115 // is >> defaultMean encompassed by possibleKeywordInput
116 return is;
117}
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:168

◆ name()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 32 of file RandExponential.cc.

32{return "RandExponential";}

Referenced by get(), and put().

◆ operator()() [1/2]

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

Reimplemented from CLHEP::HepRandom.

Definition at line 38 of file RandExponential.cc.

38 {
39 return fire( defaultMean );
40}

◆ operator()() [2/2]

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

Definition at line 42 of file RandExponential.cc.

42 {
43 return fire( mean );
44}

◆ put()

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

Reimplemented from CLHEP::HepRandom.

Definition at line 81 of file RandExponential.cc.

81 {
82 long pr=os.precision(20);
83 std::vector<unsigned long> t(2);
84 os << " " << name() << "\n";
85 os << "Uvec" << "\n";
86 t = DoubConv::dto2longs(defaultMean);
87 os << defaultMean << " " << t[0] << " " << t[1] << "\n";
88 os.precision(pr);
89 return os;
90#ifdef REMOVED
91 long pr=os.precision(20);
92 os << " " << name() << "\n";
93 os << defaultMean << "\n";
94 os.precision(pr);
95 return os;
96#endif
97}
static std::vector< unsigned long > dto2longs(double d)
Definition: DoubConv.cc:94

◆ shoot() [1/4]

double CLHEP::RandExponential::shoot ( )
static

Definition at line 46 of file RandExponential.cc.

46 {
47 return -std::log(HepRandom::getTheEngine()->flat());
48}
static HepRandomEngine * getTheEngine()
Definition: Random.cc:270
double flat()
Definition: Random.cc:201

Referenced by captureStatics(), layout(), main(), randomizeStatics(), shootArray(), and user_layout().

◆ shoot() [2/4]

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

Definition at line 50 of file RandExponential.cc.

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

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

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

◆ shootArray() [2/2]

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

Definition at line 61 of file RandExponential.cc.

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

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