OpenGATE / opengate

Gate 10 (beta)
http://www.opengatecollaboration.org
GNU Lesser General Public License v3.0
41 stars 37 forks source link

Phs source fixed segmentation fault (#328) #407

Open tbaudier opened 2 months ago

tbaudier commented 2 months ago

Squash of https://github.com/OpenGATE/opengate/pull/328/files

tbaudier commented 2 months ago

The output of the test is empty @GitFuchs

(venv) (base) tbaudier@eq4-tb-693 opengate_other % python opengate/tests/src/test060_phsp_source_particletype_direct.py
Importing opengate (thread 3177842) ... done
create reference PhS file
Dispatching simulation to subprocess ...
Importing opengate (thread 3177925) ... done
Importing opengate (thread 3178006) ... done
Simulation: create RunManager (single thread)
Simulation: initialize Geometry
Simulation: initialize Physics
Simulation: initialize Source
Simulation: initialize Actors
Simulation: initialize G4RunManager
Simulation: (no volumes overlap checking)
--------------------------------------------------------------------------------
Simulation: START (in a new process)
Simulation: STOP. Run: 1. Time: 1.1 seconds.
--------------------------------------------------------------------------------
Testing PhS source particle name
world
Simulation: create RunManager (single thread)
Simulation: initialize Geometry
Simulation: initialize Physics
Simulation: initialize Source
Simulation: initialize Actors
Simulation: initialize G4RunManager
Simulation: (no volumes overlap checking)
--------------------------------------------------------------------------------
Simulation: START 
End of the phase-space 1 elements, restart from beginning. Cycle count = 1
New event 0
New track e- eid=0
Empty output, no particles stored in /Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/test060/test_source_electron.root
Simulation: STOP. Run: 1. Time: 1.1 seconds.
--------------------------------------------------------------------------------
File '/Users/tbaudier/Software/GatePython/opengate_other/opengate/tests/src/../output/test060/test_source_electron.root' does not exist.
tbaudier commented 1 month ago

Hello Hermann,

Thank you for the bug fix. I integrated inside that PR and rebase everything on master.

Unfortunately, the test test019_linac_elekta_versa_with_mlc_phsp_source.py does not work because inside the phsp used by that test, the PDGCode and Weight keys are not present, they are not necessary for the test. Do you have a solution?

Thank you Thomas

GitFuchs commented 1 month ago

Hi Thomas,

the mentioned tests work again. The code complained that the PDGCode is not present although it was not needed. I have fixed it (e.g. added an exception to only complain if something is missing if it is really needed.).

Best, Hermann