Message: Re: random num generator initialization Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: random num generator initialization 

Forum: Run Management
Re: Question random num generator initialization (Valery Taranenko)
Re: None Re: random num generator initialization (Tom Roberts)
Re: Agree Re: random num generator initialization (Valery Taranenko)
Date: 03 Dec, 2009
From: Tom Roberts <Tom Roberts>

My code would not be very useful, as it is rather complex and handles many different situations. But you are welcome to download it and peruse it (e.g. search for [Ss]eed in the source files): http://g4beamline.muonsinc.com

Note that seeding the PRNG must be done after the event number is known, but before any random numbers are used to generate the track(s) of the event. BeginOfEventAction() is too late, so I put it rather deep inside GeneratePrimaries(). Note that when reading events from a file the event number is changed immediately after reading it, so this placement is a bit tricky. (In my code, both of those functions are implemented in BLManager.cc, which implements all of the Geant4 user classes.)

Don't worry about the CPU time to seed the PRNG -- it's much less than the time to process an event. A trivial simulation runs almost 10,000 ev/sec, while typical simulations are 100 to 1,000 times slower.

 Add Message Add Message
to: "Re: random num generator initialization"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]