Geant4 geometry¶
Celeritas defines mappings to the underlying Geant4 geometry objects for
integration in the rest of the code base. The
celeritas::GeantGeoParams
class manages these mappings.
Additionally, like the VecGeom and ORANGE geometry engines, it supports
navigation for individual track states (though only on CPU, and without full
support for field navigation).
-
class GeantGeoParams : public celeritas::GeoParamsInterface, public celeritas::ParamsDataInterface<GeantGeoParamsData>¶
Manage and provide access to a Geant4 geometry model.
This can be constructed directly by loading a GDML file, or in-memory using an existing physical volume. The
make_model_input
function returns the geometry hierarchy including surface definitions for optical physics. Thegeant_to_id
andid_to_geant
functions provide mappings between Geant4 pointers and Celeritas IDs.The
ImplVolumeId
used by Celeritas is equal to the index of aG4LogicalVolume
in theG4LogicalVolumeStore
. Due to potential resetting of the geometry, the internal Geant4 ID for the volume may be offset from this index. Currently theImplVolumeId
maps exactly to theVolumeId
value: some volumes may be unreachable by the world hierarchy.In general, the
G4VPhysicalVolume
is equivalent to the index in its store. However, due to the way Geant4 represents “parameterised” and “replicated” placements, a single G4PV may correspond to multiple spatial placements. Celeritas disambiguates and maps each replicated instance to a distinctVolumeInstanceId
(seedetail::GeantVolumeInstanceMapper
). When querying this ID from an in-memory physical volume, the returned value uses the G4PV’s current state (i.e., the copy number). Similarly, callingid_to_geant
on a volume instance ID for a replica volume will change the thread-local state of theG4VPhysicalVolume
.Each
SurfaceId
maps to aG4LogicalSurface
instance, which is ether aG4LogicalBorderSurface
(an “interface” surface between two volume instances) or aG4LogicalSkinSurface
(a “boundary” surrounding a single logical volume). To ensure reproducible surface IDs across runs, we put boundaries before interfaces, and sort within each set by volume IDs (not by Geant4 object pointers, which is what the Geant4 implementation stores in a table). Surface labels are accessed via the SurfaceParams object, which can be created by the model input returned by this class.