From 48e89d15975f2b9f71a6064e6fdbb3c99a67960b Mon Sep 17 00:00:00 2001
From: Kipp Cannon <kipp.cannon@ligo.org>
Date: Thu, 26 Jul 2018 17:50:23 +0900
Subject: [PATCH] lal_simulation: remove sort of burst injections

- XLALSortSimBurst() and XLALCompareSimBurstByGeocentTimeGPS() have been
  removed from lalburst upstream.  they are not needed here, nothing takes
  advantage of the injection list being time-ordered, so just don't bother
  calling them.
---
 gstlal/gst/lal/gstlal_simulation.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/gstlal/gst/lal/gstlal_simulation.c b/gstlal/gst/lal/gstlal_simulation.c
index 63a4e3dda6..6b0ec10528 100644
--- a/gstlal/gst/lal/gstlal_simulation.c
+++ b/gstlal/gst/lal/gstlal_simulation.c
@@ -192,7 +192,6 @@ static struct injection_document *load_injection_document(const char *filename,
 			success = 0;
 		} else
 			XLALPrintInfo("%s(): found sim_burst table\n", __func__);
-		XLALSortSimBurst(&new->sim_burst_table_head, XLALCompareSimBurstByGeocentTimeGPS);
 	} else
 		new->sim_burst_table_head = NULL;
 
@@ -471,12 +470,15 @@ static int update_simulation_series(REAL8TimeSeries *h, GSTLALSimulation *elemen
 
 	if(element->injection_document->sim_burst_table_head) {
 		/*
-		 * We follow the procedure in here so we don't end up adding the same burst injection to the data multiple times.
-		 * The burst_series buffer essentially windows the injections to those that are currently relevant.
-		 */
-
-		/*
-		 * create a buffer to store burst injections
+		 * create a buffer to store burst injections.  we put the
+		 * injections into this (zeroed) buffer and then from there
+		 * into h(t) so that we don't inject the same burst
+		 * injection into the data more than once (these
+		 * intermediate buffers are disjoint).
+		 * XLALBurstInjectSignals() will skip injections too far
+		 * outside of the boundaries of its target series, so in
+		 * this way we also control which injections are generated
+		 * in each iteration.
 		 */
 
 		REAL8TimeSeries *burst_series = XLALCreateREAL8TimeSeries(h->name, &h->epoch, h->f0, h->deltaT, &h->sampleUnits, h->data->length);
-- 
GitLab