CLHEP
2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
testZiggurat.cc
Go to the documentation of this file.
1
//////////////////////////////////////////////////////////////////////////
2
3
#include <iostream>
4
5
#include "CLHEP/Random/RandGauss.h"
6
#include "CLHEP/Random/RandGaussQ.h"
7
#include "CLHEP/Random/RandExponential.h"
8
#include "CLHEP/Random/RandGaussZiggurat.h"
9
#include "CLHEP/Random/RandExpZiggurat.h"
10
11
//_________________________________________________________________________
12
int
main
() {
13
14
std::ofstream
output
(
"testZiggurat.cout"
);
15
16
int
ntest=10000000;
17
18
output
<<
"DEBUG: ntest="
<<ntest<<std::endl;
19
20
double
sum_rnd1=0;
21
for
(
int
i=0;i<ntest;++i) {
22
double
g
=
CLHEP::RandGauss::shoot
();
23
sum_rnd1+=
g
;
24
}
25
sum_rnd1/=ntest;
26
output
<<
"DEBUG: avg RandGauss="
<<sum_rnd1<<std::endl;
27
28
double
sum_rnd2=0;
29
for
(
int
i=0;i<ntest;++i) {
30
double
g
=
CLHEP::RandGaussQ::shoot
();
31
sum_rnd2+=
g
;
32
}
33
sum_rnd2/=ntest;
34
output
<<
"DEBUG: avg RandGaussQ="
<<sum_rnd2<<std::endl;
35
36
double
sum_zig=0;
37
for
(
int
i=0;i<ntest;++i) {
38
double
g
=
CLHEP::RandGaussZiggurat::shoot
();
39
sum_zig+=
g
;
40
}
41
sum_zig/=ntest;
42
output
<<
"DEBUG: avg RandGaussZiggurat="
<<sum_zig<<std::endl;
43
44
double
sum_exp=0;
45
for
(
int
i=0;i<ntest;++i) {
46
double
g
=
CLHEP::RandExponential::shoot
();
47
sum_exp+=
g
;
48
}
49
sum_exp/=ntest;
50
output
<<
"DEBUG: avg RandExponential="
<<sum_exp<<std::endl;
51
52
double
sum_expZ=0;
53
for
(
int
i=0;i<ntest;++i) {
54
double
g
=
CLHEP::RandExpZiggurat::shoot
();
55
sum_expZ+=
g
;
56
}
57
sum_expZ/=ntest;
58
output
<<
"DEBUG: avg RandExpZiggurat="
<<sum_expZ<<std::endl;
59
60
return
0;
61
}
62
63
CLHEP::RandExpZiggurat::shoot
static float shoot()
Definition:
RandExpZiggurat.h:71
CLHEP::RandExponential::shoot
static double shoot()
Definition:
RandExponential.cc:46
CLHEP::RandGaussQ::shoot
static double shoot()
CLHEP::RandGaussZiggurat::shoot
static float shoot()
Definition:
RandGaussZiggurat.h:50
CLHEP::RandGauss::shoot
static double shoot()
Definition:
RandGauss.cc:64
output
std::ofstream output("ranRestoreTest.cout")
g
int g(shared_ptr< X >)
Definition:
testSharedPtrConvertible.cc:54
main
int main()
Definition:
testZiggurat.cc:12
CLHEP-CLHEP_2_4_6_4
Random
test
testZiggurat.cc
Generated by
1.9.6