CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 > Class Template Reference

Definition of a static process list/sequence. More...

#include <ProcessSequence.hpp>

Inheritance diagram for corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >:

Public Member Functions

 ProcessSequence (ProcessSequence const &)=default
 
 ProcessSequence (ProcessSequence &&)=default
 
ProcessSequenceoperator= (ProcessSequence const &)=default
 
 ProcessSequence (TProcess1 in_A, TProcess2 in_B)
 Only valid user constructor will create fully initialized object. More...
 
template<typename TParticle >
ProcessReturn doBoundaryCrossing (TParticle &particle, typename TParticle::node_type const &from, typename TParticle::node_type const &to)
 List of all BoundaryProcess. More...
 
template<typename TParticle >
ProcessReturn doContinuous (Step< TParticle > &step, ContinuousProcessIndex const limitID)
 
template<typename TSecondaries >
void doSecondaries (TSecondaries &vS)
 Process all secondaries in TSecondaries. More...
 
bool checkStep ()
 The processes of type StackProcess do have an internal counter, so they can be exectuted only each N steps. More...
 
template<typename TStack >
void doStack (TStack &stack)
 Execute the StackProcess-es in the ProcessSequence.
 
template<typename TStack >
void doCascadeEquations (TStack &stack)
 Execute the CascadeEquationsProcess-es in the ProcessSequence.
 
void initCascadeEquations ()
 Init the CascadeEquationsProcess-es in the ProcessSequence.
 
template<typename TParticle , typename TTrack >
ContinuousProcessStepLength getMaxStepLength (TParticle &&particle, TTrack &&vTrack)
 Calculate the maximum allowed length of the next tracking step, based on all ContinuousProcess-es. More...
 
template<typename TParticle >
CrossSectionType getCrossSection (TParticle const &projectile, Code const targetId, FourMomentum const &targetP4) const
 Calculates the cross section of a projectile with a target. More...
 
template<typename TParticle >
TimeType getLifetime (TParticle &particle)
 
template<typename TSecondaryView , typename TRNG >
ProcessReturn selectInteraction (TSecondaryView &&view, FourMomentum const &projectileP4, NuclearComposition const &composition, TRNG &&rng, CrossSectionType const cx_select, CrossSectionType cx_sum=CrossSectionType::zero())
 Selects one concrete InteractionProcess and samples a target nucleus from the material. More...
 
template<typename TParticle >
InverseTimeType getInverseLifetime (TParticle &&particle)
 
template<typename TSecondaryView >
ProcessReturn selectDecay (TSecondaryView &&view, InverseTimeType decay_inv_select, InverseTimeType decay_inv_sum=InverseTimeType::zero())
 

Static Public Attributes

static bool const is_process_sequence = true
 
- Static Public Attributes inherited from corsika::BaseProcess< ProcessSequence< TProcess1, TProcess2 > >
static bool const is_process_sequence
 
static bool const is_switch_process_sequence
 

Additional Inherited Members

- Public Types inherited from corsika::BaseProcess< ProcessSequence< TProcess1, TProcess2 > >
using process_type = ProcessSequence< TProcess1, TProcess2 >
 Base processor type for use in other template classes.
 
- Protected Member Functions inherited from corsika::BaseProcess< ProcessSequence< TProcess1, TProcess2 > >
ProcessSequence< TProcess1, TProcess2 > & getRef ()
 
const ProcessSequence< TProcess1, TProcess2 > & getRef () const
 
- Protected Attributes inherited from corsika::BaseProcess< ProcessSequence< TProcess1, TProcess2 > >
friend TDerived
 

Detailed Description

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
class corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >

Definition of a static process list/sequence.

A compile time static list of processes. The compiler will generate a new type based on template logic containing all the elements provided by the user.

TProcess1 and TProcess2 must both be derived from BaseProcess, and are both references if possible (lvalue), otherwise (rvalue) they are just classes. This allows us to handle both, rvalue as well as lvalue Processes in the ProcessSequence.

(For your potential interest, the static version of the ProcessSequence and all Process types are based on the CRTP C++ design pattern).

Template parameters:

Template Parameters
TProcess1is of type BaseProcess, either a dedicatd process, or a ProcessSequence
TProcess2is of type BaseProcess, either a dedicatd process, or a ProcessSequence
IndexFirstProcessto count and index each Process in the entire process-chain. The offset is the starting value for this ProcessSequence
IndexOfProcess1index of TProcess1 (counting of Process)
IndexOfProcess2index of TProcess2 (counting of Process)

Definition at line 163 of file ProcessSequence.hpp.

Constructor & Destructor Documentation

◆ ProcessSequence()

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >::ProcessSequence ( TProcess1  in_A,
TProcess2  in_B 
)

Only valid user constructor will create fully initialized object.

ProcessSequence supports and encourages move semantics. You can use object, l-value references or r-value references to construct sequences.

Parameters
in_ABaseProcess or switch/process list
in_BBaseProcess or switch/process list

Member Function Documentation

◆ checkStep()

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
bool corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >::checkStep ( )

The processes of type StackProcess do have an internal counter, so they can be exectuted only each N steps.

Often these are "maintenacne processes" that do not need to run after each single step of the simulations. In the CheckStep function it is tested if either A_ or B_ are StackProcess and if they are due for execution.

◆ doBoundaryCrossing()

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
template<typename TParticle >
ProcessReturn corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >::doBoundaryCrossing ( TParticle &  particle,
typename TParticle::node_type const &  from,
typename TParticle::node_type const &  to 
)

List of all BoundaryProcess.

Template Parameters
TParticle
Parameters
particleThe particle.
fromVolume the particle is exiting.
toVolume the particle is entering.
Returns
ProcessReturn

◆ doSecondaries()

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
template<typename TSecondaries >
void corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >::doSecondaries ( TSecondaries &  vS)

Process all secondaries in TSecondaries.

The seondaries produced by other processes and accessible via TSecondaries are processed by all SecondariesProcesse via a call here.

Template Parameters
TSecondaries
Parameters
vS

◆ getCrossSection()

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
template<typename TParticle >
CrossSectionType corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >::getCrossSection ( TParticle const &  projectile,
Code const  targetId,
FourMomentum const &  targetP4 
) const

Calculates the cross section of a projectile with a target.

Template Parameters
TParticle
Parameters
projectile
targetId
targetP4
Returns
CrossSectionType

◆ getMaxStepLength()

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
template<typename TParticle , typename TTrack >
ContinuousProcessStepLength corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >::getMaxStepLength ( TParticle &&  particle,
TTrack &&  vTrack 
)

Calculate the maximum allowed length of the next tracking step, based on all ContinuousProcess-es.

The maximum allowed step length is the minimum of the allowed track lenght over all ContinuousProcess-es in the ProcessSequence.

Template Parameters
TParticleparticle type.
TTrackthe trajectory type.
Parameters
particleThe particle data object.
trackThe track data object.
Returns
ContinuousProcessStepLength which contains the step length itself in LengthType, and a unique identifier of the related ContinuousProcess.

◆ selectInteraction()

template<typename TProcess1, typename TProcess2 = NullModel, int ProcessIndexOffset = 0, int IndexOfProcess1 = corsika::count_processes< TProcess1, corsika::count_processes<TProcess2, ProcessIndexOffset>::count>::count, int IndexOfProcess2 = corsika::count_processes<TProcess2, ProcessIndexOffset>::count>
template<typename TSecondaryView , typename TRNG >
ProcessReturn corsika::ProcessSequence< TProcess1, TProcess2, ProcessIndexOffset, IndexOfProcess1, IndexOfProcess2 >::selectInteraction ( TSecondaryView &&  view,
FourMomentum const &  projectileP4,
NuclearComposition const &  composition,
TRNG &&  rng,
CrossSectionType const  cx_select,
CrossSectionType  cx_sum = CrossSectionType::zero() 
)
inline

Selects one concrete InteractionProcess and samples a target nucleus from the material.

The selectInteraction method statically loops over all active InteractionProcess and calculates the material-weighted cross section for all of them. In an iterative way those cross sections are summed up. The random number cx_select, uniformely drawn from the cross section before energy losses, is used to discriminate the selected sub-process here. If the cross section after the step smaller than it was before, there is a non-zero probability that the particle survives and no interaction takes place. This method becomes imprecise when cross section rise with falling energies.

If a sub-process was selected, the target nucleus is selected from the material (weighted with cross section). The interaction is then executed.

Template Parameters
TSecondaryViewObject type as storage for new secondary particles.
TRNGObject type to produce random numbers.
Parameters
viewObject to store new secondary particles.
projectileP4The four momentum of the projectile.
compositionThe environment/material composition.
rngRandom number object.
cx_selectDrawn random numer, uniform between [0, cx_initial]
cx_sumFor interal use, to sum up cross section contributions.
Returns
ProcessReturn

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