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

Physics data for a track. More...

#include <PhysicsTrackView.hh>

Public Types

Type aliases
using Initializer_t = PhysicsTrackInitializer
 
using PhysicsParamsRef = NativeCRef< PhysicsParamsData >
 
using PhysicsStateRef = NativeRef< PhysicsStateData >
 
using Energy = units::MevEnergy
 
using ModelFinder = GridIdFinder< Energy, ParticleModelId >
 

Public Member Functions

CELER_FUNCTION PhysicsTrackView (PhysicsParamsRef const &params, PhysicsStateRef const &states, ParticleId particle, MaterialId material, TrackSlotId tid)
 Construct from shared and state data. More...
 
CELER_FUNCTION PhysicsTrackViewoperator= (Initializer_t const &)
 Initialize the track view.
 
CELER_FUNCTION void interaction_mfp (real_type)
 Set the distance to the next interaction, in mean free paths. More...
 
CELER_FUNCTION void reset_interaction_mfp ()
 Set the distance to the next interaction, in mean free paths. More...
 
CELER_FUNCTION void dedx_range (real_type)
 Set the energy loss range for the current material and particle energy. More...
 
CELER_FUNCTION void msc_range (MscRange const &)
 Set the range properties for multiple scattering. More...
 
CELER_FORCEINLINE_FUNCTION bool has_interaction_mfp () const
 Whether the remaining MFP has been calculated.
 
CELER_FORCEINLINE_FUNCTION real_type interaction_mfp () const
 Remaining MFP to interaction.
 
CELER_FORCEINLINE_FUNCTION real_type dedx_range () const
 Energy loss range.
 
CELER_FORCEINLINE_FUNCTION MscRange const & msc_range () const
 Persistent range properties for multiple scattering within a same volume.
 
CELER_FORCEINLINE_FUNCTION MaterialId material_id () const
 Current material identifier.
 
CELER_FUNCTION ParticleProcessId::size_type num_particle_processes () const
 Number of processes that apply to this track.
 
CELER_FUNCTION ProcessId process (ParticleProcessId) const
 Process ID for the given within-particle process index.
 
CELER_FUNCTION ValueGridId value_grid (ValueGridType table, ParticleProcessId) const
 Return value grid data for the given table type and process if available. More...
 
CELER_FUNCTION IntegralXsProcess const & integral_xs_process (ParticleProcessId ppid) const
 Get data for processes that use the integral approach. More...
 
CELER_FUNCTION real_type calc_xs (ParticleProcessId ppid, MaterialView const &material, Energy energy) const
 Calculate macroscopic cross section for the process.
 
CELER_FUNCTION real_type calc_max_xs (IntegralXsProcess const &process, ParticleProcessId ppid, MaterialView const &material, Energy energy) const
 Estimate maximum macroscopic cross section for the process over the step. More...
 
CELER_FUNCTION ModelFinder make_model_finder (ParticleProcessId) const
 Models that apply to the given process ID.
 
CELER_FUNCTION ValueTableId value_table (ParticleModelId) const
 Return value table data for the given particle/model/material. More...
 
CELER_FUNCTION TabulatedElementSelector make_element_selector (ValueTableId, Energy) const
 Construct an element selector to sample an element from tabulated xs data.
 
CELER_FUNCTION bool has_at_rest () const
 Whether the particle can have a discrete interaction at rest.
 
CELER_FUNCTION ModelId action_to_model (ActionId) const
 Convert an action to a model ID for diagnostics, false if not a model.
 
CELER_FUNCTION ActionId model_to_action (ModelId) const
 Convert a selected model ID into a simulation action ID.
 
CELER_FUNCTION ModelId model_id (ParticleModelId) const
 Get the model ID corresponding to the given ParticleModelId.
 
CELER_FUNCTION real_type range_to_step (real_type range) const
 Calculate scaled step range. More...
 
CELER_FORCEINLINE_FUNCTION PhysicsParamsScalars const & scalars () const
 Access scalar properties (options, IDs).
 
CELER_FUNCTION size_type num_particles () const
 Number of particle types.
 
template<class T >
CELER_FUNCTIONmake_calculator (ValueGridId) const
 Construct a grid calculator of the given type. More...
 
CELER_FUNCTION ModelId hardwired_model (ParticleProcessId ppid, Energy energy) const
 Return the model ID that applies to the given process ID and energy if the process is hardwired to calculate macroscopic cross sections on the fly. More...
 
CELER_FUNCTION ParticleProcessId eloss_ppid () const
 Particle-process ID of the process with the de/dx and range tables.
 

Detailed Description

Physics data for a track.

The physics track view provides an interface for data and operations common to most processes and models.

Constructor & Destructor Documentation

◆ PhysicsTrackView()

CELER_FUNCTION celeritas::PhysicsTrackView::PhysicsTrackView ( PhysicsParamsRef const &  params,
PhysicsStateRef const &  states,
ParticleId  pid,
MaterialId  mid,
TrackSlotId  tid 
)
inline

Construct from shared and state data.

Particle and material IDs are derived from other class states.

Member Function Documentation

◆ calc_max_xs()

CELER_FUNCTION real_type celeritas::PhysicsTrackView::calc_max_xs ( IntegralXsProcess const &  process,
ParticleProcessId  ppid,
MaterialView const &  material,
Energy  energy 
) const
inline

Estimate maximum macroscopic cross section for the process over the step.

If this is a particle with an energy loss process, this returns the estimate of the maximum cross section over the step. If the energy of the global maximum of the cross section (calculated at initialization) is in the interval \( [\xi E_0, E_0) \), where \( E_0 \) is the pre-step energy and \( \xi \) is min_eprime_over_e (defined by default as \( \xi = 1 - \alpha \), where \( \alpha \) is max_step_over_range), \( \sigma_{\max} \) is set to the global maximum. Otherwise, \( \sigma_{\max} = \max( \sigma(E_0), \sigma(\xi E_0) ) \). If the cross section is not monotonic in the interval \( [\xi E_0, E_0) \) and the interval does not contain the global maximum, the post-step cross section \( \sigma(E_1) \) may be larger than \( \sigma_{\max} \).

◆ dedx_range()

CELER_FUNCTION void celeritas::PhysicsTrackView::dedx_range ( real_type  range)
inline

Set the energy loss range for the current material and particle energy.

This value will be calculated once at the beginning of each step.

◆ hardwired_model()

CELER_FUNCTION ModelId celeritas::PhysicsTrackView::hardwired_model ( ParticleProcessId  ppid,
Energy  energy 
) const
inline

Return the model ID that applies to the given process ID and energy if the process is hardwired to calculate macroscopic cross sections on the fly.

If the result is null, tables should be used for this process/energy.

◆ integral_xs_process()

CELER_FUNCTION auto celeritas::PhysicsTrackView::integral_xs_process ( ParticleProcessId  ppid) const
inline

Get data for processes that use the integral approach.

Particles that have energy loss processes will have a different energy at the pre- and post-step points. This means the assumption that the cross section is constant along the step is no longer valid. Instead, Monte Carlo integration can be used to sample the interaction length for the discrete process with the correct probability from the exact distribution,

\[ p = 1 - \exp \left( -\int_{E_0}^{E_1} n \sigma(E) \dif s \right), \]

where \( E_0 \) is the pre-step energy, \( E_1 \) is the post-step energy, n is the atom density, and s is the interaction length.

At the start of the step, the maximum value of the cross section over the step \( \sigma_{max} \) is estimated and used as the macroscopic cross section for the process rather than \( \sigma_{E_0} \). After the step, the new value of the cross section \( \sigma(E_1) \) is calculated, and the discrete interaction for the process occurs with probability

\[ p = \frac{\sigma(E_1)}{\sigma_{\max}}. \]

See section 7.4 of the Geant4 Physics Reference (release 10.6) for details.

◆ interaction_mfp()

CELER_FUNCTION void celeritas::PhysicsTrackView::interaction_mfp ( real_type  mfp)
inline

Set the distance to the next interaction, in mean free paths.

This value will be decremented at each step.

◆ make_calculator()

template<class T >
CELER_FUNCTION T celeritas::PhysicsTrackView::make_calculator ( ValueGridId  id) const
inline

Construct a grid calculator of the given type.

The calculator must take two arguments: a reference to XsGridRef, and a reference to the Values data structure.

◆ msc_range()

CELER_FUNCTION void celeritas::PhysicsTrackView::msc_range ( MscRange const &  msc_range)
inline

Set the range properties for multiple scattering.

These values will be calculated at the first step in every tracking volume.

◆ range_to_step()

CELER_FUNCTION real_type celeritas::PhysicsTrackView::range_to_step ( real_type  range) const
inline

Calculate scaled step range.

This is the updated step function given by Eq. 7.4 of Geant4 Physics Reference Manual, Release 10.6:

\[ s = \alpha r + \rho (1 - \alpha) (2 - \frac{\rho}{r}) \]

where alpha is max_step_over_range and rho is min_range .

Below min_range, no step scaling is applied, but the step can still be arbitrarily small.

◆ reset_interaction_mfp()

CELER_FUNCTION void celeritas::PhysicsTrackView::reset_interaction_mfp ( )
inline

Set the distance to the next interaction, in mean free paths.

This value will be decremented at each step.

◆ value_grid()

CELER_FUNCTION auto celeritas::PhysicsTrackView::value_grid ( ValueGridType  table_type,
ParticleProcessId  ppid 
) const
inline

Return value grid data for the given table type and process if available.

If the result is not null, it can be used to instantiate a grid Calculator.

If the result is null, it's likely because the process doesn't have the associated value (e.g. if the table type is "energy_loss" and the process is not a slowing-down process).

◆ value_table()

CELER_FUNCTION ValueTableId celeritas::PhysicsTrackView::value_table ( ParticleModelId  pmid) const
inline

Return value table data for the given particle/model/material.

A null result means either the model is material independent or the material only has one element, so no cross section CDF tables are stored.


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