Commit 24ddfae76d308d86f98bcd4bd5e87841c3be2b0f
1 parent
74c18e2e
Delete any existing event list in ctobssim before appending new simulated events.
Showing
3 changed files
with
17 additions
and
3 deletions
ChangeLog
NEWS
| ... | ... | @@ -28,7 +28,11 @@ None |
| 28 | 28 | |
| 29 | 29 | 5. ctobssim - CTA observation simulation |
| 30 | 30 | ---------------------------------------- |
| 31 | -None | |
| 31 | +Any existing events in an event list are now removed before starting the | |
| 32 | +simulation to enable providing an existing event file on input from which | |
| 33 | +only the observation attributes are extracted (for example GTI, ROI, energy | |
| 34 | +range, etc.) while the measured events are replaced by the simulated ones | |
| 35 | +(#1663). | |
| 32 | 36 | |
| 33 | 37 | |
| 34 | 38 | 6. ctselect - CTA event selection | ... | ... |
src/ctobssim/ctobssim.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * ctobssim - Observation simulator tool * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2015 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2016 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -360,6 +360,14 @@ void ctobssim::run(void) |
| 360 | 360 | continue; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | + // Remove now all events from the event list but keep the | |
| 364 | + // event list information such as ROI, Good Time Intervals, | |
| 365 | + // energy boundaries. This will also keep additional columns | |
| 366 | + // in an event list file. | |
| 367 | + GCTAEventList* events = | |
| 368 | + static_cast<GCTAEventList*>(const_cast<GEvents*>(obs->events())); | |
| 369 | + events->remove(0, events->size()); | |
| 370 | + | |
| 363 | 371 | // Work on a clone of the CTA observation. This makes sure that |
| 364 | 372 | // any memory allocated for computing (for example a response |
| 365 | 373 | // cache) is properly de-allocated on exit of this run |
| ... | ... | @@ -407,7 +415,8 @@ void ctobssim::run(void) |
| 407 | 415 | // to avoid multiple threads writing simultaneously |
| 408 | 416 | #pragma omp critical |
| 409 | 417 | { |
| 410 | - obs_clone.save(outfile, clobber()); | |
| 418 | + //obs_clone.save(outfile, clobber()); | |
| 419 | + obs->save(outfile, clobber()); | |
| 411 | 420 | } |
| 412 | 421 | |
| 413 | 422 | // Dispose events | ... | ... |