Message: Re: RandomSeed saving in Sensitive Detector Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Feedback Re: RandomSeed saving in Sensitive Detector 

Forum: Event and Track Management
Re: Question RandomSeed saving in Sensitive Detector (Nicole Ackerman)
Date: 25 Apr, 2012
From: Gumplinger Peter <Gumplinger Peter>

Hi Nicole,

> If I use CLHEP::HepRandom::showEngineStatus(); in ProcessHits() I see a
> different set of seeds for each secondary track. Is this correct?

Yes, because showEngineStatus() shows you the random seeds as they are after the invocation of the last previous random engine request occurring before the execution of this line in the code.

> If so, is one of these the correct seed to use to recall the event?

No, none is correct.

> G4RunManager::GetRunManager()->rndmSaveThisEvent();, both of which save
> the last seed that I see printed on the screen?

That, I find a bit odd. Please, read:

"the user may wish to preserve the rndm seed of selected events. At any time in the event, put the following statement:

if (condition) G4RunManager::GetRunManager()->rndmSaveThisEvent();

currentEvent.rndm will be copied to runXXevntYY.rndm"

It is the seeds in the file runXXevntYY.rndm that you must use to reseed your interesting event. Mind you, in your ProcessHits() you may want to make sure that the rndmSaveThisEvent method is only called once for every event and not always when your 'condition' is fulfilled during an invocation of ProcessHits(). You may want to follow the LXe example where the hits (through their collection) are interrogated after the event has finished processing.

> Is there something wrong with trying to save the event from within a SD
> object?

No, not in principle.

> I can use the seeds to retrieve a specific event, but it hasn't
> been the event that I *want*. Can you recommend any further debugging I
> can do?

If it is really true that the seeds stored in the file runXXevntYY.rndm are not reproducing the event as you know it to be from the initial run, then this points to some problem with your simulation. You may be using a second random number generator, or you may be using/reading from a file to initiate your 'primary event'. In the initial run the progam will be somewhere inside the file reading a line but at the rerun the program will read from the top of the file. In that case, you not only need to know the seeds at the beginning of event but also where in the file the program read the information.

To be sure, if all is correct, G4 will reproduce the event from the initial seed.


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

1 Ok: Re: RandomSeed saving in Sensitive Detector   (Nicole Ackerman - 01 May, 2012)
 Add Message Add Message
to: "Re: RandomSeed saving in Sensitive Detector"

 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 ]