Celeritas 0.6.0-dev.115+3b60a5fd
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::TrackingManager Class Referencefinal

Offload to Celeritas via the per-particle Geant4 "tracking manager". More...

#include <TrackingManager.hh>

Inheritance diagram for celeritas::TrackingManager:
Inheritance graph
[legend]

Public Member Functions

 TrackingManager (SharedParams const *params, LocalTransporter *local)
 Construct a tracking manager with data needed to offload to Celeritas.
 
void PreparePhysicsTable (G4ParticleDefinition const &) final
 Prepare physics tables for this particle.
 
void BuildPhysicsTable (G4ParticleDefinition const &) final
 Build physics tables for this particle.
 
void HandOverOneTrack (G4Track *aTrack) final
 Offload the incoming track to Celeritas.
 
void FlushEvent () final
 Complete processing of any buffered tracks.
 
SharedParams constshared_params () const
 Get the shared params associated with this TM.
 
LocalTransporterlocal_transporter () const
 Get the thread-local transporter.
 

Detailed Description

Offload to Celeritas via the per-particle Geant4 "tracking manager".

Tracking managers are to be created during worker action initialization and are thus thread-local. Construction/addition to G4ParticleDefinition appears to take place on the master thread, typically in the ConstructProcess method, but the tracking manager pointer is part of the split-class data for the particle. It's observed that different threads have distinct pointers to a LocalTransporter instance, and that these match those of the global thread-local instances in test problems.

Note
As of Geant4 11.3, instances of this class (one per thread) will never be deleted.

Constructor & Destructor Documentation

◆ TrackingManager()

celeritas::TrackingManager::TrackingManager ( SharedParams const params,
LocalTransporter local 
)

Construct a tracking manager with data needed to offload to Celeritas.

Note
The shared/local pointers must remain valid for the lifetime of the run.

Member Function Documentation

◆ BuildPhysicsTable()

void celeritas::TrackingManager::BuildPhysicsTable ( G4ParticleDefinition const part)
final

Build physics tables for this particle.

Messaged by the G4ParticleDefinition who stores us whenever cross-section tables have to be rebuilt (i.e. if new materials have been defined). An override is needed for Celeritas as it uses the particle's process manager and tables to initialize its own physics data for the particle, and this is disabled when a custom tracking manager is used. Note that this also means we could have filters in HandOverOneTrack to hand back the track to the general G4TrackingManager if matching a predicate(s).

The implementation follows that in G4VUserPhysicsList::BuildPhysicsTable , see also Geant4 Extended Example runAndEvent/RE07.

◆ FlushEvent()

void celeritas::TrackingManager::FlushEvent ( )
final

Complete processing of any buffered tracks.

Note that this is called in G4EventManager::DoProcessing(G4Event*) after the after the main tracking loop has completed.

That is done to allow for models that may add "onload" particles back to Geant4.

◆ PreparePhysicsTable()

void celeritas::TrackingManager::PreparePhysicsTable ( G4ParticleDefinition const part)
final

Prepare physics tables for this particle.

Messaged by the G4ParticleDefinition who stores us whenever cross-section tables have to be rebuilt (i.e. if new materials have been defined). As with BuildPhysicsTable, we override this to ensure all Geant4 process/cross-section data is available for Celeritas to use.

The implementation follows that in G4VUserPhysicsList::PreparePhysicsTable , see also Geant4 Extended Example runAndEvent/RE07.


The documentation for this class was generated from the following files: