diff --git a/ChangeLog b/ChangeLog index a69da02..d1da81d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2017-03-13 +2017-03-18 * Version 1.3.0 released ======================== + Take into account RoI in ctskymap Set local language to english (#1370) Enhance logfile output of csroot2caldb script Set default deadc value to 0.98 (CTA has <2% deadtime) diff --git a/NEWS b/NEWS index 1b954a1..3ec4557 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in ctools 1.3.0.dev1 -13 March 2017 +18 March 2017 Introduction @@ -52,7 +52,8 @@ None ctskymap - CTA sky mapping -------------------------- -None +Any RoI is now taken into account in ctskymap so that if IRF background +subtraction is requested the counts and background maps are coherent. ctmodel - CTA counts cube modelling diff --git a/src/ctskymap/ctskymap.cpp b/src/ctskymap/ctskymap.cpp index f8c9958..072bbac 100644 --- a/src/ctskymap/ctskymap.cpp +++ b/src/ctskymap/ctskymap.cpp @@ -489,10 +489,14 @@ void ctskymap::map_events(GCTAObservation* obs) emax.TeV(m_emax); // Initialise binning statistics + int num_outside_roi = 0; int num_outside_map = 0; int num_outside_erange = 0; int num_in_map = 0; + // Extract region of interest from observation + GCTARoi roi = obs->roi(); + // Fill sky map for (int i = 0; i < events->size(); ++i) { @@ -517,6 +521,12 @@ void ctskymap::map_events(GCTAObservation* obs) continue; } + // If RoI is valid then skip if instrument direction is not within RoI + if (roi.is_valid() && !roi.contains(*inst)) { + continue; + num_outside_roi++; + } + // Fill event in skymap m_skymap(pixel, 0) += 1.0; num_in_map++; @@ -526,6 +536,7 @@ void ctskymap::map_events(GCTAObservation* obs) // Log binning results log_value(NORMAL, "Events in list", obs->events()->size()); log_value(NORMAL, "Events in map", num_in_map); + log_value(NORMAL, "Events outside RoI", num_outside_roi); log_value(NORMAL, "Events outside map area", num_outside_map); log_value(NORMAL, "Events outside energies", num_outside_erange); @@ -614,6 +625,9 @@ void ctskymap::map_background_irf(GCTAObservation* obs) nebin = 10; } + // Extract region of interest from observation + GCTARoi roi = obs->roi(); + // Setup energy nodes for computation GEnergies energies(nebin, emin, emax); // More complicated nbins later @@ -626,6 +640,12 @@ void ctskymap::map_background_irf(GCTAObservation* obs) // Convert sky direction in instrument direction GCTAInstDir instdir = obs->pointing().instdir(skydir); + // If RoI is valid and instrument direction is not within RoI then + // skip pixel + if (roi.is_valid() && !roi.contains(instdir)) { + continue; + } + // Compute background value for each energy node std::vector values(energies.size(), 0.0); for (int k = 0; k < energies.size(); ++k) { diff --git a/src/ctskymap/ctskymap.hpp b/src/ctskymap/ctskymap.hpp index 01aa6a1..c4efd25 100644 --- a/src/ctskymap/ctskymap.hpp +++ b/src/ctskymap/ctskymap.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctskymap - Sky mapping tool * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2016 by Juergen Knoedlseder * + * copyright (C) 2010-2017 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -33,7 +33,7 @@ /* __Definitions _________________________________________________________ */ #define CTSKYMAP_NAME "ctskymap" -#define CTSKYMAP_VERSION "1.2.0" +#define CTSKYMAP_VERSION "1.3.0" /***********************************************************************//**