25 #include "StGlobals.hh"
26 #include "StPrompt.hh"
30 #include "JamesRandom.h"
31 #include "RanecuEngine.h"
32 #include "RanluxEngine.h"
33 #include "DRand48Engine.h"
34 #include "RandEngine.h"
38 #include "RandPoisson.h"
39 #include "RandExponential.h"
40 #include "RandGauss.h"
41 #include "RandBreitWigner.h"
56 const int numberOfNumbers = 10;
58 int *vecI =
new int[size];
59 long *vecL =
new long[size];
60 double *vec =
new double[size];
68 cout <<
"(1) Flat" <<
"\n"
69 <<
"(2) Gaussian" <<
"\n"
70 <<
"(3) Exponential" <<
"\n"
71 <<
"(4) Poissonian" <<
"\n"
72 <<
"(5) Breit-Wigner" << endl;
74 StPrompt(
"Which Distribution?", distribution);
76 if(distribution>0 && distribution<6)
91 StDouble exponentialNumber;
95 switch(distribution) {
97 cout <<
"Flat Distribution:" << endl;
98 for(jj=0; jj<numberOfNumbers; jj++) {
99 flatNumber = flatDistribution.shoot();
103 for(jj=0; jj<numberOfNumbers; jj++) {
104 flatNumber = flatDistribution.shoot(width);
108 for(jj=0; jj<numberOfNumbers; jj++) {
109 flatNumber = flatDistribution.shoot(width,width+5);
113 for(jj=0; jj<numberOfNumbers; jj++) {
115 flatDistribution.shootInt(width);
119 for(jj=0; jj<numberOfNumbers; jj++) {
120 flatINumber = (int) flatDistribution.shoot(width,width+5);
124 for(jj=0; jj<numberOfNumbers; jj++) {
125 flatINumber = flatDistribution.shootBit();
128 cout <<
"Specify an Engine" << endl;
129 for(jj=0; jj<numberOfNumbers; jj++) {
130 flatNumber = flatDistribution.shoot(&engine2);
134 for(jj=0; jj<numberOfNumbers; jj++) {
135 flatNumber = flatDistribution.shoot(&engine2, width);
139 for(jj=0; jj<numberOfNumbers; jj++) {
140 flatNumber = flatDistribution.shoot(&engine2, width,width+5);
144 for(jj=0; jj<numberOfNumbers; jj++) {
145 flatINumber = flatDistribution.shootInt(&engine2, width);
149 for(jj=0; jj<numberOfNumbers; jj++) {
150 flatINumber = (int) flatDistribution.shoot(&engine2, width,width+5);
154 for(jj=0; jj<numberOfNumbers; jj++) {
155 flatINumber = flatDistribution.shootBit(&engine2);
158 cout <<
"ARRAYs of numbers" << endl;
159 flatDistribution.shootArray(size,vec);
160 for(i=0; i<size; i++)
161 cout <<
"i " << *(vec+i) << endl;
164 flatDistribution.shootArray(size,vec, width, width+10);
165 for(i=0; i<size; i++)
166 cout <<
"i " << *(vec+i) << endl;
169 flatDistribution.shootArray(&engine2, size,vec);
170 for(i=0; i<size; i++)
171 cout <<
"i " << *(vec+i) << endl;
174 flatDistribution.shootArray(&engine2, size,vec, width, width+10);
175 for(i=0; i<size; i++)
176 cout <<
"i " << *(vec+i) << endl;
178 cout <<
"operator()" << endl;
179 for(i=0; i<size; i++) {
180 cout <<
"flatDistribution() " << flatDistribution() << endl;
185 cout <<
"Gaussian Distribution:" << endl;
186 for(jj=0; jj<numberOfNumbers; jj++) {
187 gaussNumber = gaussDistribution.shoot();
190 for(jj=0; jj<numberOfNumbers; jj++) {
191 gaussNumber = gaussDistribution.shoot(mean,width);
194 for(jj=0; jj<numberOfNumbers; jj++) {
195 gaussNumber = gaussDistribution.shoot(&engine2);
198 for(jj=0; jj<numberOfNumbers; jj++) {
199 gaussNumber = gaussDistribution.shoot(&engine2,mean,width);
202 for(jj=0; jj<numberOfNumbers; jj++) {
203 gaussNumber = gaussDistribution.fire();
206 for(jj=0; jj<numberOfNumbers; jj++) {
207 gaussNumber = gaussDistribution.fire(mean,width);
210 cout <<
"Arrays" << endl;
211 gaussDistribution.shootArray(size,vec,mean,width);
212 for(i=0; i<size; i++)
213 cout <<
"i " << *(vec+i) << endl;
215 gaussDistribution.shootArray(&engine2,size,vec,mean,width);
216 for(i=0; i<size; i++)
217 cout <<
"i " << *(vec+i) << endl;
219 gaussDistribution.fireArray(size,vec,mean,width);
220 for(i=0; i<size; i++)
221 cout <<
"i " << *(vec+i) << endl;
225 cout <<
"Exponential Distribution:" << endl;
226 for(jj=0; jj<numberOfNumbers; jj++) {
227 exponentialNumber = exponentialDistribution.shoot();
228 PR(exponentialNumber);
230 for(jj=0; jj<numberOfNumbers; jj++) {
231 exponentialNumber = exponentialDistribution.shoot(mean);
232 PR(exponentialNumber);
234 for(jj=0; jj<numberOfNumbers; jj++) {
235 exponentialNumber = exponentialDistribution.fire();
236 PR(exponentialNumber);
238 for(jj=0; jj<numberOfNumbers; jj++) {
239 exponentialNumber = exponentialDistribution.fire(mean);
240 PR(exponentialNumber);
242 cout <<
"Specify Engine" << endl;
243 for(jj=0; jj<numberOfNumbers; jj++) {
244 exponentialNumber = exponentialDistribution.shoot(&engine2);
245 PR(exponentialNumber);
247 for(jj=0; jj<numberOfNumbers; jj++) {
248 exponentialNumber = exponentialDistribution.shoot(&engine2,mean);
249 PR(exponentialNumber);
251 cout <<
"Arrays" << endl;
252 exponentialDistribution.shootArray(size,vec,mean);
253 for(i=0; i<size; i++)
254 cout <<
"i " << *(vec+i) << endl;
256 exponentialDistribution.shootArray(&engine2,size,vec,mean);
257 for(i=0; i<size; i++)
258 cout <<
"i " << *(vec+i) << endl;
260 exponentialDistribution.fireArray(size,vec,mean);
261 for(i=0; i<size; i++)
262 cout <<
"i " << *(vec+i) << endl;
266 for(jj=0; jj<numberOfNumbers; jj++) {
267 poissonNumber = poissonDistribution.shoot();
270 for(jj=0; jj<numberOfNumbers; jj++) {
271 poissonNumber = poissonDistribution.shoot(mean);
274 for(jj=0; jj<numberOfNumbers; jj++) {
275 poissonNumber = poissonDistribution.fire();
278 for(jj=0; jj<numberOfNumbers; jj++) {
279 poissonNumber = poissonDistribution.fire(mean);
282 cout <<
"Specify Engine" << endl;
283 for(jj=0; jj<numberOfNumbers; jj++) {
284 poissonNumber = poissonDistribution.shoot(&engine2);
287 for(jj=0; jj<numberOfNumbers; jj++) {
288 poissonNumber = poissonDistribution.shoot(&engine2,mean);
291 cout <<
"Arrays" << endl;
292 poissonDistribution.shootArray(size,vecL,mean);
293 for(i=0; i<size; i++)
294 cout <<
"i " << *(vecL+i) << endl;
296 poissonDistribution.shootArray(&engine2,size,vecL,mean);
297 for(i=0; i<size; i++)
298 cout <<
"i " << *(vecL+i) << endl;
300 poissonDistribution.fireArray(size,vecL,mean);
301 for(i=0; i<size; i++)
302 cout <<
"i " << *(vecL+i) << endl;
306 cout <<
"Breit-Wigner Distribution:" << endl;
307 for(jj=0; jj<numberOfNumbers; jj++) {
308 bwNumber = breitWignerDistribution.shoot(mean, width);
311 for(jj=0; jj<numberOfNumbers; jj++) {
312 bwNumber = breitWignerDistribution.shoot(mean, width, cut);
315 for(jj=0; jj<numberOfNumbers; jj++) {
316 bwNumber = breitWignerDistribution.shootM2(mean, width);
319 for(jj=0; jj<numberOfNumbers; jj++) {
320 bwNumber = breitWignerDistribution.shootM2(mean, width, cut);
323 cout <<
"Specify an engine" << endl;
324 for(jj=0; jj<numberOfNumbers; jj++) {
325 bwNumber = breitWignerDistribution.shoot(&engine2, mean, width);
328 for(jj=0; jj<numberOfNumbers; jj++) {
329 bwNumber = breitWignerDistribution.shoot(&engine2, mean, width, cut);
332 for(jj=0; jj<numberOfNumbers; jj++) {
333 bwNumber = breitWignerDistribution.shootM2(&engine2, mean, width);
336 for(jj=0; jj<numberOfNumbers; jj++) {
337 bwNumber = breitWignerDistribution.shootM2(&engine2, mean, width, cut);
340 for(jj=0; jj<numberOfNumbers; jj++) {
341 bwNumber = breitWignerDistribution.fire(mean, width, cut);
344 for(jj=0; jj<numberOfNumbers; jj++) {
345 bwNumber = breitWignerDistribution.fireM2(mean, width, cut);
349 cout <<
"ARRAYS:" << endl;
350 breitWignerDistribution.shootArray(size, vec,mean, width, cut);
351 for(i=0; i<size; i++)
352 cout <<
"i " << *(vec+i) << endl;
354 breitWignerDistribution.shootArray(&engine2, size, vec,mean, width, cut);
355 for(i=0; i<size; i++)
356 cout <<
"i " << *(vec+i) << endl;
358 breitWignerDistribution.fireArray(size, vec,mean, width, cut);
359 for(i=0; i<size; i++)
360 cout <<
"i " << *(vec+i) << endl;