17 #include <corsika/framework/process/BoundaryCrossingProcess.hpp> 18 #include <corsika/framework/process/ContinuousProcess.hpp> 19 #include <corsika/framework/process/ContinuousProcessIndex.hpp> 20 #include <corsika/framework/process/ContinuousProcessStepLength.hpp> 21 #include <corsika/framework/process/DecayProcess.hpp> 22 #include <corsika/framework/process/InteractionProcess.hpp> 24 #include <corsika/framework/process/SecondariesProcess.hpp> 25 #include <corsika/framework/process/StackProcess.hpp> 27 #include <corsika/framework/core/Step.hpp> 32 #include <type_traits> 76 template <
typename TCondition,
typename TSequence,
typename USequence,
77 int IndexFirstProcess = 0,
78 int IndexOfProcess1 = count_processes<TSequence, IndexFirstProcess>::count,
79 int IndexOfProcess2 = count_processes<USequence, IndexOfProcess1>::count>
81 :
public BaseProcess<SwitchProcessSequence<TCondition, TSequence, USequence>> {
83 using process1_type =
typename std::decay_t<TSequence>;
84 using process2_type =
typename std::decay_t<USequence>;
87 static_assert(is_process_v<process1_type>,
88 "can only use process derived from BaseProcess in " 89 "SwitchProcessSequence, for Process 1");
90 static_assert(is_process_v<process2_type>,
91 "can only use process derived from BaseProcess in " 92 "SwitchProcessSequence, for Process 2");
96 "cannot use StackProcess in SwitchProcessSequence, for Process 1");
98 "cannot use StackProcess in SwitchProcessSequence, for Process 2");
102 static_assert(!contains_stack_process_v<process1_type>,
103 "cannot use StackProcess in SwitchProcessSequence, remove from " 104 "ProcessSequence 1");
105 static_assert(!contains_stack_process_v<process2_type>,
106 "cannot use StackProcess in SwitchProcessSequence, remove from " 107 "ProcessSequence 2");
117 static bool const is_process_sequence =
true;
118 static bool const is_switch_process_sequence =
true;
136 template <
typename TParticle>
138 typename TParticle::node_type
const& from,
139 typename TParticle::node_type
const& to);
141 template <
typename TParticle>
145 template <
typename TSecondaries>
146 void doSecondaries(TSecondaries& vS);
148 template <
typename TParticle,
typename TTrack>
151 template <
typename TParticle>
152 CrossSectionType getCrossSection(TParticle
const& projectile, Code
const targetId,
155 template <
typename TSecondaryView,
typename TRNG>
162 template <
typename TParticle>
163 TimeType getLifetime(TParticle&& particle) {
164 return 1. / getInverseLifetime(particle);
167 template <
typename TParticle>
171 template <
typename TSecondaryView>
173 TSecondaryView& view, [[maybe_unused]]
InverseTimeType decay_inv_select,
181 #ifdef CORSIKA_UNIT_TESTING 182 TCondition getCondition()
const {
return select_; }
183 TSequence getSequence()
const {
return A_; }
184 USequence getAltSequence()
const {
return B_; }
194 static unsigned int constexpr numberOfProcesses_ = IndexOfProcess2;
207 template <
typename TCondition,
typename TSequence,
typename USequence,
208 typename = std::enable_if_t<is_process_v<typename std::decay_t<TSequence>> &&
209 is_process_v<typename std::decay_t<USequence>>>>
211 TCondition&& selector, TSequence&& vA, USequence&& vB) {
219 #include <corsika/detail/framework/process/SwitchProcessSequence.inl> static size_t constexpr getNumberOfProcesses()
static counter to uniquely index (count) all ContinuousProcess in switch sequence.
Import and extend the phys::units package.
Class to switch between two process branches.
Each process in C8 must derive from BaseProcess.
SwitchProcessSequence(TCondition sel, TSequence in_A, USequence in_B)
Only valid user constructor will create fully initialized object.
To index individual processes (continuous processes) inside a ProcessSequence.
Description of physical four-vectors.
`, since they are used everywhere as integral part of the framework.
static constexpr quantity zero()
We need a "zero" of each type – for comparisons, to initialize running totals, etc.
SwitchProcessSequence< TCondition, TSequence, USequence > make_select(TCondition &&selector, TSequence &&vA, USequence &&vB)
the functin make_select(select, proc1, proc1) assembles many BaseProcesses, and ProcessSequences into...
ProcessReturn
since in a process sequence many status updates can accumulate for a single particle, this enum should define only bit-flags that can be accumulated easily with "|="
Describes the composition of matter Allowes and handles the creation of custom matter compositions...
Process to act on the entire particle stack.
To store step length in LengthType and unique index in ProcessSequence of shortest step ContinuousPro...
General FourVector object.