17.2. Interaction Position
Table of Contents
Pre-step position
Every simulation step in Geant4 has a well-defined starting point called the pre-step point. This pre-step point is represented by a G4StepPoint object and is obtained from a G4Step through the method GetPreStepPoint(). From this object you can query the particle position at the beginning of the step.
The pre-step position is a three-dimensional vector in global coordinates. You typically access it in C++ like this:
G4StepPoint* pre = step->GetPreStepPoint();
G4ThreeVector posPre = pre->GetPosition();
G4double xPre = posPre.x();
G4double yPre = posPre.y();
G4double zPre = posPre.z();The pre-step position answers the question: “Where was the particle just before this step started?” This is particularly important when the step begins at a special location, for example when the track crosses a volume boundary or when a process such as a discrete interaction starts the step.
A step often begins at one of the following situations. The track is created at its initial position. The track crosses from one volume into another. A process imposes a maximum step length and a new step starts at the endpoint of the previous one. In all these cases, the pre-step position of the current step is equal to the post-step position of the previous step for the same track, provided the track is still alive.
When you are interested in where an interaction started inside a volume, for example to record where energy deposition begins or to tag entries into a sensitive region, you often use the pre-step position together with other properties of the pre-step point, such as the volume:
G4VPhysicalVolume* preVolume =
pre->GetTouchableHandle()->GetVolume();If the step is entering a new volume, the pre-step point is located on the boundary and belongs to the incoming volume of the track. This is useful if you want to record entry positions into detectors: you check that the step status or the volume change indicates a boundary crossing, then store the pre-step position as the entry coordinate.
The pre-step position is also the natural place to evaluate quantities that depend on where a step starts. For example, you might want to apply a position-dependent threshold, or to weight energy deposited in the step according to the material at the start of the step.
Whenever you accumulate hit information at the level of steps, it is important to decide whether your “interaction position” should be associated with the pre-step or the post-step point. For entry coordinates and for effects triggered at the beginning of a step, the pre-step position is usually the correct choice.
Post-step position
The end of each step is described by the post-step point, also a G4StepPoint, obtained from GetPostStepPoint(). The post-step position is the particle position at the end of the step, in global coordinates, and is usually where the physical effect that limited the step has taken place.
You access the post-step position in C++ in a very similar way:
G4StepPoint* post = step->GetPostStepPoint();
G4ThreeVector posPost = post->GetPosition();
G4double xPost = posPost.x();
G4double yPost = posPost.y();
G4double zPost = posPost.z();The post-step point is often the most meaningful place to locate a discrete interaction. For instance, if a gamma undergoes Compton scattering, the scattering interaction is considered to happen at the post-step position of the step in which that process acted. If an ionization event produces secondaries, the creation point of these secondaries coincides with the post-step position of the parent step.
Because of this, when you want to record an interaction position in a sensitive detector, you often use the post-step point. For example, you may create a hit each time a step ends in a given volume and store the post-step position as the location of that energy deposition or interaction.
Geant4 also defines special step statuses for the post-step point, which help you interpret the post-step position. Some examples include:
fGeomBoundary step ended at a geometry boundary
fWorldBoundary step left the world volume
fPostStepDoItProc step limited by a discrete process
If the post-step status is fGeomBoundary, the post-step position lies exactly on the boundary between two volumes. In this case, the post-step volume is typically the next volume that the particle is entering. This is useful when you want to record exit positions from a detector element or entrance positions into the next region using the post-step point.
For continuous processes such as energy loss along the step, the interaction does not occur at a single mathematical point. Nevertheless, when you summarize the step with a single position, it is common to choose either the post-step point or a derived quantity. A simple choice is to use the post-step position as the representative interaction point for the energy deposited during that step.
In some cases, you may want the midpoint between pre-step and post-step coordinates as an effective interaction position:
G4ThreeVector posEff = 0.5*(posPre + posPost);This can be convenient when you want a better geometric representation of where an extended process deposited energy. However, for discrete processes and secondary production, the post-step position remains the authoritative location.
For discrete interactions and secondary particle production, treat the post-step position of the parent step as the interaction point. For volume entries or effects triggered at the start of a step, use the pre-step position. Consistently choose one definition and document it when recording interaction positions.
Views: 10
KAHIBARO