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();
71 if ( m_seeds.size() == 0 ) {
73 long theSeed = 1234567;
74 seeds.push_back( theSeed );
81 if ( m_row > 214 || m_col > 1 ) {
82 error() <<
"Generator engine seed table has dimension [215][2], you gave:"
83 <<
" Row=" << m_row <<
" Column:" << m_col <<
endmsg;
86 info() <<
"Generator engine seeds from table."
87 <<
" Row=" << m_row <<
" Column:" << m_col <<
endmsg;
90 info() <<
"Current Seed:" << hepEngine()->getSeed();
91 info() <<
" Luxury:" << m_lux.value();
94 if ( m_setSingleton ) {
95 HepRandom::setTheEngine( hepEngine() );
96 info() <<
"This is the GEANT4 engine!" <<
endmsg;
105 template <
class TYPE>
107 m_seeds.value().clear();
108 return BaseEngine::finalize();
112 template <
class TYPE>
114 auto& seeds = m_seeds.value();
117 if ( !seeds.empty() ) {
118 if ( seeds.back() != 0 ) { seeds.push_back( 0 ); }
119 hepEngine()->setSeeds( &seeds[0], m_lux );
126 template <
class TYPE>
138 seed.
push_back( hepEngine()->getSeed() );
145 return m_useTable ? std::make_unique<DualRand>( m_row, m_col ) : std::make_unique<DualRand>( m_seeds[0] );
150 return m_useTable ? std::make_unique<TripleRand>( m_row, m_col ) : std::make_unique<TripleRand>( m_seeds[0] );
155 return m_useTable ? std::make_unique<DRand48Engine>( m_row, m_col ) : std::make_unique<DRand48Engine>( m_seeds[0] );
160 return m_useTable ? std::make_unique<Hurd160Engine>( m_row, m_col ) : std::make_unique<Hurd160Engine>( m_seeds[0] );
165 return m_useTable ? std::make_unique<Hurd288Engine>( m_row, m_col ) : std::make_unique<Hurd288Engine>( m_seeds[0] );
170 return m_useTable ? std::make_unique<RanecuEngine>( m_row ) : std::make_unique<RanecuEngine>( m_seeds[0] );
175 return m_useTable ? std::make_unique<RanshiEngine>( m_row, m_col ) : std::make_unique<RanshiEngine>( m_seeds[0] );
180 return m_useTable ? std::make_unique<RanluxEngine>( m_row, m_col, m_lux )
181 : std::make_unique<RanluxEngine>( m_seeds[0], m_lux );
186 return m_useTable ? std::make_unique<Ranlux64Engine>( m_row, m_col, m_lux )
187 : std::make_unique<Ranlux64Engine>( m_seeds[0], m_lux );
192 return m_useTable ? std::make_unique<MTwistEngine>( m_row, m_col ) : std::make_unique<MTwistEngine>( m_seeds[0] );
197 return m_useTable ? std::make_unique<HepJamesRandom>( m_row, m_col )
198 : std::make_unique<HepJamesRandom>( m_seeds[0] );