How to Specify Particles/Physics processes
How to Specify Particles
In our experiment we declared our particle which is a muon because we are interested in the particles withing cosmic ray's 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. However in our code we declared a muon by
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4String particleName; G4ParticleDefinition* particle = particleTable->FindParticle(particleName="mu+"); fParticleGun->SetParticleDefinition(particle); //fParticleGun->SetParticleMomentumDirection(G4ThreeVector(xcosine,ycosine,zcosine)); // fParticleGun->SetParticleEnergy(e0);
Particles are registered automatically during construction. The user has no control over particle registration.
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);
How to Specify 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
G4VProcess
G4VProcess is the base class for all physics processes. Each physics process must implement virtual methods of G4VProcess which describe the interaction (DoIt) and determine when an interaction should occur (GPIL). In order to accommodate various types of interactions G4VProcess provides three DoIt methods:
G4VParticleChange* AlongStepDoIt( const G4Track& track, const G4Step& stepData )
This method is invoked while G4SteppingManager is transporting a particle through one step. The corresponding AlongStepDoIt for each defined process is applied for every step regardless of which process produces the minimum step length. Each resulting change to the track information is recorded and accumulated in G4Step. After all processes have been invoked, changes due to AlongStepDoIt are applied to G4Track, including the particle relocation and the safety update. Note that after the invocation of AlongStepDoIt, the endpoint of the G4Track object is in a new volume if the step was limited by a geometric boundary. In order to obtain information about the old volume, G4Step must be accessed, since it contains information about both endpoints of a step.
G4VParticleChange* PostStepDoIt( const G4Track& track, const G4Step& stepData )
This method is invoked at the end point of a step, only if its process has produced the minimum step length, or if the process is forced to occur. G4Track will be updated after each invocation of PostStepDoIt, in contrast to the AlongStepDoIt method.
G4VParticleChange* AtRestDoIt( const G4Track& track, const G4Step& stepData )
This method is invoked only for stopped particles, and only if its process produced the minimum step length or the process is forced to occur.
For each of the above DoIt methods G4VProcess provides a corresponding pure virtual GPIL method:
G4double PostStepGetPhysicalInteractionLength( const G4Track& track, G4double previousStepSize, G4ForceCondition* condition )
This method generates the step length allowed by its process. It also provides a flag to force the interaction to occur regardless of its step length.
G4double AlongStepGetPhysicalInteractionLength( const G4Track& track, G4double previousStepSize, G4double currentMinimumStep, G4double& proposedSafety, G4GPILSelection* selection )
This method generates the step length allowed by its process.
G4double AtRestGetPhysicalInteractionLength( const G4Track& track, G4ForceCondition* condition )
This method generates the step length in time allowed by its process. It also provides a flag to force the interaction to occur regardless of its step length.
Other pure virtual methods in G4VProcess follow:
virtual G4bool IsApplicable(const G4ParticleDefinition&)
returns true if this process object is applicable to the particle type.
virtual void PreparePhysicsTable(const G4ParticleDefinition&) and
virtual void BuildPhysicsTable(const G4ParticleDefinition&)
is messaged by the process manager, whenever cross section tables should be prepared and rebuilt due to changing cut-off values. It is not mandatory if the process is not affected by cut-off values.
virtual void StartTracking() and
virtual void EndTracking()
are messaged by the tracking manager at the beginning and end of tracking the current track.
How to specify the type of Physics process
The user must create a class derived from G4VUserPhysicsList and implement the pure virtual method ConstructProcess(). For a Physics process you must register the G4Transportation class with all particle classes. The AddTransportation() method is listed and provided in G4VUserPhysicsList class.
void MyPhysicsList::ConstructProcess() { // Define transportation process AddTransportation(); }