From 35455921c796095e328dc4581d66ac22de6e4723 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Wed, 13 Feb 2019 17:01:05 +0100
Subject: [PATCH] save node in trackingTest "stack"

---
 Processes/TrackingLine/testTrackingLine.cc     | 8 +++++---
 Processes/TrackingLine/testTrackingLineStack.h | 9 +++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/Processes/TrackingLine/testTrackingLine.cc b/Processes/TrackingLine/testTrackingLine.cc
index 00ad3e8e..d0c22599 100644
--- a/Processes/TrackingLine/testTrackingLine.cc
+++ b/Processes/TrackingLine/testTrackingLine.cc
@@ -69,14 +69,16 @@ TEST_CASE("TrackingLine") {
 
     //~ std::cout << env.GetUniverse().get() << std::endl;
 
-    DummyParticle p(1_GeV, Vector<MOMENTUM>(cs, 0_GeV, 0_GeV, 1_GeV),
-                    Point(cs, 0_m, 0_m, 0_m));
-
     auto const radius = 20_m;
 
     auto theMedium = corsika::environment::Environment::CreateNode<Sphere>(
         Point{env.GetCoordinateSystem(), 0_m, 0_m, 0_m}, radius);
     universe.AddChild(std::move(theMedium));
+    
+    Point p0(cs, 0_m, 0_m, 0_m);
+    auto* const node = universe.GetContainingNode(p0);
+    DummyParticle p(1_GeV, Vector<MOMENTUM>(cs, 0_GeV, 0_GeV, 1_GeV),
+                    p0, node);
 
     Point const origin(cs, {0_m, 0_m, 0_m});
     Vector<corsika::units::si::SpeedType::dimension_type> v(cs, 0_m / second,
diff --git a/Processes/TrackingLine/testTrackingLineStack.h b/Processes/TrackingLine/testTrackingLineStack.h
index b825bc2f..819934d4 100644
--- a/Processes/TrackingLine/testTrackingLineStack.h
+++ b/Processes/TrackingLine/testTrackingLineStack.h
@@ -13,6 +13,7 @@
 #define _include_process_trackinling_teststack_h_
 
 #include <corsika/geometry/Point.h>
+#include <corsika/environment/Environment.h>
 #include <corsika/geometry/Vector.h>
 #include <corsika/particles/ParticleProperties.h>
 #include <corsika/units/PhysicalUnits.h>
@@ -23,18 +24,22 @@ struct DummyParticle {
   corsika::units::si::HEPEnergyType fEnergy;
   corsika::geometry::Vector<MOMENTUM> fMomentum;
   corsika::geometry::Point fPosition;
+  corsika::environment::BaseNodeType const* fNodePtr;
 
   DummyParticle(corsika::units::si::HEPEnergyType pEnergy,
                 corsika::geometry::Vector<MOMENTUM> pMomentum,
-                corsika::geometry::Point pPosition)
+                corsika::geometry::Point pPosition,
+                corsika::environment::BaseNodeType const* pNodePtr)
       : fEnergy(pEnergy)
       , fMomentum(pMomentum)
-      , fPosition(pPosition) {}
+      , fPosition(pPosition)
+      , fNodePtr(pNodePtr) {}
 
   auto GetEnergy() const { return fEnergy; }
   auto GetMomentum() const { return fMomentum; }
   auto GetPosition() const { return fPosition; }
   auto GetPID() const { return corsika::particles::Code::Unknown; }
+  auto* GetNode() const { return fNodePtr; }
 };
 
 struct DummyStack {
-- 
GitLab