Commit 4b010e1f74cba16404bdd8bb1729f658a0edc18d

Authored by Jürgen Knödlseder
1 parent e737cfda

Correct DEFAULT energy threshold handling in ctselect

Showing 1 changed file with 6 additions and 8 deletions
src/ctselect/ctselect.cpp
@@ -561,11 +561,15 @@ void ctselect::get_parameters(void) @@ -561,11 +561,15 @@ void ctselect::get_parameters(void)
561 get_gti(GTimeReference()); 561 get_gti(GTimeReference());
562 562
563 // Get energy selection parameters 563 // Get energy selection parameters
  564 + m_usethres = (*this)["usethres"].string();
564 if ((*this)["emin"].is_valid() && (*this)["emax"].is_valid()) { 565 if ((*this)["emin"].is_valid() && (*this)["emax"].is_valid()) {
565 m_emin = (*this)["emin"].real(); 566 m_emin = (*this)["emin"].real();
566 m_emax = (*this)["emax"].real(); 567 m_emax = (*this)["emax"].real();
567 m_select_energy = true; 568 m_select_energy = true;
568 } 569 }
  570 + else if ((m_usethres == "DEFAULT") || (m_usethres == "USER")) {
  571 + m_select_energy = true;
  572 + }
569 573
570 // Get phase selection string 574 // Get phase selection string
571 std::string phase_expr = gammalib::strip_whitespace(gammalib::tolower( 575 std::string phase_expr = gammalib::strip_whitespace(gammalib::tolower(
@@ -645,9 +649,8 @@ void ctselect::get_parameters(void) @@ -645,9 +649,8 @@ void ctselect::get_parameters(void)
645 } // endif: phase selection parameters were valid 649 } // endif: phase selection parameters were valid
646 650
647 // Get other User parameters 651 // Get other User parameters
648 - m_expr = (*this)["expr"].string();  
649 - m_usethres = (*this)["usethres"].string();  
650 - m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); 652 + m_expr = (*this)["expr"].string();
  653 + m_chatter = static_cast<GChatter>((*this)["chatter"].integer());
651 654
652 // If needed later, query output filename and prefix now 655 // If needed later, query output filename and prefix now
653 if (read_ahead()) { 656 if (read_ahead()) {
@@ -1081,11 +1084,6 @@ void ctselect::select_events(GCTAObservation* obs, @@ -1081,11 +1084,6 @@ void ctselect::select_events(GCTAObservation* obs,
1081 list->ebounds(ebounds); 1084 list->ebounds(ebounds);
1082 } 1085 }
1083 1086
1084 - // ... otherwise set new boundaries  
1085 - else if (ebounds.size() > 0) {  
1086 - list->ebounds(ebounds);  
1087 - }  
1088 -  
1089 // ... otherwise restore old Ebounds if they existed 1087 // ... otherwise restore old Ebounds if they existed
1090 else if (old_ebounds.size() > 0) { 1088 else if (old_ebounds.size() > 0) {
1091 list->ebounds(old_ebounds); 1089 list->ebounds(old_ebounds);