From 8510ca23a081968698b325f7d4f8dd88f1fa0c99 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Thu, 4 Apr 2019 07:53:45 +0200 Subject: [PATCH] Change order in ctobservation::set_obs_bounds() to behave like standard ctobssim --- src/support/ctobservation.cpp | 75 +++++++++++++++++++++++++++++++++++++-------------------------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/src/support/ctobservation.cpp b/src/support/ctobservation.cpp index c5f95cb..9b7b201 100755 --- a/src/support/ctobservation.cpp +++ b/src/support/ctobservation.cpp @@ -533,44 +533,6 @@ void ctobservation::set_obs_bounds(void) continue; } - // If there are no Good Time Intervals then read the "tmin" and "tmax" - // user parameters and add them - if (list->gti().is_empty()) { - if (has_par("tmin") && (*this)["tmin"].is_valid() && - has_par("tmax") && (*this)["tmax"].is_valid()) { - - // Set time reference - GTimeReference ref = (has_par("mjdref")) - ? GTimeReference((*this)["mjdref"].real(), "s", "TT", "LOCAL") - : GTimeReference(G_CTA_MJDREF, "s", "TT", "LOCAL"); - - // Get time limits - GTime tmin = (*this)["tmin"].time(ref); - GTime tmax = (*this)["tmax"].time(ref); - - // Set GTI - GGti gti(tmin, tmax); - - // Set GTI of list - list->gti(gti); - - } // endif: "tmin" and "tmax" parameters existed and were valid - } // endif: GTI was not set - - - // If there are no energy boundaries then read the "emin" and "emax" - // user parameters and add them - if (list->ebounds().is_empty()) { - if (has_par("emin") && (*this)["emin"].is_valid() && - has_par("emax") && (*this)["emax"].is_valid()) { - double emin((*this)["emin"].real()); - double emax((*this)["emax"].real()); - GEbounds ebounds(GEnergy(emin, "TeV"), - GEnergy(emax, "TeV")); - list->ebounds(ebounds); - } - } - // If there is no RoI then read the "rad" user parameters and use // the pointing direction to set the RoI if (!list->roi().is_valid()) { @@ -602,6 +564,43 @@ void ctobservation::set_obs_bounds(void) } // endif: ROI radius was accessible } // endif: list had no ROI + // If there are no energy boundaries then read the "emin" and "emax" + // user parameters and add them + if (list->ebounds().is_empty()) { + if (has_par("emin") && (*this)["emin"].is_valid() && + has_par("emax") && (*this)["emax"].is_valid()) { + double emin((*this)["emin"].real()); + double emax((*this)["emax"].real()); + GEbounds ebounds(GEnergy(emin, "TeV"), + GEnergy(emax, "TeV")); + list->ebounds(ebounds); + } + } + + // If there are no Good Time Intervals then read the "tmin" and "tmax" + // user parameters and add them + if (list->gti().is_empty()) { + if (has_par("tmin") && (*this)["tmin"].is_valid() && + has_par("tmax") && (*this)["tmax"].is_valid()) { + + // Set time reference + GTimeReference ref = (has_par("mjdref")) + ? GTimeReference((*this)["mjdref"].real(), "s", "TT", "LOCAL") + : GTimeReference(G_CTA_MJDREF, "s", "TT", "LOCAL"); + + // Get time limits + GTime tmin = (*this)["tmin"].time(ref); + GTime tmax = (*this)["tmax"].time(ref); + + // Set GTI + GGti gti(tmin, tmax); + + // Set GTI of list + list->gti(gti); + + } // endif: "tmin" and "tmax" parameters existed and were valid + } // endif: GTI was not set + } // endfor: looped over observations // Return -- libgit2 0.21.4