GetSeed() runs out of seeds for very high statistics

Hi all,

I am trying to run my code on activation which requires very high statistics. I understand that the error is due to the fact that the seed reaches INT_MAX. Is there a way to change the type of the seed to long long int? I was trying to set the seed myself but setTheSeed takes only long ints as arguments and not long long ints.

(On the older Geant4 forum I read that running several runs and then merging the results might be a solution also. Although my concern is that in that case Geant4 would use the same seeds in each individual run, so it would just duplicate the same run again and again. Therefore would not achieve higher statistics…)

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : Run0115
issued by : G4RNGHelper::GetSeed
No seed number 7294(7294 available)
Original seed number -2 filled so far 2147480000
*** Fatal Exception *** core dump ***
G4WT6 > **** Track information is not available at this moment
G4WT6 > **** Step information is not available at this moment
G4WT6 >
-------- EEEE -------- G4Exception-END --------- EEEE -------

Many thanks,

I have never seen that seeding issue, but another related problem will be that the event ID is G4int, which is a 32 bit signed integer on most platforms, so the event ID will overflow after 2147483647 (2.1 billion events), and as far as I know the simulation will halt/terminate then as well.

I do not know if something ugly might happen, but if you do not use the event ID in your analysis, you could set up a UserAction which resets the event ID back to zero after it reached INT_MAX, this should enable you to circumvent this and run an infinite amount of events.

Alternatively you could refactor the event ID to use a 64 bit (long) (unsiged) integer type in the Geant4 source code, this should not have many ugly implications (other than doubling the storage size for event IDs), and will allow to run a practically “infinite” number of events as well.

My apologies for the long silence, I have been trying to get my head around this problem. In the end I solved this issue by using current time in microsends for each local run as a seed. Then I split my simulation into a lot of local runs each consisting of less events then INT_MAX.

If you’re running jobs one after another on a single node, using the current time as a seed is reasonable and will produce unique events.

If you’re planning to submit jobs to a batch farm, then local time won’t be sufficient for uniqueness. In our experiment (CDMS), we implemented a call to UUID to generate a unique seed value, even across multiple batch nodes:

// Create array of longs big enough to hold UUID plus zero terminator
const size_t nlong = sizeof(uuid_t)/sizeof(long) + 1;
long* seeds = new long[nlong];
seeds[nlong-1] = 0;    
unsigned char* theUUID = (unsigned char*)&seeds[0];

I get the same error message, how did you solve it