The G4HepEm library documentation

Contains the top level G4HepEm librray code documentation and the (current) connection to (any) Geant4 applications.

The G4HepEmRunManager code documentauion

class G4HepEmRunManager

This is the top level interface to all G4HepEm functionalities.

Author

M. Novak

Date

2020

A master object is responsible to construct, store and initialise all global (e.g. material, material-cut, element, configuartion parameter, etc) related data structures used by (at run-time), and shared among all other (worker) run managers. These need to be done only once for a given run: only once for all (e-/e+ and gamma) particles and only by the master. Additional data structures are aslo created by the master run manager that are also shared between the workers. These are data, specific for a given particle type and needs to be crated only if it’s required i.e. if the simulation of that particle needs to be done by the HepEm. These need to be created and initialised only by the master and individually for each particle when requested. All the above data objects are constructed by and stored in the master run manager and worker run managers will have only their pointer mebers to set to these unique data objects (used as read-only at run time). Beyond these shared data objects, each worker run-manager will have their own instance from the G4HepEmTLData that stores worker local data.

Public Functions

void Initialize(G4HepEmRandomEngine *theRNGEngine, int hepEmParticleIndx)

Builds or sets (data) members of run-manager.

For the master-RM it initialises i.e. builds:

  • the global data structures that are shared by all run-managers i.e. shared by all workers, processes and particles at run-time as read-only data (configuration parameters, all the elememnt, material and material- production-cuts related data structres).

  • particle specific data that are also shared by all run-managers i.e. by all workers (range, dE/dx tables for e-/e+, macroscopic cross sections and target element selectors) For a worker-RM:

  • sets all the pointer members to data that are shared among the run-managers to their master values.

  • creates and sets the worker-local data structure for each worker and sets its random engine pointer to the corresponding geant4, thread local random engine pointer.

void Clear()

Clears all data structures that has been created by calling the Initialize() method and re-sets the correspondig pointer members to null.

G4HepEmRunManager(const G4HepEmRunManager&) = delete

delete copy CTR and assigment operators

Private Functions

void InitializeGlobal()

Initialisation of all global data structures.

Extracts EM and other configuration parameters, builds all the elememnt, matrial and material-production-cuts related data structures shared by all workers, all processes and all particles at run-time as read-only data. In other words, these are the global data structures. This should be invoked by the master thread and only once!

Private Members

bool fIsMaster

Flag to indicate the master run-manager.

bool fIsInitialisedForParticle[3]

Flags to indicate if the master has been initialized for the given particle.

struct G4HepEmParameters *fTheG4HepEmParameters

=== These data are created by the Master-RM and shared among all Worker-RMs.

Collection of configuration parameters used at initialization and run time.

Private Static Attributes

static G4HepEmRunManager *gTheG4HepEmRunManagerMaster = nullptr

Pointer to the master run-manager.

The G4HepEmProcess code documentauion

class G4HepEmProcess : public G4VProcess

G4HepEm connection to Geant4 through the implementation of the Geant4 G4VProcess interface.

Author

M. Novak

Date

2020

A single instance of this process needs to be assigned to the \(e^-\) and/or to the \(e^+\) and/or the \(\gamma\) particle in the Geant4 physics list of the Geant4 application. Then, when running the application, all the physics realted information for these particles is provided to the Geant4 tracking by G4HepEm instead the native Geant4 processes.

G4VProcess is implemented as pure (Forced) discrete physics process. Since the the corresponding PostStepDoIt interface method is called in each step by the Geant4 stepping loop, this ensures that all (continous, discrete and even at reast) interactions can be implemented in a single G4HepEm function.

This Geant4 process interface implementation has a G4HepEmRunManager member that is the top level interface to all G4HepEm functionalities. All the infomation, required by the G4 tracking (i.e. physical interaction length and do it) is provided through this G4HepEmRunManager member in the appropriate AlongStep versions of these two above interafce methods.

Note

One instance should be assigned to all particles (see the TestEm3 example PhysListHepEm::ConstructProcess() interface method for example).

Note

Don’t assigne the same process twise, i.e. both the native Geant4 versions and G4HepEm, since it leads to double counting.