Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RandGaussQ.h
Go to the documentation of this file.
1 // $Id:$
2 // -*- C++ -*-
3 //
4 // -----------------------------------------------------------------------
5 // HEP Random
6 // --- RandGaussQ ---
7 // class header file
8 // -----------------------------------------------------------------------
9 
10 // Class defining methods RandGaussQ, which is derived from RandGauss.
11 // The user interface is identical; but RandGaussQ is faster and a bit less
12 // accurate.
13 
14 // =======================================================================
15 // M. Fischler - Created: 24th Jan 2000
16 // M Fischler - put and get to/from streams 12/10/04
17 //
18 // =======================================================================
19 
20 #ifndef RandGaussQ_h
21 #define RandGaussQ_h 1
22 
23 #include "CLHEP/Random/RandGauss.h"
24 
25 namespace CLHEP {
26 
27 /**
28  * @author
29  * @ingroup random
30  */
31 class RandGaussQ : public RandGauss {
32 
33 public:
34 
35  inline RandGaussQ ( HepRandomEngine& anEngine, double mean=0.0,
36  double stdDev=1.0 );
37  inline RandGaussQ ( HepRandomEngine* anEngine, double mean=0.0,
38  double stdDev=1.0 );
39  // These constructors should be used to instantiate a RandGaussQ
40  // distribution object defining a local engine for it.
41  // The static generator will be skipped using the non-static methods
42  // defined below.
43  // If the engine is passed by pointer the corresponding engine object
44  // will be deleted by the RandGaussQ destructor.
45  // If the engine is passed by reference the corresponding engine object
46  // will not be deleted by the RandGaussQ destructor.
47 
48  // Destructor
49  virtual ~RandGaussQ();
50 
51  //
52  // Methods to generate Gaussian-distributed random deviates:
53  //
54  // If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec while
55  // RandGaussQ::fire() adds only .4 usec.
56  //
57 
58  // Static methods to shoot random values using the static generator
59 
60  static inline double shoot();
61 
62  static inline double shoot( double mean, double stdDev );
63 
64  static void shootArray ( const int size, double* vect,
65  double mean=0.0, double stdDev=1.0 );
66 
67  // Static methods to shoot random values using a given engine
68  // by-passing the static generator.
69 
70  static inline double shoot( HepRandomEngine* anotherEngine );
71 
72  static inline double shoot( HepRandomEngine* anotherEngine,
73  double mean, double stdDev );
74 
75 
76  static void shootArray ( HepRandomEngine* anotherEngine,
77  const int size,
78  double* vect, double mean=0.0,
79  double stdDev=1.0 );
80 
81  // Instance methods using the localEngine to instead of the static
82  // generator, and the default mean and stdDev established at construction
83 
84  inline double fire();
85 
86  inline double fire ( double mean, double stdDev );
87 
88  void fireArray ( const int size, double* vect);
89  void fireArray ( const int size, double* vect,
90  double mean, double stdDev );
91 
92  virtual double operator()();
93  virtual double operator()( double mean, double stdDev );
94 
95  // Save and restore to/from streams
96 
97  std::ostream & put ( std::ostream & os ) const;
98  std::istream & get ( std::istream & is );
99 
100  std::string name() const;
102 
103  static std::string distributionName() {return "RandGaussQ";}
104  // Provides the name of this distribution class
105 
106 
107 protected:
108 
109  static double transformQuick (double r);
110  static double transformSmall (double r);
111 
112 private:
113 
114  // All the engine info, and the default mean and sigma, are in the RandGauss
115  // base class.
116 
117 };
118 
119 } // namespace CLHEP
120 
121 #include "CLHEP/Random/RandGaussQ.icc"
122 
123 #endif
std::string name() const
Definition: RandGaussQ.cc:22
virtual ~RandGaussQ()
Definition: RandGaussQ.cc:25
static double shoot()
static double transformSmall(double r)
Definition: RandGaussQ.cc:125
static double transformQuick(double r)
Definition: RandGaussQ.cc:92
RandGaussQ(HepRandomEngine &anEngine, double mean=0.0, double stdDev=1.0)
static std::string distributionName()
Definition: RandGaussQ.h:103
HepRandomEngine & engine()
Definition: RandGaussQ.cc:23
std::ostream & put(std::ostream &os) const
Definition: RandGaussQ.cc:166
static void shootArray(const int size, double *vect, double mean=0.0, double stdDev=1.0)
Definition: RandGaussQ.cc:36
virtual double operator()()
Definition: RandGaussQ.cc:28
void fireArray(const int size, double *vect)
Definition: RandGaussQ.cc:51