00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef ST_RANDOM_HH
00018 #define ST_RANDOM_HH
00019
00020 #include "Randomize.h"
00021
00022 class StRandom {
00023 public:
00024 StRandom();
00025 ~StRandom();
00026
00027 static void setSeed(long s);
00028
00029 static double flat();
00030 static double flat(double w);
00031 static double flat(double a, double b);
00032
00033 static long flatInt(long n);
00034 static long flatInt(long m, long n);
00035
00036 static double exponential();
00037 static double exponential(double mean);
00038
00039 static double gauss();
00040 static double gauss(double mean, double stdDev);
00041
00042 static long poisson(double mean);
00043
00044 static double breitWigner(double a=1.0, double b=0.2);
00045 static double breitWigner(double a, double b, double c);
00046 static double breitWignerM2(double a=1.0, double b=0.2);
00047 static double breitWignerM2(double a, double b, double c);
00048
00049 private:
00050 static RanluxEngine mEngine;
00051 static RandFlat mFlat;
00052 static RandBreitWigner mBreitWigner;
00053 static RandExponential mExponential;
00054 static RandGauss mGauss;
00055 static RandPoisson mPoisson;
00056 };
00057
00058 inline void StRandom::setSeed(long s) { mEngine.setSeed(s); }
00059 inline double StRandom::flat() { return mFlat.shoot(); }
00060 inline double StRandom::flat(double w) { return mFlat.shoot(w); }
00061 inline double StRandom::flat(double a, double b) { return mFlat.shoot(a, b); }
00062 inline long StRandom::flatInt(long n) { return mFlat.shootInt(n); }
00063 inline long StRandom::flatInt(long m, long n) { return mFlat.shootInt(m,n); }
00064 inline double StRandom::exponential() { return mExponential.shoot(); }
00065 inline double StRandom::exponential(double mean) { return mExponential.shoot(mean); }
00066 inline double StRandom::gauss() { return mGauss.shoot(0, 1); }
00067 inline double StRandom::gauss(double mean, double stdDev) { return mGauss.shoot(mean, stdDev); }
00068 inline long StRandom::poisson(double mean) { return mPoisson.shoot(mean); }
00069 inline double StRandom::breitWigner(double a, double b) { return mBreitWigner.shoot(a, b); }
00070 inline double StRandom::breitWigner(double a, double b, double c) { return mBreitWigner.shoot(a, b, c); }
00071 inline double StRandom::breitWignerM2(double a, double b) { return mBreitWigner.shootM2(a, b); }
00072 inline double StRandom::breitWignerM2(double a, double b, double c) { return mBreitWigner.shootM2(a, b, c); }
00073
00074 #endif