Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phs source fixed segmentation fault (#328) #407

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tbaudier
Copy link
Contributor

@tbaudier tbaudier force-pushed the phsSourceCodeEnhancements_merge_test branch from c7174a0 to 8bf79cb Compare May 16, 2024 13:17
@tbaudier
Copy link
Contributor Author

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.

GitFuchs and others added 2 commits May 29, 2024 11:24
Fixed segmentation faults due to wrong variable type when passing from python to cpp. Was double, should be float

* Enforce correct data type on python side (in case different data types in root file or delivered via uproot

* restructured data transfer from python to cpp

* minor adjustments

* added method to rotate the phase space source in addition to movement required by treatment plan for treatment plan phs source

* fixed wrongly initialized value for entry_start for multithreaded mode

* fixed initialization for multithreading of phs source

* Update phspsources.py

In multithreading mode
entry_start needs to be an array containing one entry for every thread.
If it is not created by the user,
create a entry_start array with the correct number of start entries
all entries are spaced by the ceil(number of particles/thread)+1

* added improved initialization of starting values for phase space files and sources in multi threading

* Improved phase space source documentation

---------

Co-authored-by: Thomas BAUDIER <thomas.baudier@creatis.insa-lyon.fr>
@tbaudier tbaudier force-pushed the phsSourceCodeEnhancements_merge_test branch from c218fc8 to b792627 Compare May 29, 2024 09:24
@tbaudier
Copy link
Contributor Author

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants