Too small geometries in Geant4? (segmentation error)

Hello, I am currently struggeling with a segmentation fault error. My simulation is based on the example /extended/electromagnetic/TestEm7. I modified the setup to have multiple parallel “wires”, red in attached picture. On top of the wires I placed another layer white in attached picture. Now my code works usually fine. It runs without a problem if I have up to 11 wires on a substrate of 30x30 um. The wire dimensions are then 30um/22 x 30um x 5 nm. Then a couple of interesting things happen:

  1. If I have 12 wires with the wire dimensions 30um/24 x 30um x 5 nm, my program still runs but it doesn’t end properly anymore. It is able to go through all events but isn’t anymore able to write a proper output.root file and ends with a segmentation error. I’m working here with a random beam (random y,z position, momentum fixed and always in x direction). Remarkably, if I change the beam to a fixed position I no longer have this problem and the simultation runs fine.

  2. If I even further increase the wires to 100 (dimensions are then 30um/200 x 30um x 5 nm) then the program is able to only simulate a couple of events before crashing. It crashes also with a segmentation fault error. I identified the corresponding line which presumable causes the crash in my stepping action to be analysisManager->FillH1(1, x, edep); . Although in the previous steps and events this line of code wasn’t an issue. Also, if I change here from a random beam to a fixed one the simulation runs almost through, but, similiar as in 1., it crashes at the end with a segmentation fault. However, here it managed to then write a working output.root.

Further infos:

  • I also have run the simulation previously without this wire structure, and only 2 layers, each with 5 nm thickness, on top of a substrate. Here, I didn’t have any problems.

  • I currently have a maxstepsize of 0.3 nm

  • I have also run the program with valgrind yielding me Invalid read of size 8 when crashing


  • the error is not due to the size of the Strips: I still have the same error with an overall larger geometry
  • the error is defently due to the analysis manager, since the crashes always happen if I am trying to access it/fill it
  • How I access the analysismanger shouldn’t be different from example TestEm7: root file etc. are initialized in and in the AnalysisManager is initialized for each step again

I managed to solve the error and run the simulation with my abovely described setup. The issue for me was the copy number specified in G4PVPlacement. If this number exeeds 23 for me I have the abovely mentioned errors. Giving every Volume the same copy number works just fine, since I am not interested in unique identification of the wires anyway. However, I still don’t know what the Issue here is though.

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