From d89fd993253b0cf1867baac55eefe8428f2fb963 Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Wed, 24 Mar 2021 15:26:38 +0100
Subject: [PATCH] conex lost energy

---
 corsika/detail/modules/conex/CONEXhybrid.inl    | 8 +++++++-
 corsika/detail/modules/qgsjetII/Interaction.inl | 2 +-
 corsika/modules/conex/CONEXhybrid.hpp           | 4 ++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/corsika/detail/modules/conex/CONEXhybrid.inl b/corsika/detail/modules/conex/CONEXhybrid.inl
index 5b350013f..6ab443e49 100644
--- a/corsika/detail/modules/conex/CONEXhybrid.inl
+++ b/corsika/detail/modules/conex/CONEXhybrid.inl
@@ -54,7 +54,8 @@ namespace corsika {
 
         return b.normalized();
       })}
-      , y_sf_{showerAxis_.getDirection().cross(x_sf_)} {
+      , y_sf_{showerAxis_.getDirection().cross(x_sf_)}
+      , energy_em_(0_GeV) {
 
     CORSIKA_LOG_DEBUG("x_sf (conexObservationCS): {}",
                       x_sf_.getComponents(conexObservationCS_));
@@ -180,6 +181,7 @@ namespace corsika {
 
     double const E = energy / 1_GeV;
     double const m = mass / 1_GeV;
+    energy_em_ += energy;
 
     CORSIKA_LOG_DEBUG("CONEXhybrid: removing {} {:5e} GeV", egs_pid, energy);
 
@@ -284,4 +286,8 @@ namespace corsika {
     fitout.close();
   }
 
+  inline HEPEnergyType CONEXhybrid::getEnergyEM() const { return energy_em_; }
+
+  inline void CONEXhybrid::reset() { energy_em_ = 0_GeV; }
+
 } // namespace corsika
diff --git a/corsika/detail/modules/qgsjetII/Interaction.inl b/corsika/detail/modules/qgsjetII/Interaction.inl
index a97265abc..2409ff8f4 100644
--- a/corsika/detail/modules/qgsjetII/Interaction.inl
+++ b/corsika/detail/modules/qgsjetII/Interaction.inl
@@ -241,7 +241,7 @@ namespace corsika::qgsjetII {
         if (targetCode != Proton::code)
           throw std::runtime_error("QgsjetII Taget not possible.");
       }
-      CORSIKA_LOG_DEBUG("Interaction: target qgsjetII code/A: ", targetMassNumber);
+      CORSIKA_LOG_DEBUG("Interaction: target qgsjetII code/A: {}", targetMassNumber);
 
       int projectileMassNumber = 1; // "1" means "hadron"
       QgsjetIIHadronType qgsjet_hadron_type =
diff --git a/corsika/modules/conex/CONEXhybrid.hpp b/corsika/modules/conex/CONEXhybrid.hpp
index b8927f635..d5480d9db 100644
--- a/corsika/modules/conex/CONEXhybrid.hpp
+++ b/corsika/modules/conex/CONEXhybrid.hpp
@@ -39,6 +39,9 @@ namespace corsika {
 
     CoordinateSystemPtr const& getObserverCS() const { return conexObservationCS_; }
 
+    HEPEnergyType getEnergyEM() const;
+    void reset();
+    
   private:
     // data members
     //! CONEX e.m. particle codes
@@ -52,6 +55,7 @@ namespace corsika {
     CoordinateSystemPtr const conexObservationCS_; //!< CONEX observation frame
     DirectionVector const x_sf_,
         y_sf_; //!< unit vectors of CONEX shower frame, z_sf is shower axis direction
+    HEPEnergyType energy_em_;
   };
 } // namespace corsika
 
-- 
GitLab