All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
util::RandFastGauss Class Reference

Normal distribution focussing on speed. More...

#include <RandFastGauss.h>

Inheritance diagram for util::RandFastGauss:

Public Member Functions

 RandFastGauss (CLHEP::HepRandomEngine &anEngine, double mean=0.0, double stdDev=1.0)
 Constructor: borrows an engine but does not manage it. More...
 
 RandFastGauss (CLHEP::HepRandomEngine *anEngine, double mean=0.0, double stdDev=1.0)
 Constructor: takes ownership of the engine. More...
 
double fire ()
 Extracts a single normal value under the default distribution. More...
 
double fire (double mean, double stdDev)
 Extracts a single normal value under the specified normal distribution. More...
 
void fireArray (const int size, double *vect)
 
void fireArray (const int size, double *vect, double mean, double stdDev)
 
virtual double operator() () override
 Extracts a single normal value under the default distribution. More...
 
double operator() (double mean, double stdDev)
 Extracts a single normal value under the specified normal distribution. More...
 
virtual std::string name () const override
 Returns the name of the distribution. More...
 
virtual CLHEP::HepRandomEngine & engine () override
 Returns the default random generator engine. More...
 
virtual std::ostream & put (std::ostream &os) const override
 
virtual std::istream & get (std::istream &is) override
 

Static Public Member Functions

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 (CLHEP::HepRandomEngine *anEngine)
 
static double shoot (CLHEP::HepRandomEngine *anEngine, double mean, double stdDev)
 
static void shootArray (CLHEP::HepRandomEngine *anEngine, const int size, double *vect, double mean=0.0, double stdDev=1.0)
 
static std::string distributionName ()
 Returns the name of the distribution. More...
 
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)
 

Protected Member Functions

double normal ()
 

Protected Attributes

util::GaussianTransformer< double > fTransform
 
std::shared_ptr
< CLHEP::HepRandomEngine > 
localEngine
 

Private Attributes

util::FastAndPoorGauss< 32768U > fToGauss
 Translates uniform number in [ 0, 1 ] into a Gaussian number. More...
 

Detailed Description

Normal distribution focussing on speed.

The random number is generated via util::FastAndPoorGauss<double>.

Note
This class is incomplete.

Definition at line 32 of file RandFastGauss.h.

Constructor & Destructor Documentation

util::RandFastGauss::RandFastGauss ( CLHEP::HepRandomEngine &  anEngine,
double  mean = 0.0,
double  stdDev = 1.0 
)

Constructor: borrows an engine but does not manage it.

Definition at line 148 of file RandFastGauss.h.

152  : HepRandom()
153  , fTransform(mean, stdDev)
154  , localEngine(&anEngine, [](void const*){})
util::GaussianTransformer< double > fTransform
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
std::shared_ptr< CLHEP::HepRandomEngine > localEngine
util::RandFastGauss::RandFastGauss ( CLHEP::HepRandomEngine *  anEngine,
double  mean = 0.0,
double  stdDev = 1.0 
)

Constructor: takes ownership of the engine.

The ownership of the specified engine is transferred to this object, which will dispose of it at the end of its life.

Member Function Documentation

static std::string util::RandFastGauss::distributionName ( )
inlinestatic

Returns the name of the distribution.

Definition at line 95 of file RandFastGauss.h.

95 { return "RandFastGauss"; }
virtual CLHEP::HepRandomEngine& util::RandFastGauss::engine ( )
inlineoverridevirtual

Returns the default random generator engine.

Definition at line 92 of file RandFastGauss.h.

92 { return *localEngine; }
std::shared_ptr< CLHEP::HepRandomEngine > localEngine
double util::RandFastGauss::fire ( )
inline

Extracts a single normal value under the default distribution.

Definition at line 72 of file RandFastGauss.h.

72 { return fTransform(normal()); }
util::GaussianTransformer< double > fTransform
double util::RandFastGauss::fire ( double  mean,
double  stdDev 
)
inline

Extracts a single normal value under the specified normal distribution.

Definition at line 75 of file RandFastGauss.h.

75 { return normal() * stdDev + mean; }
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
void util::RandFastGauss::fireArray ( const int  size,
double *  vect 
)
void util::RandFastGauss::fireArray ( const int  size,
double *  vect,
double  mean,
double  stdDev 
)
virtual std::istream& util::RandFastGauss::get ( std::istream &  is)
inlineoverridevirtual

Definition at line 100 of file RandFastGauss.h.

101  { return is; }
virtual std::string util::RandFastGauss::name ( ) const
inlineoverridevirtual

Returns the name of the distribution.

Definition at line 89 of file RandFastGauss.h.

89 { return distributionName(); }
static std::string distributionName()
Returns the name of the distribution.
Definition: RandFastGauss.h:95
double util::RandFastGauss::normal ( )
inlineprotected

Definition at line 134 of file RandFastGauss.h.

134 { return fToGauss(localEngine->flat()); }
util::FastAndPoorGauss< 32768U > fToGauss
Translates uniform number in [ 0, 1 ] into a Gaussian number.
std::shared_ptr< CLHEP::HepRandomEngine > localEngine
virtual double util::RandFastGauss::operator() ( )
inlineoverridevirtual

Extracts a single normal value under the default distribution.

Definition at line 83 of file RandFastGauss.h.

83 { return fire(); }
double fire()
Extracts a single normal value under the default distribution.
Definition: RandFastGauss.h:72
double util::RandFastGauss::operator() ( double  mean,
double  stdDev 
)
inline

Extracts a single normal value under the specified normal distribution.

Definition at line 86 of file RandFastGauss.h.

86 { return fire(mean, stdDev); }
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
double fire()
Extracts a single normal value under the default distribution.
Definition: RandFastGauss.h:72
virtual std::ostream& util::RandFastGauss::put ( std::ostream &  os) const
inlineoverridevirtual

Definition at line 98 of file RandFastGauss.h.

99  { return os; }
static std::istream& util::RandFastGauss::restoreDistState ( std::istream &  is)
static
static void util::RandFastGauss::restoreEngineStatus ( const char  filename[] = "Config.conf")
static
static std::istream& util::RandFastGauss::restoreFullState ( std::istream &  is)
static
static std::ostream& util::RandFastGauss::saveDistState ( std::ostream &  os)
static
static void util::RandFastGauss::saveEngineStatus ( const char  filename[] = "Config.conf")
static
static std::ostream& util::RandFastGauss::saveFullState ( std::ostream &  os)
static
static double util::RandFastGauss::shoot ( )
static
static double util::RandFastGauss::shoot ( double  mean,
double  stdDev 
)
static
static double util::RandFastGauss::shoot ( CLHEP::HepRandomEngine *  anEngine)
static
static double util::RandFastGauss::shoot ( CLHEP::HepRandomEngine *  anEngine,
double  mean,
double  stdDev 
)
static
static void util::RandFastGauss::shootArray ( const int  size,
double *  vect,
double  mean = 0.0,
double  stdDev = 1.0 
)
static
static void util::RandFastGauss::shootArray ( CLHEP::HepRandomEngine *  anEngine,
const int  size,
double *  vect,
double  mean = 0.0,
double  stdDev = 1.0 
)
static

Member Data Documentation

util::FastAndPoorGauss<32768U> util::RandFastGauss::fToGauss
private

Translates uniform number in [ 0, 1 ] into a Gaussian number.

Definition at line 139 of file RandFastGauss.h.

util::GaussianTransformer<double> util::RandFastGauss::fTransform
protected

Definition at line 130 of file RandFastGauss.h.

std::shared_ptr<CLHEP::HepRandomEngine> util::RandFastGauss::localEngine
protected

Definition at line 132 of file RandFastGauss.h.


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