diff --git a/Framework/Cascade/Cascade.h b/Framework/Cascade/Cascade.h index 7353b9a84c00e4279573296454dfaa0dd593d909..c4f07d64791e0fc1950e825fe4069680ef717c95 100644 --- a/Framework/Cascade/Cascade.h +++ b/Framework/Cascade/Cascade.h @@ -17,8 +17,7 @@ #include <corsika/stack/SecondaryView.h> #include <corsika/units/PhysicalUnits.h> #include <corsika/stack/history/EventType.hpp> - -#include <corsika/logging/Logging.h> +#include <corsika/stack/history/HistorySecondaryProducer.hpp> #include <corsika/setup/SetupTrajectory.h> @@ -326,9 +325,11 @@ namespace corsika::cascade { actual_decay_time); const auto sample_process = uniDist(fRNG); units::si::InverseTimeType inv_decay_count = units::si::InverseTimeType::zero(); - auto const returnCode = fProcessSequence.SelectDecay(particle, view, sample_process, - inv_decay_count); - view.GetProjectile().GetEvent()->set_type(history::EventType::Decay); + auto const returnCode = + fProcessSequence.SelectDecay(particle, view, sample_process, inv_decay_count); + if constexpr (TStackView::has_event) { + view.GetProjectile().GetEvent()->setEventType(history::EventType::Decay); + } return returnCode; } @@ -342,9 +343,11 @@ namespace corsika::cascade { current_inv_length); const auto sample_process = uniDist(fRNG); auto inv_lambda_count = units::si::InverseGrammageType::zero(); - auto const returnCode = fProcessSequence.SelectInteraction(particle, view, sample_process, - inv_lambda_count); - view.GetProjectile().GetEvent()->set_type(history::EventType::Interaction); + auto const returnCode = fProcessSequence.SelectInteraction( + particle, view, sample_process, inv_lambda_count); + if constexpr (TStackView::has_event) { + view.GetProjectile().GetEvent()->setEventType(history::EventType::Interaction); + } return returnCode; } diff --git a/Framework/StackInterface/SecondaryView.h b/Framework/StackInterface/SecondaryView.h index 8ab305a81d66543a0054d56d708a9797094f6d36..ae8b62c661cc834c70645e25725ca684c4a0c7c0 100644 --- a/Framework/StackInterface/SecondaryView.h +++ b/Framework/StackInterface/SecondaryView.h @@ -405,6 +405,8 @@ namespace corsika::stack { using View = SecondaryView<T1, T2, DefaultSecondaryProducer>; public: + static bool constexpr has_event{false}; + /** * Method is called after a new secondary has been created on the * SecondaryView. Extra logic can be introduced here. diff --git a/Stack/History/HistorySecondaryProducer.hpp b/Stack/History/HistorySecondaryProducer.hpp index 0d3a88124da908c785f9d50de92658fa7d223bda..792a83d9538ee742c75b4474b1399edfd6139645 100644 --- a/Stack/History/HistorySecondaryProducer.hpp +++ b/Stack/History/HistorySecondaryProducer.hpp @@ -13,6 +13,8 @@ #include <corsika/logging/Logging.h> +#include <boost/type_index.hpp> + #include <memory> #include <type_traits> #include <utility> @@ -24,6 +26,7 @@ namespace corsika::history { class HistorySecondaryProducer { public: EventPtr event_; + static bool constexpr has_event{true}; public: template <typename Particle>