Error when running too many events in Geant4

_Geant4 Version: 11.2.1
_Operating System: MacOS 14.4

Dear Everyone,

I am running my Geant4 project successfully with no errors. I need to run a proton gun for more than 10^6 protons. I am using run.mac to do /run/beamOn 50000
Which is working properly and without any crashes. But as soon as I go above 50723 events for whatever reason, I get this error:

WARNING - Attempt to delete the physical volume store while geometry closed !
WARNING - Attempt to delete the logical volume store while geometry closed !
WARNING - Attempt to delete the solid store while geometry closed !
WARNING - Attempt to delete the region store while geometry closed !

Is there a particular reason behind it? Is there a bug in the code or very little storage space? Has someone else ever faced such an error message?

Thank you,

You should be looking at the log file before that point. What error messages do you see?

Those lines happen if something calls ::exit() without calling the Geant4 “cleanup”/end-of-job code. Nothing in Geant4 itself does that. Do you have an if-block where you put in an ::exit(2) statement or an assert() condition?

Hello! Thank you for the suggestion, I have looked into the code and apparently, I am using a rootmanager class that has a maximum number of PannelHits assigned to it. I was able to extend the maximum number and it all worked out.

Thank you so much for the help.

Hi khalil

I am wondering if you already find the solution, I have the same problem

Hello I just saw the reply.
This was happening to be because I was using a files to upload the data in a ROOT Tree. When defining it in the .hh I had to specify Max numbers of pannels for the hits:

  static const int MaxNGenPart = 10000;
  static const int MaxNPannelHit = 10000;
  static const int MaxNPannelHit1 = 10000;

Previously they were set each to 500. When the hits are too many it will create a segment violation and the code will break after a certain number of events. Thus the ROOT Tree is saturated.
Simply increasing that number when running too many events fixes things.

1 Like

I see , I will try to implement it

Thank you

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.