How to Specify Particles¶
G4VUserPhysicsList
is one of the mandatory user base classes
described in How to Define the main() Program. Within this class all
particles and physics processes to be used in your simulation must be
defined. The range cut-off parameter should also be defined in this
class.
The user must create a class derived from G4VuserPhysicsList
and
implement the following pure virtual methods:
ConstructParticle(); // construction of particles
ConstructProcess(); // construct processes and register them to particles
The user may also want to override the default implementation of the following virtual method:
SetCuts(); // setting a range cut value for all particles
This section provides some simple examples of the
ConstructParticle()
and SetCuts()
methods. For information on
ConstructProcess()
methods, please see
How to Specify Physics Processes.
Particle Definition¶
Geant4 provides various types of particles for use in simulations:
ordinary particles, such as electrons, protons, and gammas
resonant particles with very short lifetimes, such as vector mesons and delta baryons
nuclei, such as deuteron, alpha, and heavy ions (including hyper-nuclei)
quarks, di-quarks, and gluon
Each particle is represented by its own class, which is derived from
G4ParticleDefinition
. (Exception: G4Ions represents all heavy
nuclei. Please see Particles.) Particles are organized into
six major categories:
lepton,
meson,
baryon,
boson,
shortlived and
ion,
each of which is defined in a corresponding sub-directory under
geant4/source/particles
. There is also a corresponding granular
library for each particle category.
The G4ParticleDefinition
Class¶
G4ParticleDefinition
has properties which characterize individual
particles, such as, name, mass, charge, spin, and so on. Most of these
properties are “read-only” and can not be changed directly.
G4ParticlePropertyTable
is used to retrieve (load) particle property
of G4ParticleDefinition
into (from) G4ParticlePropertyData
.
How to Access a Particle¶
Each particle class type represents an individual particle type, and each class has a single object. This object can be accessed by using the static method of each class. There are some exceptions to this rule; please see Particles for details.
For example, the class G4Electron
represents the electron and the
member G4Electron::theInstance
points its only object. The pointer
to this object is available through the static methods
G4Electron::ElectronDefinition()
. G4Electron::Definition()
.
More than 100 types of particles are provided by default, to be used in various physics processes. In normal applications, users will not need to define their own particles.
The unique object for each particle class is created when its static method to get the pointer is called at the first time. Because particles are dynamic objects and should be instantiated before initialization of physics processes, you must explicitly invoke static methods of all particle classes required by your program at the initialization step. (NOTE: The particle object was static and created automatically before 8.0 release)
Dictionary of Particles¶
The G4ParticleTable
class is provided as a dictionary of particles.
Various utility methods are provided, such as:
FindParticle(G4String name); // find the particle by name
FindParticle(G4int PDGencoding) // find the particle by PDG encoding .
G4ParticleTable
is defined as a singleton object, and the static
method G4ParticleTable::GetParticleTable()
provides its pointer.
As for heavy ions (including hyper-nuclei), objects are created
dynamically by requests from users and processes. The
G4ParticleTable
class provides methods to create ions, such as:
G4ParticleDefinition* GetIon( G4int atomicNumber,
G4int atomicMass,
G4double excitationEnergy);
Particles are registered automatically during construction. The user has no control over particle registration.
Constructing Particles¶
ConstructParticle()
is a pure virtual method, in which the static
member functions for all the particles you require should be called.
This ensures that objects of these particles are created.
Warning
You must define “ALL PARTICLE TYPES” which are used in your application, except for heavy ions. “ALL PARTICLE TYPES” means not only primary particles, but also all other particles which may appear as secondaries generated by physics processes you use. Beginning with Geant4 version 8.0, you should keep this rule strictly because all particle definitions are revised to “non-static” objects.
For example, suppose you need a proton and a geantino, which is a
virtual particle used for simulation and which does not interact with
materials. The ConstructParticle()
method is implemented as below:
void MyPhysicsList::ConstructParticle()
{
G4Proton::ProtonDefinition();
G4Geantino::GeantinoDefinition();
}
Due to the large number of pre-defined particles in Geant4, it is cumbersome to list all the particles by this method. If you want all the particles in a Geant4 particle category, there are six utility classes, corresponding to each of the particle categories, which perform this function:
G4BosonConstructor
G4LeptonConstructor
G4MesonConstructor
G4BaryonConstructor
G4IonConstructor
G4ShortlivedConstructor
.
An example of this is shown in ExN05PhysicsList
, listed below.
void ExN05PhysicsList::ConstructLeptons()
{
// Construct all leptons
G4LeptonConstructor pConstructor;
pConstructor.ConstructParticle();
}
Range Cuts¶
To avoid infrared divergence, some electromagnetic processes require a
threshold below which no secondary will be generated. Because of this
requirement, gammas, electrons and positrons require production
threshold. This threshold should be defined as a distance, or range
cut-off, which is internally converted to an energy for individual
materials. The range threshold should be defined in the initialization
phase using the SetCuts()
method of G4VUserPhysicsList
.
Cuts per Region discusses threshold and tracking cuts in detail.
Setting the cuts¶
Production threshold values should be defined in SetCuts()
which is
a virtual method of the G4VUserPhysicsList
. Construction of
particles, materials, and processes should precede the invocation of
SetCuts()
. G4RunManager
takes care of this sequence in usual
applications.
This range cut value is converted threshold energies for each material and for each particle type (i.e. electron, positron and gamma) so that the particle with threshold energy stops (or is absorbed) after traveling the range cut distance. In addition, from the 9.3 release ,this range cut value is applied to the proton as production thresholds of nuclei for hadron elastic processes. In this case, the range cut value does not means the distance of traveling. Threshold energies are calculated by a simple formula from the cut in range.
Note that the upper limit of the threshold energy is defined as 10 GeV. If you want to set higher threshold energy, you can change the limit by using “/cuts/setMaxCutEnergy” command before setting the range cut.
The idea of a “unique cut value in range” is one of the important features of Geant4 and is used to handle cut values in a coherent manner. For most applications, users need to determine only one cut value in range, and apply this value to gammas, electrons and positrons alike. (and proton too)
The default implementation of SetCuts()
method provides a
defaultCutValue
member as the unique range cut-off value for all
particle types. The defaultCutValue
is set to 1.0 mm by default.
User can change this value by SetDefaultCutValue()
The “/run/setCut”
command may be used to change the default cut value interactively.
Warning
DO NOT change cut values inside the event loop. Cut values may however be changed between runs.
It is possible to set different range cut values for gammas, electrons
and positrons by using SetCutValue()
methods (or using
“/run/setCutForAGivenParticle” command). However, user must be careful
with physics outputs because Geant4 processes (especially energy loss)
are designed to conform to the “unique cut value in range” scheme.
Beginning with Geant4 version 5.1, it is now possible to set production thresholds for each geometrical region. This new functionality is described in Cuts per Region.