How to Specify Physics Processes¶
Physics Processes¶
Physics processes describe how particles interact with materials. Geant4 provides seven major categories of processes:
electromagnetic,
hadronic,
transportation,
decay,
optical,
photolepton_hadron, and
parameterisation.
All physics processes are derived from the G4VProcess
base class.
Its virtual methods
AtRestDoIt
,AlongStepDoIt
, andPostStepDoIt
and the corresponding methods
AtRestGetPhysicalInteractionLength
,AlongStepGetPhysicalInteractionLength
, andPostStepGetPhysicalInteractionLength
describe the behavior of a physics process when they are implemented in a derived class. The details of these methods are described in Physics Processes.
The following are specialized base classes to be used for simple processes:
G4VAtRestProcess
Processes with only
AtRestDoIt
G4VContinuousProcess
Processes with only
AlongStepDoIt
G4VDiscreteProcess
processes with only
PostStepDoIt
Another 4 virtual classes, such as G4VContinuousDiscreteProcess
, are
provided for complex processes.
Managing Processes¶
The G4ProcessManager
class contains a list of processes that a
particle can undertake. It has information on the order of invocation of
the processes, as well as which kind of DoIt
method is valid for
each process in the list. A G4ProcessManager
object corresponds to
each particle and is attached to the G4ParticleDefiniton
class.
In order to validate processes, they should be registered with the
particle’s G4ProcessManager
. Process ordering information is
included by using the AddProcess()
and SetProcessOrdering()
methods. For registration of simple processes, the
AddAtRestProcess()
, AddContinuousProcess()
and
AddDiscreteProcess()
methods may be used.
G4ProcessManager
is able to turn some processes on or off during a
run by using the ActivateProcess()
and InActivateProcess()
methods. These methods are valid only after process registration is
complete, so they must not be used in the PreInit phase.
The G4VUserPhysicsList
class creates and attaches
G4ProcessManager
objects to all particle classes defined in the
ConstructParticle()
method.
Specifying Physics Processes¶
G4VUserPhysicsList
is the base class for a “mandatory user class”
(see How to Define the main() Program), in which all physics processes and
all particles required in a simulation must be registered. The user must
create a class derived from G4VUserPhysicsList
and implement the
pure virtual method ConstructProcess()
.
For example, if just the G4Geantino
particle class is required, only
the transportation process need be registered. The
ConstructProcess()
method would then be implemented as follows:
void MyPhysicsList::ConstructProcess()
{
// Define transportation process
AddTransportation();
}
Here, the AddTransportation()
method is provided in the
G4VUserPhysicsList
class to register the G4Transportation
class
with all particle classes. The G4Transportation
class (and/or
related classes) describes the particle motion in space and time. It is
the mandatory process for tracking particles.
In the ConstructProcess()
method, physics processes should be
created and registered with each particle’s instance of
G4ProcessManager
.
An example of process registration is given in the
G4VUserPhysicsList
::AddTransportation()
method.
Registration in G4ProcessManager
is a complex procedure for other
processes and particles because the relations between processes are
crucial for some processes. In order to ease registration procedures,
G4PhysicsListHelper is provided. Users do not care about type of
processes (i.e. AtRest and/or Discrete and/or Continuous ) or ordering
parameters.
An example of electromagnetic process registration for the gamma is shown below
void MyPhysicsList::ConstructProcess()
{
// Define transportation process
AddTransportation();
// electromagnetic processes
ConstructEM();
}
void MyPhysicsList::ConstructEM()
{
// Get pointer to G4PhysicsListHelper
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
// Get pointer to gamma
G4ParticleDefinition* particle = G4Gamma::GammaDefinition();
// Construct and register processes for gamma
ph->RegisterProcess(new G4PhotoElectricEffect(), particle);
ph->RegisterProcess(new G4ComptonScattering(), particle);
ph->RegisterProcess(new G4GammaConversion(), particle);
ph->RegisterProcess(new G4RayleighScattering(), particle);
}