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

Read/write view to the physical properties of a single particle track. More...

#include <ParticleTrackView.hh>

Public Types

Type aliases
using ParamsRef = celeritas::NativeCRef< ParticleParamsData >
 
using StateRef = celeritas::NativeRef< ParticleStateData >
 
using Initializer_t = ParticleTrackInitializer
 
using Charge = units::ElementaryCharge
 
using Energy = units::MevEnergy
 
using Mass = units::MevMass
 
using Momentum = units::MevMomentum
 
using MomentumSq = units::MevMomentumSq
 
using Speed = units::LightSpeed
 

Public Member Functions

CELER_FUNCTION ParticleTrackView (ParamsRef const &params, StateRef const &states, TrackSlotId id)
 Construct from dynamic and static particle properties.
 
CELER_FUNCTION ParticleTrackViewoperator= (Initializer_t const &other)
 Initialize the particle.
 
CELER_FUNCTION void energy (Energy)
 Change the particle's kinetic energy. More...
 
CELER_FUNCTION void subtract_energy (Energy)
 Reduce the particle's energy without undergoing a collision [MeV].
 
CELER_FORCEINLINE_FUNCTION ParticleId particle_id () const
 Unique particle type identifier.
 
CELER_FORCEINLINE_FUNCTION Energy energy () const
 Kinetic energy [MeV].
 
CELER_FORCEINLINE_FUNCTION bool is_stopped () const
 Whether the track is stopped (zero kinetic energy).
 
CELER_FORCEINLINE_FUNCTION ParticleView particle_view () const
 Get static particle properties for the current state.
 
CELER_FORCEINLINE_FUNCTION Mass mass () const
 Rest mass [MeV / c^2].
 
CELER_FORCEINLINE_FUNCTION Charge charge () const
 Elementary charge.
 
CELER_FORCEINLINE_FUNCTION real_type decay_constant () const
 Decay constant in native units.
 
CELER_FORCEINLINE_FUNCTION bool is_antiparticle () const
 Whether it is an antiparticle.
 
CELER_FORCEINLINE_FUNCTION bool is_stable () const
 Whether particle is stable.
 
CELER_FUNCTION Energy total_energy () const
 Kinetic energy plus rest energy [MeV].
 
CELER_FUNCTION real_type beta_sq () const
 Square of \( \beta \), which is the fraction of lightspeed [unitless]. More...
 
CELER_FUNCTION Speed speed () const
 Speed [1/c]. More...
 
CELER_FUNCTION real_type lorentz_factor () const
 Lorentz factor [unitless]. More...
 
CELER_FUNCTION Momentum momentum () const
 Relativistic momentum [MeV / c]. More...
 
CELER_FUNCTION MomentumSq momentum_sq () const
 Square of relativistic momentum [MeV^2 / c^2]. More...
 

Detailed Description

Read/write view to the physical properties of a single particle track.

These functions should be used in each physics Process or Interactor or anything else that needs to access particle properties. Assume that all these functions are expensive: when using them as accessors, locally store the results rather than calling the function repeatedly. If any of the calculations prove to be hot spots we will experiment with cacheing some of the variables.

Member Function Documentation

◆ beta_sq()

CELER_FUNCTION real_type celeritas::ParticleTrackView::beta_sq ( ) const
inline

Square of \( \beta \), which is the fraction of lightspeed [unitless].

Beta is calculated using the equality

\[ pc/E = \beta ; \quad \beta^2 = \frac{p^2 c^2}{E^2} \]

. Using

\[ E^2 = p^2 c^2 + m^2 c^4 \]

and

\[ E = K + mc^2 \]

the square of the fraction of lightspeed speed is

\[ \beta^2 = 1 - \left( \frac{mc^2}{K + mc^2} \right)^2 = 1 - \gamma^{-2} \]

where \( \gamma \) is the Lorentz factor (see below).

By choosing not to divide out the mass, this expression will work for massless particles.

Todo:
For nonrelativistic particles (low kinetic energy) this expression may be inaccurate due to rounding error. It is however guaranteed to be in the exact range [0, 1].

◆ energy()

CELER_FUNCTION void celeritas::ParticleTrackView::energy ( Energy  quantity)
inline

Change the particle's kinetic energy.

This should only be used when the particle is in a valid state. For HEP applications, the new energy should always be less than the starting energy.

◆ lorentz_factor()

CELER_FUNCTION real_type celeritas::ParticleTrackView::lorentz_factor ( ) const
inline

Lorentz factor [unitless].

The Lorentz factor can be viewed as a transformation from classical quantities to relativistic quantities. It's defined as

\[ \gamma = \frac{1}{\sqrt{1 - v^2 / c^2}} \]

Its value is infinite for the massless photon, and greater than or equal to 1 otherwise.

Gamma can also be calculated from the total (rest + kinetic) energy

\[ E = \gamma mc^2 = K + mc^2 \]

which we ues here since K and m are the primary stored quantities of the particles:

\[ \gamma = 1 + \frac{K}{mc^2} \]

◆ momentum()

CELER_FUNCTION auto celeritas::ParticleTrackView::momentum ( ) const
inline

Relativistic momentum [MeV / c].

This is calculated by taking the root of the square of the momentum.

◆ momentum_sq()

CELER_FUNCTION auto celeritas::ParticleTrackView::momentum_sq ( ) const
inline

Square of relativistic momentum [MeV^2 / c^2].

Total energy:

\[ E = K + mc^2 \]

Relation between energy and momentum:

\[ E^2 = p^2 c^2 + m^2 c^4 \]

therefore

\[ p^2 = \frac{E^2}{c^2} - m^2 c^2 \]

or

\[ p^2 = \frac{K^2}{c^2} + 2 * m * K \]

◆ speed()

CELER_FUNCTION auto celeritas::ParticleTrackView::speed ( ) const
inline

Speed [1/c].

Speed is calculated using beta so that the expression works for massless particles.


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