Implement offload to Celeritas from Geant4 using G4VTrackingManager hook (#1050)
* Implement concrete G4VTrackingManager for offload to Celeritas
Interface for offload of tracks to Celeritas via Geant4's G4VTrackingManager hook introduced in v11.0, complementing existing fast simulation, tracking action offload strategies.
Implementations of offload and flush largely follow those of existing fast simulation offload. Build/PreparePhysicsTable are overidden to ensure Geant4 tables for the particle(s) handled by the tracking manager are rebuilt and thus available to Celeritas to build its tables. This follows the Geant4 extended runAndEvent/RE07 example.
Restrict build of class to Geant4 11.0 and higher as abstract G4VTrackingManager interface is not available prior to that.
* Minimal example of using TrackingManagerOffload
Largely copy-paste of existing simple/fastsim offload examples, adapted for new TrackingManagerOffload class. Primary changes are:
* Custom physics constructor inheriting from G4EmStandardPhysics * Overrides ConstructProcess, taking base class defaults except for constructing a TrackingManagerOffload instance and adding this to the electron, positron, and gamma particle definitions * Replace EM physics in FTFP_BERT physics lists with this new physics constructor
* Add basic docs on TrackingManagerOffload
* Remove particle type validation
Prepare/BuildPhysicsTable have to be called before Celeritas' SharedParams can be constructed, and so the list of offloadable particles will be empty.
Remove validation check here as it cannot be run at this point.
* Log call to ConstructProcess to clarify use on master/worker
Co-authored-by: Seth R. Johnson <johnsonsr@ornl.gov>
* Add trailing full stop to satisfy Doxygen autobrief
* Test offload examples in each Geant4 threading model
For each offload example, add a test that runs it with each of Geant4's threading types:
- Serial - MT (standard C++ threads) - Tasking (PTL-based tasks+threadpool)
Only enable the latter two if the found Geant4 supports them.
* Clarify implementations of physics table functions
- Use contracts on pointers that require deref - Follow GeantImporter implementation for loop over processes
A cleaner range-based for over processes isn't possible due to G4ProcessVector not providing a directly compatible interface.