-
Notifications
You must be signed in to change notification settings - Fork 38
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
Implement step limiter (G4UserLimits) #130
Conversation
* Include Getters/Setters for UserLimits * Change return policies for Getters * set py::nodelete for G4Region to prevent python's garbage collection
… ... to be implemented)
…tput from the hook function such as SimulationEngine.user_fct_after_init()
…_limiters, cuts etc)
I just saw that PR #123 also mentions UserLimits. It's probably worth cross-checking. |
Do not merge yet. I will still extend and modify this PR. |
FYI:
|
… and WrappedG4RunManager
Update: I will do a full local run of tests over night and see what comes out. |
Another update: |
Provided a fix for broken syntax after updating colored package to v1.5 |
Implemented fixes in parallel world handling. They were due to that part being implemented in parallel to structural changes in this PR. |
Locally, i.e. on MacOS, python 3.9, all tests pass. |
In test045 (GANs), I had incorrectly copied the cut settings from the old version. Fixed now. test013_phys_list_1.py was slightly out of stat tolerance. Increased tolerance from 10% to 12%. |
This PR bundles a series of commits to implement step size limitation per volume (region) in opengate, plus some bug fixes and cosmetic improvements along the way.
It required new binding for some Geant4 classes and a thin wrapper around the G4RunManager to expose essential protected members. Changes mainly appear in Simulation and SimulationEngine classes, in VolumeManager and VolumeEngine, as well as PhysicsManager and PhysicsEngine classes.
Note 1: The initialization order in SimulationEngine.initialize was changed because initializing the step limiter requires an initialized geometry (G4RunManager.InitializeGeometry). Only then can G4RunManager.InitializePhysics be called. This has to do with the states handled by the G4StateManager. The G4RunManager.Initialize function would internally initialize geometry and physics in one go, which is incompatible with step limiter initialization.
Please refer to G4RunManager.cpp and exampleB2b in the Geant4 source.
Note 2: The step limiter is only handled correctly in single thread mode. Multithread mode would also require a wrapped RunManager (see note 1). As a temporary workaround, a check might need to be added to raise an error if a step limiter is requested in MT mode.