From 0a155a586b6f4828ba3932c83fe54d4f4a491ace Mon Sep 17 00:00:00 2001
From: Johannes Schumann <johannes.schumann@fau.de>
Date: Wed, 5 May 2021 18:15:38 +0200
Subject: [PATCH] Fix write out for outgoing lepton from neutrino vertex

---
 km3buu/output.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/km3buu/output.py b/km3buu/output.py
index 8d12ccd..15be9d9 100644
--- a/km3buu/output.py
+++ b/km3buu/output.py
@@ -559,8 +559,13 @@ def write_detector_file(gibuu_output,
         nu_in_trk.E = event.lepIn_E
         nu_in_trk.t = timestamp
         nu_in_trk.status = PARTICLE_MC_STATUS["InitialState"]
+        evt.mc_trks.push_back(nu_in_trk)
 
-        if not propagate_tau:
+        if tau_secondaries is not None:
+            event_tau_sec = tau_secondaries[mc_event_id]
+            add_particles(event_tau_sec, vtx_pos, R, mc_trk_id, timestamp)
+            mc_trk_id += len(event_tau_sec.E)
+        else:
             lep_out_trk = ROOT.Trk()
             lep_out_trk.id = mc_trk_id
             mc_trk_id += 1
@@ -575,12 +580,6 @@ def write_detector_file(gibuu_output,
             lep_out_trk.status = PARTICLE_MC_STATUS["StableFinalState"]
             evt.mc_trks.push_back(lep_out_trk)
 
-        evt.mc_trks.push_back(nu_in_trk)
-
-        if tau_secondaries is not None:
-            event_tau_sec = tau_secondaries[mc_event_id]
-            add_particles(event_tau_sec, vtx_pos, R, mc_trk_id, timestamp)
-            mc_trk_id += len(event_tau_sec.E)
 
         add_particles(event, vtx_pos, R, mc_trk_id, timestamp,
                       PARTICLE_MC_STATUS["StableFinalState"])
-- 
GitLab