From 0c1b0e4621778e54f6c7e251a5901b96f935f190 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Fri, 25 Sep 2020 18:09:14 +0200
Subject: [PATCH] modified tests to use setup::StackView together with
 setup::Stack

---
 Processes/OnShellCheck/testOnShellCheck.cc | 9 ++++-----
 Processes/ParticleCut/testParticleCut.cc   | 4 ++--
 Processes/Pythia/testPythia8.cc            | 4 ++--
 Processes/QGSJetII/testQGSJetII.cc         | 2 +-
 Processes/Sibyll/testSibyll.cc             | 8 ++++----
 Processes/UrQMD/testUrQMD.cc               | 6 ++----
 6 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/Processes/OnShellCheck/testOnShellCheck.cc b/Processes/OnShellCheck/testOnShellCheck.cc
index cfc7d159b..0d45b1e29 100644
--- a/Processes/OnShellCheck/testOnShellCheck.cc
+++ b/Processes/OnShellCheck/testOnShellCheck.cc
@@ -37,11 +37,10 @@ TEST_CASE("OnShellCheck", "[processes]") {
   // two energies
   const HEPEnergyType E = 10_GeV;
   // list of arbitrary particles
-  std::array<particles::Code, 4> particleList = {
-      particles::Code::PiPlus, particles::Code::PiMinus, particles::Code::Helium,
-      particles::Code::Gamma};
+  std::array const particleList{particles::Code::PiPlus, particles::Code::PiMinus,
+                                particles::Code::Helium, particles::Code::Gamma};
 
-  std::array<double, 4> mass_shifts = {1.1, 1.001, 1.0, 1.0};
+  std::array const mass_shifts{1.1, 1.001, 1.0, 1.0};
 
   SECTION("check particle masses") {
 
@@ -57,7 +56,7 @@ TEST_CASE("OnShellCheck", "[processes]") {
             corsika::stack::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}),
             geometry::Point(rootCS, 0_m, 0_m, 0_m), 0_ns});
     // view on secondary particles
-    corsika::stack::SecondaryView view(particle);
+    setup::StackView view{particle};
     // ref. to primary particle through the secondary view.
     // only this way the secondary view is populated
     auto projectile = view.GetProjectile();
diff --git a/Processes/ParticleCut/testParticleCut.cc b/Processes/ParticleCut/testParticleCut.cc
index cdf3887a7..03432fc03 100644
--- a/Processes/ParticleCut/testParticleCut.cc
+++ b/Processes/ParticleCut/testParticleCut.cc
@@ -55,7 +55,7 @@ TEST_CASE("ParticleCut", "[processes]") {
             corsika::stack::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}),
             geometry::Point(rootCS, 0_m, 0_m, 0_m), 0_ns});
     // view on secondary particles
-    corsika::stack::SecondaryView view(particle);
+    setup::StackView view{particle};
     // ref. to primary particle through the secondary view.
     // only this way the secondary view is populated
     auto projectile = view.GetProjectile();
@@ -85,7 +85,7 @@ TEST_CASE("ParticleCut", "[processes]") {
             corsika::stack::MomentumVector(rootCS, {0_GeV, 0_GeV, 0_GeV}),
             geometry::Point(rootCS, 0_m, 0_m, 0_m), 0_ns});
     // view on secondary particles
-    corsika::stack::SecondaryView view(particle);
+    setup::StackView view{particle};
     // ref. to primary particle through the secondary view.
     // only this way the secondary view is populated
     auto projectile = view.GetProjectile();
diff --git a/Processes/Pythia/testPythia8.cc b/Processes/Pythia/testPythia8.cc
index 4b1da6d83..6a8ae279b 100644
--- a/Processes/Pythia/testPythia8.cc
+++ b/Processes/Pythia/testPythia8.cc
@@ -130,7 +130,7 @@ TEST_CASE("pythia process") {
 
     random::RNGManager::GetInstance().RegisterRandomStream("pythia");
 
-    corsika::stack::SecondaryView view(particle);
+    setup::StackView view(particle);
 
     process::pythia::Decay model;
 
@@ -179,7 +179,7 @@ TEST_CASE("pythia process") {
                    corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{
             particles::Code::PiPlus, E0, plab, pos, 0_ns});
     particle.SetNode(nodePtr);
-    corsika::stack::SecondaryView view(particle);
+    setup::StackView view(particle);
 
     process::pythia::Interaction model;
 
diff --git a/Processes/QGSJetII/testQGSJetII.cc b/Processes/QGSJetII/testQGSJetII.cc
index 0e6fddae9..8f036bafc 100644
--- a/Processes/QGSJetII/testQGSJetII.cc
+++ b/Processes/QGSJetII/testQGSJetII.cc
@@ -133,7 +133,7 @@ TEST_CASE("QgsjetIIInterface", "[processes]") {
             particles::Code::Proton, E0, plab, pos, 0_ns});
 
     particle.SetNode(nodePtr);
-    corsika::stack::SecondaryView view(particle);
+    setup::StackView view(particle);
     auto projectile = view.GetProjectile();
     auto const projectileMomentum = projectile.GetMomentum();
 
diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc
index e99400670..84e04ba21 100644
--- a/Processes/Sibyll/testSibyll.cc
+++ b/Processes/Sibyll/testSibyll.cc
@@ -130,7 +130,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
                    corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{
             particles::Code::Proton, E0, plab, pos, 0_ns});
     particle.SetNode(nodePtr);
-    corsika::stack::SecondaryView view(particle);
+    corsika::setup::StackView view(particle);
 
     Interaction model;
 
@@ -215,7 +215,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
                    corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{
             particles::Code::Proton, E0, plab, pos, 0_ns});
     particle.SetNode(nodePtr);
-    corsika::stack::SecondaryView view(particle);
+    corsika::setup::StackView view(particle);
 
     Interaction model;
 
@@ -245,7 +245,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
                                      units::si::TimeType, unsigned short, unsigned short>{
             particles::Code::Nucleus, E0, plab, pos, 0_ns, 4, 2});
     particle.SetNode(nodePtr);
-    corsika::stack::SecondaryView view(particle);
+    corsika::setup::StackView view(particle);
 
     Interaction hmodel;
     NuclearInteraction model(hmodel, env);
@@ -266,7 +266,7 @@ TEST_CASE("SibyllInterface", "[processes]") {
         std::tuple<particles::Code, units::si::HEPEnergyType,
                    corsika::stack::MomentumVector, geometry::Point, units::si::TimeType>{
             particles::Code::Lambda0, E0, plab, pos, 0_ns});
-    corsika::stack::SecondaryView view(particle);
+    corsika::setup::StackView view(particle);
 
     Decay model;
 
diff --git a/Processes/UrQMD/testUrQMD.cc b/Processes/UrQMD/testUrQMD.cc
index f7d36c891..71cdd8068 100644
--- a/Processes/UrQMD/testUrQMD.cc
+++ b/Processes/UrQMD/testUrQMD.cc
@@ -95,8 +95,7 @@ auto setupStack(int vA, int vZ, HEPEnergyType vMomentum, TNodeType* vNodePtr,
 
   particle.SetNode(vNodePtr);
   return std::make_tuple(
-      std::move(stack),
-      std::make_unique<decltype(corsika::stack::SecondaryView(particle))>(particle));
+      std::move(stack), std::make_unique<decltype(setup::StackView{particle})>(particle));
 }
 
 template <typename TNodeType>
@@ -117,8 +116,7 @@ auto setupStack(particles::Code vProjectileType, HEPEnergyType vMomentum,
 
   particle.SetNode(vNodePtr);
   return std::make_tuple(
-      std::move(stack),
-      std::make_unique<decltype(corsika::stack::SecondaryView(particle))>(particle));
+      std::move(stack), std::make_unique<decltype(setup::StackView{particle})>(particle));
 }
 
 TEST_CASE("UrQMD") {
-- 
GitLab