From 617555df0503d8a9c078251dcc8f99d3af0d7929 Mon Sep 17 00:00:00 2001
From: Maximilian Reininghaus <maximilian.reininghaus@kit.edu>
Date: Wed, 16 Jan 2019 10:04:18 +0100
Subject: [PATCH] COMBoost

---
 Framework/Utilities/COMBoost.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Framework/Utilities/COMBoost.cc b/Framework/Utilities/COMBoost.cc
index 1bf8f839f..b12180b30 100644
--- a/Framework/Utilities/COMBoost.cc
+++ b/Framework/Utilities/COMBoost.cc
@@ -22,10 +22,13 @@ COMBoost::COMBoost(HEPEnergyType eProjectile, COMBoost::MomentumVector const& pP
   auto const a = (pProjectile / pProjNorm).GetComponents().eVector;
 
   if (a(0) == 0 && a(1) == 0) {
-    // if pProjectile ~ (0, 0, -1), the standard formula for the rotation matrix breaks
-    // down but we can easily define a suitable rotation manually. We just need some SO(3)
-    // matrix that reverses the z-axis and I like this one:
-    fRotation << 1, 0, 0, 0, -1, 0, 0, 0, -1;
+    if (a(2) < 0) {
+      // if pProjectile ~ (0, 0, -1), the standard formula for the rotation matrix breaks
+      // down but we can easily define a suitable rotation manually. We just need some
+      // SO(3) matrix that reverses the z-axis and I like this one:
+
+      fRotation << 1, 0, 0, 0, -1, 0, 0, 0, -1;
+    }
   } else {
     Eigen::Vector3d const b{0, 0, 1};
     auto const v = a.cross(b);
-- 
GitLab