Physics Table¶
General Concepts¶
In Geant4, physics processes use many tables of cross sections, energy
losses and other physics values. Before the execution of an event loop,
PreparePhysicsTable()
and BuildPhysicsTable()
methods of
G4VProcess
are invoked for all processes and as a part of
initialisation procedure cross section tables are prepared. Energy loss
processes calculate cross section and/or energy loss values for each
pair of material and production cut value used in geometry for a give
run. A change in production cut values therefore require these cross
sections to be re-calculated. Cross sections for hadronic processes and
gamma processes do not depend on the production cut but sampling of
final state may depend on cuts, so full re-initialisation is performed.
The G4PhysicsTable
class is used to handle cross section tables.
G4PhysicsTable
is a collection of instances of G4PhysicsVector
(and derived classes), each of which has cross section values for a
particle within a given energy range traveling in a material. By default
the linear interpolation is used, alternatively spline may be used if
the flag of spline is activated by SetSpline method of the
G4PhysicsVector
Material-Cuts Couple¶
Users can assign different production cuts to different regions (see Cuts per Region). This means that if the same material is used in regions with different cut values, the processes need to prepare several different cross sections for that material.
The G4ProductionCutsTable
has G4MaterialCutsCouple
objects, each
of which consists of a material paired with a cut value. These
G4MaterialCutsCouple
s are numbered with an index which is the same
as the index of a G4PhysicsVector
for the corresponding
G4MaterialCutsCouple
in the G4PhysicsTable
. The list of
MaterialCutsCouples used in the current geometry setup is updated
before starting the event loop in each run.
File I/O for the Physics Table¶
Calculated physics tables for electromagnetic processes can be stored in files. The user may thus eliminate the time required for the calculation of physics tables by retrieving them from the files.
Using the built-in user command “storePhysicsTable” (see Built-in Commands), stores physics tables in files. Information on materials and cuts defined in the current geometry setup are stored together with physics tables because calculated values in the physics tables depend on MaterialCutsCouple. Note that physics tables are calculated before the event loop, not in the initialization phase. So, at least one event must be executed before using the “storePhysicsTable” command.
Calculated physics tables can be retrieved from files by using the “retrievePhysicsTable” command. Materials and cuts from files are compared with those defined in the current geometry setup, and only physics vectors corresponding to the MaterialCutsCouples used in the current setup are restored. Note that nothing happens just after the “retrievePhysicsTable” command is issued. Restoration of physics tables will be executed in parallel with the calculation of physics tables.
Building the Physics Table¶
In the G4RunManagerKernel::RunInitialization()
method, after the
list of MaterialCutsCouples is updated, the
G4VUserPhysicsList::BuildPhysicsTable()
method is invoked to build
physics tables for all processes.
Initially, the G4VProcess::PreparePhysicsTable()
method is invoked.
Each process creates G4PhysicsTable
objects as necessary. It then
checks whether the MaterialCutsCouples have been modified after a
run to determine if the corresponding physics vectors can be used in the
next run or need to be re-calculated.
Next, the G4VProcess::RetrievePhysicsTable()
method is invoked if
the G4VUserPhysicsList::fRetrievePhysicsTable
flag is asserted.
After checking materials and cuts in files, physics vectors
corresponding to the MaterialCutsCouples used in the current setup
are restored.
Finally, the G4VProcess::BuildPhysicsTable()
method is invoked and
only physics vectors which need to be re-calculated are built.
At the end of program G4PhysicsTable
should be deleted. Before
deletion of a table it should be cleaned up using the method
G4PhysicsTable::clearAndDestroy()
. This method should be called in a
middle of the run if an old table is removed and a new one is created.