From b44993dd41c0193ebd37f5e5c7a079d7e199588d Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Wed, 23 Sep 2020 19:21:01 +0200
Subject: [PATCH] first try real-world history with vertical_EAS

---
 Documentation/Examples/CMakeLists.txt     |  1 +
 Documentation/Examples/vertical_EAS.cc    | 19 ++++++++++++-------
 Stack/History/HistoryObservationPlane.hpp |  2 +-
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/Documentation/Examples/CMakeLists.txt b/Documentation/Examples/CMakeLists.txt
index 75b717608..c1972c894 100644
--- a/Documentation/Examples/CMakeLists.txt
+++ b/Documentation/Examples/CMakeLists.txt
@@ -115,6 +115,7 @@ if (Pythia8_FOUND)
     CORSIKAgeometry
     CORSIKAenvironment
     CORSIKAprocesssequence
+    CORSIKAhistory # for HistoryObservationPlane
     )
 endif()
 
diff --git a/Documentation/Examples/vertical_EAS.cc b/Documentation/Examples/vertical_EAS.cc
index f7f45e5ea..4e8ca5cfd 100644
--- a/Documentation/Examples/vertical_EAS.cc
+++ b/Documentation/Examples/vertical_EAS.cc
@@ -37,6 +37,9 @@
 #include <corsika/units/PhysicalUnits.h>
 #include <corsika/utl/CorsikaFenv.h>
 
+#include <corsika/history/HistoryObservationPlane.hpp>
+#include <corsika/history/HistorySecondaryView.hpp>
+
 #include <iomanip>
 #include <iostream>
 #include <limits>
@@ -63,9 +66,9 @@ void registerRandomStreams(const int seed) {
   random::RNGManager::GetInstance().RegisterRandomStream("urqmd");
   random::RNGManager::GetInstance().RegisterRandomStream("proposal");
 
-  if (seed==0)
+  if (seed == 0)
     random::RNGManager::GetInstance().SeedAll();
-  else 
+  else
     random::RNGManager::GetInstance().SeedAll(seed);
 }
 
@@ -81,8 +84,7 @@ int main(int argc, char** argv) {
   feenableexcept(FE_INVALID);
 
   int seed = 0;
-  if (argc>4)
-    seed = std::stoi(std::string(argv[4]));
+  if (argc > 4) seed = std::stoi(std::string(argv[4]));
   // initialize random number sequence(s)
   registerRandomStreams(seed);
 
@@ -205,8 +207,9 @@ int main(int argc, char** argv) {
   process::longitudinal_profile::LongitudinalProfile longprof{showerAxis};
 
   Plane const obsPlane(showerCore, Vector<dimensionless_d>(rootCS, {0., 0., 1.}));
-  process::observation_plane::ObservationPlane observationLevel(obsPlane,
-                                                                "particles.dat");
+  //~ process::observation_plane::ObservationPlane observationLevel(obsPlane,
+  //~ "particles.dat");
+  corsika::history::HistoryObservationPlane observationLevel{stack, obsPlane};
 
   process::UrQMD::UrQMD urqmd;
   process::interaction_counter::InteractionCounter urqmdCounted{urqmd};
@@ -223,7 +226,9 @@ int main(int argc, char** argv) {
 
   // define air shower object, run simulation
   tracking_line::TrackingLine tracking;
-  cascade::Cascade EAS(env, tracking, sequence, stack);
+  cascade::Cascade<decltype(tracking), decltype(sequence), decltype(stack),
+                   corsika::history::HistorySecondaryView<corsika::setup::StackView> >
+      EAS(env, tracking, sequence, stack);
 
   // to fix the point of first interaction, uncomment the following two lines:
   //  EAS.SetNodes();
diff --git a/Stack/History/HistoryObservationPlane.hpp b/Stack/History/HistoryObservationPlane.hpp
index a603963db..99a6b424f 100644
--- a/Stack/History/HistoryObservationPlane.hpp
+++ b/Stack/History/HistoryObservationPlane.hpp
@@ -20,7 +20,7 @@
 
 namespace corsika::history {
   namespace detail {
-    auto hist_factory() {
+    inline auto hist_factory() {
       /*auto h = boost::histogram::make_histogram(
           boost::histogram::axis::regular<double, boost::histogram::axis::transform::log>{
               130, 1e8, 1e21, "muon energy/eV"},
-- 
GitLab