Commit f216e606b7717df1b239c3aff011ff8c1cde2141

Authored by Jürgen Knödlseder
1 parent 979dccb6

Avoid loading of event file.

Showing 1 changed file with 4 additions and 18 deletions
src/ctbkgcube/ctbkgcube.cpp
... ... @@ -322,9 +322,6 @@ void ctbkgcube::run(void)
322 322 // Fill the cube
323 323 fill_cube(obs);
324 324  
325   - // Dispose events to free memory
326   - obs->dispose_events();
327   -
328 325 } // endif: CTA observation found
329 326  
330 327 } // endfor: looped over observations
... ... @@ -650,10 +647,9 @@ void ctbkgcube::set_from_cntmap(const std::string& filename)
650 647 *
651 648 * @param[in] obs Pointer to CTA observation.
652 649 *
653   - * @exception GException::invalid_value
654   - * No event list found in CTA observation.
655   - *
656 650 * Fills the background cube with the model value for a CTA observation.
  651 + * This method will not need to load the event file as it gets the event
  652 + * ROI and GTI directly from the observation.
657 653 ***************************************************************************/
658 654 void ctbkgcube::fill_cube(GCTAObservation* obs)
659 655 {
... ... @@ -666,20 +662,10 @@ void ctbkgcube::fill_cube(GCTAObservation* obs)
666 662 int n_bins_outside = 0;
667 663  
668 664 // Extract region of interest from CTA observation
669   - const GCTAEventList* list = dynamic_cast<const GCTAEventList*>(obs->events());
670   - if (list == NULL) {
671   - std::string msg = "CTA Observation does not contain an event "
672   - "list. Event list information is needed to "
673   - "retrieve the Region of Interest for each "
674   - "CTA observation. Please provide an event list "
675   - "or an observation definition file containing "
676   - "event lists as \"infile\" parameter.";
677   - throw GException::invalid_value(G_FILL_CUBE, msg);
678   - }
679   - const GCTARoi& roi = list->roi();
  665 + GCTARoi roi = obs->roi();
680 666  
681 667 // Set GTI of actual observations as the GTI of the event cube
682   - m_bkgcube.gti(obs->events()->gti());
  668 + m_bkgcube.gti(obs->gti());
683 669  
684 670 // Get observation livetime
685 671 double livetime = obs->livetime();
... ...