|
Geant4 User's Guide
For Application Developers
Geometry
|
4.1.8 The Geometry Navigator
Navigation through the geometry at tracking time is implemented by the class
G4Navigator. The navigator is used to locate points in the geometry
and compute distances to geometry boundaries. At tracking time, the navigator
is intended to be the only point of interaction with tracking.
Internally, the G4Navigator has several private helper/utility classes:
- G4NavigationHistory - stores the compounded transformations,
replication/parameterisation information, and volume pointers at each
level of the hierarchy to the current location. The volume types
at each level are also stored - whether normal (placement),
replicated or parameterised.
- G4NormalNavigation - provides location & distance computation
functions for geometries containing 'placement' volumes, with no voxels.
- G4VoxelNavigation - provides location and distance computation
functions for geometries containing 'placement' physical volumes with
voxels. Internally a stack of voxel information is maintained. Private
functions allow for isotropic distance computation to voxel boundaries
and for computation of the 'next voxel' in a specified direction.
- G4ParameterisedNavigation - provides location and distance
computation functions for geometries containing parameterised volumes
with voxels. Voxel information is maintained similarly to
G4VoxelNavigation, but computation can also be simpler by
adopting voxels to be one level deep only (unrefined, or 1D
optimisation)
- G4ReplicaNavigation - provides location and distance computation
functions for replicated volumes.
In addition, the navigator maintains a set of flags for exiting/entry
optimisation. A navigator is not a singleton class; this is mainly to
allow a design extension in future (e.g geometrical event biasing).
Navigation and Tracking
The main functions required for tracking in the geometry are described below.
Additional functions are provided to return the net transformation of volumes
and for the creation of touchables. None of the functions implicitly requires
that the geometry be described hierarchically.
- SetWorldVolume()
Sets the first volume in the hierarchy. It must be unrotated and
untranslated from the origin.
- LocateGlobalPointAndSetup()
Locates the volume containing the specified global point. This
involves a traverse of the hierarchy, requiring the computation of
compound transformations, testing replicated and parameterised volumes
(etc). To improve efficiency this search may be performed relative
to the last, and this is the recommended way of calling the
function. A 'relative' search may be used for the first call of the
function which will result in the search defaulting to a search from
the root node of the hierarchy.
Searches may also be performed using a G4TouchableHistory.
- LocateGlobalPointAndUpdateTouchableHandle()
First, search the geometrical hierarchy like the above method
LocateGlobalPointAndSetup(). Then use the volume found and its
navigation history to update the touchable.
- ComputeStep()
Computes the distance to the next boundary intersected along the
specified unit direction from a specified point. The point must be
have been located prior to calling ComputeStep().
When calling ComputeStep(), a proposed physics step is passed.
If it can be determined that the first intersection lies at or beyond that
distance then kInfinity is returned. In any case, if the returned
step is greater than the physics step, the physics step must be taken.
- SetGeometricallyLimitedStep()
Informs the navigator that the last computed step was taken in its
entirety. This enables entering/exiting optimisation, and should be
called prior to calling LocateGlobalPointAndSetup().
- CreateTouchableHistory()
Creates a G4TouchableHistory object, for which the caller has
deletion responsibility. The 'touchable' volume is the volume returned
by the last Locate operation. The object includes a copy of the current
NavigationHistory, enabling the efficient relocation of points
in/close to the current volume in the hierarchy.
As stated previously, the navigator makes use of utility classes to
perform location and step computation functions. The different navigation
utilities manipulate the G4NavigationHistory object.
In LocateGlobalPointAndSetup() the process of locating a
point breaks down into three main stages - optimisation,
determination that the point is contained with a subtree (mother and
daughters), and determination of the actual containing daughter. The
latter two can be thought of as scanning first 'up' the hierarchy
until a volume that is guaranteed to contain the point is found, and
then scanning 'down' until the actual volume that contains the point
is found.
In ComputeStep() three types of computation are treated
depending on the current containing volume:
- The volume contains normal (placement) daughters (or none)
- The volume contains a single parameterised volume object,
representing many volumes
- The volume is a replica and contains normal (placement) daughters
Run-time commands
When running in verbose mode (i.e. the default, G4VERBOSE
set while installing the Geant4 kernel libraries), the navigator provides
a few commands to control its behavior. It is possible to select different
verbosity levels (up to 5), with the command:
geometry/navigator/verbose [verbose_level]
or to force the navigator to run in check mode:
geometry/navigator/check_mode [true/false]
The latter will force more strict and less tolerant checks in step/safety
computation to verify the correctness of the solids' response in the
geometry.
By combining check_mode with verbosity level-1, additional verbosity
checks on the response from the solids can be activated.
About the authors