StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StRandom.hh
1 /***************************************************************************
2  *
3  * $Id: StRandom.hh,v 1.1 2000/03/16 16:29:14 ullrich Exp $
4  *
5  * Author: Thomas Ullrich, Mar 2000
6  ***************************************************************************
7  *
8  * Description: User friendly interface to CLHEP random generators.
9  *
10  ***************************************************************************
11  *
12  * $Log: StRandom.hh,v $
13  * Revision 1.1 2000/03/16 16:29:14 ullrich
14  * Initial Revision
15  *
16  **************************************************************************/
17 #ifndef ST_RANDOM_HH
18 #define ST_RANDOM_HH
19 
20 #include "Randomize.h"
21 
22 class StRandom {
23 public:
24  StRandom();
25  ~StRandom();
26 
27  static void setSeed(long s);
28 
29  static double flat();
30  static double flat(double w);
31  static double flat(double a, double b);
32 
33  static long flatInt(long n);
34  static long flatInt(long m, long n);
35 
36  static double exponential();
37  static double exponential(double mean);
38 
39  static double gauss();
40  static double gauss(double mean, double stdDev);
41 
42  static long poisson(double mean);
43 
44  static double breitWigner(double a=1.0, double b=0.2);
45  static double breitWigner(double a, double b, double c);
46  static double breitWignerM2(double a=1.0, double b=0.2);
47  static double breitWignerM2(double a, double b, double c);
48 
49 private:
50  static RanluxEngine mEngine;
51  static RandFlat mFlat;
52  static RandBreitWigner mBreitWigner;
53  static RandExponential mExponential;
54  static RandGauss mGauss;
55  static RandPoisson mPoisson;
56 };
57 
58 inline void StRandom::setSeed(long s) { mEngine.setSeed(s); }
59 inline double StRandom::flat() { return mFlat.shoot(); }
60 inline double StRandom::flat(double w) { return mFlat.shoot(w); }
61 inline double StRandom::flat(double a, double b) { return mFlat.shoot(a, b); }
62 inline long StRandom::flatInt(long n) { return mFlat.shootInt(n); }
63 inline long StRandom::flatInt(long m, long n) { return mFlat.shootInt(m,n); }
64 inline double StRandom::exponential() { return mExponential.shoot(); }
65 inline double StRandom::exponential(double mean) { return mExponential.shoot(mean); }
66 inline double StRandom::gauss() { return mGauss.shoot(0, 1); }
67 inline double StRandom::gauss(double mean, double stdDev) { return mGauss.shoot(mean, stdDev); }
68 inline long StRandom::poisson(double mean) { return mPoisson.shoot(mean); }
69 inline double StRandom::breitWigner(double a, double b) { return mBreitWigner.shoot(a, b); }
70 inline double StRandom::breitWigner(double a, double b, double c) { return mBreitWigner.shoot(a, b, c); }
71 inline double StRandom::breitWignerM2(double a, double b) { return mBreitWigner.shootM2(a, b); }
72 inline double StRandom::breitWignerM2(double a, double b, double c) { return mBreitWigner.shootM2(a, b, c); }
73 
74 #endif