Commit e737cfdae37ea662bc8d2fe02402b0659fbd1c16

Authored by Jürgen Knödlseder
1 parent c2ba7f92

Correct apply DEFAULT energy boundaries in ctselect

Showing 1 changed file with 10 additions and 5 deletions
src/ctselect/ctselect.cpp
@@ -714,8 +714,8 @@ void ctselect::select_events(GCTAObservation* obs, @@ -714,8 +714,8 @@ void ctselect::select_events(GCTAObservation* obs,
714 GCTARoi old_roi = list->roi(); 714 GCTARoi old_roi = list->roi();
715 GEbounds old_ebounds = list->ebounds(); 715 GEbounds old_ebounds = list->ebounds();
716 716
717 - // Determine new energy boundaries for selection  
718 - // taking into account previous existing ones 717 + // Determine new energy boundaries for selection taking into account
  718 + // previous existing ones
719 double emin = 0.0; 719 double emin = 0.0;
720 double emax = 0.0; 720 double emax = 0.0;
721 GEbounds ebounds = set_ebounds(obs, list->ebounds()); 721 GEbounds ebounds = set_ebounds(obs, list->ebounds());
@@ -1081,6 +1081,11 @@ void ctselect::select_events(GCTAObservation* obs, @@ -1081,6 +1081,11 @@ void ctselect::select_events(GCTAObservation* obs,
1081 list->ebounds(ebounds); 1081 list->ebounds(ebounds);
1082 } 1082 }
1083 1083
  1084 + // ... otherwise set new boundaries
  1085 + else if (ebounds.size() > 0) {
  1086 + list->ebounds(ebounds);
  1087 + }
  1088 +
1084 // ... otherwise restore old Ebounds if they existed 1089 // ... otherwise restore old Ebounds if they existed
1085 else if (old_ebounds.size() > 0) { 1090 else if (old_ebounds.size() > 0) {
1086 list->ebounds(old_ebounds); 1091 list->ebounds(old_ebounds);
@@ -1156,7 +1161,7 @@ GEbounds ctselect::set_ebounds(GCTAObservation* obs, const GEbounds& ebounds) co @@ -1156,7 +1161,7 @@ GEbounds ctselect::set_ebounds(GCTAObservation* obs, const GEbounds& ebounds) co
1156 if (m_usethres == "DEFAULT") { 1161 if (m_usethres == "DEFAULT") {
1157 1162
1158 // Get CTA IRF respsonse pointer and throw exception if we don't 1163 // Get CTA IRF respsonse pointer and throw exception if we don't
1159 - // find IRF 1164 + // find IRF
1160 const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*> 1165 const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*>
1161 (obs->response()); 1166 (obs->response());
1162 if (rsp == NULL) { 1167 if (rsp == NULL) {
@@ -1190,7 +1195,7 @@ GEbounds ctselect::set_ebounds(GCTAObservation* obs, const GEbounds&amp; ebounds) co @@ -1190,7 +1195,7 @@ GEbounds ctselect::set_ebounds(GCTAObservation* obs, const GEbounds&amp; ebounds) co
1190 emax = hi_save_thres; 1195 emax = hi_save_thres;
1191 } 1196 }
1192 1197
1193 - } //endif: usethres was "DEFAULT" 1198 + } // endif: usethres was "DEFAULT"
1194 1199
1195 // ... otherwise check if a user specified threshold should be applied 1200 // ... otherwise check if a user specified threshold should be applied
1196 else if (m_usethres == "USER") { 1201 else if (m_usethres == "USER") {
@@ -1220,7 +1225,7 @@ GEbounds ctselect::set_ebounds(GCTAObservation* obs, const GEbounds&amp; ebounds) co @@ -1220,7 +1225,7 @@ GEbounds ctselect::set_ebounds(GCTAObservation* obs, const GEbounds&amp; ebounds) co
1220 emax = hi_user_thres; 1225 emax = hi_user_thres;
1221 } 1226 }
1222 1227
1223 - } // endif: usethres was "USER 1228 + } // endif: usethres was "USER"
1224 1229
1225 // Set selection energy boundaries 1230 // Set selection energy boundaries
1226 GEbounds result; 1231 GEbounds result;