Commit dc236082beb192042a58b29f914c485ebf09057c

Authored by Luigi Tibaldo
1 parent 6540305d

rad>= roi_radius treated as rad > roi_radius, numerical tolerance margin for enclosure verification

Showing 1 changed file with 6 additions and 4 deletions
src/ctselect/ctselect.cpp
... ... @@ -928,17 +928,19 @@ void ctselect::select_events(GCTAObservation* obs,
928 928 double distance = centre.dist_deg(roi_centre);
929 929  
930 930 // If the requested RoI and selected RoI are centred at the same
931   - // position and the requested RoI is bigger then the original
932   - // keep original radius
  931 + // position and the requested RoI is bigger or same size as
  932 + // the original keep original radius
933 933 // RoIs same centre = distance < 1.e-4
934 934 // to cope with numerical precision limitations
935   - if ((distance < 1.e-4) && (rad > roi_radius)) {
  935 + if ((distance < 1.e-4) && (rad >= roi_radius)) {
936 936 rad = roi_radius;
937 937 }
938 938  
939 939 // ... otherwise, check if requested RoI is enclosed within
940 940 // original RoI
941   - else if ((distance + rad) > roi_radius) {
  941 + // enclosed = distance + rad - roi_radius > 1.e-4
  942 + // to cope with numerical precision limitations
  943 + else if ((distance + rad - roi_radius) > 1.e-4) {
942 944  
943 945 // If selection is enforced log warning and store
944 946 if (m_forcesel) {
... ...