CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
RandGaussT.h
Go to the documentation of this file.
1// $Id: RandGaussT.h,v 1.5 2010/06/16 17:24:53 garren Exp $
2// -*- C++ -*-
3//
4// -----------------------------------------------------------------------
5// HEP Random
6// --- RandGaussT ---
7// class header file
8// -----------------------------------------------------------------------
9
10// Class defining methods RandGaussT, which is derived from RandGauss.
11// The user interface is identical.
12// RandGaussT ---
13// Always uses exactly one flat random from the engine
14// Is stateless so that saveEngineStatus works even if invoked knowing
15// only that the distribution is a HepRandom. (RandGauss is not stateless.)
16// Is accurate to more than 12 decimal places in all cases, and more so
17// near the end points.
18// Runs about as fast as RandGauss.
19// RandGaussT utilizes HepStat::flatToGaussian(r), so its effective footprint
20// (for the tables used) is almost 30K bytes.
21
22// =======================================================================
23// M. Fischler Created 2/2/00
24// M Fischler - put and get to/from streams 12/10/04
25//
26// =======================================================================
27
28#ifndef RandGaussT_h
29#define RandGaussT_h 1
30
31#include "CLHEP/Random/defs.h"
32#include "CLHEP/Random/RandGauss.h"
33#include "CLHEP/Random/Stat.h"
34
35namespace CLHEP {
36
37/**
38 * @author
39 * @ingroup random
40 */
41class RandGaussT : public RandGauss {
42
43public:
44
45 inline RandGaussT ( HepRandomEngine& anEngine, double mean=0.0,
46 double stdDev=1.0 );
47 inline RandGaussT ( HepRandomEngine* anEngine, double mean=0.0,
48 double stdDev=1.0 );
49 // These constructors should be used to instantiate a RandGaussT
50 // distribution object defining a local engine for it.
51 // The static generator will be skipped using the non-static methods
52 // defined below.
53 // If the engine is passed by pointer the corresponding engine object
54 // will be deleted by the RandGaussT destructor.
55 // If the engine is passed by reference the corresponding engine object
56 // will not be deleted by the RandGaussT destructor.
57
58 // Destructor
59 virtual ~RandGaussT();
60
61 //
62 // Methods to generate Gaussian-distributed random deviates:
63 //
64 // If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec;
65 // RandGaussT::fire() similarly adds 1 usec.
66 //
67
68 // Static methods to shoot random values using the static generator
69
70 static inline double shoot();
71
72 static inline double shoot( double mean, double stdDev );
73
74 static void shootArray ( const int size, double* vect,
75 double mean=0.0, double stdDev=1.0 );
76
77 // Static methods to shoot random values using a given engine
78 // by-passing the static generator.
79
80 static inline double shoot( HepRandomEngine* anotherEngine );
81
82 static inline double shoot( HepRandomEngine* anotherEngine,
83 double mean, double stdDev );
84
85
86 static void shootArray ( HepRandomEngine* anotherEngine,
87 const int size,
88 double* vect, double mean=0.0,
89 double stdDev=1.0 );
90
91 // Instance methods using the localEngine to instead of the static
92 // generator, and the default mean and stdDev established at construction
93
94 inline double fire();
95
96 inline double fire ( double mean, double stdDev );
97
98 void fireArray ( const int size, double* vect);
99 void fireArray ( const int size, double* vect,
100 double mean, double stdDev );
101
102 virtual double operator()();
103 virtual double operator()( double mean, double stdDev );
104
105 // Save and restore to/from streams
106
107 std::ostream & put ( std::ostream & os ) const;
108 std::istream & get ( std::istream & is );
109
110 std::string name() const;
112
113 static std::string distributionName() {return "RandGaussT";}
114 // Provides the name of this distribution class
115
116private:
117
118 // All the engine info, and the default mean and sigma, are in the RandGauss
119 // base class.
120
121};
122
123} // namespace CLHEP
124
125#ifdef ENABLE_BACKWARDS_COMPATIBILITY
126// backwards compatibility will be enabled ONLY in CLHEP 1.9
127using namespace CLHEP;
128#endif
129
130#include "CLHEP/Random/RandGaussT.icc"
131
132#endif
virtual ~RandGaussT()
Definition: RandGaussT.cc:25
static double shoot(HepRandomEngine *anotherEngine, double mean, double stdDev)
RandGaussT(HepRandomEngine *anEngine, double mean=0.0, double stdDev=1.0)
HepRandomEngine & engine()
Definition: RandGaussT.cc:23
static double shoot(HepRandomEngine *anotherEngine)
double fire(double mean, double stdDev)
static double shoot(double mean, double stdDev)
static std::string distributionName()
Definition: RandGaussT.h:113
static void shootArray(const int size, double *vect, double mean=0.0, double stdDev=1.0)
Definition: RandGaussT.cc:37
static double shoot()
std::ostream & put(std::ostream &os) const
Definition: RandGaussT.cc:65
void fireArray(const int size, double *vect)
Definition: RandGaussT.cc:52
RandGaussT(HepRandomEngine &anEngine, double mean=0.0, double stdDev=1.0)
std::istream & get(std::istream &is)
Definition: RandGaussT.cc:73
virtual double operator()()
Definition: RandGaussT.cc:28
std::string name() const
Definition: RandGaussT.cc:22