Commit e634e79ae4e557544a7910dd5b767d4bc67732ba
1 parent
4819414f
Only set observation boundaries if CTA observation has events.
Showing
1 changed file
with
3 additions
and
4 deletions
src/support/ctool.cpp
| @@ -811,7 +811,6 @@ void ctool::set_obs_response(GCTAObservation* obs) | @@ -811,7 +811,6 @@ void ctool::set_obs_response(GCTAObservation* obs) | ||
| 811 | * @brief Set observation boundaries | 811 | * @brief Set observation boundaries |
| 812 | * | 812 | * |
| 813 | * @param[in,out] obs Observation container | 813 | * @param[in,out] obs Observation container |
| 814 | - * | ||
| 815 | ***************************************************************************/ | 814 | ***************************************************************************/ |
| 816 | void ctool::set_obs_bounds(GObservations& obs) | 815 | void ctool::set_obs_bounds(GObservations& obs) |
| 817 | { | 816 | { |
| @@ -821,8 +820,8 @@ void ctool::set_obs_bounds(GObservations& obs) | @@ -821,8 +820,8 @@ void ctool::set_obs_bounds(GObservations& obs) | ||
| 821 | // Is this observation a CTA observation? | 820 | // Is this observation a CTA observation? |
| 822 | GCTAObservation* cta = dynamic_cast<GCTAObservation*>(obs[i]); | 821 | GCTAObservation* cta = dynamic_cast<GCTAObservation*>(obs[i]); |
| 823 | 822 | ||
| 824 | - // Yes ... | ||
| 825 | - if (cta != NULL) { | 823 | + // Continue only if observation is CTA and has events |
| 824 | + if ((cta != NULL) && (cta->has_events())) { | ||
| 826 | 825 | ||
| 827 | // Get pointer on event list | 826 | // Get pointer on event list |
| 828 | GCTAEventList* list = const_cast<GCTAEventList*>(dynamic_cast<const GCTAEventList*>(cta->events())); | 827 | GCTAEventList* list = const_cast<GCTAEventList*>(dynamic_cast<const GCTAEventList*>(cta->events())); |
| @@ -850,7 +849,7 @@ void ctool::set_obs_bounds(GObservations& obs) | @@ -850,7 +849,7 @@ void ctool::set_obs_bounds(GObservations& obs) | ||
| 850 | 849 | ||
| 851 | // If there is a "rad" parameter then use it | 850 | // If there is a "rad" parameter then use it |
| 852 | if (has_par("rad")) { | 851 | if (has_par("rad")) { |
| 853 | - double rad = (*this)["rad"].real(); | 852 | + double rad = (*this)["rad"].real(); |
| 854 | GCTARoi roi(GCTAInstDir(cta->pointing().dir()), rad); | 853 | GCTARoi roi(GCTAInstDir(cta->pointing().dir()), rad); |
| 855 | list->roi(roi); | 854 | list->roi(roi); |
| 856 | } | 855 | } |