4#include "CLHEP/Units/GlobalPhysicalConstants.h"
5#include "CLHEP/Random/Randomize.h"
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);
60 cout <<
" Flat ]0,1[ : " << RandFlat::shoot() << endl;
61 cout <<
" Flat ]0,5[ : " << RandFlat::shoot(5) << endl;
62 cout <<
" Flat ]-5,3[ : " << RandFlat::shoot(-5,3) << endl;
63 cout <<
" Exp (m=1) : " << RandExponential::shoot() << endl;
64 cout <<
" Exp (m=3) : " << RandExponential::shoot(3) << endl;
65 cout <<
" Gauss (m=1) : " << RandGauss::shoot() << endl;
66 cout <<
" Gauss (m=3,v=1) : " << RandGauss::shoot(3,1) << endl;
67 cout <<
" Wigner(1,0.2) : " << RandBreitWigner::shoot(1,0.2) << endl;
68 cout <<
" Wigner(1,0.2,1) : " << RandBreitWigner::shoot(1,0.2,1) << endl;
69 cout <<
" Wigner2(1,0.2) : " << RandBreitWigner::shootM2(1,0.2) << endl;
70 cout <<
" Wigner2(1,0.2,1) : " << RandBreitWigner::shootM2(1,0.2,1) << endl;
71 cout <<
" IntFlat [0,99[ : " << RandFlat::shootInt(99) << endl;
72 cout <<
" IntFlat [-99,37[ : " << RandFlat::shootInt(-99,37) << endl;
73 cout <<
" Poisson (m=3.0) : " << RandPoisson::shoot(m1) << endl;
74 cout <<
" Binomial(n=1,p=0.5) : " << RandBinomial::shoot() << endl;
75 cout <<
" Binomial(n=-5,p=0.3): " << RandBinomial::shoot(-5,0.3) << endl;
76 cout <<
" ChiSqr (a=1) : " << RandChiSquare::shoot() << endl;
77 cout <<
" ChiSqr (a=-5) : " << RandChiSquare::shoot(-5) << endl;
78 cout <<
" Gamma (k=1,l=1) : " << RandGamma::shoot() << endl;
79 cout <<
" Gamma (k=3,l=0.5) : " << RandGamma::shoot(3,0.5) << endl;
80 cout <<
" StudT (a=1) : " << RandStudentT::shoot() << endl;
81 cout <<
" StudT (a=2.5) : " << RandStudentT::shoot(2.5) << endl;
83 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
84 RandFlat::shootArray(size,vect);
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(m1) << 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;
230 cout <<
" Flat ]0,1[ : " << RandFlat::shoot(anEngine) << endl;
231 cout <<
" Flat ]0,5[ : " << RandFlat::shoot(anEngine,5) << endl;
232 cout <<
" Flat ]-5,3[ : " << RandFlat::shoot(anEngine,-5,3) << endl;
233 cout <<
" Exp (m=1) : " << RandExponential::shoot(anEngine) << endl;
234 cout <<
" Exp (m=3) : " << RandExponential::shoot(anEngine,3) << endl;
235 cout <<
" Gauss (m=1) : " << RandGauss::shoot(anEngine) << endl;
236 cout <<
" Gauss (m=3,v=1) : " << RandGauss::shoot(anEngine,3,1) << endl;
237 cout <<
" Wigner(1,0.2) : " << RandBreitWigner::shoot(anEngine,1,0.2) << endl;
238 cout <<
" Wigner(1,0.2,1) : " << RandBreitWigner::shoot(anEngine,1,0.2,1) << endl;
239 cout <<
" Wigner2(1,0.2) : " << RandBreitWigner::shootM2(anEngine,1,0.2) << endl;
240 cout <<
" Wigner2(1,0.2,1) : " << RandBreitWigner::shootM2(anEngine,1,0.2,1) << endl;
241 cout <<
" IntFlat [0,99[ : " << RandFlat::shootInt(anEngine,99) << endl;
242 cout <<
" IntFlat [-99,37[ : " << RandFlat::shootInt(anEngine,-99,37) << endl;
243 cout <<
" Poisson (m=3.0) : " << RandPoisson::shoot(anEngine,m1) << endl;
244 cout <<
" Binomial(n=1,p=0.5) : " << RandBinomial::shoot(anEngine) << endl;
245 cout <<
" Binomial(n=-5,p=0.3): " << RandBinomial::shoot(anEngine,-5,0.3) << endl;
246 cout <<
" ChiSqr (a=1) : " << RandChiSquare::shoot(anEngine) << endl;
247 cout <<
" ChiSqr (a=-5) : " << RandChiSquare::shoot(anEngine,-5) << endl;
248 cout <<
" Gamma (k=1,l=1) : " << RandGamma::shoot(anEngine) << endl;
249 cout <<
" Gamma (k=3,l=0.5) : " << RandGamma::shoot(anEngine,3,0.5) << endl;
250 cout <<
" StudT (a=1) : " << RandStudentT::shoot(anEngine) << endl;
251 cout <<
" StudT (a=2.5) : " << RandStudentT::shoot(anEngine,2.5) << endl;
253 cout <<
" Shooting an array of 5 flat numbers ..." << endl << endl;
254 RandFlat::shootArray(anEngine,size,vect);
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;
void fireArray(const int size, double *vect)
RanshiEngine theRanshiEngine
Hurd160Engine theHurd160Engine
Ranlux64Engine theRanlux64Engine
RanecuEngine theRanecuEngine
TripleRand theTripleRandEngine
DRand48Engine theDRand48Engine
DualRand theDualRandEngine
HepJamesRandom theJamesEngine
RanluxEngine theRanluxEngine(19780503, 4)
MTwistEngine theMTwistEngine
Hurd288Engine theHurd288Engine