Celeritas  0.5.0-86+4a8eea4
Public Member Functions | List of all members
celeritas::SimpleOffload Class Reference

Compressed interface for running Celeritas in a multithread Geant4 app. More...

#include <SimpleOffload.hh>

Public Member Functions

 SimpleOffload ()=default
 Construct with celeritas disabled.
 
 SimpleOffload (SetupOptions const *setup, SharedParams *params, LocalTransporter *local)
 Construct from a reference to shared params and local data. More...
 
void Build (SetupOptions const *setup, SharedParams *params, LocalTransporter *local)
 Lazy initialization of this class on a worker thread.
 
void BuildForMaster (SetupOptions const *setup, SharedParams *params)
 Lazy initialization of this class on the master thread.
 
void BeginOfRunAction (G4Run const *run)
 Initialize celeritas data from setup options.
 
void BeginOfEventAction (G4Event const *event)
 Send Celeritas the event ID and reseed the Celeritas RNG.
 
void PreUserTrackingAction (G4Track *track)
 Send tracks to Celeritas if applicable and "StopAndKill" if so.
 
void EndOfEventAction (G4Event const *event)
 Flush offloaded tracks from Celeritas.
 
void EndOfRunAction (G4Run const *run)
 Finalize Celeritas.
 
 operator bool () const
 Whether offloading is enabled.
 

Detailed Description

Compressed interface for running Celeritas in a multithread Geant4 app.

This class must be a thread-local instance with references to data that exceed the lifetime of the class: e.g. SharedParams can be a global variable, and LocalTransporter can be a global variable with thread_local storage duration.

The CELER_DISABLE environment variable, if set and non-empty, will disable offloading so that Celeritas will not be built nor kill tracks.

The method names correspond to methods in Geant4 User Actions and must be called from all threads, both worker and master.

Constructor & Destructor Documentation

◆ SimpleOffload()

celeritas::SimpleOffload::SimpleOffload ( SetupOptions const *  setup,
SharedParams params,
LocalTransporter local 
)

Construct from a reference to shared params and local data.

On construction, this will check for the CELER_DISABLE variable and disable offloading if set. Otherwise it will initialize the multithread logging if the run manager is initialized.


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