CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
corsika::SwitchProcessSequence< TCondition, TSequence, USequence, IndexFirstProcess, IndexOfProcess1, IndexOfProcess2 > Class Template Reference

Class to switch between two process branches. More...

#include <SwitchProcessSequence.hpp>

Inheritance diagram for corsika::SwitchProcessSequence< TCondition, TSequence, USequence, IndexFirstProcess, IndexOfProcess1, IndexOfProcess2 >:

Public Member Functions

 SwitchProcessSequence (SwitchProcessSequence const &)=default
 
 SwitchProcessSequence (SwitchProcessSequence &&)=default
 
SwitchProcessSequenceoperator= (SwitchProcessSequence const &)=default
 
 SwitchProcessSequence (TCondition sel, TSequence in_A, USequence 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)
 
template<typename TParticle >
ProcessReturn doContinuous (Step< TParticle > &particle, ContinuousProcessIndex const limitId)
 
template<typename TSecondaries >
void doSecondaries (TSecondaries &vS)
 
template<typename TParticle , typename TTrack >
ContinuousProcessStepLength getMaxStepLength (TParticle &particle, TTrack &vTrack)
 
template<typename TParticle >
CrossSectionType getCrossSection (TParticle const &projectile, Code const targetId, FourMomentum const &targetP4) const
 
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())
 
template<typename TParticle >
TimeType getLifetime (TParticle &&particle)
 
template<typename TParticle >
InverseTimeType getInverseLifetime (TParticle &&particle)
 
template<typename TSecondaryView >
ProcessReturn selectDecay (TSecondaryView &view, [[maybe_unused]] InverseTimeType decay_inv_select, [[maybe_unused]] InverseTimeType decay_inv_sum=InverseTimeType::zero())
 

Static Public Attributes

static bool const is_process_sequence = true
 
static bool const is_switch_process_sequence = true
 
- Static Public Attributes inherited from corsika::BaseProcess< SwitchProcessSequence< TCondition, TSequence, USequence > >
static bool const is_process_sequence
 
static bool const is_switch_process_sequence
 

Additional Inherited Members

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

Detailed Description

template<typename TCondition, typename TSequence, typename USequence, int IndexFirstProcess = 0, int IndexOfProcess1 = count_processes<TSequence, IndexFirstProcess>::count, int IndexOfProcess2 = count_processes<USequence, IndexOfProcess1>::count>
class corsika::SwitchProcessSequence< TCondition, TSequence, USequence, IndexFirstProcess, IndexOfProcess1, IndexOfProcess2 >

Class to switch between two process branches.

A compile-time static list of processes that uses an internal TCondition class to switch between different versions of processes (or process sequence).

TSequence and USequence must 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 SwitchProcessSequence. Please use the corsika::make_select(condition, sequence, alt_sequence) factory function for best results.

TCondition has to implement a bool operator()(Particle const&). Note: TCondition may absolutely also use random numbers to sample between its results. This can be used to achieve arbitrarily smooth transition or mixtures of processes.

Warning: do not put StackProcess into a SwitchProcessSequence since this makes no sense. The StackProcess acts on an entire particle stack and not on indiviidual particles.

Template parameters:

Template Parameters
TConditionselector functor/function
TSequenceis of type BaseProcess, either a dedicatd process, or a ProcessSequence
USequenceis of type BaseProcess, either a dedicatd process, or a ProcessSequence
IndexFirstProcessto count and index each Process in the entire process-chain
IndexOfProcess1index of TSequence (counting of Process)
IndexOfProcess2index of USequence (counting of Process)

See also class ProcessSequence.

Definition at line 80 of file SwitchProcessSequence.hpp.

Constructor & Destructor Documentation

◆ SwitchProcessSequence()

template<typename TCondition, typename TSequence, typename USequence, int IndexFirstProcess = 0, int IndexOfProcess1 = count_processes<TSequence, IndexFirstProcess>::count, int IndexOfProcess2 = count_processes<USequence, IndexOfProcess1>::count>
corsika::SwitchProcessSequence< TCondition, TSequence, USequence, IndexFirstProcess, IndexOfProcess1, IndexOfProcess2 >::SwitchProcessSequence ( TCondition  sel,
TSequence  in_A,
USequence  in_B 
)
inline

Only valid user constructor will create fully initialized object.

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

Parameters
selfunctor to switch between branch A and B
in_Aprocess branch A
in_Bprocess branch B

Definition at line 131 of file SwitchProcessSequence.hpp.


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