From fc91d2a2aee0489f2eee216d4c9e1a47ec93cf47 Mon Sep 17 00:00:00 2001
From: Felix Riehn <felix@matilda>
Date: Wed, 26 Dec 2018 17:30:18 +0000
Subject: [PATCH] added number of wounded nucleons to sibyll interface

---
 Processes/Sibyll/Interaction.h | 8 +++++---
 Processes/Sibyll/sibyll2.3c.cc | 2 ++
 Processes/Sibyll/sibyll2.3c.h  | 8 ++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Processes/Sibyll/Interaction.h b/Processes/Sibyll/Interaction.h
index 9f106211..57236eb7 100644
--- a/Processes/Sibyll/Interaction.h
+++ b/Processes/Sibyll/Interaction.h
@@ -16,10 +16,11 @@ namespace corsika::process::sibyll {
   class Interaction : public corsika::process::InteractionProcess<Interaction> {
 
     mutable int fCount = 0;
-
+    mutable int fNucCount = 0;
+    
   public:
     Interaction() {}
-    ~Interaction() { std::cout << "Sibyll::Interaction n=" << fCount << std::endl; }
+    ~Interaction() { std::cout << "Sibyll::Interaction n=" << fCount << " Nnuc=" << fNucCount <<std::endl;}
 
     void Init() {
 
@@ -227,7 +228,8 @@ namespace corsika::process::sibyll {
           // print final state
           int print_unit = 6;
           sib_list_(print_unit);
-
+	  fNucCount += get_nwounded()-1;
+	  
           // delete current particle
           p.Delete();
 
diff --git a/Processes/Sibyll/sibyll2.3c.cc b/Processes/Sibyll/sibyll2.3c.cc
index de48630e..d77c81b7 100644
--- a/Processes/Sibyll/sibyll2.3c.cc
+++ b/Processes/Sibyll/sibyll2.3c.cc
@@ -3,6 +3,8 @@
 #include <corsika/random/RNGManager.h>
 #include <random>
 
+int get_nwounded() { return s_chist_.nwd; }
+
 double s_rndm_(int&) {
   static corsika::random::RNG& rng =
       corsika::random::RNGManager::GetInstance().GetRandomStream("s_rndm");
diff --git a/Processes/Sibyll/sibyll2.3c.h b/Processes/Sibyll/sibyll2.3c.h
index 0a0ecc11..e7076891 100644
--- a/Processes/Sibyll/sibyll2.3c.h
+++ b/Processes/Sibyll/sibyll2.3c.h
@@ -19,6 +19,12 @@ extern struct {
   int np;
 } s_plist_;
 
+// additional information about interactions.
+  // number of wounded nucleons, number of hard and soft scatterings etc.
+extern struct {
+  int nnsof[20], nnjet[20], jdif[20], nwd, njet, nsof;
+}s_chist_;
+  
 extern struct {
   double cbr[223 + 16 + 12 + 8];
   int kdec[1338 + 6 * (16 + 12 + 8)];
@@ -85,6 +91,8 @@ void sib_sigma_hp_(const int&, const double&, double&, double&, double&, double*
 
 double s_rndm_(int&);
 
+  int get_nwounded();  
+  
 // phojet random generator setup
 void pho_rndin_(int&, int&, int&, int&);
 }
-- 
GitLab