Negative number on BeamOn!

Dear All,
I have try to run a multi threaded simulation with a number of events of 3 10**9. However, the simulation was crashed and the output error was generated and showed the following message:
***** Illegal parameter (0) </run/beamOn -294967296> *****

Have Any Advice ?
Regards,
Jaafar

Dear Jaafar,

It happened because of an integer overflow (you set an integer value larger than INT_MAX). See more info, for instance, at https://www.geeksforgeeks.org/int_max-int_min-cc-applications/
To sort this out, you may divide your simulation in different runs, having each less than INT_MAX events.

Hope this helps,
Miguel

1 Like

Dear Miguel,
Thank you for your reply.
Yes I know that the number of events to be processed shouldn’t execs max(G4int) ~ 2.14^9.
Herein what I have used in my simulation:
/run/numberOfThreads 10
/run/eventModulo 300000000
/run/beamOn 3000000000 # total number of events to be processed
What I m looking for is to attribute to the beamOn method a value declared as long int instead of int type order to avoid this error. So my question is a such redefinition can be possible and how can be made?

Regards,
Jaafar

You cannot do that. The argument to beamOn is an integer (G4int). If you put into the macro a longer value, then it will be converted and truncated, leaving you with an invalid quantity.

1 Like

Thank you @mkelsey for your reply.
So if a such multi-threaded simulation requires shooting more than max(G4int) of primary events, in this case what is the adequate solution ?

Multiple runs per job:

/run/beamOn 1000000000
/run/beamOn 1000000000
/run/beamOn 1000000000

You should set up your output so that either each run gets a unique name (we use the run number as part of the filename in my simulation framework), or you can set up your user actions to open output at the beginning of the job, and keep it open between runs.

Thank you @mkelsey for your solution, multi-run seems to be a good approach.