From 28d68d01716c5f337ca5de12a71b45f4259d61ab Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Sat, 6 Jun 2020 13:37:10 +0200
Subject: [PATCH] added momentum conservation test for sibyll::Interaction

---
 Processes/Sibyll/testSibyll.cc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Processes/Sibyll/testSibyll.cc b/Processes/Sibyll/testSibyll.cc
index 308e8ea18..e4ec476d7 100644
--- a/Processes/Sibyll/testSibyll.cc
+++ b/Processes/Sibyll/testSibyll.cc
@@ -136,8 +136,18 @@ TEST_CASE("SibyllInterface", "[processes]") {
     Interaction model;
 
     [[maybe_unused]] const process::EProcessReturn ret = model.DoInteraction(projectile);
-    [[maybe_unused]] auto const pSum = sumMomentum(view, cs);
+    auto const pSum = sumMomentum(view, cs);
 
+    // for debugging!
+    std::cout << pSum.GetComponents(cs) << std::endl;
+    std::cout << plab.GetComponents(cs) << std::endl;
+
+    CHECK(pSum.GetComponents(cs).GetX() / P0 == Approx(1).margin(1e-4));
+    CHECK(pSum.GetComponents(cs).GetY() / 1_GeV == Approx(0).margin(1e-4));
+    CHECK(pSum.GetComponents(cs).GetZ() / 1_GeV == Approx(0).margin(1e-4));
+
+    CHECK((pSum - plab).norm() / 1_GeV == Approx(0).margin(1e-4));
+    CHECK(pSum.norm() / P0 == Approx(1).margin(1e-4));
     [[maybe_unused]] const GrammageType length = model.GetInteractionLength(particle);
   }
 
-- 
GitLab