18 #define NUMBER_OF_SEEDS 1
21 #define HEPRNDM_HEPRNDMENGINES_CPP
37 #include "CLHEP/Random/Random.h"
38 #include "CLHEP/Random/DualRand.h"
39 #include "CLHEP/Random/TripleRand.h"
40 #include "CLHEP/Random/DRand48Engine.h"
41 #include "CLHEP/Random/Hurd160Engine.h"
42 #include "CLHEP/Random/Hurd288Engine.h"
43 #include "CLHEP/Random/JamesRandom.h"
44 #include "CLHEP/Random/MTwistEngine.h"
45 #include "CLHEP/Random/RanecuEngine.h"
46 #include "CLHEP/Random/Ranlux64Engine.h"
47 #include "CLHEP/Random/RanluxEngine.h"
48 #include "CLHEP/Random/RanshiEngine.h"
52 using namespace CLHEP;
73 m_seeds.erase(m_seeds.begin(), m_seeds.end());
75 if ( m_seeds.size() == 0 ) {
77 long theSeed = 1234567;
78 m_seeds.push_back(theSeed);
83 status = initializeEngine();
85 log <<
MSG::INFO <<
"Generator engine type:"
89 if ( m_row > 214 || m_col > 1 ) {
90 log <<
MSG::ERROR <<
"Generator engine seed table has dimension [215][2], you gave:"
91 <<
" Row=" << m_row <<
" Column:" << m_col <<
endmsg;
95 log <<
MSG::INFO <<
"Generator engine seeds from table."
96 <<
" Row=" << m_row <<
" Column:" << m_col <<
endmsg;
99 log <<
"Current Seed:" << m_hepEngine->getSeed();
100 log <<
" Luxury:" << m_lux;
103 if ( m_setSingleton ) {
104 HepRandom::setTheEngine(m_hepEngine);
105 log <<
"This is the GEANT4 engine!" <<
endmsg;
110 log <<
MSG::ERROR <<
"Cannot initialze random engine of type:"
119 HepRandom::setTheEngine(0);
129 return m_hepEngine->flat();
134 typedef std::vector<long> seed_t;
136 for ( seed_t::const_iterator
i = seed.begin();
i < seed.end();
i++ ) {
137 m_seeds.push_back(*
i);
139 if ( m_seeds.size() > 0 ) {
140 if ( m_seeds.back() != 0 ) {
141 m_seeds.push_back(0);
143 m_hepEngine->setSeeds(&m_seeds[0], m_lux);
161 seed.push_back(m_hepEngine->getSeed());
167 m_hepEngine = (m_useTable) ?
new DualRand(m_row, m_col) :
new DualRand(m_seeds[0]);
172 m_hepEngine = (m_useTable) ?
new TripleRand(m_row, m_col) :
new TripleRand(m_seeds[0]);
177 m_hepEngine = (m_useTable) ?
new DRand48Engine(m_row, m_col) :
new DRand48Engine(m_seeds[0]);
182 m_hepEngine = (m_useTable) ?
new Hurd160Engine(m_row, m_col) :
new Hurd160Engine(m_seeds[0]);
187 m_hepEngine = (m_useTable) ?
new Hurd288Engine(m_row, m_col) :
new Hurd288Engine(m_seeds[0]);
192 m_hepEngine = (m_useTable) ?
new RanecuEngine(m_row) :
new RanecuEngine(m_seeds[0]);
197 m_hepEngine = (m_useTable) ?
new RanshiEngine(m_row, m_col) :
new RanshiEngine(m_seeds[0]);
202 m_hepEngine = (m_useTable) ?
new RanluxEngine(m_row, m_col, m_lux) :
new RanluxEngine(m_seeds[0], m_lux);
207 m_hepEngine = (m_useTable) ?
new Ranlux64Engine(m_row, m_col, m_lux) :
new Ranlux64Engine(m_seeds[0], m_lux);
212 m_hepEngine = (m_useTable) ?
new MTwistEngine(m_row, m_col) :
new MTwistEngine(m_seeds[0]);
217 m_hepEngine = (m_useTable) ?
new HepJamesRandom(m_row, m_col) :
new HepJamesRandom(m_seeds[0]);
Definition of the MsgStream class used to transmit messages.
virtual StatusCode initialize()
Initialize the Engine.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual double rndm() const
Single shot / This was declared "virtual double rndm()" which causes / compiler warnings since the si...
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
bool isSuccess() const
Test for a status code of SUCCESS.
std::vector< long > m_seeds
StatusCode seeds(std::vector< long > &seed) const
Retrieve seeds.
HepRndm::Engine< DualRand > e1
#define DECLARE_COMPONENT(type)
StatusCode setSeeds(const std::vector< long > &seed)
virtual double rndm() const { return BaseEngine::rndm( ); }
virtual StatusCode finalize()
Service override: finalization.
virtual StatusCode initializeEngine()
Create/Initialize new HepEngine....
This class is used for returning status codes from appropriate routines.
virtual StatusCode finalize()
Finalize the Engine.
virtual ~Engine()
Standard Destructor.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
virtual StatusCode initialize()
Service override: initialization.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.