<div dir="ltr">Hello all,<div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>&quot;Two integer seeds are used to initialise a sequence. <b>Not all pairs of integers define a good random sequence</b> 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 2<sup>60</sup>≈10<sup>18</sup> . 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 10<sup>9</sup> numbers apart. Thus a sequence started from one of the seed pairs, after 10<sup>9 </sup>numbers will start generating the next one.&quot;</div>
<div><br></div>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:<div>
<br></div><div>c Feeding seeds back to the GEANT random number generator is dangerous</div><div>c because those seed settings are generally made assuming that RANECQ</div>
<div>c is independent of GRNDMQ and can be hardcoded to reset when some</div><div>c random bit of code gets called for the first time.  Only GEANT</div>
<div>c should ever initialize the seed.</div><div>c      CALL GRNDMQ(JSEED,KSEED,1,&#39;S&#39;)</div><div>
<br></div><div>So my recommendation: what we are doing now is correct.  Let&#39;s keep it like it is, and review the issue again when hdgeant4 is up and running.</div>
<div><br></div><div>-Richard Jones</div></div>