5.6.  Physics Table

5.6.1.  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, the BuildPhysicsTable() method of G4VProcess is 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 material and for each production cut value assigned to each material. 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.

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

5.6.2.  Material-Cuts Couple

Users can assign different production cuts to different regions (see Section 5.5). 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 G4MaterialCutsCouples are numbered with an index which is the same as the index of a G4PhysicsVector for the corresponding G4MaterialCutsCouplein the G4PhysicsTable. The list of MaterialCutsCouples used in the current geometry setup is updated before starting the event loop in each run.

5.6.3.  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 Section 7.1), 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.

5.6.4.  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. If an application is using multi-threading mode the method G4PhysicsTable::clearAndDestroy() should not be called. However, this method should be called in a middle of the run if an old table is removed and a new one is created.