Commit 3335d555306d37a7b58fcc45fa1b95635ee1e1ba

Authored by Jürgen Knödlseder
1 parent 052e74fa

Take into account RoI in ctskymap

ChangeLog
1 -2017-03-13 1 +2017-03-18
2 2
3 * Version 1.3.0 released 3 * Version 1.3.0 released
4 ======================== 4 ========================
5 5
  6 + Take into account RoI in ctskymap
6 Set local language to english (#1370) 7 Set local language to english (#1370)
7 Enhance logfile output of csroot2caldb script 8 Enhance logfile output of csroot2caldb script
8 Set default deadc value to 0.98 (CTA has <2% deadtime) 9 Set default deadc value to 0.98 (CTA has <2% deadtime)
1 New Features and Important Changes in ctools 1.3.0.dev1 1 New Features and Important Changes in ctools 1.3.0.dev1
2 2
3 -13 March 2017 3 +18 March 2017
4 4
5 5
6 Introduction 6 Introduction
@@ -52,7 +52,8 @@ None @@ -52,7 +52,8 @@ None
52 52
53 ctskymap - CTA sky mapping 53 ctskymap - CTA sky mapping
54 -------------------------- 54 --------------------------
55 -None 55 +Any RoI is now taken into account in ctskymap so that if IRF background
  56 +subtraction is requested the counts and background maps are coherent.
56 57
57 58
58 ctmodel - CTA counts cube modelling 59 ctmodel - CTA counts cube modelling
src/ctskymap/ctskymap.cpp
@@ -489,10 +489,14 @@ void ctskymap::map_events(GCTAObservation* obs) @@ -489,10 +489,14 @@ void ctskymap::map_events(GCTAObservation* obs)
489 emax.TeV(m_emax); 489 emax.TeV(m_emax);
490 490
491 // Initialise binning statistics 491 // Initialise binning statistics
  492 + int num_outside_roi = 0;
492 int num_outside_map = 0; 493 int num_outside_map = 0;
493 int num_outside_erange = 0; 494 int num_outside_erange = 0;
494 int num_in_map = 0; 495 int num_in_map = 0;
495 496
  497 + // Extract region of interest from observation
  498 + GCTARoi roi = obs->roi();
  499 +
496 // Fill sky map 500 // Fill sky map
497 for (int i = 0; i < events->size(); ++i) { 501 for (int i = 0; i < events->size(); ++i) {
498 502
@@ -517,6 +521,12 @@ void ctskymap::map_events(GCTAObservation* obs) @@ -517,6 +521,12 @@ void ctskymap::map_events(GCTAObservation* obs)
517 continue; 521 continue;
518 } 522 }
519 523
  524 + // If RoI is valid then skip if instrument direction is not within RoI
  525 + if (roi.is_valid() && !roi.contains(*inst)) {
  526 + continue;
  527 + num_outside_roi++;
  528 + }
  529 +
520 // Fill event in skymap 530 // Fill event in skymap
521 m_skymap(pixel, 0) += 1.0; 531 m_skymap(pixel, 0) += 1.0;
522 num_in_map++; 532 num_in_map++;
@@ -526,6 +536,7 @@ void ctskymap::map_events(GCTAObservation* obs) @@ -526,6 +536,7 @@ void ctskymap::map_events(GCTAObservation* obs)
526 // Log binning results 536 // Log binning results
527 log_value(NORMAL, "Events in list", obs->events()->size()); 537 log_value(NORMAL, "Events in list", obs->events()->size());
528 log_value(NORMAL, "Events in map", num_in_map); 538 log_value(NORMAL, "Events in map", num_in_map);
  539 + log_value(NORMAL, "Events outside RoI", num_outside_roi);
529 log_value(NORMAL, "Events outside map area", num_outside_map); 540 log_value(NORMAL, "Events outside map area", num_outside_map);
530 log_value(NORMAL, "Events outside energies", num_outside_erange); 541 log_value(NORMAL, "Events outside energies", num_outside_erange);
531 542
@@ -614,6 +625,9 @@ void ctskymap::map_background_irf(GCTAObservation* obs) @@ -614,6 +625,9 @@ void ctskymap::map_background_irf(GCTAObservation* obs)
614 nebin = 10; 625 nebin = 10;
615 } 626 }
616 627
  628 + // Extract region of interest from observation
  629 + GCTARoi roi = obs->roi();
  630 +
617 // Setup energy nodes for computation 631 // Setup energy nodes for computation
618 GEnergies energies(nebin, emin, emax); // More complicated nbins later 632 GEnergies energies(nebin, emin, emax); // More complicated nbins later
619 633
@@ -626,6 +640,12 @@ void ctskymap::map_background_irf(GCTAObservation* obs) @@ -626,6 +640,12 @@ void ctskymap::map_background_irf(GCTAObservation* obs)
626 // Convert sky direction in instrument direction 640 // Convert sky direction in instrument direction
627 GCTAInstDir instdir = obs->pointing().instdir(skydir); 641 GCTAInstDir instdir = obs->pointing().instdir(skydir);
628 642
  643 + // If RoI is valid and instrument direction is not within RoI then
  644 + // skip pixel
  645 + if (roi.is_valid() && !roi.contains(instdir)) {
  646 + continue;
  647 + }
  648 +
629 // Compute background value for each energy node 649 // Compute background value for each energy node
630 std::vector<double> values(energies.size(), 0.0); 650 std::vector<double> values(energies.size(), 0.0);
631 for (int k = 0; k < energies.size(); ++k) { 651 for (int k = 0; k < energies.size(); ++k) {
src/ctskymap/ctskymap.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * ctskymap - Sky mapping tool * 2 * ctskymap - Sky mapping tool *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 33
34 /* __Definitions _________________________________________________________ */ 34 /* __Definitions _________________________________________________________ */
35 #define CTSKYMAP_NAME "ctskymap" 35 #define CTSKYMAP_NAME "ctskymap"
36 -#define CTSKYMAP_VERSION "1.2.0" 36 +#define CTSKYMAP_VERSION "1.3.0"
37 37
38 38
39 /***********************************************************************//** 39 /***********************************************************************//**