From 24ddfae76d308d86f98bcd4bd5e87841c3be2b0f Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 12 Feb 2016 00:31:58 +0100 Subject: [PATCH] Delete any existing event list in ctobssim before appending new simulated events. --- ChangeLog | 1 + NEWS | 6 +++++- src/ctobssim/ctobssim.cpp | 13 +++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5996754..96c3e74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Version 1.1.0 released ======================== + Delete existing events before simulation in ctobssim (#1663) Add csiactcopy script (#1661) ctselect allows usage of non-default events and GTI extensions (#1598) diff --git a/NEWS b/NEWS index 20d9b33..e164696 100644 --- a/NEWS +++ b/NEWS @@ -28,7 +28,11 @@ None 5. ctobssim - CTA observation simulation ---------------------------------------- -None +Any existing events in an event list are now removed before starting the +simulation to enable providing an existing event file on input from which +only the observation attributes are extracted (for example GTI, ROI, energy +range, etc.) while the measured events are replaced by the simulated ones +(#1663). 6. ctselect - CTA event selection diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 3d9c721..7ec7450 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctobssim - Observation simulator tool * * ----------------------------------------------------------------------- * - * copyright (C) 2011-2015 by Juergen Knoedlseder * + * copyright (C) 2011-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -360,6 +360,14 @@ void ctobssim::run(void) continue; } + // Remove now all events from the event list but keep the + // event list information such as ROI, Good Time Intervals, + // energy boundaries. This will also keep additional columns + // in an event list file. + GCTAEventList* events = + static_cast(const_cast(obs->events())); + events->remove(0, events->size()); + // Work on a clone of the CTA observation. This makes sure that // any memory allocated for computing (for example a response // cache) is properly de-allocated on exit of this run @@ -407,7 +415,8 @@ void ctobssim::run(void) // to avoid multiple threads writing simultaneously #pragma omp critical { - obs_clone.save(outfile, clobber()); + //obs_clone.save(outfile, clobber()); + obs->save(outfile, clobber()); } // Dispose events -- libgit2 0.21.4