From 44cf5966151362121f2d3a6aad24c81bd8119d73 Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Tue, 18 Dec 2018 18:03:52 +0100
Subject: [PATCH] removed warning, more cleanup

---
 #.gitlab-ci.yml#                          | 37 +++++++++++++++++++++++
 CMakeLists.txt                            |  2 +-
 Documentation/Examples/cascade_example.cc |  9 +++---
 Processes/Sibyll/Interaction.h            | 10 ++----
 Stack/SuperStupidStack/SuperStupidStack.h |  5 +--
 5 files changed, 46 insertions(+), 17 deletions(-)
 create mode 100644 #.gitlab-ci.yml#

diff --git a/#.gitlab-ci.yml# b/#.gitlab-ci.yml#
new file mode 100644
index 000000000..fb8f6a95b
--- /dev/null
+++ b/#.gitlab-ci.yml#
@@ -0,0 +1,37 @@
+image: ubuntu:bionic
+
+variables:
+  GIT_SSL_NO_VERIFY: "1"
+
+before_script:
+  - apt-get update --yes
+  - apt-get install --yes cmake libboost-dev libeigen3-dev python3 gfortran
+
+build:
+  stage: build
+  tags:
+    - run1
+  script:
+    - mkdir build
+    - cd build
+    - cmake .. 
+    - cmake --build .
+    - ctest -V
+
+# code_quality:
+#   image: docker:stable
+#   variables:
+#     DOCKER_DRIVER: overlay2
+#   allow_failure: true
+#   services:
+#     - docker:stable-dind
+#   script:
+#     - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
+#     - docker run
+#         --env SOURCE_CODE="$PWD"
+#         --volume "$PWD":/code
+#         --volume /var/run/docker.sock:/var/run/docker.sock
+#         "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
+#   artifacts:
+#     reports:
+#       codequality: gl-code-quality-report.json
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 567dd5ce5..d2d4df9b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
 endif()
  
 if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
-  message(STATUS "Setting build type to '${default_bluild_type}' as no other was specified.")
+  message(STATUS "Setting build type to '${default_build_type}' as no other was specified.")
   set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
       STRING "Choose the type of build." FORCE)
   # Set the possible values of build type for cmake-gui
diff --git a/Documentation/Examples/cascade_example.cc b/Documentation/Examples/cascade_example.cc
index cf6cd03b5..60e436a4e 100644
--- a/Documentation/Examples/cascade_example.cc
+++ b/Documentation/Examples/cascade_example.cc
@@ -170,10 +170,11 @@ public:
   void ShowResults() {
     cout << " ******************************" << endl
          << " ParticleCut: " << endl
-         << " energy in em.  component (GeV): " << fEmEnergy / 1_GeV << endl
-         << " no. of em.  particles injected: " << fEmCount << endl
-         << " energy in inv. component (GeV): " << fInvEnergy / 1_GeV << endl
-         << " no. of inv. particles injected: " << fInvCount << endl
+         << " energy in em.  component (GeV):  " << fEmEnergy / 1_GeV << endl
+         << " no. of em.  particles injected:  " << fEmCount << endl
+         << " energy in inv. component (GeV):  " << fInvEnergy / 1_GeV << endl
+         << " no. of inv. particles injected:  " << fInvCount << endl
+         << " energy below particle cut (GeV): " << fEnergy / 1_GeV << endl
          << " ******************************" << endl;
   }
 
diff --git a/Processes/Sibyll/Interaction.h b/Processes/Sibyll/Interaction.h
index 10e45a0c3..fbaf7c5f5 100644
--- a/Processes/Sibyll/Interaction.h
+++ b/Processes/Sibyll/Interaction.h
@@ -28,12 +28,6 @@ namespace corsika::process::sibyll {
       corsika::random::RNGManager& rmng = corsika::random::RNGManager::GetInstance();
       rmng.RegisterRandomStream("s_rndm");
 
-      // test random number generator
-      std::cout << "Interaction: "
-                << " test sequence of random numbers." << std::endl;
-      int a = 0;
-      for (int i = 0; i < 8; ++i) std::cout << i << " " << s_rndm_(a) << std::endl;
-
       // initialize Sibyll
       sibyll_ini_();
     }
@@ -186,7 +180,7 @@ namespace corsika::process::sibyll {
         EnergyType E = p.GetEnergy();
         EnergyType Etot = E + Etarget;
         // total momentum
-        MomentumVector Ptot = p.GetMomentum(); // + pTarget;
+        MomentumVector Ptot = p.GetMomentum();
         // invariant mass, i.e. cm. energy
         EnergyType Ecm =
             sqrt(Etot * Etot - Ptot.squaredNorm()); // sqrt( 2. * E * 0.93827_GeV );
@@ -210,7 +204,7 @@ namespace corsika::process::sibyll {
                   << " Ecm(GeV): " << Ecm / 1_GeV << std::endl;
         if (E < 8.5_GeV || Ecm < 10_GeV) {
           std::cout << "Interaction: "
-                    << " DoInteraction: dropping particle.." << std::endl;
+                    << " DoInteraction: should have dropped particle.." << std::endl;
           // p.Delete(); delete later... different process
         } else {
           // Sibyll does not know about units..
diff --git a/Stack/SuperStupidStack/SuperStupidStack.h b/Stack/SuperStupidStack/SuperStupidStack.h
index 3a12c052f..3e9bfe831 100644
--- a/Stack/SuperStupidStack/SuperStupidStack.h
+++ b/Stack/SuperStupidStack/SuperStupidStack.h
@@ -74,12 +74,9 @@ namespace corsika::stack {
         return GetStackData().GetTime(GetIndex());
       }
 
-      //#warning this does not really work, nor makes sense:
       corsika::geometry::Vector<corsika::units::si::SpeedType::dimension_type>
       GetDirection() const {
-        auto P = GetMomentum();
-        return P / P.norm() * 1e10 *
-               (corsika::units::si::meter / corsika::units::si::second);
+        return GetMomentum() / GetEnergy() * corsika::units::constants::c;
       }
     };
 
-- 
GitLab