Commit b74899b6e68ea82a96acb9dfc0634cb37bf33995

Authored by Jürgen Knödlseder
2 parents 9709f848 e2d01f3c

Merge remote-tracking branch 'cdeil/action_1109' into integration

doc/html/doc/ctobssim.html
@@ -235,6 +235,21 @@ TeV).</td> @@ -235,6 +235,21 @@ TeV).</td>
235 </tr> 235 </tr>
236 <tr> 236 <tr>
237 <td width="50">&nbsp;</td> 237 <td width="50">&nbsp;</td>
  238 +<td colspan="2"><span class="irafpar"><strong>edisp
  239 +[bool]</strong></span></td>
  240 +</tr>
  241 +<tr>
  242 +<td width="50">&nbsp;</td>
  243 +<td width="25">&nbsp;</td>
  244 +<td width="525">Apply energy dispersion?</td>
  245 +</tr>
  246 +<tr>
  247 +<td width="50">&nbsp;</td>
  248 +<td>&nbsp;</td>
  249 +<td width="525">&nbsp;</td>
  250 +</tr>
  251 +<tr>
  252 +<td width="50">&nbsp;</td>
238 <td colspan="2"><span class="irafpar"><strong>(deadc 253 <td colspan="2"><span class="irafpar"><strong>(deadc
239 = 0.95) 254 = 0.95)
240 [double]</strong></span></td> 255 [double]</strong></span></td>
src/ctobssim/ctobssim.cpp
@@ -544,14 +544,15 @@ void ctobssim::set_list(GCTAObservation* obs) @@ -544,14 +544,15 @@ void ctobssim::set_list(GCTAObservation* obs)
544 if (obs != NULL) { 544 if (obs != NULL) {
545 545
546 // Get CTA observation parameters 546 // Get CTA observation parameters
547 - m_ra = (*this)["ra"].real();  
548 - m_dec = (*this)["dec"].real();  
549 - m_rad = (*this)["rad"].real();  
550 - m_tmin = (*this)["tmin"].real();  
551 - m_tmax = (*this)["tmax"].real();  
552 - m_emin = (*this)["emin"].real();  
553 - m_emax = (*this)["emax"].real();  
554 - m_deadc = (*this)["deadc"].real(); 547 + m_ra = (*this)["ra"].real();
  548 + m_dec = (*this)["dec"].real();
  549 + m_rad = (*this)["rad"].real();
  550 + m_tmin = (*this)["tmin"].real();
  551 + m_tmax = (*this)["tmax"].real();
  552 + m_emin = (*this)["emin"].real();
  553 + m_emax = (*this)["emax"].real();
  554 + m_apply_edisp = (*this)["edisp"].boolean();
  555 + m_deadc = (*this)["deadc"].real();
555 556
556 // Allocate CTA event list 557 // Allocate CTA event list
557 GCTAEventList events; 558 GCTAEventList events;
@@ -629,7 +630,8 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models, @@ -629,7 +630,8 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
629 630
630 // Get pointer on CTA response. Throw an exception if the response 631 // Get pointer on CTA response. Throw an exception if the response
631 // is not defined. 632 // is not defined.
632 - const GCTAResponse& rsp = obs->response(); 633 + GCTAResponse& rsp = const_cast<GCTAResponse&>(obs->response());
  634 + rsp.apply_edisp(m_apply_edisp);
633 635
634 // Make sure that the observation holds a CTA event list. If this 636 // Make sure that the observation holds a CTA event list. If this
635 // is not the case then allocate and attach a CTA event list now. 637 // is not the case then allocate and attach a CTA event list now.
@@ -988,15 +990,16 @@ void ctobssim::init_members(void) @@ -988,15 +990,16 @@ void ctobssim::init_members(void)
988 m_prefix.clear(); 990 m_prefix.clear();
989 m_caldb.clear(); 991 m_caldb.clear();
990 m_irf.clear(); 992 m_irf.clear();
991 - m_seed = 1;  
992 - m_ra = 0.0;  
993 - m_dec = 0.0;  
994 - m_rad = 0.0;  
995 - m_tmin = 0.0;  
996 - m_tmax = 0.0;  
997 - m_emin = 0.0;  
998 - m_emax = 0.0;  
999 - m_deadc = 1.0; 993 + m_seed = 1;
  994 + m_ra = 0.0;
  995 + m_dec = 0.0;
  996 + m_rad = 0.0;
  997 + m_tmin = 0.0;
  998 + m_tmax = 0.0;
  999 + m_emin = 0.0;
  1000 + m_emax = 0.0;
  1001 + m_apply_edisp = true;
  1002 + m_deadc = 1.0;
1000 1003
1001 // Initialise protected members 1004 // Initialise protected members
1002 m_rans.clear(); 1005 m_rans.clear();
@@ -1032,20 +1035,21 @@ void ctobssim::init_members(void) @@ -1032,20 +1035,21 @@ void ctobssim::init_members(void)
1032 void ctobssim::copy_members(const ctobssim& app) 1035 void ctobssim::copy_members(const ctobssim& app)
1033 { 1036 {
1034 // Copy user parameters 1037 // Copy user parameters
1035 - m_infile = app.m_infile;  
1036 - m_outfile = app.m_outfile;  
1037 - m_prefix = app.m_prefix;  
1038 - m_caldb = app.m_caldb;  
1039 - m_irf = app.m_irf;  
1040 - m_seed = app.m_seed;  
1041 - m_ra = app.m_ra;  
1042 - m_dec = app.m_dec;  
1043 - m_rad = app.m_rad;  
1044 - m_tmin = app.m_tmin;  
1045 - m_tmax = app.m_tmax;  
1046 - m_emin = app.m_emin;  
1047 - m_emax = app.m_emax;  
1048 - m_deadc = app.m_deadc; 1038 + m_infile = app.m_infile;
  1039 + m_outfile = app.m_outfile;
  1040 + m_prefix = app.m_prefix;
  1041 + m_caldb = app.m_caldb;
  1042 + m_irf = app.m_irf;
  1043 + m_seed = app.m_seed;
  1044 + m_ra = app.m_ra;
  1045 + m_dec = app.m_dec;
  1046 + m_rad = app.m_rad;
  1047 + m_tmin = app.m_tmin;
  1048 + m_tmax = app.m_tmax;
  1049 + m_emin = app.m_emin;
  1050 + m_emax = app.m_emax;
  1051 + m_apply_edisp = app.m_apply_edisp;
  1052 + m_deadc = app.m_deadc;
1049 1053
1050 // Copy protected members 1054 // Copy protected members
1051 m_area = app.m_area; 1055 m_area = app.m_area;
src/ctobssim/ctobssim.hpp
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 /***********************************************************************//** 39 /***********************************************************************//**
40 * @class ctobssim 40 * @class ctobssim
41 * 41 *
42 - * @brief CTA observation simulator tool interface defintion 42 + * @brief CTA observation simulator tool interface definition
43 * 43 *
44 * This class simulates CTA observation(s) using Monte Carlo sampling of the 44 * This class simulates CTA observation(s) using Monte Carlo sampling of the
45 * source and background models. The class supports simulation of data of 45 * source and background models. The class supports simulation of data of
@@ -79,20 +79,21 @@ protected: @@ -79,20 +79,21 @@ protected:
79 void save_xml(void); 79 void save_xml(void);
80 80
81 // User parameters 81 // User parameters
82 - std::string m_infile; //!< Input model  
83 - std::string m_outfile; //!< Output events file  
84 - std::string m_prefix; //!< Prefix for multiple event lists  
85 - std::string m_caldb; //!< Calibration database repository  
86 - std::string m_irf; //!< Instrument response function  
87 - int m_seed; //!< Random number generator seed  
88 - double m_ra; //!< RA of pointing direction  
89 - double m_dec; //!< DEC of pointing direction  
90 - double m_rad; //!< FOV radius (degrees)  
91 - double m_tmin; //!< Start time (MET)  
92 - double m_tmax; //!< Stop time (MET)  
93 - double m_emin; //!< Lower energy (TeV)  
94 - double m_emax; //!< Upper energy (TeV)  
95 - double m_deadc; //!< Average deadtime correction 82 + std::string m_infile; //!< Input model
  83 + std::string m_outfile; //!< Output events file
  84 + std::string m_prefix; //!< Prefix for multiple event lists
  85 + std::string m_caldb; //!< Calibration database repository
  86 + std::string m_irf; //!< Instrument response function
  87 + int m_seed; //!< Random number generator seed
  88 + double m_ra; //!< RA of pointing direction
  89 + double m_dec; //!< DEC of pointing direction
  90 + double m_rad; //!< FOV radius (degrees)
  91 + double m_tmin; //!< Start time (MET)
  92 + double m_tmax; //!< Stop time (MET)
  93 + double m_emin; //!< Lower energy (TeV)
  94 + double m_emax; //!< Upper energy (TeV)
  95 + bool m_apply_edisp; //!< Apply energy dispersion?
  96 + double m_deadc; //!< Average deadtime correction
96 97
97 // Protected members 98 // Protected members
98 double m_area; //!< Surface area for simulation (cm2) 99 double m_area; //!< Surface area for simulation (cm2)
src/ctobssim/ctobssim.par
@@ -36,6 +36,7 @@ tmin, r, a, 0.0, 0, , &quot;Start time (MET in s)&quot; @@ -36,6 +36,7 @@ tmin, r, a, 0.0, 0, , &quot;Start time (MET in s)&quot;
36 tmax, r, a, 1800.0, 0, , "End time (MET in s)" 36 tmax, r, a, 1800.0, 0, , "End time (MET in s)"
37 emin, r, a, 0.1, 0, , "Lower energy limit (TeV)" 37 emin, r, a, 0.1, 0, , "Lower energy limit (TeV)"
38 emax, r, a, 100.0, 0, , "Upper energy limit (TeV)" 38 emax, r, a, 100.0, 0, , "Upper energy limit (TeV)"
  39 +edisp, b, h, yes, , , "Apply energy dispersion?"
39 deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor" 40 deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor"
40 # 41 #
41 # Standard parameters 42 # Standard parameters