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 #ifndef RandFlat_h
00029 #define RandFlat_h 1
00030
00031 #include "CLHEP/Random/Random.h"
00032
00037 class RandFlat : public HepRandom {
00038
00039 public:
00040
00041 inline RandFlat ( HepRandomEngine& anEngine );
00042 inline RandFlat ( HepRandomEngine& anEngine, double width );
00043 inline RandFlat ( HepRandomEngine& anEngine, double a, double b );
00044 inline RandFlat ( HepRandomEngine* anEngine );
00045 inline RandFlat ( HepRandomEngine* anEngine, double width );
00046 inline RandFlat ( HepRandomEngine* anEngine, double a, double b );
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 virtual ~RandFlat();
00057
00058
00059
00060
00061 static double shoot();
00062
00063 static inline double shoot( double width );
00064
00065 static inline double shoot( double a, double b );
00066
00067 static inline long shootInt( long n );
00068
00069 static inline long shootInt( long m, long n );
00070
00071 static inline int shootBit();
00072
00073 static void shootArray ( const int size, double* vect );
00074
00075 static void shootArray ( const int size, double* vect,
00076 double lx, double dx );
00077
00078
00079
00080
00081 static inline double shoot ( HepRandomEngine* anEngine );
00082
00083 static inline double shoot( HepRandomEngine* anEngine, double width );
00084
00085 static inline double shoot( HepRandomEngine* anEngine,
00086 double a, double b );
00087 static inline long shootInt( HepRandomEngine* anEngine, long n );
00088
00089 static inline long shootInt( HepRandomEngine* anEngine, long m, long n );
00090
00091 static inline int shootBit( HepRandomEngine* );
00092
00093 static inline void shootArray ( HepRandomEngine* anEngine,
00094 const int size, double* vect );
00095
00096 static void shootArray ( HepRandomEngine* anEngine,
00097 const int size, double* vect,
00098 double lx, double dx );
00099
00100
00101
00102
00103 inline double fire();
00104
00105 inline double fire( double width );
00106
00107 inline double fire( double a, double b );
00108
00109 inline long fireInt( long n );
00110
00111 inline long fireInt( long m, long n );
00112
00113 inline int fireBit();
00114
00115 void fireArray (const int size, double* vect);
00116
00117 void fireArray (const int size, double* vect,
00118 double lx, double dx);
00119
00120 double operator()();
00121 double operator()( double width );
00122 double operator()( double a, double b );
00123
00124
00125
00126
00127
00128
00129 static void saveEngineStatus( const char filename[] = "Config.conf" );
00130
00131
00132 static void restoreEngineStatus( const char filename[] = "Config.conf" );
00133
00134
00135 protected:
00136
00137
00138 RandFlat(const RandFlat& d);
00139
00140 private:
00141
00142
00143
00144
00145
00146 inline void fireBits();
00147 static inline void shootBits();
00148 static inline void shootBits(HepRandomEngine*);
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 static const unsigned long MSB;
00161 static const int MSBBits;
00162
00163
00164 unsigned long randomInt;
00165 unsigned long firstUnusedBit;
00166 static unsigned long staticRandomInt;
00167 static unsigned long staticFirstUnusedBit;
00168
00169 HepRandomEngine* localEngine;
00170 bool deleteEngine;
00171 const double defaultWidth;
00172 const double defaultA;
00173 const double defaultB;
00174
00175 };
00176
00177 #include "CLHEP/Random/RandFlat.icc"
00178
00179 #endif