[Halld-offline] inject random seeds into HDGeant?

Richard Jones richard.t.jones at uconn.edu
Thu Mar 20 15:26:02 EDT 2014


Hello all,

I implemented the code in bggen() to create a tuple of integers
representing the seed of the random number generator at the start of each
event, and store these in the output hddm record for each event.  The
stated policy was that these were to be used to initialize the state of the
random number generator at the start of each event, for all subsequent
stages of the simulation workflow (hdgeant, mcsmear).  However, at this
late stage I am very wary of injecting unchecked code into the dc-2 stack.

So...  I ran a bunch of events, and some evidence of skewed distributions
showed up in the distribution of background (out of time) beam photons
coming from the internal generator in hdgeant.  Hence, I suspected that the
initialization of the G3 random number generator using random seeds that
come from the outside might be problematic.  Here are some words from deep
in the G4 documentation.

"Two integer seeds are used to initialise a sequence. *Not all pairs of
integers define a good random sequence* or one which is independent from
others. Sections of the same random sequence can be defined as independent
sequences. The period of the generator is 260≈1018 . A generation has been
performed in order to provide the seeds to start any of the generated
sections. There are 215 possible seed pairs and they are all 109 numbers
apart. Thus a sequence started from one of the seed pairs, after 109 numbers
will start generating the next one."

There are 2 ways to set the seeds in G3: use one of the 213 (no, really)
predefined sequences (what we are doing now), or come up with your own pair
of random ints and hope that the sequence is reasonably well behaved.
 Apparently if you try enough different random seeds, the chances that you
hit the bad spots is pretty high.  Hence our observed skew.  From a code
snippet imbedded deep in the G3 simulation for the Minos experiement:

c Feeding seeds back to the GEANT random number generator is dangerous
c because those seed settings are generally made assuming that RANECQ
c is independent of GRNDMQ and can be hardcoded to reset when some
c random bit of code gets called for the first time. Only GEANT
c should ever initialize the seed.
c CALL GRNDMQ(JSEED,KSEED,1,'S')

So my recommendation: what we are doing now is correct. Let's keep it like
it is, and review the issue again when hdgeant4 is up and running.

-Richard Jones
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jlab.org/pipermail/halld-offline/attachments/20140320/51a4155f/attachment-0002.html>


More information about the Halld-offline mailing list