From db79d50dfdc07bc1ef91e3b25823bb83ff94a42f Mon Sep 17 00:00:00 2001
From: Johannes Schumann <johannes.schumann@fau.de>
Date: Thu, 22 Apr 2021 13:11:31 +0200
Subject: [PATCH] Add xsec to w2list

---
 km3buu/output.py            | 6 ++----
 km3buu/tests/test_output.py | 2 ++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/km3buu/output.py b/km3buu/output.py
index 6ba0c0e..db2e3e2 100644
--- a/km3buu/output.py
+++ b/km3buu/output.py
@@ -126,7 +126,7 @@ PARTICLE_MC_STATUS = {
 W2LIST_LOOKUP = {
     "PS": 0,
     "EG": 1,
-    "XSEC_MEAN": 2,
+    "XSEC": 2,
     "COLUMN_DEPTH": 3,
     "P_EARTH": 4,
     "WATER_INT_LEN": 5,
@@ -137,8 +137,6 @@ W2LIST_LOOKUP = {
     "CC": 10,
     "DISTAMAX": 11,
     "WATERXSEC": 12,
-    "XSEC": 13,
-    "DXSEC": 14,
     "TARGETA": 15,
     "TARGETZ": 16,
     "VERINCAN": 17,
@@ -519,7 +517,7 @@ def write_detector_file(gibuu_output,
         evt.w.push_back(-1.0)  #w3 (= w2*flux)
         # Event Information (w2list)
         evt.w2list.resize(W2LIST_LENGTH)
-
+        evt.w2list[W2LIST_LOOKUP["XSEC"]] = event.xsec
         evt.w2list[W2LIST_LOOKUP["TARGETA"]] = gibuu_output.A
         evt.w2list[W2LIST_LOOKUP["TARGETZ"]] = gibuu_output.Z
         evt.w2list[W2LIST_LOOKUP["BX"]] = bjorkenx[mc_event_id]
diff --git a/km3buu/tests/test_output.py b/km3buu/tests/test_output.py
index b103d4c..d6ea63b 100644
--- a/km3buu/tests/test_output.py
+++ b/km3buu/tests/test_output.py
@@ -117,6 +117,8 @@ class TestAANET(unittest.TestCase):
         np.testing.assert_allclose(evt.mc_tracks.pos_y, -122.54421157)
         np.testing.assert_allclose(evt.mc_tracks.pos_z, 208.57726764)
         usr = evt.mc_tracks.usr[0]
+        # XSEC
+        np.testing.assert_almost_equal(evt.w2list[2], 40.62418521597373)
         # Bx
         np.testing.assert_almost_equal(evt.w2list[7], 0.35479262672400624)
         # By
-- 
GitLab