Interfaces¶
These classes manage access to geometric information throughout the codebase.
They work in tandem with celeritas::GeantGeoParams
to associate
volume identifiers with Geant4 runtime data structures.
-
class VolumeParams¶
Define and manage a hierarchy of volumes and instances thereof.
See the introduction to the Geometry API section for a detailed description of volumes in the detector geometry description. This class abstracts the graph of user-defined volumes, relating nodes (VolumeId, aka logical volume) to edges (VolumeInstanceId, aka physical volume) and providing the means to determine the path (VolumeUniqueInstanceId, aka touchable history) of a track state. In conjunction with
GeantGeoParams
this allows conversion between the Celeritas geometry implementation and the Geant4 geometry navigation.
-
class SurfaceParams : public celeritas::ParamsDataInterface<SurfaceParamsData>¶
Map volumetric geometry information to surface IDs.
See the introduction to the Geometry API section for a detailed description of surfaces in the detector geometry description.
The specification of surfaces using volume relationships is required by volume-based geometries such as Geant4 and VecGeom 1, so it is not currently possible to define different properties for the different faces of a volume unless those faces are surrounded by distinct geometric volumes. Since ORANGE and VecGeom 2 support true surface definitions, a future extension will allow the user to attach surface properties to, for example, different sides of a cube.
-
class GeoParamsInterface¶
Interface class for accessing host geometry metadata.
This class is implemented by
OrangeParams
to allow navigation with the ORANGE geometry implementation,VecgeomParams
for using VecGeom, andGeantGeoParams
for testing with the Geant4-provided navigator.Subclassed by celeritas::GeantGeoParams, celeritas::OrangeParams, celeritas::VecgeomParams
A few helper functions can be used to build collections (see
Data model) of ImplVolumeId
for runtime tracking (used
internally by fields, physics, etc.).
-
template<class T, class G, class F>
inline Collection<T, Ownership::value, MemSpace::host, ImplVolumeId> celeritas::build_volume_collection(G const &geo, F &&fill_value)¶ Create a “collection” that maps from ImplVolumeId to a value.
This builds collections for runtime execution using a GeoTrackView’s
impl_volume_id()
call, which requires less indirection thanvolume_id()
.Given a geometry (which is allowed to be
GeoParamsInterface
), a functionwill be called for everyT(*)(VolumeId)
ImplVolumeId
in the geometry that corresponds to a canonical volume. The resulting value will be assigned to the collection.
-
template<class T>
class VolumeMapFiller¶ Helper class to fill a volume collection from a map.
Example:
host_data.detector = build_volume_collection<DetectorId>(geo, VolumeMapFiller{det_ids});
Runtime usage¶
A geometry “track view” is the key class used to access and/or modify a geometry state. (See Data model for more discussion of views and states.) Most states are a combination of physical properties (position, direction) and logical properties (volume path, surface, surface side).
The track view provides mutators for changing the state:
The assignment operator takes a
celeritas::GeoTrackInitializer
object or a “detailed” (other state plus new direction) initializer to locate the point in the geometry hierarchy.move_to_boundary
moves the track to the boundary of the current volume along the current direction, updating its logical state to indicate that it is on the boundary of the current volumecross_boundary
changes the logical state when on the boundary, updating to the next volumemove_internal
changes the physical position of the geometry state without altering the logical state (i.e., it must remain within the current volume)set_dir
changes the direction of the track (in global coordinate system)
Query operations return properties of the current state:
pos
anddir
return the physical position and direction in the global coordinate systemvolume_id
andvolume_instance_id
obtain canonical geometry information about the stateis_outside
returns whether the track has left the world (or started outside the outermost known volume)is_on_boundary
is true if a track is exactly on the boundary of a volume, capable of changing to another volume without altering the physical positionnormal
returns a global-coordinate direction perpendicular to the volume at the local point when on a boundary. The sign of the surface normal is implementation-dependent; it may change based on the track state (previous volume, direction, surface sign) or geometry construction.
Some operations return properties but update the internal state (e.g., setting a “next volume” attribute).
find_next_step
determines the distance to the next boundary (i.e., a different implementation volume) along the track’s current direction, optionally up to a given distance. Queries may be more efficient for small distances.find_safety
determines the distance to the nearest boundary in any direction (i.e., the radius of the maximally inscribed sphere), up to an optional maximum distance.