From 44c119bcc0f47f87f3639c92ab317c81f60ff7c9 Mon Sep 17 00:00:00 2001 From: ralfulrich <ralf.ulrich@kit.edu> Date: Mon, 21 Sep 2020 18:57:01 +0200 Subject: [PATCH] SetupStack is now using HistoryStackExtension --- .../StackInterface/StackIteratorInterface.h | 6 +++- Setup/SetupStack.h | 29 ++++++++++++++----- Stack/History/HistoryStackExtension.h | 17 ++++++++++- Stack/History/testHistoryView.cc | 9 ++---- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/Framework/StackInterface/StackIteratorInterface.h b/Framework/StackInterface/StackIteratorInterface.h index 3955cafd4..5b1d25757 100644 --- a/Framework/StackInterface/StackIteratorInterface.h +++ b/Framework/StackInterface/StackIteratorInterface.h @@ -12,7 +12,7 @@ namespace corsika::history { template <typename T> - class HSecondaryView; // forward decl. for befriending + class HistorySecondaryView; // forward decl. for befriending } namespace corsika::stack { @@ -80,6 +80,10 @@ namespace corsika::stack { friend class ParticleBase<StackIteratorInterface>; // for access to GetStackData friend class SecondaryView<TStackData, TParticleInterface>; // access for SecondaryView + + template <typename T> + friend class corsika::history::HistorySecondaryView; + private: unsigned int index_ = 0; StackType* data_ = 0; // info: Particles and StackIterators become invalid when parent diff --git a/Setup/SetupStack.h b/Setup/SetupStack.h index 5c22321b0..88e9f7711 100644 --- a/Setup/SetupStack.h +++ b/Setup/SetupStack.h @@ -19,6 +19,9 @@ namespace corsika::setup { namespace detail { + // ------------------------------------------ + // add geometry node tracking data to stack: + // the GeometryNode stack needs to know the type of geometry-nodes from the // environment: template <typename TStackIter> @@ -26,13 +29,6 @@ namespace corsika::setup { typename stack::node::MakeGeometryDataInterface<TStackIter, setup::SetupEnvironment>::type; - /* - template <typename TStackIter> - using SetupGeometryHistoryDataInterface = - typename stack::node::MakeHistoryDataInterface<TStackIter, - ...event... >::type; - */ - // combine particle data stack with geometry information for tracking template <typename TStackIter> using StackWithGeometryInterface = corsika::stack::CombinedParticleInterface< @@ -44,10 +40,27 @@ namespace corsika::setup { corsika::stack::node::GeometryData<setup::SetupEnvironment>, StackWithGeometryInterface>; + + // ------------------------------------------ + // Add [optional] history data to stack, too: + + // combine dummy stack with geometry information for tracking + template <typename TStackIter> + using StackWithHistoryInterface = corsika::stack::CombinedParticleInterface< + StackWithGeometry::PIType, history::HistoryEventDataInterface, + TStackIter>; + + using StackWithHistory = corsika::stack::CombinedStack< + typename StackWithGeometry::StackImpl, + history::HistoryEventData, StackWithHistoryInterface>; + } // namespace detail + + // --------------------------------------- // this is the FINAL stack we use in C8: - using Stack = detail::StackWithGeometry; + //using Stack = detail::StackWithGeometry; + using Stack = detail::StackWithHistory; /* See Issue 161 diff --git a/Stack/History/HistoryStackExtension.h b/Stack/History/HistoryStackExtension.h index 294a53780..a6c24ca1e 100644 --- a/Stack/History/HistoryStackExtension.h +++ b/Stack/History/HistoryStackExtension.h @@ -9,7 +9,6 @@ #pragma once #include <corsika/stack/Stack.h> -#include <corsika/history/Event.hpp> #include <memory> #include <tuple> @@ -88,4 +87,20 @@ namespace corsika::history { typedef HistoryDataInterface<T, TEvent> type; }; +} // namespace corsika::history + + + // for user-friendlyness we create the HistoryDataInterface type + // with the histoy::Event data content right here: + +#include <corsika/history/Event.hpp> + +namespace corsika::history { + + template <typename TStackIter> + using HistoryEventDataInterface = + typename history::MakeHistoryDataInterface<TStackIter, history::Event>::type; + + using HistoryEventData = history::HistoryData<history::Event>; + } // namespace corsika::history diff --git a/Stack/History/testHistoryView.cc b/Stack/History/testHistoryView.cc index 1eb9efe14..9ef0a2f48 100644 --- a/Stack/History/testHistoryView.cc +++ b/Stack/History/testHistoryView.cc @@ -28,20 +28,15 @@ using namespace corsika::units::si; way, but with real particle data */ -// the GeometryNode stack needs to know the type of geometry-nodes from the DummyEnv: -template <typename TStackIter> -using HistoryDataInterface = - typename history::MakeHistoryDataInterface<TStackIter, history::Event>::type; - // combine dummy stack with geometry information for tracking template <typename TStackIter> using StackWithHistoryInterface = corsika::stack::CombinedParticleInterface< - stack::nuclear_extension::ParticleDataStack::PIType, HistoryDataInterface, + stack::nuclear_extension::ParticleDataStack::PIType, history::HistoryEventDataInterface, TStackIter>; using TestStack = corsika::stack::CombinedStack< typename stack::nuclear_extension::ParticleDataStack::StackImpl, - history::HistoryData<history::Event>, StackWithHistoryInterface>; + history::HistoryEventData, StackWithHistoryInterface>; /* See Issue 161 -- GitLab