28 #define NUMBER_OF_SEEDS 1
31 #define HEPRNDM_HEPRNDMENGINES_CPP
47 #include <CLHEP/Random/DRand48Engine.h>
48 #include <CLHEP/Random/DualRand.h>
49 #include <CLHEP/Random/Hurd160Engine.h>
50 #include <CLHEP/Random/Hurd288Engine.h>
51 #include <CLHEP/Random/JamesRandom.h>
52 #include <CLHEP/Random/MTwistEngine.h>
53 #include <CLHEP/Random/RanecuEngine.h>
54 #include <CLHEP/Random/Ranlux64Engine.h>
55 #include <CLHEP/Random/RanluxEngine.h>
56 #include <CLHEP/Random/RanshiEngine.h>
57 #include <CLHEP/Random/TripleRand.h>
61 using namespace CLHEP;
68 auto& seeds = m_seeds.value();
70 if ( m_seeds.size() == 0 ) {
72 long theSeed = 1234567;
73 seeds.push_back( theSeed );
80 if ( m_row > 214 || m_col > 1 ) {
81 error() <<
"Generator engine seed table has dimension [215][2], you gave:"
82 <<
" Row=" << m_row <<
" Column:" << m_col <<
endmsg;
85 info() <<
"Generator engine seeds from table."
86 <<
" Row=" << m_row <<
" Column:" << m_col <<
endmsg;
89 info() <<
"Current Seed:" << hepEngine()->getSeed();
90 info() <<
" Luxury:" << m_lux.value();
93 if ( m_setSingleton ) {
94 HepRandom::setTheEngine( hepEngine() );
95 info() <<
"This is the GEANT4 engine!" <<
endmsg;
104 template <
class TYPE>
106 m_seeds.value().clear();
107 return BaseEngine::finalize();
111 template <
class TYPE>
113 auto& seeds = m_seeds.value();
116 if ( !seeds.empty() ) {
117 if ( seeds.back() != 0 ) { seeds.push_back( 0 ); }
118 hepEngine()->setSeeds( &seeds[0], m_lux );
125 template <
class TYPE>
137 seed.push_back( hepEngine()->getSeed() );
144 return m_useTable ? std::make_unique<DualRand>( m_row, m_col ) : std::make_unique<DualRand>( m_seeds[0] );
149 return m_useTable ? std::make_unique<TripleRand>( m_row, m_col ) : std::make_unique<TripleRand>( m_seeds[0] );
154 return m_useTable ? std::make_unique<DRand48Engine>( m_row, m_col ) : std::make_unique<DRand48Engine>( m_seeds[0] );
159 return m_useTable ? std::make_unique<Hurd160Engine>( m_row, m_col ) : std::make_unique<Hurd160Engine>( m_seeds[0] );
164 return m_useTable ? std::make_unique<Hurd288Engine>( m_row, m_col ) : std::make_unique<Hurd288Engine>( m_seeds[0] );
169 return m_useTable ? std::make_unique<RanecuEngine>( m_row ) : std::make_unique<RanecuEngine>( m_seeds[0] );
174 return m_useTable ? std::make_unique<RanshiEngine>( m_row, m_col ) : std::make_unique<RanshiEngine>( m_seeds[0] );
179 return m_useTable ? std::make_unique<RanluxEngine>( m_row, m_col, m_lux )
180 : std::make_unique<RanluxEngine>( m_seeds[0], m_lux );
185 return m_useTable ? std::make_unique<Ranlux64Engine>( m_row, m_col, m_lux )
186 : std::make_unique<Ranlux64Engine>( m_seeds[0], m_lux );
191 return m_useTable ? std::make_unique<MTwistEngine>( m_row, m_col ) : std::make_unique<MTwistEngine>( m_seeds[0] );
196 return m_useTable ? std::make_unique<HepJamesRandom>( m_row, m_col )
197 : std::make_unique<HepJamesRandom>( m_seeds[0] );