17.4. Time of Flight
Table of Contents
Measuring travel time
Time of flight in a Geant4 simulation is the time a particle needs to travel from some reference point, usually its creation or a detector surface, to another point of interest. In Geant4 this is expressed through the particle’s global time, which increases as the particle is transported step by step.
The global time of a track is stored in the G4Track object and can be accessed in user actions such as SteppingAction or TrackingAction. For example, inside a stepping action you can call step->GetPreStepPoint()->GetGlobalTime() to obtain the time at the beginning of the step, or step->GetPostStepPoint()->GetGlobalTime() for the time at the end of the step. These times are always expressed in Geant4 time units, for example ns, ps, or s, so you can directly convert them into convenient units when recording them.
A typical way to measure travel time to a detector is to record the global time of a track when it first enters a given logical volume. You can detect that situation by checking the volume of the pre and post step points. If the pre step point volume is different from the detector volume and the post step point volume is equal to it, then the step corresponds to the particle crossing into that detector. At that moment, the post step point global time gives you the arrival time. You can then store this time in your analysis objects, for example histograms or ntuples, using the Geant4 analysis system.
If you need the time difference between two locations, you can subtract two global time values that you have recorded at those locations. Often, you will take the global time at the detector and subtract a known emission time. If your primary particles are all created at global time zero, then the global time at the detector is directly the time of flight from the source to that detector. If particles are created with different start times, you can record the global time when each primary is generated and compute the difference event by event.
When working with time of flight, it is important to keep the distinction between global time and any other time concept in your code. Global time is advanced by Geant4 as the particle travels and undergoes interactions, and is consistent across tracks and events within the simulation framework. You should avoid inventing a parallel time variable unless you have a specific reason, for example modeling electronic delays in readout systems, and in that case you would usually start from the global time and then add your detector or electronics response model.
Always use GetGlobalTime() from the relevant step or track to measure particle travel time, and always express your timing quantities using explicit Geant4 time units such as ns or ps to avoid unit errors.
Time of flight measurements are central for detector timing studies, coincidence measurements, and time based particle identification. In each case, the practical implementation in Geant4 starts from recording global times at well defined points, then forming time differences and finally analyzing these values with histograms or other output formats.
Views: 10
KAHIBARO