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/DecayProcess.hpp> 21 #include <corsika/framework/process/InteractionProcess.hpp> 23 #include <corsika/framework/process/SecondariesProcess.hpp> 24 #include <corsika/framework/process/StackProcess.hpp> 29 #include <type_traits> 73 template <
typename TCondition,
typename TSequence,
typename USequence,
74 int IndexFirstProcess = 0,
75 int IndexOfProcess1 = count_processes<TSequence, IndexFirstProcess>::count,
76 int IndexOfProcess2 = count_processes<USequence, IndexOfProcess1>::count>
78 :
public BaseProcess<SwitchProcessSequence<TCondition, TSequence, USequence>> {
80 using process1_type =
typename std::decay_t<TSequence>;
81 using process2_type =
typename std::decay_t<USequence>;
84 static_assert(is_process_v<process1_type>,
85 "can only use process derived from BaseProcess in " 86 "SwitchProcessSequence, for Process 1");
87 static_assert(is_process_v<process2_type>,
88 "can only use process derived from BaseProcess in " 89 "SwitchProcessSequence, for Process 2");
93 "cannot use StackProcess in SwitchProcessSequence, for Process 1");
95 "cannot use StackProcess in SwitchProcessSequence, for Process 2");
99 static_assert(!contains_stack_process_v<process1_type>,
100 "cannot use StackProcess in SwitchProcessSequence, remove from " 101 "ProcessSequence 1");
102 static_assert(!contains_stack_process_v<process2_type>,
103 "cannot use StackProcess in SwitchProcessSequence, remove from " 104 "ProcessSequence 2");
114 static bool const is_process_sequence =
true;
115 static bool const is_switch_process_sequence =
true;
133 template <
typename TParticle>
135 typename TParticle::node_type
const& from,
136 typename TParticle::node_type
const& to);
138 template <
typename TParticle,
typename TTrack>
142 template <
typename TSecondaries>
143 void doSecondaries(TSecondaries& vS);
145 template <
typename TParticle,
typename TTrack>
148 template <
typename TParticle>
149 GrammageType getInteractionLength(TParticle&& particle) {
150 return 1. / getInverseInteractionLength(particle);
153 template <
typename TParticle>
156 template <
typename TSecondaryView>
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>
Import and extend the phys::units package.
static unsigned int constexpr getNumberOfProcesses()
static counter to uniquely index (count) all ContinuousProcess in switch sequence.
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.
class "quantity" is the heart of the library.
The cascade namespace assembles all objects needed to simulate full particles cascades.
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 "|="
Process to act on the entire particle stack.
To store step length in LengthType and unique index in ProcessSequence of shortest step ContinuousPro...