From a6ce0b8334f2d1097cbb021e1e0b69de3b9e1640 Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <schaller@strw.leidenuniv.nl>
Date: Thu, 17 Dec 2020 13:51:28 +0100
Subject: [PATCH] Store the number of times a particle was hit by SNII or AGN
 feedback, not only whether it was hit.

---
 src/tracers/EAGLE/tracers.h    | 4 ++--
 src/tracers/EAGLE/tracers_io.h | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/tracers/EAGLE/tracers.h b/src/tracers/EAGLE/tracers.h
index 8065b80375..11c5af4e5a 100644
--- a/src/tracers/EAGLE/tracers.h
+++ b/src/tracers/EAGLE/tracers.h
@@ -145,7 +145,7 @@ static INLINE void tracers_first_init_xpart(
  */
 static INLINE void tracers_after_feedback(struct xpart *xp) {
 
-  xp->tracers_data.hit_by_SNII_feedback = 1;
+  xp->tracers_data.hit_by_SNII_feedback++;
 }
 
 /**
@@ -163,7 +163,7 @@ static INLINE void tracers_after_black_holes_feedback(
     struct xpart *xp, const int with_cosmology, const float scale_factor,
     const double time, const double delta_energy) {
 
-  xp->tracers_data.hit_by_AGN_feedback = 1;
+  xp->tracers_data.hit_by_AGN_feedback++;
   xp->tracers_data.AGN_feedback_energy += delta_energy;
 }
 
diff --git a/src/tracers/EAGLE/tracers_io.h b/src/tracers/EAGLE/tracers_io.h
index 3c540132e9..0971a7f4de 100644
--- a/src/tracers/EAGLE/tracers_io.h
+++ b/src/tracers/EAGLE/tracers_io.h
@@ -77,13 +77,15 @@ __attribute__((always_inline)) INLINE static int tracers_write_particles(
       io_make_output_field("HeatedBySNIIFeedback", CHAR, 1, UNIT_CONV_NO_UNITS,
                            0.f, xparts, tracers_data.hit_by_SNII_feedback,
                            "Flags the particles that have been directly hit by "
-                           "a SNII feedback event at some point in the past.");
+                           "a SNII feedback event at some point in the past. "
+                           "If > 0, contains the number of individual events.");
 
   list[3] =
       io_make_output_field("HeatedByAGNFeedback", CHAR, 1, UNIT_CONV_NO_UNITS,
                            0.f, xparts, tracers_data.hit_by_AGN_feedback,
                            "Flags the particles that have been directly hit by "
-                           "an AGN feedback event at some point in the past.");
+                           "an AGN feedback event at some point in the past. "
+                           "If > 0, contains the number of individual events.");
 
   list[4] = io_make_output_field("EnergiesReceivedFromAGNFeedback", FLOAT, 1,
                                  UNIT_CONV_ENERGY, 0.f, xparts,
-- 
GitLab