The G4HepEmRun
library documentation
Documentation of the run-time functionalities stored in the G4HepEmRun
library.
Particle managers
A separate manager object is designed for each particle type that is used to provide
all the information and perform all the actions related to physics. These top level
managers (G4HepEmElectronManager
for e-/e+ and G4HepEmGammaManager
for \(\gamma\) particles) can be used to obtain the physics step limits and to perform
all physics interactions in a particle transport simulation.
The two functions, through the manager provides its functionalities are the
\(\texttt{HowFar}\) : provides the information regarding how far the particle can go (along its original direction), till its next stop due to physics interaction(s)
\(\texttt{Perform}\) : performs the corresponding physics interaction(s) (including all continuous, discrete and at-rest)
Note
While each of the worker G4HepEmRunManager
objects has their
own instance of these top level managers (per particle type), a single instance
form each could also be shared by all workers since these particle manager objects
do not have any state variables.
Code documentation
-
struct G4HepEmElectronManager
The top level run-time manager for e-/e+ transport simulations.
This manager can provide the information regarding how far a given e-/e+ particle goes along its original direction till it’s needed to be stopped again because some physics interaction(s) needs to be performed. It is also responsible to perform the required interaction(s) as well.
- Author
M. Novak
- Date
2020
The two methods, through wich this manager acts on the particles, are the G4HepEmElectronManager::HowFar() and G4HepEmElectronManager::Perform(). The first provides the information regarding how far the particle can go, along its original direction, till its next stop due to physics interaction(s). The second can be used to perform the corresponding physics interaction(s). All physics interactions, relevant for HEP detector simulatios, such as
ionisation
,bremsstrahlung
,Coulomb scattering
are considered for e-/e+ withannihilation
in addition for e+, including both their continuous, discrete and at-rest parts pespectively. The accuracy of the models, used to describe these interactions, are also compatible to those used by HEP detector simulations.Each G4HepEmRunManager has its own member from this manager for e-/e+ transport. However, a single object could alos be used and shared by all the worker run managers since this G4HepEmElectronManager is stateless. All the state and thread related infomation (e.g. primary/secondary tracks or the thread local random engine) are stored in the G4HepEmTLData input argument, that is also used to deliver the effect of the actions of this manager (i.e. written into the tracks stored in the input G4HepEmTLData argument).
Public Static Functions
-
static void HowFar(struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmTLData *tlData)
Functions that provides the information regarding how far a given e-/e+ particle goes.
This functions provides the information regarding how far a given e-/e+ particle goes till it’s needed to be stopped again because some physics interaction(s) needs to be performed. The input/primary e-/e+ particle track is provided through the G4HepEmTLData input argument. The The computed physics step lenght is written directly into the input track. There is no any local (state) variable used in the computation.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
tlData – pointer to a worker-local, G4HepEmTLData object. The corresonding object is assumed to contain all the required input information in its primary G4HepEmTLData::fElectronTrack member. This member is also used to deliver the results of the function call, i.e. the computed physics step limit is written into the G4HepEmTLData::fElectronTrack (in its fGStepLength member).
- static G4HepEmHostDevice void HowFarToDiscreteInteraction (struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmElectronTrack *theElTrack)
Function that provides the information regarding how far a given e-/e+ particle goes.
This function provides the information regarding how far a given e-/e+ particle goes till it’s needed to be stopped again because a discrete interaction needs to be performed. The input/primary e-/e+ particle track is provided as G4HepEmElectronTrack which must have sampled
number-of-interaction-left
. The computed physics step length is written directly into the input track. There is no local (state) variable used in the computation.Note: This function does not involve multiple scattering!
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theElTrack – pointer to the input information of the track. The data structure must have all entries
number-of-interaction-left
sampled and is also used to deliver the results of the function call, i.e. the computed physics step limit is written into its fPStepLength member.
- static G4HepEmHostDevice void HowFarToMSC (struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmElectronTrack *theElTrack, G4HepEmRandomEngine *rnge)
Function that provides the information regarding how far a given e-/e+ particle goes.
This function provides the information regarding how far a given e-/e+ particle goes till it’s needed to be stopped again because of a MSC step limit. The input/primary e-/e+ particle track is provided as G4HepEmElectronTrack which must have sampled
number-of-interaction-left
. The computed physics step length is written directly into the input track. There is no local (state) variable used in the computation.Note: This function does not involve multiple scattering!
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theElTrack – pointer to the input information of the track, used to deliver the results of the function call, i.e.the computed physics step limit is written into its fPStepLength and fGStepLength member.
- static G4HepEmHostDevice void HowFar (struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmElectronTrack *theElTrack, G4HepEmRandomEngine *rnge)
Function that provides the information regarding how far a given e-/e+ particle goes.
This function provides the information regarding how far a given e-/e+ particle goes till it’s needed to be stopped again because some physics interaction(s) needs to be performed. The input/primary e-/e+ particle track is provided as G4HepEmElectronTrack which must have sampled
number-of-interaction-left
. The computed physics step length is written directly into the input track. There is no local (state) variable used in the computation.- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theElTrack – pointer to the input information of the track. The data structure must have all entries
number-of-interaction-left
sampled and is also used to deliver the results of the function call, i.e. the computed physics step limit is written into its fGStepLength member.
- static G4HepEmHostDevice void UpdatePStepLength (G4HepEmElectronTrack *theElTrack)
Function that updates the physical step length after the geometry step.
If MSC is active and we hit a boundary, convert the geometry step length to a true step length.
- static G4HepEmHostDevice void UpdateNumIALeft (G4HepEmElectronTrack *theElTrack)
Update the number-of-interaction-left according to the physical step length.
- Parameters:
theElTrack – pointer to the input and output information of the track.
- static G4HepEmHostDevice bool ApplyMeanEnergyLoss (struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmElectronTrack *theElTrack)
Apply the mean energy loss along the physical step length.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theElTrack – pointer to the input and output information of the track.
- static G4HepEmHostDevice void SampleMSC (struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmElectronTrack *theElTrack, G4HepEmRandomEngine *rnge)
Sample MSC direction change and displacement.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theElTrack – pointer to the input and output information of the track.
- static G4HepEmHostDevice bool SampleLossFluctuations (struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmElectronTrack *theElTrack, G4HepEmRandomEngine *rnge)
Sample loss fluctuations for the mean energy loss.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theElTrack – pointer to the input and output information of the track.
- static G4HepEmHostDevice bool PerformContinuous (struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmElectronTrack *theElTrack, G4HepEmRandomEngine *rnge)
Functions that performs all continuous physics interactions for a given e-/e+ particle.
This functions can be invoked when the particle is propagated to its post-step point to perform all continuous physics interactions. The input/primary e-/e+ particle track is provided through as G4HepEmElectronTrack. There is no local (state) variable used in the computation.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theElTrack – pointer to the input information of the track. All the results of this function call, i.e. the primary particle’s energy updated to its post-interaction(s), are also delivered through this object.
- Returns:
boolean whether the particle was stopped
- static G4HepEmHostDevice bool CheckDelta (struct G4HepEmData *hepEmData, G4HepEmTrack *theTrack, double rand)
Function to check if a delta interaction happens instead of the discrete process.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
theTrack – pointer to the input information of the track.
rand – number drawn at random
- Returns:
boolean whether a delta interaction happens
-
static void PerformDiscrete(struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmTLData *tlData)
Functions that performs the discrete interaction for a given e-/e+ particle.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
tlData – pointer to a worker-local, G4HepEmTLData object. The corresonding object is assumed to contain all the required input information in its primary G4HepEmTLData::fElectronTrack member. All the results of this function call, i.e. the primary particle updated to its post-interaction(s) state as well as the possible secondary particles, are also delivered through this G4HepEmTLData.
-
static void Perform(struct G4HepEmData *hepEmData, struct G4HepEmParameters *hepEmPars, G4HepEmTLData *tlData)
Functions that performs all physics interactions for a given e-/e+ particle.
This functions can be invoked when the particle is propagated to its post-step point to perform all physics interactions. The input/primary e-/e+ particle track is provided through the G4HepEmTLData input argument. The post-interaction(s) primary track and the secondary tracks are also provided through this G4HepEmTLData input argument. There is no any local (state) variable used in the computation.
- Parameters:
hepEmData – pointer to the top level, global, G4HepEmData structure.
hepEmPars – pointer to the global, G4HepEmParameters structure.
tlData – pointer to a worker-local, G4HepEmTLData object. The corresonding object is assumed to contain all the required input information in its primary G4HepEmTLData::fElectronTrack member. All the results of this function call, i.e. the primary particle updated to its post-interaction(s) state as well as the possible secondary particles, are also delivered through this G4HepEmTLData.
- static G4HepEmHostDevice double GetRestRange (const struct G4HepEmElectronData *elData, const int imc, const double ekin, const double lekin)
The following functions are not meant to be called directly by clients, only from tests.
Auxiliary function that evaluates and provides the
restricted range
for the given kinetic energy and material-cuts combination.- Parameters:
elData – pointer to the global e-/e+ data structure that contains the corresponding
Energy Loss
related data.imc – index of the
G4HepEm
material-cuts in which the range is requiredekin – kinetic energy of the e-/e+ at which the range is required
lekin – logarithm of the above kinetic energy
- Returns:
Restricted range
value, interpolated at the given e-/e+ kinetic energy in the given material-cuts based on the corresponding (discrete)Energy Loss
data provded as input.
-
struct G4HepEmGammaManager
The top level run-time manager for \(\gamma\) transport simulations.
It will be the same for \(\gamma\) as the G4HepEmElectronManager for e-/e+.
- Author
M. Novak
- Date
2021
-
class G4HepEmTLData
A simple data structure to store and propagate worker local data between the components.
- Author
M. Novak
- Date
2020
Each worker
G4HepEmRunManager
-s has their ownG4HepEmTLData
object (constructed in theirG4HepEmRunManager::Initialize()
method) that is used to store:the thread local random engine object pointer: to provide independent, unique source of random numbers for each worker when invoking the
G4HepEm
functionsprimary \(e^-/e^+\) and \(\gamma\) track objects: to propagate primary track state information to/from the (state-less)
G4HepEmElectronManager
/G4HepEmGammaManager
functionssecondary \(e^-/e^+\) and \(\gamma\) track buffers: to propagate secondary track information (back) from the (state-less)
G4HepEmElectronManager
/G4HepEmGammaManager
functions as well as between these particle managers and the interaction functions
Note
All state variables are stored in this
G4HepEmTLData
object inG4HepEm
.