Commit d1bca57e89e4736097a7e3112fad6798da1351a2

Authored by Jürgen Knödlseder
1 parent 907508c6

Enhance logging of skipped observations.

Showing 1 changed file with 22 additions and 18 deletions
src/ctobssim/ctobssim.cpp
... ... @@ -225,8 +225,8 @@ void ctobssim::run(void)
225 225 m_save_and_dispose = true;
226 226 }
227 227  
228   - // Determine the number of valid CTA observations, set energy dispersion flag
229   - // for all CTA observations and save old values in save_edisp vector
  228 + // Determine the number of valid CTA observations, set energy dispersion
  229 + // flag for all CTA observations and save old values in save_edisp vector
230 230 int n_observations = 0;
231 231 std::vector<bool> save_edisp;
232 232 save_edisp.assign(m_obs.size(), false);
... ... @@ -324,15 +324,26 @@ void ctobssim::run(void)
324 324 #pragma omp for
325 325 for (int i = 0; i < m_obs.size(); ++i) {
326 326  
  327 + // Write header for observation
  328 + if (logTerse()) {
  329 + if (m_obs[i]->name().length() > 1) {
  330 + wrklog.header3("Observation "+m_obs[i]->name());
  331 + }
  332 + else {
  333 + wrklog.header3("Observation");
  334 + }
  335 + }
  336 +
327 337 // Get pointer on CTA observation
328 338 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]);
329 339  
330 340 // Skip observation if it's not CTA
331 341 if (obs == NULL) {
332 342 if (logTerse()) {
333   - log << "Warning: Skipping "+m_obs[i]->instrument();
334   - log << " observation \"";
335   - log << m_obs[i]->name() << "\"" << std::endl;
  343 + wrklog << " Skipping "+m_obs[i]->instrument();
  344 + wrklog << " observation \"";
  345 + wrklog << m_obs[i]->name() << "\"";
  346 + wrklog << " (id=" << m_obs[i]->id() << ")" << std::endl;
336 347 }
337 348 continue;
338 349 }
... ... @@ -340,22 +351,15 @@ void ctobssim::run(void)
340 351 // Skip observation if we have a binned observation
341 352 if (obs->eventtype() == "CountsCube") {
342 353 if (logTerse()) {
343   - log << "Warning: Skipping binned observation \"";
344   - log << obs->name()+"\"" << std::endl;
  354 + wrklog << " Skipping binned ";
  355 + wrklog << obs->instrument();
  356 + wrklog << " observation \"";
  357 + wrklog << obs->name()+"\"";
  358 + wrklog << " (id=" << obs->id() << ")" << std::endl;
345 359 }
346 360 continue;
347 361 }
348 362  
349   - // Write header for observation
350   - if (logTerse()) {
351   - if (obs->name().length() > 1) {
352   - wrklog.header3("Observation "+obs->name());
353   - }
354   - else {
355   - wrklog.header3("Observation");
356   - }
357   - }
358   -
359 363 // Work on a clone of the CTA observation. This makes sure that
360 364 // any memory allocated for computing (for example a response
361 365 // cache) is properly de-allocated on exit of this run
... ... @@ -409,7 +413,7 @@ void ctobssim::run(void)
409 413 // Dispose events
410 414 obs->dispose_events();
411 415  
412   - }
  416 + } // endif: save and dispose requested
413 417  
414 418 } // endfor: looped over observations
415 419  
... ...