4 #include "CLHEP/Units/GlobalPhysicalConstants.h"
5 #include "CLHEP/Random/Randomize.h"
12 using namespace CLHEP;
30 cout <<
"r=" << r() << endl;
33 cout <<
"---------------------------- Random shooting test -----------------------------" << endl;
34 cout <<
" -------------------- " << endl;
35 cout <<
" >>> Random Engines available <<<" << endl << endl;
36 cout <<
" > HepJamesRandom (default)" << endl;
37 cout <<
" > Rand" << endl;
38 cout <<
" > DRand48" << endl;
39 cout <<
" > Ranlux" << endl;
40 cout <<
" > Ranlux64" << endl;
41 cout <<
" > Ranecu" << endl;
42 cout <<
" > Hurd160" << endl;
43 cout <<
" > Hurd288" << endl;
44 cout <<
" > MTwist" << endl;
45 cout <<
" > Ranshi" << endl;
46 cout <<
" > DualRand" << endl;
47 cout <<
" > TripleRand" << endl << endl;
48 cout <<
" ----- Press <ENTER> to continue -----";
49 if ( cin.get() !=
'\n')
exit(0);
83 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
85 for (
int i=0; i<size; ++i )
86 cout <<
" " << vect[i];
117 cout <<
" ----- Press <ENTER> to continue -----";
118 if ( cin.get() !=
'\n')
exit(0);
119 cout << endl << endl;
120 cout <<
"-------------------- Shooting test on distribution objects --------------------" << endl;
122 cout <<
" Flat ]0,1[ : " << aFlatObj.
fire() << endl;
123 cout <<
" Flat ]0,5[ : " << aFlatObj.
fire(5) << endl;
124 cout <<
" Flat ]-5,3[ : " << aFlatObj.
fire(-5,3) << endl;
125 cout <<
" Exp (m=1) : " << anExponentialObj.
fire() << endl;
126 cout <<
" Exp (m=3) : " << anExponentialObj.
fire(3) << endl;
127 cout <<
" Gauss (m=1) : " << aGaussObj.
fire() << endl;
128 cout <<
" Gauss (m=3,v=1) : " << aGaussObj.
fire(3,1) << endl;
129 cout <<
" Wigner(1,0.2) : " << aBreitObj.
fire(1,0.2) << endl;
130 cout <<
" Wigner(1,0.2,1) : " << aBreitObj.
fire(1,0.2,1) << endl;
131 cout <<
" Wigner2(1,0.2) : " << aBreitObj.
fireM2(1,0.2) << endl;
132 cout <<
" Wigner2(1,0.2,1) : " << aBreitObj.
fireM2(1,0.2,1) << endl;
133 cout <<
" IntFlat [0,99[ : " << aFlatObj.
fireInt(99) << endl;
134 cout <<
" IntFlat [-99,37[ : " << aFlatObj.
fireInt(-99,37) << endl;
135 cout <<
" Poisson (m=3.0) : " << aPoissonObj.
fire(m) << endl;
136 cout <<
" Binomial(n=1,p=0.5) : " << aBinomialObj.
fire() << endl;
137 cout <<
" Binomial(n=-5,p=0.3): " << aBinomialObj.
fire(-5,0.3) << endl;
138 cout <<
" ChiSqr (a=1) : " << aChiSquareObj.
fire() << endl;
139 cout <<
" ChiSqr (a=-5) : " << aChiSquareObj.
fire(-5) << endl;
140 cout <<
" Gamma (k=1,l=1) : " << aGammaObj.
fire() << endl;
141 cout <<
" Gamma (k=3,l=0.5) : " << aGammaObj.
fire(3,0.5) << endl;
142 cout <<
" StudT (a=1) : " << aStudentTObj.
fire() << endl;
143 cout <<
" StudT (a=2.5) : " << aStudentTObj.
fire(2.5) << endl;
145 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
147 for (
int i=0; i<size; ++i )
148 cout <<
" " << vect[i];
149 cout << endl << endl;
150 cout <<
" ----- Press <ENTER> to continue -----";
151 if ( cin.get() !=
'\n')
exit(0);
162 cout << endl << endl;
163 cout <<
"-------------------- Shooting test skeeping the generator ---------------------" << endl;
165 cout <<
" >>> Select a Random Engine <<<" << endl << endl;
166 cout <<
" a. HepJamesRandom (default)" << endl;
167 cout <<
" b. Rand" << endl;
168 cout <<
" c. DRand48" << endl;
169 cout <<
" d. Ranlux" << endl;
170 cout <<
" e. Ranlux64" << endl;
171 cout <<
" f. Ranecu" << endl;
172 cout <<
" g. Hurd160" << endl;
173 cout <<
" h. Hurd288" << endl;
174 cout <<
" i. MTwist" << endl;
175 cout <<
" j. Ranshi" << endl;
176 cout <<
" k. DualRand" << endl;
177 cout <<
" l. TripleRand" << endl << endl;
180 while ((sel!=
'a')&&(sel!=
'b')&&(sel!=
'c')&&(sel!=
'd')&&(sel!=
'e')&&
181 (sel!=
'f')&&(sel!=
'g')&&(sel!=
'h')&&(sel!=
'i')&&(sel!=
'j')&&
182 (sel!=
'k')&&(sel!=
'l')) {
183 cout << endl <<
" >>> Choice not legal !! [a..l]<<<" << endl;
249 cout <<
" Gamma (k=3,l=0.5) : " <<
RandGamma::shoot(anEngine,3,0.5) << endl;
253 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
255 for (
int i=0; i<size; ++i )
256 cout <<
" " << vect[i];
257 cout << endl << endl;
262 cout <<
"------------------------- Test on HepJamesRandom ----------------------------" << endl;
265 cout <<
" ----- Press <ENTER> to continue -----";
266 if ( cin.get() !=
'\n')
exit(0);
268 cout <<
"--------------------------- Test on RandEngine ------------------------------" << endl;
272 cout <<
" ----- Press <ENTER> to continue -----";
273 if ( cin.get() !=
'\n')
exit(0);
275 cout <<
"------------------------- Test on DRand48Engine -----------------------------" << endl;
279 cout <<
" ----- Press <ENTER> to continue -----";
280 if ( cin.get() !=
'\n')
exit(0);
282 cout <<
"--------------------- Test on RanluxEngine (luxury 4) ------------------------" << endl;
286 cout <<
" ----- Press <ENTER> to continue -----";
287 if ( cin.get() !=
'\n')
exit(0);
289 cout <<
"------------------------- Test on Ranlux64Engine -----------------------------" << endl;
293 cout <<
" ----- Press <ENTER> to continue -----";
294 if ( cin.get() !=
'\n')
exit(0);
296 cout <<
"-------------------------- Test on RanecuEngine ------------------------------" << endl;
300 cout <<
" ----- Press <ENTER> to continue -----";
301 if ( cin.get() !=
'\n')
exit(0);
303 cout <<
"------------------------- Test on Hurd160Engine ------------------------------" << endl;
307 cout <<
" ----- Press <ENTER> to continue -----";
308 if ( cin.get() !=
'\n')
exit(0);
310 cout <<
"------------------------- Test on Hurd288Engine ------------------------------" << endl;
314 cout <<
" ----- Press <ENTER> to continue -----";
315 if ( cin.get() !=
'\n')
exit(0);
317 cout <<
"-------------------------- Test on MTwistEngine ------------------------------" << endl;
321 cout <<
" ----- Press <ENTER> to continue -----";
322 if ( cin.get() !=
'\n')
exit(0);
324 cout <<
"-------------------------- Test on RanshiEngine ------------------------------" << endl;
328 cout <<
" ----- Press <ENTER> to continue -----";
329 if ( cin.get() !=
'\n')
exit(0);
331 cout <<
"------------------------- Test on DualRandEngine -----------------------------" << endl;
335 cout <<
" ----- Press <ENTER> to continue -----";
336 if ( cin.get() !=
'\n')
exit(0);
338 cout <<
"------------------------ Test on TripleRandEngine ----------------------------" << endl;