## Geant4 Particle Transportation » History » Version 10

« Previous - Version 10/11 (diff) - Next » - Current version
Soon Jun, 06/17/2015 07:03 PM

# Geant4 Particle Transportation¶

## Top-Down Transportation Chain:¶

1. test the existence of a magnetic field and whether the particle is charged
if(charged particle && non-zero-BField) G4PropagatorInField::ComputeStep in http://www-geant4.kek.jp/lxr/source/geometry/navigation/src/G4PropagatorInField.cc
else G4Navigator::ComputeStep in http://www-geant4.kek.jp/lxr/source/geometry/navigation/src/G4Navigator.cc
2. determine epsilon (local error bound) using DeltaOneStep (distance unit, default = 0.01 mm), epsilonMin and epsilonMax (unit-less),
and the given physical step size (h)
```epsilon = DeltaOneStep / ProposedStepLength
if(epsilon < epsilonMin) epsilon = epsilonMin            (for the case that h is relatively a small step)
if(epsilon > epsilonMax) epsilon = epsilonMax            (for the case that h is relatively a large step)
```
see again G4PropagatorInField::ComputeStep http://www-geant4.kek.jp/lxr/source/geometry/navigation/src/G4PropagatorInField.cc
3. do-while loop inside G4PropagatorInField::ComputeStep
until sum(h_i) < step where
h_i (step length taken) = G4ChordFinder::AdvanceChordLimited in http://www-geant4.kek.jp/lxr/source/geometry/magneticfield/src/G4ChordFinder.cc
and find the crossing point if the resultant chord intersects with a geometrical boundary with
IntersectChord in http://www-geant4.kek.jp/lxr/source/geometry/navigation/src/G4MultiLevelLocator.cc
The accuracy of the intersection is controlled by DeltaIntersection (distance unit, default = 1 micron) which is the distance between the segment and
the ending position of the stepper near the volume boundary by the iterative approach inside the routine.
4. test for a quick advance or an accurate advance inside G4ChordFinder::AdvanceChordLimited
do while QuickAdvance if (delta < DeltaChord) where delta is the shortest distance to chord (sagitta) and DeltaChord is the miss-distance (default = 0.25mm or set to the smallest volume dimension)
then if (step possible x epsilon) > epsilon0) invoke G4MagInt_Driver::AccurateAdvance in http://www-geant4.kek.jp/lxr/source/geometry/magneticfield/src/G4MagIntegratorDriver.cc
where epsilon0 is the local truncated error from the stepper
5. G4MagInt_Driver::AccurateAdvance test for h_i < stepMinimum (do-while loop until sum(h_i) < hstep) where stepMinimum is the minimum step size for G4MagInt_Driver::QuickAdvance
(otherwise, use G4MagInt_Driver::OneGoodStep) - h_i is calculated by either QuickAdvance or AccurateAdvance.
6. G4MagInt_Driver::QuickAdvance
OneGoodStep loops over the Stepper and evaluates the truncation error (for-loop test epsilon0 < epsilon before break) (and then adjust the step size control if necessary)
G4MagInt_Driver::QuickAdvance call Stepper and DistanceChord
default Stepper: G4ClassicalRK4::DumbStepper in http://www-geant4.kek.jp/lxr/source/geometry/magneticfield/src/G4ClassicalRK4.cc
7. G4ClassicalRK4::Stepper calls G4EquationOfMotion::EvaluateRhsReturnB in http://www-geant4.kek.jp/lxr/source/geometry/magneticfield/src/G4EquationOfMotion.cc
8. G4EquationOfMotion::EvaluateRhsReturnB calls G4MagneticField::GetFieldValue (pure virtual) in http://www-geant4.kek.jp/lxr/source/geometry/magneticfield/include/G4MagneticField.hh