CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
RandGaussQ.h
Go to the documentation of this file.
1// $Id: RandGaussQ.h,v 1.5 2010/06/16 17:24:53 garren Exp $
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/defs.h"
24#include "CLHEP/Random/RandGauss.h"
25
26namespace CLHEP {
27
28/**
29 * @author
30 * @ingroup random
31 */
32class RandGaussQ : public RandGauss {
33
34public:
35
36 inline RandGaussQ ( HepRandomEngine& anEngine, double mean=0.0,
37 double stdDev=1.0 );
38 inline RandGaussQ ( HepRandomEngine* anEngine, double mean=0.0,
39 double stdDev=1.0 );
40 // These constructors should be used to instantiate a RandGaussQ
41 // distribution object defining a local engine for it.
42 // The static generator will be skipped using the non-static methods
43 // defined below.
44 // If the engine is passed by pointer the corresponding engine object
45 // will be deleted by the RandGaussQ destructor.
46 // If the engine is passed by reference the corresponding engine object
47 // will not be deleted by the RandGaussQ destructor.
48
49 // Destructor
50 virtual ~RandGaussQ();
51
52 //
53 // Methods to generate Gaussian-distributed random deviates:
54 //
55 // If a fast good engine takes 1 usec, RandGauss::fire() adds 1 usec while
56 // RandGaussQ::fire() adds only .4 usec.
57 //
58
59 // Static methods to shoot random values using the static generator
60
61 static inline double shoot();
62
63 static inline double shoot( double mean, double stdDev );
64
65 static void shootArray ( const int size, double* vect,
66 double mean=0.0, double stdDev=1.0 );
67
68 // Static methods to shoot random values using a given engine
69 // by-passing the static generator.
70
71 static inline double shoot( HepRandomEngine* anotherEngine );
72
73 static inline double shoot( HepRandomEngine* anotherEngine,
74 double mean, double stdDev );
75
76
77 static void shootArray ( HepRandomEngine* anotherEngine,
78 const int size,
79 double* vect, double mean=0.0,
80 double stdDev=1.0 );
81
82 // Instance methods using the localEngine to instead of the static
83 // generator, and the default mean and stdDev established at construction
84
85 inline double fire();
86
87 inline double fire ( double mean, double stdDev );
88
89 void fireArray ( const int size, double* vect);
90 void fireArray ( const int size, double* vect,
91 double mean, double stdDev );
92
93 virtual double operator()();
94 virtual double operator()( double mean, double stdDev );
95
96 // Save and restore to/from streams
97
98 std::ostream & put ( std::ostream & os ) const;
99 std::istream & get ( std::istream & is );
100
101 std::string name() const;
103
104 static std::string distributionName() {return "RandGaussQ";}
105 // Provides the name of this distribution class
106
107
108protected:
109
110 static double transformQuick (double r);
111 static double transformSmall (double r);
112
113private:
114
115 // All the engine info, and the default mean and sigma, are in the RandGauss
116 // base class.
117
118};
119
120} // namespace CLHEP
121
122#ifdef ENABLE_BACKWARDS_COMPATIBILITY
123// backwards compatibility will be enabled ONLY in CLHEP 1.9
124using namespace CLHEP;
125#endif
126
127#include "CLHEP/Random/RandGaussQ.icc"
128
129#endif
static double shoot()
virtual ~RandGaussQ()
Definition: RandGaussQ.cc:26
std::istream & get(std::istream &is)
Definition: RandGaussQ.cc:175
RandGaussQ(HepRandomEngine &anEngine, double mean=0.0, double stdDev=1.0)
static double shoot(HepRandomEngine *anotherEngine, double mean, double stdDev)
static double shoot(HepRandomEngine *anotherEngine)
static std::string distributionName()
Definition: RandGaussQ.h:104
static double transformSmall(double r)
Definition: RandGaussQ.cc:126
std::ostream & put(std::ostream &os) const
Definition: RandGaussQ.cc:167
static void shootArray(const int size, double *vect, double mean=0.0, double stdDev=1.0)
Definition: RandGaussQ.cc:37
static double shoot(double mean, double stdDev)
double fire(double mean, double stdDev)
void fireArray(const int size, double *vect)
Definition: RandGaussQ.cc:52
HepRandomEngine & engine()
Definition: RandGaussQ.cc:24
std::string name() const
Definition: RandGaussQ.cc:23
RandGaussQ(HepRandomEngine *anEngine, double mean=0.0, double stdDev=1.0)
virtual double operator()()
Definition: RandGaussQ.cc:29
static double transformQuick(double r)
Definition: RandGaussQ.cc:93