Commit e2d01f3c53907fecbf04707d40003e29ba505d84

Authored by Christoph Deil
1 parent 70ed8749

Add edisp parameter to ctobssim

doc/html/doc/ctobssim.html
... ... @@ -235,6 +235,21 @@ TeV).</td>
235 235 </tr>
236 236 <tr>
237 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 253 <td colspan="2"><span class="irafpar"><strong>(deadc
239 254 = 0.95)
240 255 [double]</strong></span></td>
... ...
src/ctobssim/ctobssim.cpp
... ... @@ -532,14 +532,15 @@ void ctobssim::set_list(GCTAObservation* obs)
532 532 if (obs != NULL) {
533 533  
534 534 // Get CTA observation parameters
535   - m_ra = (*this)["ra"].real();
536   - m_dec = (*this)["dec"].real();
537   - m_rad = (*this)["rad"].real();
538   - m_tmin = (*this)["tmin"].real();
539   - m_tmax = (*this)["tmax"].real();
540   - m_emin = (*this)["emin"].real();
541   - m_emax = (*this)["emax"].real();
542   - m_deadc = (*this)["deadc"].real();
  535 + m_ra = (*this)["ra"].real();
  536 + m_dec = (*this)["dec"].real();
  537 + m_rad = (*this)["rad"].real();
  538 + m_tmin = (*this)["tmin"].real();
  539 + m_tmax = (*this)["tmax"].real();
  540 + m_emin = (*this)["emin"].real();
  541 + m_emax = (*this)["emax"].real();
  542 + m_apply_edisp = (*this)["edisp"].boolean();
  543 + m_deadc = (*this)["deadc"].real();
543 544  
544 545 // Allocate CTA event list
545 546 GCTAEventList events;
... ... @@ -617,7 +618,8 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models,
617 618  
618 619 // Get pointer on CTA response. Throw an exception if the response
619 620 // is not defined.
620   - const GCTAResponse& rsp = obs->response();
  621 + GCTAResponse& rsp = const_cast<GCTAResponse&>(obs->response());
  622 + rsp.apply_edisp(m_apply_edisp);
621 623  
622 624 // Make sure that the observation holds a CTA event list. If this
623 625 // is not the case then allocate and attach a CTA event list now.
... ... @@ -976,15 +978,16 @@ void ctobssim::init_members(void)
976 978 m_prefix.clear();
977 979 m_caldb.clear();
978 980 m_irf.clear();
979   - m_seed = 1;
980   - m_ra = 0.0;
981   - m_dec = 0.0;
982   - m_rad = 0.0;
983   - m_tmin = 0.0;
984   - m_tmax = 0.0;
985   - m_emin = 0.0;
986   - m_emax = 0.0;
987   - m_deadc = 1.0;
  981 + m_seed = 1;
  982 + m_ra = 0.0;
  983 + m_dec = 0.0;
  984 + m_rad = 0.0;
  985 + m_tmin = 0.0;
  986 + m_tmax = 0.0;
  987 + m_emin = 0.0;
  988 + m_emax = 0.0;
  989 + m_apply_edisp = true;
  990 + m_deadc = 1.0;
988 991  
989 992 // Initialise protected members
990 993 m_rans.clear();
... ... @@ -1020,20 +1023,21 @@ void ctobssim::init_members(void)
1020 1023 void ctobssim::copy_members(const ctobssim& app)
1021 1024 {
1022 1025 // Copy user parameters
1023   - m_infile = app.m_infile;
1024   - m_outfile = app.m_outfile;
1025   - m_prefix = app.m_prefix;
1026   - m_caldb = app.m_caldb;
1027   - m_irf = app.m_irf;
1028   - m_seed = app.m_seed;
1029   - m_ra = app.m_ra;
1030   - m_dec = app.m_dec;
1031   - m_rad = app.m_rad;
1032   - m_tmin = app.m_tmin;
1033   - m_tmax = app.m_tmax;
1034   - m_emin = app.m_emin;
1035   - m_emax = app.m_emax;
1036   - m_deadc = app.m_deadc;
  1026 + m_infile = app.m_infile;
  1027 + m_outfile = app.m_outfile;
  1028 + m_prefix = app.m_prefix;
  1029 + m_caldb = app.m_caldb;
  1030 + m_irf = app.m_irf;
  1031 + m_seed = app.m_seed;
  1032 + m_ra = app.m_ra;
  1033 + m_dec = app.m_dec;
  1034 + m_rad = app.m_rad;
  1035 + m_tmin = app.m_tmin;
  1036 + m_tmax = app.m_tmax;
  1037 + m_emin = app.m_emin;
  1038 + m_emax = app.m_emax;
  1039 + m_apply_edisp = app.m_apply_edisp;
  1040 + m_deadc = app.m_deadc;
1037 1041  
1038 1042 // Copy protected members
1039 1043 m_area = app.m_area;
... ...
src/ctobssim/ctobssim.hpp
... ... @@ -39,7 +39,7 @@
39 39 /***********************************************************************//**
40 40 * @class ctobssim
41 41 *
42   - * @brief CTA observation simulator tool interface defintion
  42 + * @brief CTA observation simulator tool interface definition
43 43 *
44 44 * This class simulates CTA observation(s) using Monte Carlo sampling of the
45 45 * source and background models. The class supports simulation of data of
... ... @@ -79,20 +79,21 @@ protected:
79 79 void save_xml(void);
80 80  
81 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 98 // Protected members
98 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 36 tmax, r, a, 1800.0, 0, , "End time (MET in s)"
37 37 emin, r, a, 0.1, 0, , "Lower energy limit (TeV)"
38 38 emax, r, a, 100.0, 0, , "Upper energy limit (TeV)"
  39 +edisp, b, h, yes, , , "Apply energy dispersion?"
39 40 deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor"
40 41 #
41 42 # Standard parameters
... ...