From 059936bc89f86a576b1671cb2b4c75b2727558db Mon Sep 17 00:00:00 2001 From: Luigi Tibaldo Date: Thu, 23 Nov 2017 16:59:47 +0100 Subject: [PATCH] added is_onoff method to ctool support --- src/support/ctool.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/support/ctool.hpp | 1 + 2 files changed, 39 insertions(+), 0 deletions(-) diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp index e4fd7e5..6f06d7d 100644 --- a/src/support/ctool.cpp +++ b/src/support/ctool.cpp @@ -1193,6 +1193,44 @@ bool ctool::is_stacked(void) return stacked; } +/***********************************************************************//** + * @brief Query user parameters for On/Off analysis + * + * @return True if an On/Off analysis should be done. + * + * Queries the parameter "method", and if this is "ONOFF" signal that an On/ + * Off analysis is requested. In that case, all necessary input parameters of + * csphagen are queried: "inexclusion", "srcshape", "rad", "bkgmethod", + * "bkgregmin", "maxoffset", "stack", "etruemin", "etruemax", "etruebins" + * + * Using this method assures that the parameters are always queried in the + * same order. + ***************************************************************************/ +bool ctool::is_onoff(void) +{ + // initialise onoff flag + bool onoff = false; + // query analysis method chosen + if ((*this)["method"].string() == "ONOFF"){ + //modify onoff flag + onoff = true; + //query csphagen parameters + (*this)["inexclusion"].filename(); + if ((*this)["srcshape"].string() == "CIRCLE"){ + (*this)["rad"].real(); + } + if ((*this)["bkgmethod"].string() == "REFLECTED"){ + (*this)["bkgregmin"].integer(); + } + (*this)["maxoffset"].real(); + (*this)["etruemin"].real(); + (*this)["etruemx"].real(); + (*this)["etruebins"].integer(); + } + + // Return stacked flag + return onoff; +} /***********************************************************************//** * @brief Set response for all CTA observations in container diff --git a/src/support/ctool.hpp b/src/support/ctool.hpp index 26a6aea..97c66e9 100644 --- a/src/support/ctool.hpp +++ b/src/support/ctool.hpp @@ -104,6 +104,7 @@ protected: // Protected methods that query user parameters bool is_stacked(void); + bool is_onoff(void); // Protected methods for logging void log_observations(const GChatter& chatter, -- libgit2 0.21.4