00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef RandGauss_h
00037 #define RandGauss_h 1
00038
00039 #include "Random.h"
00040
00041 class RandGauss : public HepRandom {
00042
00043 public:
00044
00045 inline RandGauss ( HepRandomEngine& anEngine );
00046 inline RandGauss ( HepRandomEngine* anEngine );
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 virtual ~RandGauss();
00057
00058
00059
00060
00061 static HepDouble shoot();
00062
00063 static inline HepDouble shoot( HepDouble mean, HepDouble stdDev );
00064
00065 static void shootArray ( const HepInt size, HepDouble* vect,
00066 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00067 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00068 static void shootArray ( vector<HepDouble>&,
00069 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00070 #else
00071 static void shootArray ( vector<HepDouble, allocator<HepDouble> >&,
00072 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00073 #endif
00074
00075
00076
00077 static HepDouble shoot( HepRandomEngine* anEngine );
00078
00079 static inline HepDouble shoot( HepRandomEngine* anEngine,
00080 HepDouble mean, HepDouble stdDev );
00081
00082 static void shootArray ( HepRandomEngine* anEngine, const HepInt size,
00083 HepDouble* vect, HepDouble mean=0.0,
00084 HepDouble stdDev=1.0 );
00085 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00086 static void shootArray ( HepRandomEngine*,
00087 vector<HepDouble>&,
00088 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00089 #else
00090 static void shootArray ( HepRandomEngine*,
00091 vector<HepDouble, allocator<HepDouble> >&,
00092 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00093 #endif
00094
00095
00096
00097 HepDouble fire();
00098
00099 inline HepDouble fire( HepDouble mean, HepDouble stdDev );
00100
00101 void fireArray ( const HepInt size, HepDouble* vect,
00102 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00103 #ifndef ST_NO_TEMPLATE_DEF_ARGS
00104 void fireArray ( vector<HepDouble>&,
00105 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00106 #else
00107 void fireArray ( vector<HepDouble, allocator<HepDouble> >&,
00108 HepDouble mean=0.0, HepDouble stdDev=1.0 );
00109 #endif
00110 HepDouble operator()();
00111
00112 protected:
00113
00114 static HepBoolean getFlag() {return HepRandom::getTheGenerator()->getFlag();}
00115
00116 static void setFlag( HepBoolean val ){HepRandom::getTheGenerator()->setFlag(val);}
00117
00118 static HepDouble getVal() {return HepRandom::getTheGenerator()->getVal();}
00119
00120 static void setVal( HepDouble nextVal ){HepRandom::getTheGenerator()->setVal(nextVal);}
00121
00122 private:
00123
00124 HepRandomEngine* localEngine;
00125 HepBoolean deleteEngine, set;
00126 HepDouble nextGauss;
00127
00128 };
00129
00130
00131
00132
00133
00134 inline RandGauss::RandGauss(HepRandomEngine & anEngine)
00135 : localEngine(&anEngine), deleteEngine(false), set(false),
00136 nextGauss(0.0) {}
00137
00138 inline RandGauss::RandGauss(HepRandomEngine * anEngine)
00139 : localEngine(anEngine), deleteEngine(true), set(false),
00140 nextGauss(0.0) {}
00141
00142 inline HepDouble RandGauss::shoot(HepDouble mean, HepDouble stdDev) {
00143 return shoot()*stdDev + mean;
00144 }
00145
00146 inline HepDouble RandGauss::shoot(HepRandomEngine* anEngine,
00147 HepDouble mean, HepDouble stdDev) {
00148 return shoot(anEngine)*stdDev + mean;
00149 }
00150
00151 inline HepDouble RandGauss::fire(HepDouble mean, HepDouble stdDev) {
00152 return fire()*stdDev + mean;
00153 }
00154
00155 #endif