From d1bca57e89e4736097a7e3112fad6798da1351a2 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Thu, 2 Jul 2015 11:15:09 +0200 Subject: [PATCH] Enhance logging of skipped observations. --- src/ctobssim/ctobssim.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 075fbdd..0344d20 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -225,8 +225,8 @@ void ctobssim::run(void) m_save_and_dispose = true; } - // Determine the number of valid CTA observations, set energy dispersion flag - // for all CTA observations and save old values in save_edisp vector + // Determine the number of valid CTA observations, set energy dispersion + // flag for all CTA observations and save old values in save_edisp vector int n_observations = 0; std::vector save_edisp; save_edisp.assign(m_obs.size(), false); @@ -324,15 +324,26 @@ void ctobssim::run(void) #pragma omp for for (int i = 0; i < m_obs.size(); ++i) { + // Write header for observation + if (logTerse()) { + if (m_obs[i]->name().length() > 1) { + wrklog.header3("Observation "+m_obs[i]->name()); + } + else { + wrklog.header3("Observation"); + } + } + // Get pointer on CTA observation GCTAObservation* obs = dynamic_cast(m_obs[i]); // Skip observation if it's not CTA if (obs == NULL) { if (logTerse()) { - log << "Warning: Skipping "+m_obs[i]->instrument(); - log << " observation \""; - log << m_obs[i]->name() << "\"" << std::endl; + wrklog << " Skipping "+m_obs[i]->instrument(); + wrklog << " observation \""; + wrklog << m_obs[i]->name() << "\""; + wrklog << " (id=" << m_obs[i]->id() << ")" << std::endl; } continue; } @@ -340,22 +351,15 @@ void ctobssim::run(void) // Skip observation if we have a binned observation if (obs->eventtype() == "CountsCube") { if (logTerse()) { - log << "Warning: Skipping binned observation \""; - log << obs->name()+"\"" << std::endl; + wrklog << " Skipping binned "; + wrklog << obs->instrument(); + wrklog << " observation \""; + wrklog << obs->name()+"\""; + wrklog << " (id=" << obs->id() << ")" << std::endl; } continue; } - // Write header for observation - if (logTerse()) { - if (obs->name().length() > 1) { - wrklog.header3("Observation "+obs->name()); - } - else { - wrklog.header3("Observation"); - } - } - // 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 @@ -409,7 +413,7 @@ void ctobssim::run(void) // Dispose events obs->dispose_events(); - } + } // endif: save and dispose requested } // endfor: looped over observations -- libgit2 0.21.4