Commit 059936bc89f86a576b1671cb2b4c75b2727558db
1 parent
bca8b3d8
added is_onoff method to ctool support
Showing
2 changed files
with
39 additions
and
0 deletions
src/support/ctool.cpp
| @@ -1193,6 +1193,44 @@ bool ctool::is_stacked(void) | @@ -1193,6 +1193,44 @@ bool ctool::is_stacked(void) | ||
| 1193 | return stacked; | 1193 | return stacked; |
| 1194 | } | 1194 | } |
| 1195 | 1195 | ||
| 1196 | +/***********************************************************************//** | ||
| 1197 | + * @brief Query user parameters for On/Off analysis | ||
| 1198 | + * | ||
| 1199 | + * @return True if an On/Off analysis should be done. | ||
| 1200 | + * | ||
| 1201 | + * Queries the parameter "method", and if this is "ONOFF" signal that an On/ | ||
| 1202 | + * Off analysis is requested. In that case, all necessary input parameters of | ||
| 1203 | + * csphagen are queried: "inexclusion", "srcshape", "rad", "bkgmethod", | ||
| 1204 | + * "bkgregmin", "maxoffset", "stack", "etruemin", "etruemax", "etruebins" | ||
| 1205 | + * | ||
| 1206 | + * Using this method assures that the parameters are always queried in the | ||
| 1207 | + * same order. | ||
| 1208 | + ***************************************************************************/ | ||
| 1209 | +bool ctool::is_onoff(void) | ||
| 1210 | +{ | ||
| 1211 | + // initialise onoff flag | ||
| 1212 | + bool onoff = false; | ||
| 1213 | + // query analysis method chosen | ||
| 1214 | + if ((*this)["method"].string() == "ONOFF"){ | ||
| 1215 | + //modify onoff flag | ||
| 1216 | + onoff = true; | ||
| 1217 | + //query csphagen parameters | ||
| 1218 | + (*this)["inexclusion"].filename(); | ||
| 1219 | + if ((*this)["srcshape"].string() == "CIRCLE"){ | ||
| 1220 | + (*this)["rad"].real(); | ||
| 1221 | + } | ||
| 1222 | + if ((*this)["bkgmethod"].string() == "REFLECTED"){ | ||
| 1223 | + (*this)["bkgregmin"].integer(); | ||
| 1224 | + } | ||
| 1225 | + (*this)["maxoffset"].real(); | ||
| 1226 | + (*this)["etruemin"].real(); | ||
| 1227 | + (*this)["etruemx"].real(); | ||
| 1228 | + (*this)["etruebins"].integer(); | ||
| 1229 | + } | ||
| 1230 | + | ||
| 1231 | + // Return stacked flag | ||
| 1232 | + return onoff; | ||
| 1233 | +} | ||
| 1196 | 1234 | ||
| 1197 | /***********************************************************************//** | 1235 | /***********************************************************************//** |
| 1198 | * @brief Set response for all CTA observations in container | 1236 | * @brief Set response for all CTA observations in container |
src/support/ctool.hpp
| @@ -104,6 +104,7 @@ protected: | @@ -104,6 +104,7 @@ protected: | ||
| 104 | 104 | ||
| 105 | // Protected methods that query user parameters | 105 | // Protected methods that query user parameters |
| 106 | bool is_stacked(void); | 106 | bool is_stacked(void); |
| 107 | + bool is_onoff(void); | ||
| 107 | 108 | ||
| 108 | // Protected methods for logging | 109 | // Protected methods for logging |
| 109 | void log_observations(const GChatter& chatter, | 110 | void log_observations(const GChatter& chatter, |