CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RandomObjects/CLHEP/Random/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 
35 namespace CLHEP {
36 
41 class RandGaussT : public RandGauss {
42 
43 public:
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;
111  HepRandomEngine & engine();
112 
113  static std::string distributionName() {return "RandGaussT";}
114  // Provides the name of this distribution class
115 
116 private:
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
127 using namespace CLHEP;
128 #endif
129 
130 #include "CLHEP/Random/RandGaussT.icc"
131 
132 #endif
CLHEP::RandGaussT::RandGaussT
RandGaussT(HepRandomEngine &anEngine, double mean=0.0, double stdDev=1.0)
CLHEP::RandGaussT::~RandGaussT
virtual ~RandGaussT()
Definition: RandGaussT.cc:25
CLHEP::RandGaussT::engine
HepRandomEngine & engine()
Definition: RandGaussT.cc:23
CLHEP::RandGaussT::shoot
static double shoot()
CLHEP::RandGaussT::put
std::ostream & put(std::ostream &os) const
Definition: RandGaussT.cc:65
RandGauss
How the various random distributions are validated The distributions in for example RandGauss
Definition: validation.doc:4
is
HepRotation and so forth isNear() norm2() rectify() static Rotation row1 row4(To avoid bloat in the code pulled in for programs which don 't use all these features, we split the implementation .cc files. Only isNear() goes into the original Rotation.cc) --------------------------------------- HepAxisAngle and HepEulerAngles classes --------------------------------------- These classes are very useful and simple structures for holding the result of a nice intuituve decomposition of a rotation there is no longer much content in the distinct ZOOM PhysicsVectors library The only content left in the library is the object files representing the various Exception objects When we build the CLHEP classes for the ZOOM we will set up so as to use ZOOM SpaceVector is(but we can disable namespace usage and most of our users do so at this point). What I do is leave Hep3Vector in the global namespace
CLHEP::RandGaussT::fire
double fire()
size
user code seldom needs to call this function directly ZMerrno whether or not they are still recorded ZMerrno size() Return the(integer) number of ZMthrow 'n exceptions currently recorded. 5) ZMerrno.clear() Set an internal counter to zero. This counter is available(see next function) to user code to track ZMthrow 'n exceptions that have occurred during any arbitrary time interval. 6) ZMerrno.countSinceCleared() Return the(integer) number of ZMthrow 'n exceptions that have been recorded via ZMerrno.write()
CLHEP::RandGaussT::fireArray
void fireArray(const int size, double *vect)
Definition: RandGaussT.cc:52
CLHEP
Definition: ClhepVersion.h:13
CLHEP::RandGaussT::name
std::string name() const
Definition: RandGaussT.cc:22
CLHEP::RandGaussT::shootArray
static void shootArray(const int size, double *vect, double mean=0.0, double stdDev=1.0)
Definition: RandGaussT.cc:37
CLHEP::RandGaussT::operator()
virtual double operator()()
Definition: RandGaussT.cc:28
CLHEP::RandGaussT::distributionName
static std::string distributionName()
Definition: RandomObjects/CLHEP/Random/RandGaussT.h:113
CLHEP::RandGaussT::get
std::istream & get(std::istream &is)
Definition: RandGaussT.cc:73