Commit 0c2ccf439ed7967593520072c252ca3c2ad5ae64
1 parent
0ec4abd9
add ctbkgcube
Showing
9 changed files
with
991 additions
and
1 deletions
configure.ac
| @@ -884,6 +884,7 @@ AC_CONFIG_FILES([Makefile | @@ -884,6 +884,7 @@ AC_CONFIG_FILES([Makefile | ||
| 884 | src/ctselect/Makefile | 884 | src/ctselect/Makefile |
| 885 | src/ctexpcube/Makefile | 885 | src/ctexpcube/Makefile |
| 886 | src/ctpsfcube/Makefile | 886 | src/ctpsfcube/Makefile |
| 887 | + src/ctbkgcube/Makefile | ||
| 887 | src/ctcubemask/Makefile | 888 | src/ctcubemask/Makefile |
| 888 | src/ctools-setup | 889 | src/ctools-setup |
| 889 | test/Makefile | 890 | test/Makefile |
src/Makefile.am
| @@ -13,6 +13,7 @@ SUBDIRS = ctbin \ | @@ -13,6 +13,7 @@ SUBDIRS = ctbin \ | ||
| 13 | ctskymap \ | 13 | ctskymap \ |
| 14 | ctexpcube \ | 14 | ctexpcube \ |
| 15 | ctpsfcube \ | 15 | ctpsfcube \ |
| 16 | + ctbkgcube \ | ||
| 16 | ctcubemask | 17 | ctcubemask |
| 17 | 18 | ||
| 18 | # Scripts to be distributed | 19 | # Scripts to be distributed |
| @@ -33,6 +34,7 @@ libctools_la_LIBADD = ctbin/libctbin.la \ | @@ -33,6 +34,7 @@ libctools_la_LIBADD = ctbin/libctbin.la \ | ||
| 33 | ctskymap/libctskymap.la \ | 34 | ctskymap/libctskymap.la \ |
| 34 | ctexpcube/libctexpcube.la \ | 35 | ctexpcube/libctexpcube.la \ |
| 35 | ctpsfcube/libctpsfcube.la \ | 36 | ctpsfcube/libctpsfcube.la \ |
| 37 | + ctbkgcube/libctbkgcube.la \ | ||
| 36 | ctcubemask/libctcubemask.la | 38 | ctcubemask/libctcubemask.la |
| 37 | 39 | ||
| 38 | # Distribute scripts | 40 | # Distribute scripts |
src/ctbin/ctbin.cpp
| @@ -777,7 +777,7 @@ void ctbin::fill_cube(GCTAObservation* obs) | @@ -777,7 +777,7 @@ void ctbin::fill_cube(GCTAObservation* obs) | ||
| 777 | // Make sure that the observation holds a CTA event list. If this | 777 | // Make sure that the observation holds a CTA event list. If this |
| 778 | // is not the case then throw an exception. | 778 | // is not the case then throw an exception. |
| 779 | if (dynamic_cast<const GCTAEventList*>(obs->events()) == NULL) { | 779 | if (dynamic_cast<const GCTAEventList*>(obs->events()) == NULL) { |
| 780 | - throw GException::no_list(G_BIN_EVENTS); | 780 | + throw GException::no_list(G_FILL_CUBE); |
| 781 | } | 781 | } |
| 782 | 782 | ||
| 783 | // Initialise binning statistics | 783 | // Initialise binning statistics |
src/ctbkgcube/Makefile.am
0 โ 100644
| 1 | +## Process this file with automake to produce Makefile.in | ||
| 2 | + | ||
| 3 | +# Program name | ||
| 4 | +bin_PROGRAMS = ctbkgcube | ||
| 5 | + | ||
| 6 | +# Sources | ||
| 7 | +sources = ctbkgcube.cpp | ||
| 8 | + | ||
| 9 | +# Libtool library | ||
| 10 | +noinst_LTLIBRARIES = libctbkgcube.la | ||
| 11 | +libctbkgcube_la_SOURCES = $(sources) | ||
| 12 | + | ||
| 13 | +# Program definition | ||
| 14 | +ctbkgcube_SOURCES = main.cpp | ||
| 15 | +ctbkgcube_LDFLAGS = $(LIB_LINK_OPTION) @LDFLAGS@ | ||
| 16 | +ctbkgcube_CPPFLAGS = @CPPFLAGS@ | ||
| 17 | +ctbkgcube_LDADD = libctbkgcube.la | ||
| 18 | + | ||
| 19 | +# Parameter files | ||
| 20 | +pfilesdir = $(prefix)/syspfiles | ||
| 21 | +pfiles_DATA = ctbkgcube.par |
src/ctbkgcube/ctbkgcube
0 โ 100755
No preview for this file type
src/ctbkgcube/ctbkgcube.cpp
0 โ 100644
| 1 | +/*************************************************************************** | ||
| 2 | + * ctbkgcube - CTA background cube tool * | ||
| 3 | + * ----------------------------------------------------------------------- * | ||
| 4 | + * copyright (C) 2014 by Chia-Chun Lu * | ||
| 5 | + * ----------------------------------------------------------------------- * | ||
| 6 | + * * | ||
| 7 | + * This program is free software: you can redistribute it and/or modify * | ||
| 8 | + * it under the terms of the GNU General Public License as published by * | ||
| 9 | + * the Free Software Foundation, either version 3 of the License, or * | ||
| 10 | + * (at your option) any later version. * | ||
| 11 | + * * | ||
| 12 | + * This program is distributed in the hope that it will be useful, * | ||
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
| 15 | + * GNU General Public License for more details. * | ||
| 16 | + * * | ||
| 17 | + * You should have received a copy of the GNU General Public License * | ||
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
| 19 | + * * | ||
| 20 | + ***************************************************************************/ | ||
| 21 | +/** | ||
| 22 | + * @file ctbkgcube.cpp | ||
| 23 | + * @brief CTA background cube tool implementation | ||
| 24 | + * @author Chia-Chun Lu | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +/* __ Includes ___________________________________________________________ */ | ||
| 28 | +#ifdef HAVE_CONFIG_H | ||
| 29 | +#include <config.h> | ||
| 30 | +#endif | ||
| 31 | +#include <cstdio> | ||
| 32 | +#include "ctbkgcube.hpp" | ||
| 33 | +#include "GTools.hpp" | ||
| 34 | +#include "GWcs.hpp" | ||
| 35 | + | ||
| 36 | +/* __ Method name definitions ____________________________________________ */ | ||
| 37 | +#define G_GET_EBOUNDS "ctbkgcube::get_ebounds()" | ||
| 38 | +#define G_GET_PARAMETERS "ctbkgcube::get_parameters()" | ||
| 39 | +#define G_SET_FROM_CNTMAP "ctbkgcube::set_from_cntmap(std::string&)" | ||
| 40 | + | ||
| 41 | +/* __ Debug definitions __________________________________________________ */ | ||
| 42 | + | ||
| 43 | +/* __ Coding definitions _________________________________________________ */ | ||
| 44 | + | ||
| 45 | + | ||
| 46 | +/*========================================================================== | ||
| 47 | + = = | ||
| 48 | + = Constructors/destructors = | ||
| 49 | + = = | ||
| 50 | + ==========================================================================*/ | ||
| 51 | + | ||
| 52 | +/***********************************************************************//** | ||
| 53 | + * @brief Void constructor | ||
| 54 | + ***************************************************************************/ | ||
| 55 | +ctbkgcube::ctbkgcube(void) : GApplication(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) | ||
| 56 | +{ | ||
| 57 | + // Initialise members | ||
| 58 | + init_members(); | ||
| 59 | + | ||
| 60 | + // Write header into logger | ||
| 61 | + log_header(); | ||
| 62 | + | ||
| 63 | + // Return | ||
| 64 | + return; | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | + | ||
| 68 | +/***********************************************************************//** | ||
| 69 | + * @brief Observations constructor | ||
| 70 | + * | ||
| 71 | + * param[in] obs Observation container. | ||
| 72 | + * | ||
| 73 | + * This method creates an instance of the class by copying an existing | ||
| 74 | + * observations container. | ||
| 75 | + ***************************************************************************/ | ||
| 76 | +ctbkgcube::ctbkgcube(const GObservations& obs) : | ||
| 77 | + GApplication(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) | ||
| 78 | +{ | ||
| 79 | + // Initialise members | ||
| 80 | + init_members(); | ||
| 81 | + | ||
| 82 | + // Set observations | ||
| 83 | + m_obs = obs; | ||
| 84 | + | ||
| 85 | + // Write header into logger | ||
| 86 | + log_header(); | ||
| 87 | + | ||
| 88 | + // Return | ||
| 89 | + return; | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +/***********************************************************************//** | ||
| 95 | + * @brief Command line constructor | ||
| 96 | + * | ||
| 97 | + * @param[in] argc Number of arguments in command line. | ||
| 98 | + * @param[in] argv Array of command line arguments. | ||
| 99 | + ***************************************************************************/ | ||
| 100 | +ctbkgcube::ctbkgcube(int argc, char *argv[]) : | ||
| 101 | + GApplication(CTBKGCUBE_NAME, CTBKGCUBE_VERSION, argc, argv) | ||
| 102 | +{ | ||
| 103 | + // Initialise members | ||
| 104 | + init_members(); | ||
| 105 | + | ||
| 106 | + // Write header into logger | ||
| 107 | + log_header(); | ||
| 108 | + | ||
| 109 | + // Return | ||
| 110 | + return; | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | + | ||
| 114 | +/***********************************************************************//** | ||
| 115 | + * @brief Copy constructor | ||
| 116 | + * | ||
| 117 | + * @param[in] app ctbkgcube application. | ||
| 118 | + ***************************************************************************/ | ||
| 119 | +ctbkgcube::ctbkgcube(const ctbkgcube& app) : GApplication(app) | ||
| 120 | +{ | ||
| 121 | + // Initialise members | ||
| 122 | + init_members(); | ||
| 123 | + | ||
| 124 | + // Copy members | ||
| 125 | + copy_members(app); | ||
| 126 | + | ||
| 127 | + // Return | ||
| 128 | + return; | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | + | ||
| 132 | +/***********************************************************************//** | ||
| 133 | + * @brief Destructor | ||
| 134 | + ***************************************************************************/ | ||
| 135 | +ctbkgcube::~ctbkgcube(void) | ||
| 136 | +{ | ||
| 137 | + // Free members | ||
| 138 | + free_members(); | ||
| 139 | + | ||
| 140 | + // Return | ||
| 141 | + return; | ||
| 142 | +} | ||
| 143 | + | ||
| 144 | + | ||
| 145 | +/*========================================================================== | ||
| 146 | + = = | ||
| 147 | + = Operators = | ||
| 148 | + = = | ||
| 149 | + ==========================================================================*/ | ||
| 150 | + | ||
| 151 | +/***********************************************************************//** | ||
| 152 | + * @brief Assignment operator | ||
| 153 | + * | ||
| 154 | + * @param[in] app ctbkgcube application. | ||
| 155 | + * @return Returns ctbkgcube application. | ||
| 156 | + ***************************************************************************/ | ||
| 157 | +ctbkgcube& ctbkgcube::operator=(const ctbkgcube& app) | ||
| 158 | +{ | ||
| 159 | + // Execute only if object is not identical | ||
| 160 | + if (this != &app) { | ||
| 161 | + | ||
| 162 | + // Copy base class members | ||
| 163 | + this->GApplication::operator=(app); | ||
| 164 | + | ||
| 165 | + // Free members | ||
| 166 | + free_members(); | ||
| 167 | + | ||
| 168 | + // Initialise members | ||
| 169 | + init_members(); | ||
| 170 | + | ||
| 171 | + // Copy members | ||
| 172 | + copy_members(app); | ||
| 173 | + | ||
| 174 | + } // endif: object was not identical | ||
| 175 | + | ||
| 176 | + // Return this object | ||
| 177 | + return *this; | ||
| 178 | +} | ||
| 179 | + | ||
| 180 | + | ||
| 181 | +/*========================================================================== | ||
| 182 | + = = | ||
| 183 | + = Public methods = | ||
| 184 | + = = | ||
| 185 | + ==========================================================================*/ | ||
| 186 | + | ||
| 187 | +/***********************************************************************//** | ||
| 188 | + * @brief Clear instance | ||
| 189 | + ***************************************************************************/ | ||
| 190 | +void ctbkgcube::clear(void) | ||
| 191 | +{ | ||
| 192 | + // Free members | ||
| 193 | + free_members(); | ||
| 194 | + this->GApplication::free_members(); | ||
| 195 | + | ||
| 196 | + // Initialise members | ||
| 197 | + this->GApplication::init_members(); | ||
| 198 | + init_members(); | ||
| 199 | + | ||
| 200 | + // Return | ||
| 201 | + return; | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | + | ||
| 205 | +/***********************************************************************//** | ||
| 206 | + * @brief Execute application | ||
| 207 | + * | ||
| 208 | + * This is the main execution method of the ctbkgcube class. It is invoked | ||
| 209 | + * when the executable is called from command line. The method generates | ||
| 210 | + * the background cube and saves the result. | ||
| 211 | + ***************************************************************************/ | ||
| 212 | +void ctbkgcube::execute(void) | ||
| 213 | +{ | ||
| 214 | + // Signal that some parameters should be read ahead | ||
| 215 | + m_read_ahead = true; | ||
| 216 | + | ||
| 217 | + // Create the background cube | ||
| 218 | + run(); | ||
| 219 | + | ||
| 220 | + // Save the background cube into the output FITS file | ||
| 221 | + save(); | ||
| 222 | + | ||
| 223 | + // Return | ||
| 224 | + return; | ||
| 225 | +} | ||
| 226 | + | ||
| 227 | + | ||
| 228 | +/***********************************************************************//** | ||
| 229 | + * @brief Generate the background cube(s). | ||
| 230 | + * | ||
| 231 | + * This method reads the task parameters from the parfile, sets up the | ||
| 232 | + * observation container, loops over all CTA observations in the container | ||
| 233 | + * and generates an background cube from the CTA observations. | ||
| 234 | + ***************************************************************************/ | ||
| 235 | +void ctbkgcube::run(void) | ||
| 236 | +{ | ||
| 237 | + // If we're in debug mode then all output is also dumped on the screen | ||
| 238 | + if (logDebug()) { | ||
| 239 | + log.cout(true); | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + // Get task parameters | ||
| 243 | + get_parameters(); | ||
| 244 | + | ||
| 245 | + // Write parameters into logger | ||
| 246 | + if (logTerse()) { | ||
| 247 | + log_parameters(); | ||
| 248 | + log << std::endl; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + // Set energy dispersion flag for all CTA observations and save old | ||
| 252 | + // values in save_edisp vector | ||
| 253 | + std::vector<bool> save_edisp; | ||
| 254 | + save_edisp.assign(m_obs.size(), false); | ||
| 255 | + for (int i = 0; i < m_obs.size(); ++i) { | ||
| 256 | + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | ||
| 257 | + if (obs != NULL) { | ||
| 258 | + save_edisp[i] = obs->response()->apply_edisp(); | ||
| 259 | + obs->response()->apply_edisp(m_apply_edisp); | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + // Write observation(s) into logger | ||
| 264 | + if (logTerse()) { | ||
| 265 | + log << std::endl; | ||
| 266 | + if (m_obs.size() > 1) { | ||
| 267 | + log.header1("Observations"); | ||
| 268 | + } | ||
| 269 | + else { | ||
| 270 | + log.header1("Observation"); | ||
| 271 | + } | ||
| 272 | + log << m_obs << std::endl; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + // Write header | ||
| 276 | + if (logTerse()) { | ||
| 277 | + log << std::endl; | ||
| 278 | + log.header1("Generate background cube"); | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + // If there are no models associated with the observations then | ||
| 282 | + // load now the model definition from the XML file | ||
| 283 | + if (m_obs.models().size() == 0) { | ||
| 284 | + m_bgmdl = (*this)["bgmdl"].filename(); | ||
| 285 | + m_obs.models(GModels(m_bgmdl)); | ||
| 286 | + | ||
| 287 | + // TODO: throw a message when no background definition file is given | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + // Loop over all observations in the container | ||
| 291 | + for (int i = 0; i < m_obs.size(); ++i) { | ||
| 292 | + | ||
| 293 | + // Get CTA observation | ||
| 294 | + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | ||
| 295 | + | ||
| 296 | + // Fill background cube | ||
| 297 | + fill_cube(obs, m_obs.models()); | ||
| 298 | + | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + // Restore energy dispersion flag for all CTA observations | ||
| 302 | + for (int i = 0; i < m_obs.size(); ++i) { | ||
| 303 | + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | ||
| 304 | + if (obs != NULL) { | ||
| 305 | + obs->response()->apply_edisp(save_edisp[i]); | ||
| 306 | + } | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + // Return | ||
| 310 | + return; | ||
| 311 | +} | ||
| 312 | + | ||
| 313 | +/***********************************************************************//** | ||
| 314 | + * @brief Generate background cube | ||
| 315 | + * | ||
| 316 | + * @param[in] obs CTA observation pointer. | ||
| 317 | + * @param[in] models Model container. | ||
| 318 | + * | ||
| 319 | + * | ||
| 320 | + ***************************************************************************/ | ||
| 321 | +void ctbkgcube::fill_cube(GCTAObservation* obs, const GModels& models) | ||
| 322 | +{ | ||
| 323 | + | ||
| 324 | + // Get pointing to do coordinate transformation | ||
| 325 | + GCTAPointing pnt = obs->pointing(); | ||
| 326 | + GTime time = (*obs->events())[0]->time(); | ||
| 327 | + double ontime = obs->ontime(); | ||
| 328 | + // Continue only if observation pointer is valid | ||
| 329 | + if (obs != NULL) { | ||
| 330 | + | ||
| 331 | + // Initialise statistics | ||
| 332 | + double sum = 0.0; | ||
| 333 | + | ||
| 334 | + // Loop over all pixels in sky map | ||
| 335 | + for (int pixel = 0; pixel < m_bkgcube.npix(); ++pixel) { | ||
| 336 | + | ||
| 337 | + GSkyDir dir = m_bkgcube.inx2dir(pixel); | ||
| 338 | + GCTAInstDir instdir = pnt.instdir(dir); | ||
| 339 | + | ||
| 340 | + // Loop over all background cube energy bins | ||
| 341 | + for (int iebin = 0; iebin < m_ebounds.size(); ++iebin){ | ||
| 342 | + | ||
| 343 | + // Get event bin | ||
| 344 | + GCTAEventBin* bin = new GCTAEventBin(); | ||
| 345 | + | ||
| 346 | + // Compute model value for event bin | ||
| 347 | + double model = | ||
| 348 | + models.eval(*(const_cast<const GCTAEventBin*>(bin)), *obs) * | ||
| 349 | + bin->size(); | ||
| 350 | + | ||
| 351 | + // Store value | ||
| 352 | + bin->counts( bin->counts() + model ); | ||
| 353 | + | ||
| 354 | + // Sum all events | ||
| 355 | + sum += model; | ||
| 356 | + } | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + // Log results | ||
| 360 | + if (logTerse()) { | ||
| 361 | + log << gammalib::parformat("Model events in cube"); | ||
| 362 | + log << sum << std::endl; | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + } // endif: observation pointer was not valid | ||
| 366 | + | ||
| 367 | + // Return | ||
| 368 | + return; | ||
| 369 | +} | ||
| 370 | + | ||
| 371 | +/***********************************************************************//** | ||
| 372 | + * @brief Save background cube | ||
| 373 | + * | ||
| 374 | + ***************************************************************************/ | ||
| 375 | +void ctbkgcube::save(void) | ||
| 376 | +{ | ||
| 377 | + // Write header | ||
| 378 | + if (logTerse()) { | ||
| 379 | + log << std::endl; | ||
| 380 | + log.header1("Save background cube"); | ||
| 381 | + } | ||
| 382 | + | ||
| 383 | + // Get output filename | ||
| 384 | + m_outfile = (*this)["outfile"].filename(); | ||
| 385 | + | ||
| 386 | + // Save background cube | ||
| 387 | + m_bkgcube.save(m_outfile, clobber()); | ||
| 388 | + | ||
| 389 | + // Return | ||
| 390 | + return; | ||
| 391 | +} | ||
| 392 | + | ||
| 393 | + | ||
| 394 | +/***********************************************************************//** | ||
| 395 | + * @brief Get application parameters | ||
| 396 | + * | ||
| 397 | + * Get all task parameters from parameter file or (if required) by querying | ||
| 398 | + * the user. The parameters are read in the correct order. | ||
| 399 | + * | ||
| 400 | + * @todo Setup background cube from counts map | ||
| 401 | + ***************************************************************************/ | ||
| 402 | +void ctbkgcube::get_parameters(void) | ||
| 403 | +{ | ||
| 404 | + // If we do not have any observations in the container then get an | ||
| 405 | + // input file name or observation descriptor file | ||
| 406 | + if (m_obs.size() == 0) { | ||
| 407 | + get_obs(); | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + // Make sure that response is set | ||
| 411 | + set_response(); | ||
| 412 | + | ||
| 413 | + // Read energy dispersion flag | ||
| 414 | + m_apply_edisp = (*this)["edisp"].boolean(); | ||
| 415 | + | ||
| 416 | + // If no counts map is specified then setup the background cube from | ||
| 417 | + // the user parameters | ||
| 418 | + std::string cntmap = (*this)["cntmap"].filename(); | ||
| 419 | + if ((cntmap == "NONE") || (gammalib::strip_whitespace(cntmap) == "")) { | ||
| 420 | + | ||
| 421 | + // Get user parameters for counts map definition | ||
| 422 | + std::string wcs = (*this)["proj"].string(); | ||
| 423 | + std::string coordsys = (*this)["coordsys"].string(); | ||
| 424 | + double xref = (*this)["xref"].real(); | ||
| 425 | + double yref = (*this)["yref"].real(); | ||
| 426 | + double binsz = (*this)["binsz"].real(); | ||
| 427 | + int nxpix = (*this)["nxpix"].integer(); | ||
| 428 | + int nypix = (*this)["nypix"].integer(); | ||
| 429 | + | ||
| 430 | + // Get energy definition | ||
| 431 | + get_ebounds(); | ||
| 432 | + | ||
| 433 | + // Define background cube | ||
| 434 | + m_bkgcube = GSkymap(wcs, coordsys, xref, yref, | ||
| 435 | + -binsz, binsz, nxpix, nypix, | ||
| 436 | + m_ebounds.size()); | ||
| 437 | + } | ||
| 438 | + | ||
| 439 | + // ... otherwise setup the background cube from the counts map | ||
| 440 | + else { | ||
| 441 | + | ||
| 442 | + // Set background cube from counts map | ||
| 443 | + set_from_cntmap(cntmap); | ||
| 444 | + | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + // Read output filename (if needed) | ||
| 448 | + if (m_read_ahead) { | ||
| 449 | + m_outfile = (*this)["outfile"].filename(); | ||
| 450 | + } | ||
| 451 | + | ||
| 452 | + // Return | ||
| 453 | + return; | ||
| 454 | +} | ||
| 455 | + | ||
| 456 | + | ||
| 457 | +/***********************************************************************//** | ||
| 458 | + * @brief Get observation definition | ||
| 459 | + * | ||
| 460 | + * Get observation definition from the user parameters. | ||
| 461 | + ***************************************************************************/ | ||
| 462 | +void ctbkgcube::get_obs(void) | ||
| 463 | +{ | ||
| 464 | + // Get input filename | ||
| 465 | + std::string filename = (*this)["infile"].filename(); | ||
| 466 | + | ||
| 467 | + // Try first to open as FITS file | ||
| 468 | + try { | ||
| 469 | + | ||
| 470 | + // Allocate CTA observation | ||
| 471 | + GCTAObservation obs; | ||
| 472 | + | ||
| 473 | + // Load input file in CTA observation | ||
| 474 | + obs.load(filename); | ||
| 475 | + | ||
| 476 | + // Append CTA observation to container | ||
| 477 | + m_obs.append(obs); | ||
| 478 | + | ||
| 479 | + | ||
| 480 | + } | ||
| 481 | + | ||
| 482 | + // ... otherwise try to open as XML file | ||
| 483 | + catch (GException::fits_open_error &e) { | ||
| 484 | + | ||
| 485 | + // Load observations from XML file | ||
| 486 | + m_obs.load(filename); | ||
| 487 | + | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + // Return | ||
| 491 | + return; | ||
| 492 | +} | ||
| 493 | + | ||
| 494 | + | ||
| 495 | +/***********************************************************************//** | ||
| 496 | + * @brief Set observation response | ||
| 497 | + * | ||
| 498 | + * Set response for all observations that so have no response. | ||
| 499 | + ***************************************************************************/ | ||
| 500 | +void ctbkgcube::set_response(void) | ||
| 501 | +{ | ||
| 502 | + // Loop over all observations | ||
| 503 | + for (int i = 0; i < m_obs.size(); ++i) { | ||
| 504 | + | ||
| 505 | + // Is this observation a CTA observation? | ||
| 506 | + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | ||
| 507 | + | ||
| 508 | + // Yes ... | ||
| 509 | + if (obs != NULL) { | ||
| 510 | + | ||
| 511 | + // Set response if we don't have one | ||
| 512 | + if (!obs->hasresponse()) { | ||
| 513 | + | ||
| 514 | + // Load response information | ||
| 515 | + std::string database = (*this)["caldb"].string(); | ||
| 516 | + std::string irf = (*this)["irf"].string(); | ||
| 517 | + | ||
| 518 | + // Set calibration database. If specified parameter is a | ||
| 519 | + // directory then use this as the pathname to the calibration | ||
| 520 | + // database. Otherwise interpret this as the instrument name, | ||
| 521 | + // the mission being "cta" | ||
| 522 | + GCaldb caldb; | ||
| 523 | + if (gammalib::dir_exists(database)) { | ||
| 524 | + caldb.rootdir(database); | ||
| 525 | + } | ||
| 526 | + else { | ||
| 527 | + caldb.open("cta", database); | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | + // Set reponse | ||
| 531 | + obs->response(irf, caldb); | ||
| 532 | + | ||
| 533 | + } // endif: observation already has a response | ||
| 534 | + | ||
| 535 | + } // endif: observation was a CTA observation | ||
| 536 | + | ||
| 537 | + } // endfor: looped over all observations | ||
| 538 | + | ||
| 539 | + // Return | ||
| 540 | + return; | ||
| 541 | +} | ||
| 542 | + | ||
| 543 | + | ||
| 544 | +/***********************************************************************//** | ||
| 545 | + * @brief Get energy boundaries from parameters | ||
| 546 | + * | ||
| 547 | + * @exception GException::invalid_value | ||
| 548 | + * Invalid extension name encountered. | ||
| 549 | + * | ||
| 550 | + * Get the energy boundaries from the user parameters. | ||
| 551 | + ***************************************************************************/ | ||
| 552 | +void ctbkgcube::get_ebounds(void) | ||
| 553 | +{ | ||
| 554 | + // Determine the energy binning alogrithm | ||
| 555 | + std::string ebinalg = (*this)["ebinalg"].string(); | ||
| 556 | + | ||
| 557 | + // If we have the binning given by a file then try to get the boundaries | ||
| 558 | + // from that file | ||
| 559 | + if (ebinalg == "FILE") { | ||
| 560 | + | ||
| 561 | + // Get filename | ||
| 562 | + std::string filename = (*this)["ebinfile"].filename(); | ||
| 563 | + | ||
| 564 | + // Open fits file to check which extension is given | ||
| 565 | + GFits file(filename); | ||
| 566 | + | ||
| 567 | + // Check first for EBOUNDS extension | ||
| 568 | + if (file.contains("EBOUNDS")) { | ||
| 569 | + file.close(); | ||
| 570 | + m_ebounds.load(filename, "EBOUNDS"); | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + // ... then check for ENERGYBINS extension | ||
| 574 | + else if (file.contains("ENERGYBINS")) { | ||
| 575 | + file.close(); | ||
| 576 | + m_ebounds.load(filename, "ENERGYBINS"); | ||
| 577 | + } | ||
| 578 | + | ||
| 579 | + // ... otherwise throw an exception | ||
| 580 | + else { | ||
| 581 | + file.close(); | ||
| 582 | + std::string msg = "No extension with name \"EBOUNDS\" or" | ||
| 583 | + " \"ENERGYBINS\" found in FITS file" | ||
| 584 | + " \""+filename+"\".\n" | ||
| 585 | + "An \"EBOUNDS\" or \"ENERGYBINS\" extension" | ||
| 586 | + " is required if the parameter \"ebinalg\"" | ||
| 587 | + " is set to \"FILE\"."; | ||
| 588 | + throw GException::invalid_value(G_GET_EBOUNDS, msg); | ||
| 589 | + } | ||
| 590 | + } | ||
| 591 | + | ||
| 592 | + // ... otherwise read emin, emax and nebins | ||
| 593 | + else { | ||
| 594 | + | ||
| 595 | + // Get the relevant parameters | ||
| 596 | + double emin = (*this)["emin"].real(); | ||
| 597 | + double emax = (*this)["emax"].real(); | ||
| 598 | + int enumbins = (*this)["enumbins"].integer(); | ||
| 599 | + bool log = ((*this)["ebinalg"].string() == "LIN") ? false : true; | ||
| 600 | + | ||
| 601 | + // Create energy boundaries | ||
| 602 | + m_ebounds = GEbounds(enumbins, | ||
| 603 | + GEnergy(emin, "TeV"), | ||
| 604 | + GEnergy(emax, "TeV"), | ||
| 605 | + log); | ||
| 606 | + | ||
| 607 | + } | ||
| 608 | + | ||
| 609 | + // Return | ||
| 610 | + return; | ||
| 611 | +} | ||
| 612 | + | ||
| 613 | + | ||
| 614 | +/***********************************************************************//** | ||
| 615 | + * @brief Set background cube definition from counts map | ||
| 616 | + * | ||
| 617 | + * @exception GException::invalid_value | ||
| 618 | + * Invalid counts map projection or invalid events encountered. | ||
| 619 | + * | ||
| 620 | + * Set background cube definition from counts map. | ||
| 621 | + ***************************************************************************/ | ||
| 622 | +void ctbkgcube::set_from_cntmap(const std::string& filename) | ||
| 623 | +{ | ||
| 624 | + // Allocate CTA observation | ||
| 625 | + GCTAObservation obs; | ||
| 626 | + | ||
| 627 | + // Load counts map in CTA observation | ||
| 628 | + obs.load(filename); | ||
| 629 | + | ||
| 630 | + // Set background cube from counts map | ||
| 631 | + const GCTAEventCube* cube = dynamic_cast<const GCTAEventCube*>(obs.events()); | ||
| 632 | + | ||
| 633 | + // Continue only if cube is valid | ||
| 634 | + if (cube != NULL) { | ||
| 635 | + | ||
| 636 | + // Get sky map projection | ||
| 637 | + const GWcs* wcs = dynamic_cast<const GWcs*>(cube->map().projection()); | ||
| 638 | + | ||
| 639 | + // Continue only if projection is valid | ||
| 640 | + if (wcs != NULL) { | ||
| 641 | + | ||
| 642 | + // Get user parameters for counts map definition | ||
| 643 | + std::string proj = wcs->code(); | ||
| 644 | + std::string coordsys = wcs->coordsys(); | ||
| 645 | + double xref = wcs->crval(0); | ||
| 646 | + double yref = wcs->crval(1); | ||
| 647 | + double dx = wcs->cdelt(0); | ||
| 648 | + double dy = wcs->cdelt(1); | ||
| 649 | + int nx = cube->map().nx(); | ||
| 650 | + int ny = cube->map().ny(); | ||
| 651 | + | ||
| 652 | + // Get energy definition | ||
| 653 | + m_ebounds = cube->ebounds(); | ||
| 654 | + | ||
| 655 | + // Define background cube | ||
| 656 | + m_bkgcube = GSkymap(proj, coordsys, xref, yref, | ||
| 657 | + dx, dy, nx, ny, | ||
| 658 | + m_ebounds.size()); | ||
| 659 | + | ||
| 660 | + } // endif: WCS projection was valid | ||
| 661 | + | ||
| 662 | + // ... projection is not of WCS type | ||
| 663 | + else { | ||
| 664 | + std::string msg = "Counts map project is not of WCS type."; | ||
| 665 | + throw GException::invalid_value(G_SET_FROM_CNTMAP, msg); | ||
| 666 | + } | ||
| 667 | + | ||
| 668 | + } // endif: observation contained an events cube | ||
| 669 | + | ||
| 670 | + // ... there is not events cube | ||
| 671 | + else { | ||
| 672 | + std::string msg = "No events cube found in file \"" | ||
| 673 | + ""+filename+"\"."; | ||
| 674 | + throw GException::invalid_value(G_SET_FROM_CNTMAP, msg); | ||
| 675 | + } | ||
| 676 | + | ||
| 677 | + // Return | ||
| 678 | + return; | ||
| 679 | +} | ||
| 680 | + | ||
| 681 | + | ||
| 682 | +/*========================================================================== | ||
| 683 | + = = | ||
| 684 | + = Private methods = | ||
| 685 | + = = | ||
| 686 | + ==========================================================================*/ | ||
| 687 | + | ||
| 688 | +/***********************************************************************//** | ||
| 689 | + * @brief Initialise class members | ||
| 690 | + ***************************************************************************/ | ||
| 691 | +void ctbkgcube::init_members(void) | ||
| 692 | +{ | ||
| 693 | + // Initialise members | ||
| 694 | + m_outfile.clear(); | ||
| 695 | + m_apply_edisp = false; | ||
| 696 | + | ||
| 697 | + // Initialise protected members | ||
| 698 | + m_read_ahead = false; | ||
| 699 | + m_obs.clear(); | ||
| 700 | + m_bkgcube.clear(); | ||
| 701 | + m_ebounds.clear(); | ||
| 702 | + | ||
| 703 | + // Set logger properties | ||
| 704 | + log.date(true); | ||
| 705 | + | ||
| 706 | + // Return | ||
| 707 | + return; | ||
| 708 | +} | ||
| 709 | + | ||
| 710 | + | ||
| 711 | +/***********************************************************************//** | ||
| 712 | + * @brief Copy class members | ||
| 713 | + * | ||
| 714 | + * @param[in] app Application. | ||
| 715 | + ***************************************************************************/ | ||
| 716 | +void ctbkgcube::copy_members(const ctbkgcube& app) | ||
| 717 | +{ | ||
| 718 | + // Copy attributes | ||
| 719 | + m_outfile = app.m_outfile; | ||
| 720 | + m_apply_edisp = app.m_apply_edisp; | ||
| 721 | + | ||
| 722 | + // Copy protected members | ||
| 723 | + m_read_ahead = app.m_read_ahead; | ||
| 724 | + m_obs = app.m_obs; | ||
| 725 | + m_bkgcube = app.m_bkgcube; | ||
| 726 | + m_ebounds = app.m_ebounds; | ||
| 727 | + | ||
| 728 | + // Return | ||
| 729 | + return; | ||
| 730 | +} | ||
| 731 | + | ||
| 732 | + | ||
| 733 | +/***********************************************************************//** | ||
| 734 | + * @brief Delete class members | ||
| 735 | + ***************************************************************************/ | ||
| 736 | +void ctbkgcube::free_members(void) | ||
| 737 | +{ | ||
| 738 | + // Write separator into logger | ||
| 739 | + if (logTerse()) { | ||
| 740 | + log << std::endl; | ||
| 741 | + } | ||
| 742 | + | ||
| 743 | + // Return | ||
| 744 | + return; | ||
| 745 | +} |
src/ctbkgcube/ctbkgcube.hpp
0 โ 100644
| 1 | +/*************************************************************************** | ||
| 2 | + * ctbkgcube - CTA background cube tool * | ||
| 3 | + * ----------------------------------------------------------------------- * | ||
| 4 | + * copyright (C) 2014 by Juergen Knoedlseder * | ||
| 5 | + * ----------------------------------------------------------------------- * | ||
| 6 | + * * | ||
| 7 | + * This program is free software: you can redistribute it and/or modify * | ||
| 8 | + * it under the terms of the GNU General Public License as published by * | ||
| 9 | + * the Free Software Foundation, either version 3 of the License, or * | ||
| 10 | + * (at your option) any later version. * | ||
| 11 | + * * | ||
| 12 | + * This program is distributed in the hope that it will be useful, * | ||
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
| 15 | + * GNU General Public License for more details. * | ||
| 16 | + * * | ||
| 17 | + * You should have received a copy of the GNU General Public License * | ||
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
| 19 | + * * | ||
| 20 | + ***************************************************************************/ | ||
| 21 | +/** | ||
| 22 | + * @file ctbkgcube.hpp | ||
| 23 | + * @brief CTA background cube tool definition | ||
| 24 | + * @author Chia-Chun Lu | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +#ifndef CTBKGCUBE_HPP | ||
| 28 | +#define CTBKGCUBE_HPP | ||
| 29 | + | ||
| 30 | +/* __ Includes ___________________________________________________________ */ | ||
| 31 | +#include "GammaLib.hpp" | ||
| 32 | +#include "GCTALib.hpp" | ||
| 33 | + | ||
| 34 | +/* __Definitions _________________________________________________________ */ | ||
| 35 | +#define CTBKGCUBE_NAME "ctbkgcube" | ||
| 36 | +#define CTBKGCUBE_VERSION "00-01-00" | ||
| 37 | + | ||
| 38 | + | ||
| 39 | +/***********************************************************************//** | ||
| 40 | + * @class ctbkgcube | ||
| 41 | + * | ||
| 42 | + * @brief CTA background cube tool | ||
| 43 | + ***************************************************************************/ | ||
| 44 | +class ctbkgcube : public GApplication { | ||
| 45 | + | ||
| 46 | +public: | ||
| 47 | + // Constructors and destructors | ||
| 48 | + ctbkgcube(void); | ||
| 49 | + explicit ctbkgcube(const GObservations& obs); | ||
| 50 | + ctbkgcube(int argc, char *argv[]); | ||
| 51 | + ctbkgcube(const ctbkgcube& app); | ||
| 52 | + virtual ~ctbkgcube(void); | ||
| 53 | + | ||
| 54 | + // Operators | ||
| 55 | + ctbkgcube& operator=(const ctbkgcube& app); | ||
| 56 | + | ||
| 57 | + // Methods | ||
| 58 | + void clear(void); | ||
| 59 | + void execute(void); | ||
| 60 | + void run(void); | ||
| 61 | + void save(void); | ||
| 62 | + GObservations& obs(void) { return m_obs; } | ||
| 63 | + void get_parameters(void); | ||
| 64 | + void get_obs(void); | ||
| 65 | + void set_response(void); | ||
| 66 | + void get_ebounds(void); | ||
| 67 | + void set_from_cntmap(const std::string& filename); | ||
| 68 | + void fill_cube(GCTAObservation* obs, const GModels& models); | ||
| 69 | + | ||
| 70 | +protected: | ||
| 71 | + // Protected methods | ||
| 72 | + void init_members(void); | ||
| 73 | + void copy_members(const ctbkgcube& app); | ||
| 74 | + void free_members(void); | ||
| 75 | + | ||
| 76 | + // User parameters | ||
| 77 | + std::string m_outfile; //!< Output background cube file | ||
| 78 | + std::string m_bgmdl; //!< background model | ||
| 79 | + bool m_apply_edisp; //!< Apply energy dispersion? | ||
| 80 | + | ||
| 81 | + // Protected members | ||
| 82 | + bool m_read_ahead; //!< Read ahead parameters | ||
| 83 | + GObservations m_obs; //!< Observation container | ||
| 84 | + GSkymap m_bkgcube; //!< Background cube | ||
| 85 | + GEbounds m_ebounds; //!< Energy boundaries | ||
| 86 | + | ||
| 87 | +}; | ||
| 88 | + | ||
| 89 | +#endif /* CTBKGCUBE_HPP */ |
src/ctbkgcube/ctbkgcube.par
0 โ 100644
| 1 | +############################################################################# | ||
| 2 | +# # | ||
| 3 | +# CTA Science Analysis Tools # | ||
| 4 | +# # | ||
| 5 | +# ------------------------------------------------------------------------- # | ||
| 6 | +# # | ||
| 7 | +# File: ctexpcube.par # | ||
| 8 | +# Version: 00-01-00 # | ||
| 9 | +# # | ||
| 10 | +# Author: Juergen Knoedlseder # | ||
| 11 | +# Jurgen.Knodlseder@irap.omp.eu # | ||
| 12 | +# IRAP # | ||
| 13 | +# # | ||
| 14 | +# Purpose: Parameter file for the ctexpcube application # | ||
| 15 | +# # | ||
| 16 | +############################################################################# | ||
| 17 | +# | ||
| 18 | +# General parameters | ||
| 19 | +#=================== | ||
| 20 | +infile, f, a, "NONE",,, "Observation definition file" | ||
| 21 | +bgmdl, f, a, "NONE",,, "Background definition file" | ||
| 22 | +cntmap, f, a, "NONE",,, "Counts map for background cube definition" | ||
| 23 | +outfile, f, a, "bkgcube.fits",,, "Output background cube file" | ||
| 24 | +caldb, s, a, "dummy",,, "Calibration database" | ||
| 25 | +irf, s, a, "cta_dummy_irf",,, "Instrument response function" | ||
| 26 | +edisp, b, h, no,,, "Apply energy dispersion?" | ||
| 27 | +# | ||
| 28 | +# Energy binning parameters | ||
| 29 | +#========================== | ||
| 30 | +ebinalg, s, h, "LOG", FILE|LIN|LOG,,"Algorithm for defining energy bins" | ||
| 31 | +emin, r, a, 0.1,,,"Start value for first energy bin in TeV" | ||
| 32 | +emax, r, a, 100.0,,,"Stop value for last energy bin in TeV" | ||
| 33 | +enumbins, i, a, 20,,,"Number of energy bins" | ||
| 34 | +ebinfile, f, h, "NONE",,,"Name of the file containing the energy bin definition" | ||
| 35 | +# | ||
| 36 | +# Spatial binning parameters | ||
| 37 | +#=========================== | ||
| 38 | +nxpix, i, a, 200,,, "Size of the X axis in pixels" | ||
| 39 | +nypix, i, a, 200,,, "Size of the Y axis in pixels" | ||
| 40 | +binsz, r, a, 0.02,,, "Image scale (in degrees/pixel)" | ||
| 41 | +coordsys, s, a, "CEL", CEL|GAL,,"Coordinate system (CEL - celestial, GAL - galactic)" | ||
| 42 | +xref, r, a, 83.63,,, "First coordinate of image center in degrees (RA or galactic l)" | ||
| 43 | +yref, r, a, 22.01,,, "Second coordinate of image center in degrees (DEC or galactic b)" | ||
| 44 | +axisrot, r, h, 0.0,,, "Rotation angle of image axis, in degrees" | ||
| 45 | +proj, s, a, "CAR", AIT|AZP|CAR|MER|STG|TAN,, "Projection method e.g. AIT|AZP|CAR|MER|STG|TAN" | ||
| 46 | +# | ||
| 47 | +# Standard parameters | ||
| 48 | +#==================== | ||
| 49 | +chatter, i, h, 2,0,4, "Chattiness of output" | ||
| 50 | +clobber, b, h, yes,,, "Overwrite existing output files with new output files?" | ||
| 51 | +debug, b, h, no,,, "Debugging mode activated" | ||
| 52 | +mode, s, h, "ql",,, "Mode of automatic parameters" | ||
| 53 | +logfile, f, h, "ctexpcube.log",,, "Log filename" |
src/ctbkgcube/main.cpp
0 โ 100644
| 1 | +/*************************************************************************** | ||
| 2 | + * ctbkgcube - CTA exposure cube tool * | ||
| 3 | + * ----------------------------------------------------------------------- * | ||
| 4 | + * copyright (C) 2014 by Juergen Knoedlseder * | ||
| 5 | + * ----------------------------------------------------------------------- * | ||
| 6 | + * * | ||
| 7 | + * This program is free software: you can redistribute it and/or modify * | ||
| 8 | + * it under the terms of the GNU General Public License as published by * | ||
| 9 | + * the Free Software Foundation, either version 3 of the License, or * | ||
| 10 | + * (at your option) any later version. * | ||
| 11 | + * * | ||
| 12 | + * This program is distributed in the hope that it will be useful, * | ||
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
| 15 | + * GNU General Public License for more details. * | ||
| 16 | + * * | ||
| 17 | + * You should have received a copy of the GNU General Public License * | ||
| 18 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. * | ||
| 19 | + * * | ||
| 20 | + ***************************************************************************/ | ||
| 21 | +/** | ||
| 22 | + * @file ctbkgcube/main.cpp | ||
| 23 | + * @brief CTA background cube tool main code | ||
| 24 | + * @author Chia-Chun Lu | ||
| 25 | + */ | ||
| 26 | + | ||
| 27 | +/* __ Includes ___________________________________________________________ */ | ||
| 28 | +#ifdef HAVE_CONFIG_H | ||
| 29 | +#include <config.h> | ||
| 30 | +#endif | ||
| 31 | +#include <cstdio> | ||
| 32 | +#include "ctbkgcube.hpp" | ||
| 33 | + | ||
| 34 | + | ||
| 35 | +/***********************************************************************//** | ||
| 36 | + * @brief Main entry point of application | ||
| 37 | + * | ||
| 38 | + * @param[in] argc Number of command line arguments. | ||
| 39 | + * @param[in] argv Command line arguments. | ||
| 40 | + * | ||
| 41 | + * This is the main entry point of the ctbkgcube application. It allocates a | ||
| 42 | + * ctbkgcube object and runs the application. | ||
| 43 | + ***************************************************************************/ | ||
| 44 | +int main (int argc, char *argv[]) | ||
| 45 | +{ | ||
| 46 | + // Initialise return code | ||
| 47 | + int rc = 1; | ||
| 48 | + | ||
| 49 | + // Create instance of application | ||
| 50 | + ctbkgcube application(argc, argv); | ||
| 51 | + | ||
| 52 | + // Run application | ||
| 53 | + try { | ||
| 54 | + // Execute application | ||
| 55 | + application.execute(); | ||
| 56 | + | ||
| 57 | + // Signal success | ||
| 58 | + rc = 0; | ||
| 59 | + } | ||
| 60 | + catch (std::exception &e) { | ||
| 61 | + | ||
| 62 | + // Extract error message | ||
| 63 | + std::string message = e.what(); | ||
| 64 | + std::string signal = "*** ERROR encounterted in the execution of" | ||
| 65 | + " ctbkgcube. Run aborted ..."; | ||
| 66 | + | ||
| 67 | + // Write error in logger | ||
| 68 | + application.log << signal << std::endl; | ||
| 69 | + application.log << message << std::endl; | ||
| 70 | + | ||
| 71 | + // Write error on standard output | ||
| 72 | + std::cout << signal << std::endl; | ||
| 73 | + std::cout << message << std::endl; | ||
| 74 | + | ||
| 75 | + } // endcatch: catched any application error | ||
| 76 | + | ||
| 77 | + // Return | ||
| 78 | + return rc; | ||
| 79 | +} |