Commit 8510ca23a081968698b325f7d4f8dd88f1fa0c99

Authored by Jürgen Knödlseder
1 parent 5e601dbf

Change order in ctobservation::set_obs_bounds() to behave like standard ctobssim

Showing 1 changed file with 37 additions and 38 deletions
src/support/ctobservation.cpp
... ... @@ -533,44 +533,6 @@ void ctobservation::set_obs_bounds(void)
533 533 continue;
534 534 }
535 535  
536   - // If there are no Good Time Intervals then read the "tmin" and "tmax"
537   - // user parameters and add them
538   - if (list->gti().is_empty()) {
539   - if (has_par("tmin") && (*this)["tmin"].is_valid() &&
540   - has_par("tmax") && (*this)["tmax"].is_valid()) {
541   -
542   - // Set time reference
543   - GTimeReference ref = (has_par("mjdref"))
544   - ? GTimeReference((*this)["mjdref"].real(), "s", "TT", "LOCAL")
545   - : GTimeReference(G_CTA_MJDREF, "s", "TT", "LOCAL");
546   -
547   - // Get time limits
548   - GTime tmin = (*this)["tmin"].time(ref);
549   - GTime tmax = (*this)["tmax"].time(ref);
550   -
551   - // Set GTI
552   - GGti gti(tmin, tmax);
553   -
554   - // Set GTI of list
555   - list->gti(gti);
556   -
557   - } // endif: "tmin" and "tmax" parameters existed and were valid
558   - } // endif: GTI was not set
559   -
560   -
561   - // If there are no energy boundaries then read the "emin" and "emax"
562   - // user parameters and add them
563   - if (list->ebounds().is_empty()) {
564   - if (has_par("emin") && (*this)["emin"].is_valid() &&
565   - has_par("emax") && (*this)["emax"].is_valid()) {
566   - double emin((*this)["emin"].real());
567   - double emax((*this)["emax"].real());
568   - GEbounds ebounds(GEnergy(emin, "TeV"),
569   - GEnergy(emax, "TeV"));
570   - list->ebounds(ebounds);
571   - }
572   - }
573   -
574 536 // If there is no RoI then read the "rad" user parameters and use
575 537 // the pointing direction to set the RoI
576 538 if (!list->roi().is_valid()) {
... ... @@ -602,6 +564,43 @@ void ctobservation::set_obs_bounds(void)
602 564 } // endif: ROI radius was accessible
603 565 } // endif: list had no ROI
604 566  
  567 + // If there are no energy boundaries then read the "emin" and "emax"
  568 + // user parameters and add them
  569 + if (list->ebounds().is_empty()) {
  570 + if (has_par("emin") && (*this)["emin"].is_valid() &&
  571 + has_par("emax") && (*this)["emax"].is_valid()) {
  572 + double emin((*this)["emin"].real());
  573 + double emax((*this)["emax"].real());
  574 + GEbounds ebounds(GEnergy(emin, "TeV"),
  575 + GEnergy(emax, "TeV"));
  576 + list->ebounds(ebounds);
  577 + }
  578 + }
  579 +
  580 + // If there are no Good Time Intervals then read the "tmin" and "tmax"
  581 + // user parameters and add them
  582 + if (list->gti().is_empty()) {
  583 + if (has_par("tmin") && (*this)["tmin"].is_valid() &&
  584 + has_par("tmax") && (*this)["tmax"].is_valid()) {
  585 +
  586 + // Set time reference
  587 + GTimeReference ref = (has_par("mjdref"))
  588 + ? GTimeReference((*this)["mjdref"].real(), "s", "TT", "LOCAL")
  589 + : GTimeReference(G_CTA_MJDREF, "s", "TT", "LOCAL");
  590 +
  591 + // Get time limits
  592 + GTime tmin = (*this)["tmin"].time(ref);
  593 + GTime tmax = (*this)["tmax"].time(ref);
  594 +
  595 + // Set GTI
  596 + GGti gti(tmin, tmax);
  597 +
  598 + // Set GTI of list
  599 + list->gti(gti);
  600 +
  601 + } // endif: "tmin" and "tmax" parameters existed and were valid
  602 + } // endif: GTI was not set
  603 +
605 604 } // endfor: looped over observations
606 605  
607 606 // Return
... ...