Commit a6c0453aee492196d62cf578f3be5913a8013cdc

Authored by Jürgen Knödlseder
2 parents ad0d4262 f110804a

Merge branch '2682-ctselect-noROI' into integration

# Conflicts:
#	ChangeLog
ChangeLog
... ... @@ -3,6 +3,7 @@
3 3 * Version 1.6.0 released
4 4 ========================
5 5  
  6 + Avoid ctselect error in case that RoI radius is unchanged (#2682)
6 7 Add "use_irf_bkg" parameter to cslightcrv
7 8 Add "like_accuracy" parameter to likelihood tools and scripts (#2662)
8 9 Do not skip bins with zero counts in csspec (#2671)
... ...
... ... @@ -131,6 +131,9 @@ None
131 131  
132 132 ctselect - CTA event selection
133 133 ------------------------------
  134 +Avoid an error in case that the RoI radius is identical to the existing RoI
  135 +radius (#2682).
  136 +
134 137 Interpret MET specified by "tmin" and "tmax" parameters in the time reference
135 138 of the input observations (#2054).
136 139  
... ...
doc/source/admin/release_history/1.6.rst
... ... @@ -19,6 +19,8 @@ In particular, this release provides:
19 19 Bug fixes
20 20 ---------
21 21  
  22 +* [`2682 <https://cta-redmine.irap.omp.eu/issues/2682>`_] -
  23 + Avoid :ref:`ctselect` error in case that RoI radius is unchanged
22 24 * [`2652 <https://cta-redmine.irap.omp.eu/issues/2652>`_] -
23 25 Defer import of ``ROOT`` module in :ref:`csroot2caldb` to run method
24 26 * [`2456 <https://cta-redmine.irap.omp.eu/issues/2456>`_] -
... ...
doc/source/users/reference_manual/ctselect.rst
... ... @@ -11,8 +11,10 @@ Synopsis
11 11  
12 12 This tool selects events from one or several event lists. Event selection
13 13 is based on a circular acceptance region, a time interval and an energy
14   -interval. In addition, any expression following the cfitsio syntax can be
15   -used for event selection.
  14 +interval. If any of these default selections are to be skipped, the
  15 +user should set the relative parameters to ``INDEF`` (or ``NONE``,
  16 +``UNDEF``, ``UNDEFINED``). In addition, any expression following the cfitsio
  17 +syntax can be used for event selection.
16 18  
17 19 The circular acceptance region is centred by default at the pointing direction
18 20 of each observation, but the user can specify a custom direction. To obtain in
... ... @@ -35,7 +37,7 @@ of ``prefix`` prepended to the file name that contains only the selected
35 37 events. In addition, a new observation definition file will be written
36 38 that references the new FITS files.
37 39  
38   -For each event file, the event selection parameters will be writted as data
  40 +For each event file, the event selection parameters will be written as data
39 41 selection keywords to the FITS header. These keywords are mandatory for any
40 42 unbinned maximum likelihood analysis of the event data.
41 43  
... ...
doc/source/users/tutorials/quickstart/selecting.rst
... ... @@ -74,14 +74,15 @@ From the 202210 events in the input event list 21974 events were selected.
74 74 .. note::
75 75 Event selection by :ref:`ctselect` in a given dimension can be avoided
76 76 by specifying ``NONE`` (or ``INDEF``, ``UNDEF`` or ``UNDEFINED``) for
77   - one of the selection parameters. The following run for example only
  77 + one of the selection parameters. This is recommended rather than
  78 + specifying the same selection previosuly applied to the data. The following run for example only
78 79 performs a selection by time but no selection by ROI or energy:
79 80  
80 81 .. code-block:: bash
81 82  
82 83 $ ctselect
83 84 Input event list or observation definition XML file [events.fits]
84   - RA for ROI centre (degrees) (0-360) [83.63] NONE
  85 + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180.) [3.] NONE
85 86 Start time (UTC string, JD, MJD or time in seconds) [2020-01-01T00:10:00]
86 87 Stop time (UTC string, JD, MJD or time in seconds) [2020-01-01T00:40:00]
87 88 Lower energy limit (TeV) [0.1] NONE
... ...
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) {
... ...