Message: Random Number Generation Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Random Number Generation 

Forum: Run Management
Date: 25 May, 2015
From: Chelsea Bartram <Chelsea Bartram>

Hi all,

I've realized that the source of several problems I have been having has been due to my lack of understanding of the Geant random number engines. From what I understand, if you don't specify a random number generator engine, it uses the default (HepJamesRandom).

My goal is to be able to repeat a specific event by using the following macro command: /random/resetEngineFrom run0evt0.rndm. That said, I have no problem generating run#evt###.rndm files. The issue here is duplicating them after a run.

In my main() function, if I do not specify a random number generator, it uses the same seed every time (*). If I do specify a random number generator, I get a different seed every time, which is what I want. However, if I try to run my code using /random/resetEngineFrom run#evt###.rndm (using a seed from a specific event which I would like to repeat), I do not duplicate the results. I am curious about how this works. Does /random/resetEngineFrom override my code in main()? In main() I have:

time_t systime = time(NULL);

long seed = (long) systime;

CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);


It seems like it should if the command works as intended, but that is not the case. Additionally, if I try to run with /random/resetEngineFrom run#evt####.rndm and comment out the above code in main(), it simply runs the code using a random seed, --in fact, it uses the same seed I mentioned in (*) and, importantly, this is NOT the seed from run#evt####.rndm.

I need to be able to access the seed in other parts of my code. For example, at one point, I print out

CLHEP::HepRandomEngine* theEngine=CLHEP::HepRandom::getTheEngine();


G4cout << "SEED: " << theSeed << G4endl;

If I look at the standard output, however, I see

SEED: 0 
--------- Ranecu engine status ---------
 Initial seed (index) = 58
 Current couple of seeds = 571385019, 1602100966

I must not be accessing the correct seed when I do this. Can anyone point me in the right direction? Perhaps I have not found the documentation or examples that I need.

Thank you!


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

1 Idea: Re: Random Number Generation   (Tom Roberts - 25 May, 2015)
 Add Message Add Message
to: "Random Number Generation"

 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 ]