diff --git a/doc/source/reference_manual/ctlike.rst b/doc/source/reference_manual/ctlike.rst index ccbec47..72e34b5 100644 --- a/doc/source/reference_manual/ctlike.rst +++ b/doc/source/reference_manual/ctlike.rst @@ -53,7 +53,10 @@ General parameters Applies energy dispersion to response computation. ``(refit = no) [boolean]`` - Performs refitting of solution after initial fit. + Perform refitting of solution after initial fit. + +``(fix_spat_for_ts = no) [boolean]`` + Fix spatial parameters for TS computation. diff --git a/src/ctlike/ctlike.cpp b/src/ctlike/ctlike.cpp index 2766b9e..ea01a20 100644 --- a/src/ctlike/ctlike.cpp +++ b/src/ctlike/ctlike.cpp @@ -264,21 +264,23 @@ void ctlike::run(void) // Fix spatial parameters if requested if (m_fix_spat_for_ts) { - for(int i = 0; i < models.size(); ++i) { + + // Loop over all models + for (int i = 0; i < models.size(); ++i) { // Continue only if model is skymodel GModelSky* sky= dynamic_cast(models[i]); if (sky != NULL) { // Fix spatial parameters - GModelSpatial* spat = sky->spatial(); - for (int j = 0; j < spat->size(); j++) { - (*spat)[j].fix(); - } // endfor: loop over spatial parameters + GModelSpatial* spatial = sky->spatial(); + for (int j = 0; j < spatial->size(); j++) { + (*spatial)[j].fix(); + } // endfor: looped over spatial parameters } // endif: there was a sky model - } // endfor: Loop over models + } // endfor: looped over models } // endif: spatial parameter should be fixed @@ -412,8 +414,8 @@ void ctlike::get_parameters(void) } // endif: no models were associated with observations // Get other parameters - m_refit = (*this)["refit"].boolean(); - m_apply_edisp = (*this)["edisp"].boolean(); + m_refit = (*this)["refit"].boolean(); + m_apply_edisp = (*this)["edisp"].boolean(); m_fix_spat_for_ts = (*this)["fix_spat_for_ts"].boolean(); // Optionally read ahead parameters so that they get correctly @@ -563,12 +565,13 @@ void ctlike::init_members(void) // Initialise members m_outmodel.clear(); m_obs.clear(); - m_refit = false; - m_max_iter = 100; // Set maximum number of iterations - m_max_stall = 10; // Set maximum number of stalls - m_logL = 0.0; - m_opt = NULL; - m_apply_edisp = false; + m_refit = false; + m_max_iter = 100; // Set maximum number of iterations + m_max_stall = 10; // Set maximum number of stalls + m_logL = 0.0; + m_opt = NULL; + m_apply_edisp = false; + m_fix_spat_for_ts = false; // Set logger properties log.date(true); @@ -596,14 +599,15 @@ void ctlike::init_members(void) void ctlike::copy_members(const ctlike& app) { // Copy attributes - m_refit = app.m_refit; - m_outmodel = app.m_outmodel; - m_obs = app.m_obs; - m_max_iter = app.m_max_iter; - m_max_stall = app.m_max_stall; - m_logL = app.m_logL; - m_opt = app.m_opt->clone(); - m_apply_edisp = app.m_apply_edisp; + m_refit = app.m_refit; + m_outmodel = app.m_outmodel; + m_obs = app.m_obs; + m_max_iter = app.m_max_iter; + m_max_stall = app.m_max_stall; + m_logL = app.m_logL; + m_opt = app.m_opt->clone(); + m_apply_edisp = app.m_apply_edisp; + m_fix_spat_for_ts = app.m_fix_spat_for_ts; // Return return; diff --git a/src/ctlike/ctlike.hpp b/src/ctlike/ctlike.hpp index ee40cc7..ae3a846 100644 --- a/src/ctlike/ctlike.hpp +++ b/src/ctlike/ctlike.hpp @@ -73,9 +73,9 @@ protected: double reoptimize_lm(void); // User parameters - bool m_refit; //!< Refitting - std::string m_outmodel; //!< Source model output XML file - bool m_apply_edisp; //!< Apply energy dispersion? + bool m_refit; //!< Refitting + std::string m_outmodel; //!< Source model output XML file + bool m_apply_edisp; //!< Apply energy dispersion? bool m_fix_spat_for_ts; //!< Fix spatial parameters for TS computation? // Members diff --git a/src/ctlike/ctlike.par b/src/ctlike/ctlike.par index 9e869e1..2fd8286 100644 --- a/src/ctlike/ctlike.par +++ b/src/ctlike/ctlike.par @@ -17,18 +17,18 @@ # # General parameters #=================== -inobs, f, a, "events.fits",,, "Event list, counts cube or observation definition file" -inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" -expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" -psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" -bkgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" -caldb, s, a, "prod2",,, "Calibration database" -irf, s, a, "South_50h",,, "Instrument response function" -outmodel, f, a, "crab_results.xml",,, "Source model output file" -stat, s, h, "POISSON",,, "Optimization statistics" -edisp, b, h, no,,, "Apply energy dispersion?" -refit, b, h, no,,, "Do refitting?" -fix_spat_for_ts,b,h,no,,,"Fix spatial parameters for TS computation?" +inobs, f, a, "events.fits",,, "Event list, counts cube or observation definition file" +inmodel, f, a, "$CTOOLS/share/models/crab.xml",,, "Source model" +expcube, f, a, "NONE",,, "Exposure cube file (only needed for stacked analysis)" +psfcube, f, a, "NONE",,, "PSF cube file (only needed for stacked analysis)" +bkgcube, f, a, "NONE",,, "Background cube file (only needed for stacked analysis)" +caldb, s, a, "prod2",,, "Calibration database" +irf, s, a, "South_50h",,, "Instrument response function" +outmodel, f, a, "crab_results.xml",,, "Source model output file" +stat, s, h, "POISSON",,, "Optimization statistics" +edisp, b, h, no,,, "Apply energy dispersion?" +refit, b, h, no,,, "Do refitting?" +fix_spat_for_ts, b, h, no,,,"Fix spatial parameters for TS computation?" # # Standard parameters