Commit df6de10aa6b5e169664aa5dc6ae72d3bab6e8dd8

Authored by Jürgen Knödlseder
1 parent 8e969282

Compute DETX and DETY in ctmodel if they are not available (#2694)

ChangeLog
1   -2018-09-22
  1 +2018-10-17
2 2  
3 3 * Version 1.6.0 released
4 4 ========================
5 5  
  6 + Compute DETX and DETY in ctmodel if they are not available (#2694)
6 7 Do no longer set missing boundaries in ctool::get_observations and
7 8 ctool::setup_observations (#2686)
8 9 Unnormalize background cube values in ctbkgcube (#2685)
... ...
1 1 New Features and Important Changes in ctools 1.6.0
2 2  
3   -22 September 2018
  3 +17 October 2018
4 4  
5 5  
6 6 Introduction
... ... @@ -112,6 +112,10 @@ None
112 112  
113 113 ctmodel - CTA counts cube modelling
114 114 -----------------------------------
  115 +The tools now computes DETX and DETY for every event bin if they are not
  116 +available so that model that rely on the existence of these parameters can
  117 +be handled (#2694).
  118 +
115 119 Add hidden "nthreads" parameter to control parallel computations (#2421).
116 120  
117 121  
... ...
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 +* [`2694 <https://cta-redmine.irap.omp.eu/issues/2694>`_] -
  23 + Compute ``DETX`` and ``DETY`` in :ref:`ctmodel` if they are not available
22 24 * [`2686 <https://cta-redmine.irap.omp.eu/issues/2686>`_] -
23 25 Do no longer set missing boundaries in ``ctool::get_observations`` and
24 26 ``ctool::setup_observations``
... ...
src/ctmodel/ctmodel.cpp
... ... @@ -852,6 +852,10 @@ void ctmodel::fill_cube(const GCTAObservation* obs, GModels&amp; models)
852 852 int npix = m_cube.npix();
853 853 int nebins = m_cube.ebins();
854 854  
  855 + // Get reference to the pointing for DETX and DETY computation, if
  856 + // required
  857 + const GCTAPointing& pnt = obs->pointing();
  858 +
855 859 // Get references to GTI and energy boundaries for the event list
856 860 const GGti& gti = obs->events()->gti();
857 861 const GEbounds& obs_ebounds = obs->ebounds();
... ... @@ -898,8 +902,15 @@ void ctmodel::fill_cube(const GCTAObservation* obs, GModels&amp; models)
898 902 continue;
899 903 }
900 904  
  905 + // Get instrument direction for spatial pixel. Compute DETX and DETY
  906 + // if they are not provided
  907 + GCTAInstDir dir = m_dir[i];
  908 + if (!dir.has_detx() || !dir.has_dety()) {
  909 + dir = pnt.instdir(dir.dir());
  910 + }
  911 +
901 912 // Set instrument direction, solid angle and pixel index of bin
902   - bin.dir(m_dir[i]);
  913 + bin.dir(dir);
903 914 bin.solidangle(m_solidangle[i]);
904 915 bin.ipix(i);
905 916  
... ...