Cannot add more than 16 Scoring Meshes

Note: I’ve posted this issue in “Recording, Visualizing and Persisting Data” last week, but did not receive any feedback. Now re-posting in “Particles, Track, Event, Run and Biasing”

Hi all,

In our Geant4 based program we are taking advantage of the Scoring Meshes functionality. When the number of meshes defined in the code becomes more than G4PathFinder::fMaxNav (static const value of 16) then following exception is triggered:

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : GeomNav0002
      issued by : G4PathFinder::PrepareNewTrack()
Too many active Navigators / worlds.
        Transportation Manager has 17 active navigators.
        This is more than the number allowed = 16 !
*** Fatal Exception *** core dump ***
G4WT2 > G4Track (0x7f9ab06abe20) - track ID = 1, parent ID = 0
G4WT2 >  Particle type : e- - creator process : not available
G4WT2 >  Kinetic energy : 1 GeV - Momentum direction : (0,0,1)
G4WT2 >  Step length : 0 fm  - total energy deposit : 0 eV 
G4WT2 >  Pre-step point : (0,0,-1010) - Physical volume : World (G4_AIR)
G4WT2 >  - defined by : not available
G4WT2 >  Post-step point : (0,0,-1010) - Physical volume : World (G4_AIR)
G4WT2 >  - defined by : not available
G4WT2 >  *** Note: Step information might not be properly updated.
G4WT2 > 
-------- EEEE -------- G4Exception-END --------- EEEE -------

Instead of posting our program code here I reproduced the issue in one of Geant4 examples. Namely, /extended/runAndEvent/RE03. Example takes advantage of a maximum of 3 scoring meshes. However, if we define more that 16 scoring meshes in the macro file the executable throws same exception.

I attach the modified macro file here:
run_my.txt (5.9 KB)

To reproduce the error please compile the above example and run RE03 run_my.txt

My questions are following:

  • Is having a maximum of 16 scoring meshes is intended or is a Geant4 bug?
  • If behavior is buggy can anyone suggest a workaround?

Issue reproduced on: Geant 4.10.07.p01, gcc 10.3.1, Fedora 33. Geant 4.10.06.p02, gcc 9.2.0, CentOS 7.7
Issue reproduced on: Geant 4.10.07.p01, gcc 10.3.1, Fedora 33. Geant 4.10.06.p02, gcc 9.2.0, CentOS 7.7

P.S.: exception is fired from file I tried to debug this issue but the IDE is not hitting my breakpoints - probably because G4TransportationManager has an inline definition file .icc.

I think I ran into this problem in early 2014, having 8 scoring meshes when the maximum allowed number was 7. The solution proposed at the time in the hypernews was to change in


the line

static const G4int fMaxNav = 8; // rename to kMaxNoNav ??

to a higher number. In subsequent releases, this line was updated to

static const G4int fMaxNav = 16;

which is what it is in the current version of Geant4 (4.10.7p02).

So you might want to try to rebuild your Geant4 version with fMaxNav set to a higher number (I have no idea if there are some negative side effects to be expected - at the time there were none).

Hi @smuelller thanks for your reply. We are using a pre-compiled Geant4 version on remote computing environment. Therefore changing the Geant4 code and re-compiling it from source does not seem possible.

Issue is posted on Geant4 Bugzilla: 2391 – Cannot add more than 16 Scoring Meshes

Why do you need such a huge number of meshes? Each mesh may take arbitrary number of primitive scorers.

We have a simulation of an assembly of 5x5 scintillation crystals in the program. We study the energy deposition in various parts of each crystal in the program.

Therefore we are defining an individual mesh that wraps each crystal. In this particular example it would require 5x5=25 meshes.

Meshes are not overlapping. However, for some reason they get defined in the parallel worlds.

In order to create the meshes we use the code similar to example /extended/runAndEvent/RE03. For a simple test I modified that example and increased number of meshes used in the example’s macro run2.mac from 3 to 20. And program crashed. You can find my modified macro above in the original post.

Above test indicates that by default Geant4 creates non-overlapping meshes in parallel worlds. And their number is limited to 16. To my understanding the expected behavior would be to create the meshes in one parallel world.

Looking forward to hearing from you!

Hi @makotoasai, please refer to my comment above that explains why we need more than 16 meshes. Also to my understanding meshes are defined in one parallel world. Therefore their number should not be limited by 16 (maximum number of parallel worlds)

I am looking forward to hearing from you. Any help will be greatly appreciated!