A problem using phase space files

Hi
I intend to generate my own phase space files. I have made changes to the RunAction, EventAction, and SteppingAction in the B1 example according to the manual. Other than including the necessary headers and source files the rest of the program is the same as the B1 example, using the B1 cmakelist file.

But when I run it, I have a problem, if I fire one particle then the program works. If I fire more than one particle, the program crashes and the following error appears.

I don’t know what causes this problem, does anyone know please? Thank you all for your replies.

The error message isn’t complete in that the first line shows [PID=5549, TID=7][14/26] so there are 14-15 lines above this, the first few being where the error occurs. Post that and we’ll get a better idea of what’s happening.

In general, it’s far better and clearer to copy and paste the text directly into the post rather than a screenshot. It can be posted between “fenced code blocks” to format it correctly, i.e. between three backticks like:

```
[PID=5549, TID=7][14/26] ...
```

to display as

[PID=5549, TID=7][14/26] ...
### CAUGHT SIGNAL: 11 ### address: 0x42a00000000,  signal =  SIGSEGV, value =   11, description = segmentation violation. Address not mapped to object.

Backtrace:
[PID=2786, TID=3][ 0/15]> /lib/x86_64-linux-gnu/libc.so.6(rewind+0xd) [0x7f0ddd6119ed]
[PID=2786, TID=3][ 1/15]> ./exampleB1(+0xee24) [0x55b103951e24]
[PID=2786, TID=3][ 2/15]> ./exampleB1(+0x1266c) [0x55b10395566c]
[PID=2786, TID=3][ 3/15]> ./exampleB1(+0xa698) [0x55b10394d698]
[PID=2786, TID=3][ 4/15]> /opt/geant4/geant4-install/lib/libG4run.so(_ZN12G4RunManager14RunTerminationEv+0x42) [0x7f0dde78f492]
[PID=2786, TID=3][ 5/15]> /opt/geant4/geant4-install/lib/libG4tasking.so(_ZN22G4WorkerTaskRunManager14RunTerminationEv+0x4e) [0x7f0dde8516ee]
[PID=2786, TID=3][ 6/15]> /opt/geant4/geant4-install/lib/libG4ptl.so.0(+0x1b543) [0x7f0ddd9a3543]
[PID=2786, TID=3][ 7/15]> /opt/geant4/geant4-install/lib/libG4tasking.so(_ZNSt13__future_base13_State_baseV29_M_do_setEPSt8functionIFSt10unique_ptrINS_12_Result_baseENS3_8_DeleterEEvEEPb+0x2d) [0x7f0dde8426fd]
[PID=2786, TID=3][ 8/15]> /lib/x86_64-linux-gnu/libpthread.so.0(+0x114df) [0x7f0dda4374df]
[PID=2786, TID=3][ 9/15]> /opt/geant4/geant4-install/lib/libG4ptl.so.0(+0x194e7) [0x7f0ddd9a14e7]
[PID=2786, TID=3][10/15]> /opt/geant4/geant4-install/lib/libG4ptl.so.0(_ZN3PTL10ThreadPool14execute_threadEPNS_14VUserTaskQueueE+0x351) [0x7f0ddd99d6d1]
[PID=2786, TID=3][11/15]> /opt/geant4/geant4-install/lib/libG4ptl.so.0(_ZN3PTL10ThreadPool12start_threadEPS0_PSt6vectorISt10shared_ptrINS_10ThreadDataEESaIS5_EEl+0x1a3) [0x7f0ddd99de33]
[PID=2786, TID=3][12/15]> /lib/x86_64-linux-gnu/libstdc++.so.6(+0xd6de4) [0x7f0ddd86bde4]
[PID=2786, TID=3][13/15]> /lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7f0dda42e609]
[PID=2786, TID=3][14/15]> /lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f0ddd6a5133]

Hi
I really appreciate your reply, I just started using this forum in the past few months, and there are some parts about the forum that I don’t know very well yet. Thank you for your guidance. I have pasted the 0-15 content and appreciate your help.

So the backtrace you’ve posted doesn’t have any information about which actual functions (or source lines) were involved. That’s the behaviour when you compile what CMake calls a “Release” build. I don’t think you need all the Geant4 debugging symbols, but you will find it useful to build your example with debugging enabled.

To do that, configure your exampleB1 with

cmake -DCMAKE_BUILD_TYPE=Debug ...

(where “…” means all your other normal CMake options), and rebuild it. You’ll still get the error and traceback, but the traceback will include function names and arguments, line numbers, etc.

If you build this way, you’ll also be able to run your code in the debugger (gdb) live, and step through functions, print out variables, etc.

Thank you for your reply, I will try your suggestion.