4#include "CLHEP/Units/GlobalPhysicalConstants.h"
5#include "CLHEP/Random/Randomize.h"
32 cout <<
"r=" << r() << endl;
35 cout <<
"---------------------------- Random shooting test -----------------------------" << endl;
36 cout <<
" -------------------- " << endl;
37 cout <<
" >>> Random Engines available <<<" << endl << endl;
38 cout <<
" > HepJamesRandom (default)" << endl;
39 cout <<
" > Rand" << endl;
40 cout <<
" > DRand48" << endl;
41 cout <<
" > Ranlux" << endl;
42 cout <<
" > Ranlux64" << endl;
43 cout <<
" > Ranluxpp" << endl;
44 cout <<
" > Ranecu" << endl;
45 cout <<
" > Hurd160" << endl;
46 cout <<
" > Hurd288" << endl;
47 cout <<
" > MixMax" << endl;
48 cout <<
" > MTwist" << endl;
49 cout <<
" > Ranshi" << endl;
50 cout <<
" > DualRand" << endl;
51 cout <<
" > TripleRand" << endl << endl;
52 cout <<
" ----- Press <ENTER> to continue -----";
53 if ( cin.get() !=
'\n')
exit(0);
87 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
89 for (
int i=0; i<size; ++i )
90 cout <<
" " << vect[i];
124 cout <<
" ----- Press <ENTER> to continue -----";
125 if ( cin.get() !=
'\n')
exit(0);
126 cout << endl << endl;
127 cout <<
"-------------------- Shooting test on distribution objects --------------------" << endl;
129 cout <<
" Flat ]0,1[ : " << aFlatObj.
fire() << endl;
130 cout <<
" Flat ]0,5[ : " << aFlatObj.
fire(5) << endl;
131 cout <<
" Flat ]-5,3[ : " << aFlatObj.
fire(-5,3) << endl;
132 cout <<
" Exp (m=1) : " << anExponentialObj.
fire() << endl;
133 cout <<
" Exp (m=3) : " << anExponentialObj.
fire(3) << endl;
134 cout <<
" ExpZig (m=1) : " << anExpZigguratObj.
fire() << endl;
135 cout <<
" ExpZig (m=3) : " << anExpZigguratObj.
fire(3) << endl;
136 cout <<
" Gauss (m=1) : " << aGaussObj.
fire() << endl;
137 cout <<
" Gauss (m=3,v=1) : " << aGaussObj.
fire(3,1) << endl;
138 cout <<
" Wigner(1,0.2) : " << aBreitObj.
fire(1,0.2) << endl;
139 cout <<
" Wigner(1,0.2,1) : " << aBreitObj.
fire(1,0.2,1) << endl;
140 cout <<
" Wigner2(1,0.2) : " << aBreitObj.
fireM2(1,0.2) << endl;
141 cout <<
" Wigner2(1,0.2,1) : " << aBreitObj.
fireM2(1,0.2,1) << endl;
142 cout <<
" IntFlat [0,99[ : " << aFlatObj.
fireInt(99) << endl;
143 cout <<
" IntFlat [-99,37[ : " << aFlatObj.
fireInt(-99,37) << endl;
144 cout <<
" Poisson (m=3.0) : " << aPoissonObj.
fire(m1) << endl;
145 cout <<
" Binomial(n=1,p=0.5) : " << aBinomialObj.
fire() << endl;
146 cout <<
" Binomial(n=-5,p=0.3): " << aBinomialObj.
fire(-5,0.3) << endl;
147 cout <<
" ChiSqr (a=1) : " << aChiSquareObj.
fire() << endl;
148 cout <<
" ChiSqr (a=-5) : " << aChiSquareObj.
fire(-5) << endl;
149 cout <<
" Gamma (k=1,l=1) : " << aGammaObj.
fire() << endl;
150 cout <<
" Gamma (k=3,l=0.5) : " << aGammaObj.
fire(3,0.5) << endl;
151 cout <<
" StudT (a=1) : " << aStudentTObj.
fire() << endl;
152 cout <<
" StudT (a=2.5) : " << aStudentTObj.
fire(2.5) << endl;
154 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
156 for (
int i=0; i<size; ++i )
157 cout <<
" " << vect[i];
158 cout << endl << endl;
159 cout <<
" ----- Press <ENTER> to continue -----";
160 if ( cin.get() !=
'\n')
exit(0);
171 cout << endl << endl;
172 cout <<
"-------------------- Shooting test skeeping the generator ---------------------" << endl;
174 cout <<
" >>> Select a Random Engine <<<" << endl << endl;
175 cout <<
" a. HepJamesRandom (default)" << endl;
176 cout <<
" b. Rand" << endl;
177 cout <<
" c. DRand48" << endl;
178 cout <<
" d. Ranlux" << endl;
179 cout <<
" e. Ranlux64" << endl;
180 cout <<
" f. Ranecu" << endl;
181 cout <<
" g. Hurd160" << endl;
182 cout <<
" h. Hurd288" << endl;
183 cout <<
" i. MTwist" << endl;
184 cout <<
" j. Ranshi" << endl;
185 cout <<
" k. DualRand" << endl;
186 cout <<
" l. TripleRand" << endl;
187 cout <<
" m. MixMax" << endl << endl;
190 while ((sel!=
'a')&&(sel!=
'b')&&(sel!=
'c')&&(sel!=
'd')&&(sel!=
'e')&&
191 (sel!=
'f')&&(sel!=
'g')&&(sel!=
'h')&&(sel!=
'i')&&(sel!=
'j')&&
192 (sel!=
'k')&&(sel!=
'l')&&(sel!=
'm')) {
193 cout << endl <<
" >>> Choice not legal !! [a..m]<<<" << endl;
262 cout <<
" Gamma (k=3,l=0.5) : " <<
RandGamma::shoot(anEngine,3,0.5) << endl;
266 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
268 for (
int i=0; i<size; ++i )
269 cout <<
" " << vect[i];
270 cout << endl << endl;
275 cout <<
"------------------------- Test on HepJamesRandom ----------------------------" << endl;
278 cout <<
" ----- Press <ENTER> to continue -----";
279 if ( cin.get() !=
'\n')
exit(0);
281 cout <<
"--------------------------- Test on RandEngine ------------------------------" << endl;
285 cout <<
" ----- Press <ENTER> to continue -----";
286 if ( cin.get() !=
'\n')
exit(0);
288 cout <<
"------------------------- Test on DRand48Engine -----------------------------" << endl;
292 cout <<
" ----- Press <ENTER> to continue -----";
293 if ( cin.get() !=
'\n')
exit(0);
295 cout <<
"--------------------- Test on RanluxEngine (luxury 4) ------------------------" << endl;
299 cout <<
" ----- Press <ENTER> to continue -----";
300 if ( cin.get() !=
'\n')
exit(0);
302 cout <<
"------------------------- Test on Ranlux64Engine -----------------------------" << endl;
306 cout <<
" ----- Press <ENTER> to continue -----";
307 if ( cin.get() !=
'\n')
exit(0);
309 cout <<
"------------------------- Test on RanluxppEngine -----------------------------" << endl;
313 cout <<
" ----- Press <ENTER> to continue -----";
314 if ( cin.get() !=
'\n')
exit(0);
316 cout <<
"-------------------------- Test on RanecuEngine ------------------------------" << endl;
320 cout <<
" ----- Press <ENTER> to continue -----";
321 if ( cin.get() !=
'\n')
exit(0);
323 cout <<
"------------------------- Test on Hurd160Engine ------------------------------" << endl;
327 cout <<
" ----- Press <ENTER> to continue -----";
328 if ( cin.get() !=
'\n')
exit(0);
330 cout <<
"------------------------- Test on Hurd288Engine ------------------------------" << endl;
334 cout <<
" ----- Press <ENTER> to continue -----";
335 if ( cin.get() !=
'\n')
exit(0);
337 cout <<
"-------------------------- Test on MixMaxEngine ------------------------------" << endl;
341 cout <<
" ----- Press <ENTER> to continue -----";
342 if ( cin.get() !=
'\n')
exit(0);
344 cout <<
"-------------------------- Test on MTwistEngine ------------------------------" << endl;
348 cout <<
" ----- Press <ENTER> to continue -----";
349 if ( cin.get() !=
'\n')
exit(0);
351 cout <<
"-------------------------- Test on RanshiEngine ------------------------------" << endl;
355 cout <<
" ----- Press <ENTER> to continue -----";
356 if ( cin.get() !=
'\n')
exit(0);
358 cout <<
"------------------------- Test on DualRandEngine -----------------------------" << endl;
362 cout <<
" ----- Press <ENTER> to continue -----";
363 if ( cin.get() !=
'\n')
exit(0);
365 cout <<
"------------------------ Test on TripleRandEngine ----------------------------" << endl;
static void setTheEngine(HepRandomEngine *theNewEngine)
static double shootM2(double a=1.0, double b=0.2)
static double shoot(double a=1.0, double b=0.2)
static long shootInt(long n)
void fireArray(const int size, double *vect)
static void shootArray(const int size, double *vect)
static long shoot(double mean=1.0)
RanluxppEngine theRanluxppEngine
RanshiEngine theRanshiEngine
MixMaxRng theMixMaxEngine
Hurd160Engine theHurd160Engine
Ranlux64Engine theRanlux64Engine
RanecuEngine theRanecuEngine
TripleRand theTripleRandEngine
DRand48Engine theDRand48Engine
DualRand theDualRandEngine
HepJamesRandom theJamesEngine
RanluxEngine theRanluxEngine(19780503, 4)
MTwistEngine theMTwistEngine
Hurd288Engine theHurd288Engine