Celeritas 0.7.0-dev.264+develop.12c52268
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 created by G4VUserPhysicsList::Construct during G4RunManager::Initialize on each thread. The tracking manager pointer is a thread-local part of the split-class data for a global G4Particle. This thread-local manager points to a corresponding thread-local transporter.

Because physics initialization also happens on the master MT thread, where no events are processed, a custom tracking manager also exists for that thread. In that case, the local transporter should be null.

Note
As of Geant4 11.3, instances of this class (one per thread) will never be deleted.
Warning
The physics does not reconstruct tracking managers on subsequent runs. Therefore the SharedParams and LocalTransporter must have lifetimes that span multiple runs (which is the case for using global/thread-local).

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. The local transporter should be null on the "master" thread of an MT 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.

◆ HandOverOneTrack()

void celeritas::TrackingManager::HandOverOneTrack ( G4Track track)
final

Offload the incoming track to Celeritas.

This will not be called in the master thread of an MT run.

◆ 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: