From e2d01f3c53907fecbf04707d40003e29ba505d84 Mon Sep 17 00:00:00 2001 From: Christoph Deil Date: Fri, 31 Jan 2014 09:09:06 +0100 Subject: [PATCH] Add edisp parameter to ctobssim --- doc/html/doc/ctobssim.html | 15 +++++++++++++++ src/ctobssim/ctobssim.cpp | 68 ++++++++++++++++++++++++++++++++++++-------------------------------- src/ctobssim/ctobssim.hpp | 31 ++++++++++++++++--------------- src/ctobssim/ctobssim.par | 1 + 4 files changed, 68 insertions(+), 47 deletions(-) diff --git a/doc/html/doc/ctobssim.html b/doc/html/doc/ctobssim.html index 21dded0..3e62b2c 100644 --- a/doc/html/doc/ctobssim.html +++ b/doc/html/doc/ctobssim.html @@ -235,6 +235,21 @@ TeV).   +edisp +[bool] + + +  +  +Apply energy dispersion? + + +  +  +  + + +  (deadc = 0.95) [double] diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 6163a60..50064fb 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -532,14 +532,15 @@ void ctobssim::set_list(GCTAObservation* obs) if (obs != NULL) { // Get CTA observation parameters - m_ra = (*this)["ra"].real(); - m_dec = (*this)["dec"].real(); - m_rad = (*this)["rad"].real(); - m_tmin = (*this)["tmin"].real(); - m_tmax = (*this)["tmax"].real(); - m_emin = (*this)["emin"].real(); - m_emax = (*this)["emax"].real(); - m_deadc = (*this)["deadc"].real(); + m_ra = (*this)["ra"].real(); + m_dec = (*this)["dec"].real(); + m_rad = (*this)["rad"].real(); + m_tmin = (*this)["tmin"].real(); + m_tmax = (*this)["tmax"].real(); + m_emin = (*this)["emin"].real(); + m_emax = (*this)["emax"].real(); + m_apply_edisp = (*this)["edisp"].boolean(); + m_deadc = (*this)["deadc"].real(); // Allocate CTA event list GCTAEventList events; @@ -617,7 +618,8 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, // Get pointer on CTA response. Throw an exception if the response // is not defined. - const GCTAResponse& rsp = obs->response(); + GCTAResponse& rsp = const_cast(obs->response()); + rsp.apply_edisp(m_apply_edisp); // Make sure that the observation holds a CTA event list. If this // is not the case then allocate and attach a CTA event list now. @@ -976,15 +978,16 @@ void ctobssim::init_members(void) m_prefix.clear(); m_caldb.clear(); m_irf.clear(); - m_seed = 1; - m_ra = 0.0; - m_dec = 0.0; - m_rad = 0.0; - m_tmin = 0.0; - m_tmax = 0.0; - m_emin = 0.0; - m_emax = 0.0; - m_deadc = 1.0; + m_seed = 1; + m_ra = 0.0; + m_dec = 0.0; + m_rad = 0.0; + m_tmin = 0.0; + m_tmax = 0.0; + m_emin = 0.0; + m_emax = 0.0; + m_apply_edisp = true; + m_deadc = 1.0; // Initialise protected members m_rans.clear(); @@ -1020,20 +1023,21 @@ void ctobssim::init_members(void) void ctobssim::copy_members(const ctobssim& app) { // Copy user parameters - m_infile = app.m_infile; - m_outfile = app.m_outfile; - m_prefix = app.m_prefix; - m_caldb = app.m_caldb; - m_irf = app.m_irf; - m_seed = app.m_seed; - m_ra = app.m_ra; - m_dec = app.m_dec; - m_rad = app.m_rad; - m_tmin = app.m_tmin; - m_tmax = app.m_tmax; - m_emin = app.m_emin; - m_emax = app.m_emax; - m_deadc = app.m_deadc; + m_infile = app.m_infile; + m_outfile = app.m_outfile; + m_prefix = app.m_prefix; + m_caldb = app.m_caldb; + m_irf = app.m_irf; + m_seed = app.m_seed; + m_ra = app.m_ra; + m_dec = app.m_dec; + m_rad = app.m_rad; + m_tmin = app.m_tmin; + m_tmax = app.m_tmax; + m_emin = app.m_emin; + m_emax = app.m_emax; + m_apply_edisp = app.m_apply_edisp; + m_deadc = app.m_deadc; // Copy protected members m_area = app.m_area; diff --git a/src/ctobssim/ctobssim.hpp b/src/ctobssim/ctobssim.hpp index 2f48e51..789e15b 100644 --- a/src/ctobssim/ctobssim.hpp +++ b/src/ctobssim/ctobssim.hpp @@ -39,7 +39,7 @@ /***********************************************************************//** * @class ctobssim * - * @brief CTA observation simulator tool interface defintion + * @brief CTA observation simulator tool interface definition * * This class simulates CTA observation(s) using Monte Carlo sampling of the * source and background models. The class supports simulation of data of @@ -79,20 +79,21 @@ protected: void save_xml(void); // User parameters - std::string m_infile; //!< Input model - std::string m_outfile; //!< Output events file - std::string m_prefix; //!< Prefix for multiple event lists - std::string m_caldb; //!< Calibration database repository - std::string m_irf; //!< Instrument response function - int m_seed; //!< Random number generator seed - double m_ra; //!< RA of pointing direction - double m_dec; //!< DEC of pointing direction - double m_rad; //!< FOV radius (degrees) - double m_tmin; //!< Start time (MET) - double m_tmax; //!< Stop time (MET) - double m_emin; //!< Lower energy (TeV) - double m_emax; //!< Upper energy (TeV) - double m_deadc; //!< Average deadtime correction + std::string m_infile; //!< Input model + std::string m_outfile; //!< Output events file + std::string m_prefix; //!< Prefix for multiple event lists + std::string m_caldb; //!< Calibration database repository + std::string m_irf; //!< Instrument response function + int m_seed; //!< Random number generator seed + double m_ra; //!< RA of pointing direction + double m_dec; //!< DEC of pointing direction + double m_rad; //!< FOV radius (degrees) + double m_tmin; //!< Start time (MET) + double m_tmax; //!< Stop time (MET) + double m_emin; //!< Lower energy (TeV) + double m_emax; //!< Upper energy (TeV) + bool m_apply_edisp; //!< Apply energy dispersion? + double m_deadc; //!< Average deadtime correction // Protected members double m_area; //!< Surface area for simulation (cm2) diff --git a/src/ctobssim/ctobssim.par b/src/ctobssim/ctobssim.par index e85581f..3adf939 100644 --- a/src/ctobssim/ctobssim.par +++ b/src/ctobssim/ctobssim.par @@ -36,6 +36,7 @@ tmin, r, a, 0.0, 0, , "Start time (MET in s)" tmax, r, a, 1800.0, 0, , "End time (MET in s)" emin, r, a, 0.1, 0, , "Lower energy limit (TeV)" emax, r, a, 100.0, 0, , "Upper energy limit (TeV)" +edisp, b, h, yes, , , "Apply energy dispersion?" deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor" # # Standard parameters -- libgit2 0.21.4