Commit 472a9f2b3fe5c3fd2af8c9b39f73476bcec19bf5

Authored by Jürgen Knödlseder
1 parent 0b1dbd1a

Initialise cube pixels to zero

Showing 1 changed file with 12 additions and 8 deletions
src/ctbin/ctbin.cpp
1 1 /***************************************************************************
2 2 * ctbin - Event binning tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2015 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -386,7 +386,7 @@ void ctbin::free_members(void)
386 386 /***********************************************************************//**
387 387 * @brief Get application parameters
388 388 *
389   - * @exception GException::invalid_value
  389 + * @exception GException::invalid_value
390 390 * Parameter "inobs" is required for ctbin.
391 391 *
392 392 * Get all task parameters from parameter file or (if required) by querying
... ... @@ -402,10 +402,13 @@ void ctbin::get_parameters(void)
402 402  
403 403 // Throw exception if no infile is given, since this tool needs an observation
404 404 // including events
405   - if ((*this)["inobs"].filename()=="NONE" || (*this)["inobs"].filename() == "") {
406   -
407   - std::string msg = "Parameter \"inobs\" is required to be given in ctbin."
408   - "Specify a vaild observation definition (XML or FITS) file to proceed";
  405 + if ((*this)["inobs"].filename() == "NONE" ||
  406 + (*this)["inobs"].filename() == "") {
  407 + std::string msg = "A valid file needs to be specified for the "
  408 + "\"inobs\" parameter, yet \""+
  409 + (*this)["inobs"].filename()+"\" was given."
  410 + " Specify a vaild observation definition or "
  411 + "event list FITS file to proceed.";
409 412 throw GException::invalid_value(G_GET_PARAMETERS, msg);
410 413 }
411 414  
... ... @@ -423,7 +426,7 @@ void ctbin::get_parameters(void)
423 426 // Check if pointing should be used
424 427 if (m_usepnt) {
425 428  
426   - // buld cube from user parameters and pointing information
  429 + // Build cube from user parameters and pointing information
427 430 cube = get_cube(m_obs);
428 431  
429 432 } // endif: pointing used as map center
... ... @@ -435,8 +438,9 @@ void ctbin::get_parameters(void)
435 438  
436 439 } // endelse: m_usepnt was false
437 440  
438   - // Get the skymap
  441 + // Get the skymap and initialise the pixels
439 442 m_cube = cube.map();
  443 + m_cube = 0.0;
440 444  
441 445 // Get energy boundaries
442 446 m_ebounds = cube.ebounds();
... ...