Commit 6eff4223b2ac3949960965929707def77028aecb
1 parent
d0f9823b
Redeclare ctobssim::obs() as inline method.
As the GCTAObservation class now handles transparently the disposal and re-loading of information it is not needed anymore to re-load the event list upon call of the obs() method. We thus can put the obs() method inline as before.
Showing
2 changed files
with
22 additions
and
37 deletions
src/ctobssim/ctobssim.cpp
| ... | ... | @@ -323,6 +323,7 @@ void ctobssim::run(void) |
| 323 | 323 | // is enabled, this loop will be parallelized. |
| 324 | 324 | #pragma omp for |
| 325 | 325 | for (int i = 0; i < m_obs.size(); ++i) { |
| 326 | +std::cout << "Observation " << i << ": " << get_current_rss() << std::endl; | |
| 326 | 327 | |
| 327 | 328 | // Get pointer on CTA observation |
| 328 | 329 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| ... | ... | @@ -362,6 +363,9 @@ void ctobssim::run(void) |
| 362 | 363 | wrklog << std::endl; |
| 363 | 364 | } |
| 364 | 365 | |
| 366 | + // Append the event list to the original observation | |
| 367 | + obs->events(*(obs_clone.events())); | |
| 368 | + | |
| 365 | 369 | // If requested, event lists are saved immediately |
| 366 | 370 | if (m_save_and_dispose) { |
| 367 | 371 | |
| ... | ... | @@ -387,12 +391,17 @@ void ctobssim::run(void) |
| 387 | 391 | obs_clone.save(outfile, clobber()); |
| 388 | 392 | } |
| 389 | 393 | |
| 394 | + // Dispose events | |
| 395 | + obs->dispose_events(); | |
| 396 | + | |
| 390 | 397 | } |
| 391 | 398 | |
| 392 | 399 | // ... otherwise append the event list to the original observation |
| 400 | + /* | |
| 393 | 401 | else { |
| 394 | 402 | obs->events(*(obs_clone.events())); |
| 395 | 403 | } |
| 404 | + */ | |
| 396 | 405 | |
| 397 | 406 | } // endif: CTA observation found |
| 398 | 407 | |
| ... | ... | @@ -467,43 +476,6 @@ void ctobssim::save(void) |
| 467 | 476 | } |
| 468 | 477 | |
| 469 | 478 | |
| 470 | -/***********************************************************************//** | |
| 471 | - * @brief Return observation container | |
| 472 | - * | |
| 473 | - * @return Reference to observation container | |
| 474 | - ***************************************************************************/ | |
| 475 | -const GObservations& ctobssim::obs(void) const | |
| 476 | -{ | |
| 477 | - // If event lists have been disposed, load them now into the observation | |
| 478 | - // container | |
| 479 | - if (m_save_and_dispose) { | |
| 480 | - | |
| 481 | - // Loop over all observation in the container | |
| 482 | - for (int i = 0; i < m_obs.size(); ++i) { | |
| 483 | - | |
| 484 | - // Get CTA observation | |
| 485 | - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | |
| 486 | - | |
| 487 | - // Handle only CTA observations | |
| 488 | - if (obs != NULL) { | |
| 489 | - | |
| 490 | - // Load observation from FITS file | |
| 491 | - obs->load(obs->eventfile()); | |
| 492 | - | |
| 493 | - } // endif: observation was a CTA observations | |
| 494 | - | |
| 495 | - } // endfor: looped over CTA observations | |
| 496 | - | |
| 497 | - // Now we have the event lists hence we can reset the disposal flag | |
| 498 | - m_save_and_dispose = false; | |
| 499 | - | |
| 500 | - } // endif: event lists have been disposed | |
| 501 | - | |
| 502 | - // Return observation container | |
| 503 | - return m_obs; | |
| 504 | -} | |
| 505 | - | |
| 506 | - | |
| 507 | 479 | /*========================================================================== |
| 508 | 480 | = = |
| 509 | 481 | = Private methods = | ... | ... |
src/ctobssim/ctobssim.hpp
| ... | ... | @@ -111,4 +111,17 @@ protected: |
| 111 | 111 | int m_event_id; //!< Event identifier |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | + | |
| 115 | +/***********************************************************************//** | |
| 116 | + * @brief Return observation container | |
| 117 | + * | |
| 118 | + * @return Reference to observation container | |
| 119 | + ***************************************************************************/ | |
| 120 | +inline | |
| 121 | +const GObservations& ctobssim::obs(void) const | |
| 122 | +{ | |
| 123 | + // Return observation container | |
| 124 | + return m_obs; | |
| 125 | +} | |
| 126 | + | |
| 114 | 127 | #endif /* CTOBSSIM_HPP */ | ... | ... |