| Geant4 User's Guide For Application Developers Getting Started with Geant4

2.5 How to Specify Physics Processes

## 2.5.1 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`, and
- `PostStepDoIt`

and the corresponding methods

- `AtRestGetPhysicalInteractionLength`,
- `AlongStepGetPhysicalInteractionLength`, and
- `PostStepGetPhysicalInteractionLength`

describe the behavior of a physics process when they are implemented in a derived class. The details of these methods are described in Section 5.2.

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.

## 2.5.2 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.

## 2.5.3 Specifying Physics Processes

G4VUserPhysicsList is the base class for a "mandatory user class" (see Section 2.1), 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 ExN01PhysicsList::ConstructProcess()
      {
        // Define transportation process
        AddTransportation();
      }
Source listing 2.5.1 Register processes for a geantino.

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. Please see Section 5.2 and the example codes.

An example of electromagnetic process registration for photons is shown below:

    void MyPhysicsList::ConstructProcess()
    {
      // Define transportation process
      AddTransportation();
      // electromagnetic processes
      ConstructEM();
    }
    void MyPhysicsList::ConstructEM()
    {
       //  Get the process manager for gamma
      G4ParticleDefinition* particle = G4Gamma::GammaDefinition();
      G4ProcessManager* pmanager = particle->GetProcessManager();

      // Construct processes for gamma
      G4PhotoElectricEffect * thePhotoElectricEffect = new G4PhotoElectricEffect();
      G4ComptonScattering * theComptonScattering = new G4ComptonScattering();
      G4GammaConversion* theGammaConversion = new G4GammaConversion();

      // Register processes to gamma's process manager
      pmanager->AddDiscreteProcess(thePhotoElectricEffect);
      pmanager->AddDiscreteProcess(theComptonScattering);
      pmanager->AddDiscreteProcess(theGammaConversion);
    }
Source listing 2.5.2 Register processes for a gamma.

About the authors