Celeritas  0.5.0-56+6b053cd
Classes | Public Member Functions | Static Public Member Functions | List of all members
celeritas::GeantGeoTrackView Class Reference

Navigate through a Geant4 geometry on a single thread. More...

#include <GeantGeoTrackView.hh>

Classes

struct  DetailedInitializer
 Helper struct for initializing from an existing geometry state. More...
 

Public Types

Type aliases
using Initializer_t = GeoTrackInitializer
 
using ParamsRef = NativeCRef< GeantGeoParamsData >
 
using StateRef = NativeRef< GeantGeoStateData >
 
using real_type = double
 
using Real3 = Array< real_type, 3 >
 

Public Member Functions

 GeantGeoTrackView (ParamsRef const &params, StateRef const &state, TrackSlotId tid)
 Construct from params and state data.
 
GeantGeoTrackViewoperator= (Initializer_t const &init)
 Construct the state.
 
GeantGeoTrackViewoperator= (DetailedInitializer const &init)
 Construct the state from a direction and a copy of the parent state. More...
 
VolumeId volume_id () const
 Get the volume ID in the current cell.
 
VolumeInstanceId volume_instance_id () const
 Get the physical volume ID in the current cell.
 
LevelId level () const
 Get the depth in the geometry hierarchy.
 
void volume_instance_id (Span< VolumeInstanceId > levels) const
 Get the volume instance ID at every level. More...
 
bool is_outside () const
 Whether the track is outside the valid geometry region.
 
bool is_on_boundary () const
 Whether the track is on the boundary of a volume.
 
CELER_FORCEINLINE bool failed () const
 Whether the last operation resulted in an error.
 
Propagation find_next_step ()
 Find the distance to the next geometric boundary.
 
Propagation find_next_step (real_type max_step)
 Find the distance to the next geometric boundary. More...
 
real_type find_safety ()
 Find the safety at the current position.
 
CELER_FUNCTION real_type find_safety (real_type max_step)
 Find the safety at the current position. More...
 
void move_to_boundary ()
 Move to the next boundary but don't cross yet.
 
void move_internal (real_type step)
 Move within the current volume. More...
 
void move_internal (Real3 const &pos)
 Move within the current volume to a nearby point. More...
 
void cross_boundary ()
 Cross from one side of the current surface to the other. More...
 
void set_dir (Real3 const &newdir)
 Change the track's direction. More...
 
CELER_FORCEINLINE Real3 const & pos () const
 
CELER_FORCEINLINE Real3 const & dir () const
 
SurfaceId surface_id () const
 
SurfaceId next_surface_id () const
 

Static Public Member Functions

static constexpr real_type extra_push ()
 A tiny push to make sure tracks do not get stuck at boundaries.
 

Detailed Description

Navigate through a Geant4 geometry on a single thread.

This wraps a Geant4 geometry navigator and volume hierarchy state with the same Celeritas tracker interface. It's not going to be the most efficient code since the G4Navigator includes a lot of helper functions for managing safety distance, tracking through a field, etc. We also independently store a "celeritas" native position and direction, as well as duplicating the "geant4" position and direction that are also stored under the hood in the heavyweight navigator.

For a description of ordering requirements, see:

See also
OrangeTrackView .

Member Function Documentation

◆ cross_boundary()

void celeritas::GeantGeoTrackView::cross_boundary ( )
inline

Cross from one side of the current surface to the other.

The position must be on the boundary following a move-to-boundary.

◆ dir()

CELER_FORCEINLINE Real3 const& celeritas::GeantGeoTrackView::dir ( ) const
inline

State accessors

◆ find_next_step()

Propagation celeritas::GeantGeoTrackView::find_next_step ( real_type  max_step)
inline

Find the distance to the next geometric boundary.

It seems that ComputeStep cannot be called twice in a row without an intermediate call to LocateGlobalPointWithinVolume: the safety will be set to zero.

◆ find_safety()

auto celeritas::GeantGeoTrackView::find_safety ( real_type  max_step)
inline

Find the safety at the current position.

Warning
This can change the boundary state if the track was moved to or initialized a point on the boundary.

◆ move_internal() [1/2]

void celeritas::GeantGeoTrackView::move_internal ( Real3 const &  pos)
inline

Move within the current volume to a nearby point.

See G4PathFinder::ReLocate from G4SafetyHelper::ReLocateWithinVolume from G4VMultipleScattering::AlongStepDoIt .

◆ move_internal() [2/2]

void celeritas::GeantGeoTrackView::move_internal ( real_type  dist)
inline

Move within the current volume.

The straight-line distance must be less than the distance to the boundary.

◆ next_surface_id()

SurfaceId celeritas::GeantGeoTrackView::next_surface_id ( ) const
inline

VecGeom states are never "on" a surface

◆ operator=()

GeantGeoTrackView & celeritas::GeantGeoTrackView::operator= ( DetailedInitializer const &  init)
inline

Construct the state from a direction and a copy of the parent state.

G4Track::SetTouchableHandle from G4VEmProcess::PostStepDoIt

maybe see G4SteppingManager::Stepping

◆ pos()

CELER_FORCEINLINE Real3 const& celeritas::GeantGeoTrackView::pos ( ) const
inline

State accessors

◆ set_dir()

void celeritas::GeantGeoTrackView::set_dir ( Real3 const &  newdir)
inline

Change the track's direction.

This happens after a scattering event or movement inside a magnetic field. It resets the calculated distance-to-boundary.

◆ surface_id()

SurfaceId celeritas::GeantGeoTrackView::surface_id ( ) const
inline

VecGeom states are never "on" a surface

◆ volume_instance_id()

void celeritas::GeantGeoTrackView::volume_instance_id ( Span< VolumeInstanceId levels) const
inline

Get the volume instance ID at every level.

The input span size must be equal to the value of "level" plus one. The top-most level ("world" or level zero) starts at index zero and moves downward. Note that Geant4 uses the reverse nomenclature.


The documentation for this class was generated from the following file: