Message: Re: /random/setSeeds question Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

More Re: /random/setSeeds question 

Forum: Run Management
Re: Question /random/setSeeds question (Stefan E. Mueller)
Re: Disagree Re: /random/setSeeds question (Gumplinger Peter)
Re: More Re: /random/setSeeds question (Stefan E. Mueller)
Re: Idea Re: /random/setSeeds question (C Mos)
Date: 15 Jul, 2014
From: Stefan E. Mueller <Stefan E. Mueller>

Dear CMos,

thanks for the additional information. The thread in the hypernews you post actually inspired me some years ago to use the /random/setSeeds x y command. Back then, it worked for me (and I verified that the code I created back then still does give different results for different seeds, using geant4.9).

I also see that in source//run/src/G4RunMessenger.cc, the values given to the /random/setSeeds command are put into a seeds array and are passed to CLHEP::HepRandom::setTheSeeds(seeds). So this looks ok.

However, in the meantime I tried to use the /random/setSeeds command with the examples/extended/optical/OpNovice-code (following a proposal by P. Gumplinger), and it looks like I get identical output also in this case. I tried it both on our cluster and on my MacBook.

Of course, setting the seeds in the runaction class is a valid option, however, I think it should work also from the macro-commands.

Stefan

On Tue, 15 Jul 2014 06:29:34 GMT, C Mos wrote:

> I have had some issues along the same lines before, specifically
> defining the random seeds so to be able to run parallel jobs (read as
> "same job in different computers, no MPI") and merging results at the
> end of the session.
> 
> I do not have any experience using these functions in the macro file.
> However I do know base on documentation I read regarding the Ranecu
> Engine and from my own experience that there are two methods to define
> the seeds:
> 
>   void  setSeed (long index, int dum=0)
>   void  setSeeds (const long *seeds, int index=-1)
> 
> Please refer to the following link for further explanation:
> 
>   http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch03s02.html#sect.GlobClass.HEPRandom
> 
> And this following link brings together some discussion related to this
> topic (you may or may not have run into this before):
> 
>   http://hypernews.slac.stanford.edu/HyperNews/geant4/get/runmanage/310.html?inline=-1
> 
> I won't be able to explain the technicalities of these structures as I
> have not studied the full documentation to a proper extend. However I
> would like to emphasize from my own observations that using setSeeds()
> seems to provide the results you are looking for. I do initialization of
> my seeds USING hard code in my BeginOfRunAction() method instead of the
> main file. This will ensure every time I call the /run/beanOn I get
> different results:
> 
>     IN MY MAIN FILE:
>     G4Random::setTheEngine(new CLHEP::RanecuEngine);
> 
>     IN RUNACTION CLASS:
>     long seeds[2];
>     systime = time(NULL);
>     seeds[0] = (long) systime;
>     seeds[1] = (long) (systime*G4UniformRand());
>     G4Random::setTheSeeds(seeds);           
> 
> I hope this helps!
> 
> Cheers,
> 
> C Mos
> 

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 News: Re: /random/setSeeds question   (Stefan E. Mueller - 17 Jul, 2014)
(_ Feedback: Re: /random/setSeeds question   (David - 15 Aug, 2014)
 Add Message Add Message
to: "Re: /random/setSeeds question"

 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 ]