Dan Kaplan found a way to generate more than 2 billion (2B) independent events: use 'randomseed time'.
This works because the current time in microseconds is used as the seed at the start of the program, and the pseudo-random number generator (PRNG) is never seeded again. As the PRNG has an internal state much larger than 32 bits, it won't repeat. Moreover, each event uses a variable number of calls to the PRNG, so unless you have very simple events the number of PRNG calls will vary for each event, so the PRNG is at a different place in its sequence at the start of the next event.
NOTE: The event number for Root output loses precision above 16M, because it is a float with 24-bit mantissa. BLTrackFile and ACSII outputs have a workaround that maintains precision up to 2B. But above 2B the event numbers will repeat. So only do this if you don't care about event numbers.
Tom Roberts
Hi, Professor,
Glad to hear that. I'm sorry I missed your email before, I will also try to run something using 'randomseed=Time' to see if it works.
Best,Ziyu
On Tue, Oct 29, 2024 at 8:19 AM Daniel Kaplan <kap...@iit.edu> wrote:
Hi Ziyu, Yagmur,
It looks like I can generate many more than 2B statistically independent G4beamline events if I use randomseed=Time. I just generated 3B events that way and compared the results in the secondary-beamline EndDetector; I saw no duplicate events. This seems to be good news for generating large realistic events samples in G4beamline.
Tom - do you agree?
Dan
> On Oct 25, 2024, at 8:18 PM, Daniel Kaplan <kap...@iit.edu> wrote:
>
> Hi Ziyu, Yagmur,
>
> Did you conclude that there was or wasn’t a way to get more than 2 billion independent random-number sequences in G4beamline? What about randomseed=None or randomseed=Time or randomseed=Now?
>
> Dan
>
>> Begin forwarded message:
>>
>> From: Tom Roberts <tj...@muonsinc.com>
>> Subject: [Ext] Re: G4BL particlefilter speedup!
>> Date: October 25, 2024 at 5:52:22 PM CDT
>> To: Daniel Kaplan <kap...@iit.edu>
>>
>> I don't think so. It is possible that the random numbers are unsigned, making 4B possible; I don't know.
>> Tom Roberts
>>
>>
>> On 10/25/24 4:07 PM, Daniel Kaplan wrote:
>>> Hi Tom,
>>>
>>> I surrounded the target with a particlefilter box about 20 cm on a side and got a speedup from 1000 to 8200 events/s! :)
>>>
>>> So now I could generate 10B POT on my Mac in a reasonable time. But how would I get enough independent random numbers? Are integers >2B possible in G4BL?
>>>
>>> Dan
>>>
>>> Sent from my iPhone
>