Commit 70ed8749eda55e4592e0319654be34da0b09a4c8

Authored by Jürgen Knödlseder
1 parent 1bc34ab2

Correctly filter instrument and id attributes in ctobssim.

The instrument and id attributes provided by an observation were not considering when simulating source and background events. This has been changed now that only events will be simulated when the instrument and id are valid for a given model.
ChangeLog
1 -2014-01-21 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> 1 +2014-01-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2
3 * Bug fix Version 0.7.1 released 3 * Bug fix Version 0.7.1 released
4 ================================ 4 ================================
5 5
6 Added missing hyphens in pfiles synchronisation section (#1091) 6 Added missing hyphens in pfiles synchronisation section (#1091)
7 Add configuration test script (#1091) 7 Add configuration test script (#1091)
  8 + Correctly filter instrument and id attributes in ctobssim
8 9
9 10
10 2014-01-18 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> 11 2014-01-18 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
@@ -2,7 +2,7 @@ New Features and Important Changes in ctools 00-07-01 @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 00-07-01
2 2
3 Author(s) : Juergen Knoedlseder 3 Author(s) : Juergen Knoedlseder
4 4
5 -21 January 2014 5 +24 January 2014
6 6
7 7
8 1. Introduction 8 1. Introduction
@@ -29,7 +29,10 @@ None @@ -29,7 +29,10 @@ None
29 29
30 4. ctobssim - CTA observation simulation 30 4. ctobssim - CTA observation simulation
31 ---------------------------------------- 31 ----------------------------------------
32 -None 32 +The instrument and id attributes provided by an observation were not
  33 +considering when simulating source and background events. This has been
  34 +changed now that only events will be simulated when the instrument
  35 +and id are valid for a given model.
33 36
34 37
35 5. ctselect - CTA event selection 38 5. ctselect - CTA event selection
src/ctobssim/ctobssim.cpp
@@ -689,8 +689,10 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models, @@ -689,8 +689,10 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
689 const GModelSky* model = 689 const GModelSky* model =
690 dynamic_cast<const GModelSky*>(models[i]); 690 dynamic_cast<const GModelSky*>(models[i]);
691 691
692 - // If we have a sky model then simulate photons  
693 - if (model != NULL) { 692 + // If we have a sky model that applies to the present
  693 + // observation then simulate events
  694 + if (model != NULL &&
  695 + model->is_valid(obs->instrument(), obs->id())) {
694 696
695 // Determine duration of a time slice by limiting the 697 // Determine duration of a time slice by limiting the
696 // number of simulated photons to m_max_photons. 698 // number of simulated photons to m_max_photons.
@@ -896,9 +898,10 @@ void ctobssim::simulate_background(GCTAObservation* obs, @@ -896,9 +898,10 @@ void ctobssim::simulate_background(GCTAObservation* obs,
896 const GModelData* model = 898 const GModelData* model =
897 dynamic_cast<const GModelData*>(models[i]); 899 dynamic_cast<const GModelData*>(models[i]);
898 900
899 - // If we have a data model that applies to CTA then simulate  
900 - // events  
901 - if (model != NULL && model->is_valid("CTA", "")) { 901 + // If we have a data model that applies to the present observation
  902 + // then simulate events
  903 + if (model != NULL &&
  904 + model->is_valid(obs->instrument(), obs->id())) {
902 905
903 // Get simulated CTA event list. Note that this method 906 // Get simulated CTA event list. Note that this method
904 // includes the deadtime correction. 907 // includes the deadtime correction.