10#include "CLHEP/Units/GlobalPhysicalConstants.h"
11#include "CLHEP/Random/RanecuEngine.h"
12#include "CLHEP/Random/Random.h"
23void useSeed(
int, std::vector<Sample>& );
29 std::ofstream
output(
"testRanecuSequence.output");
31 output <<
" Setting CLHEP Random Engine..." << std::endl;
34 std::vector<Sample> ranList;
40 useSeed(1275168040-2048*215, ranList);
45 for (
int i = 0; i < 1000; ++i ) {
52 for (
unsigned int it=0; it < ranList.size(); ++it ) {
53 for (
unsigned int jt=it+1; jt < ranList.size(); ++jt ) {
56 output <<
"ERROR: Seed " << ranList[it].seed
57 <<
" and Seed " << ranList[jt].seed
58 <<
" are " << (ranList[jt].seed - ranList[it].seed )
59 <<
" apart and result in identical sequences" << std::endl;
60 std::cerr <<
"Seed " << ranList[it].seed
61 <<
" and Seed " << ranList[jt].seed
62 <<
" are " << (ranList[jt].seed - ranList[it].seed )
63 <<
" apart and result in identical sequences" << std::endl;
68 output <<
" numbad is " << numbad << std::endl;
72void useSeed(
int seed, std::vector<Sample>& ranList )
78 for(
int i = 0; i < 15; ++i ) {
83 for(
int i = 0; i < 15; ++i ) {
88 for(
int i = 0; i < 15; ++i ) {
94 for(
int i = 0; i < 15; ++i ) {
103 for(
int i = 0; i < 15; ++i ) {
107 ranList.push_back(v);
114 output <<
" case1: default constructor \n" ;
115 output <<
" comparing Seed " << s1.
seed <<
" and Seed " << s2.
seed << std::endl;
116 output <<
" case1 sequence:" ;
117 for(
unsigned int i=0; i < s1.
case1.size(); ++i )
output <<
" " << s1.
case1[i];
122 output <<
" case2: construct with single seed \n" ;
123 output <<
" comparing Seed " << s1.
seed <<
" and Seed " << s2.
seed << std::endl;
124 output <<
" case2 sequence:" ;
125 for(
unsigned int i=0; i < s1.
case2.size(); ++i )
output <<
" " << s1.
case2[i];
130 output <<
" case3: construct with single seed \n" ;
131 output <<
" comparing Seed " << s1.
seed <<
" and Seed " << s2.
seed << std::endl;
132 output <<
" case3 sequence:" ;
133 for(
unsigned int i=0; i < s1.
case3.size(); ++i )
output <<
" " << s1.
case3[i];
138 output <<
" case4: use setSeed \n" ;
139 output <<
" comparing Seed " << s1.
seed <<
" and Seed " << s2.
seed << std::endl;
140 output <<
" case4 sequence:" ;
141 for(
unsigned int i=0; i < s1.
case4.size(); ++i )
output <<
" " << s1.
case4[i];
146 output <<
" case5: use setSeeds \n" ;
147 output <<
" comparing Seed " << s1.
seed <<
" and Seed " << s2.
seed << std::endl;
148 output <<
" case5 sequence:" ;
149 for(
unsigned int i=0; i < s1.
case5.size(); ++i )
output <<
" " << s1.
case5[i];
static HepRandomEngine * getTheEngine()
static void setTheSeed(long seed, int lxr=3)
static void setTheEngine(HepRandomEngine *theNewEngine)
void setSeed(long index, int dum=0)
void setSeeds(const long *seeds, int index=-1)
std::ofstream output("ranRestoreTest.cout")
std::vector< double > case5
std::vector< double > case3
std::vector< double > case4
std::vector< double > case2
std::vector< double > case1
bool compareSamples(Sample &, Sample &, std::ofstream &)
void useSeed(int, std::vector< Sample > &)