From 9617e53e599e3618c35b5af195b9a8644e62aba2 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 24 Mar 2017 11:03:31 +0100 Subject: [PATCH] Define extension names as constant strings --- src/ctmapcube/ctmapcube.cpp | 4 ++-- src/ctobssim/ctobssim.cpp | 2 +- src/ctselect/ctselect.cpp | 12 ++++++------ src/support/ctool.cpp | 12 +++++++----- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/ctmapcube/ctmapcube.cpp b/src/ctmapcube/ctmapcube.cpp index b8a13b3..dec509e 100644 --- a/src/ctmapcube/ctmapcube.cpp +++ b/src/ctmapcube/ctmapcube.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctmapcube - Map cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2016 by Juergen Knoedlseder * + * copyright (C) 2016-2017 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -392,7 +392,7 @@ void ctmapcube::get_parameters(void) * @p ebinfile parameter is "FILE" the method loads the energy information * from a FITS file. The name of the FITS file is given by the @p ebinfile * parameter. If no extension name is specified the method will use assume - * the name to be "ENERGIES". + * the name to be `ENERGIES`. * * If the @p ebinfile parameter is "LIN" the method will create a linearly * spaced series of @p enumbins energies in the interval @p emin to @p emax. diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index df9f64b..108eb00 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -500,7 +500,7 @@ void ctobssim::publish(const std::string& name) obs->write(fits); // Publish - fits.publish("EVENTS", user_name); + fits.publish(gammalib::extname_cta_events, user_name); } // endif: there were events diff --git a/src/ctselect/ctselect.cpp b/src/ctselect/ctselect.cpp index 6c2f045..870d8f0 100644 --- a/src/ctselect/ctselect.cpp +++ b/src/ctselect/ctselect.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctselect - Data selection tool * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2016 by Juergen Knoedlseder * + * copyright (C) 2010-2017 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -240,8 +240,8 @@ void ctselect::run(void) // Initialise event input and output filenames and the event // and GTI extension names m_infiles.push_back(""); - m_evtname.push_back("EVENTS"); - m_gtiname.push_back("GTI"); + m_evtname.push_back(gammalib::extname_cta_events); + m_gtiname.push_back(gammalib::extname_gti); // Get CTA observation GCTAObservation* obs = dynamic_cast(m_obs[i]); @@ -438,7 +438,7 @@ void ctselect::publish(const std::string& name) obs->write(fits); // Publish - fits.publish("EVENTS", user_name); + fits.publish(gammalib::extname_cta_events, user_name); } // endif: there were events @@ -1183,13 +1183,13 @@ std::string ctselect::set_outfile_name(const std::string& filename) const * Extracts the Good Time Intervals extension name from the event file. We * do this by loading the events and accessing the Good Time Intervals * extension name using the GCTAEventList::gtiname() method. If the file name - * is empty, the method returns "GTI". + * is empty, the method returns `GTI`. ***************************************************************************/ std::string ctselect::get_gtiname(const std::string& filename, const std::string& evtname) const { // Initialise GTI name - std::string gtiname = "GTI"; + std::string gtiname = gammalib::extname_gti; // Continue only if the filename is not empty if (!filename.empty()) { diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp index ac96963..6a638da 100644 --- a/src/support/ctool.cpp +++ b/src/support/ctool.cpp @@ -506,8 +506,8 @@ void ctool::setup_models(GObservations& obs, * No valid energy boundary extension found. * * Get the energy boundaries according to the user parameters. The method - * supports loading of energy boundary information from the EBOUNDS or - * ENERGYBINS extension, or setting energy boundaries using a linear + * supports loading of energy boundary information from the `EBOUNDS` or + * `ENERGYBINS` extension, or setting energy boundaries using a linear * or logarithmical spacing. * * The following parameters are read: @@ -540,7 +540,7 @@ GEbounds ctool::create_ebounds(void) // Open energy boundary file using the EBOUNDS or ENERGYBINS // extension. Throw an exception if opening fails. GFits file(ebinfile); - if (file.contains("EBOUNDS")) { + if (file.contains(gammalib::extname_ebounds)) { file.close(); ebounds.load(ebinfile); } @@ -551,9 +551,11 @@ GEbounds ctool::create_ebounds(void) } else { file.close(); - std::string msg = "No extension with name \"EBOUNDS\" or" + std::string msg = "No extension with name \""+ + gammalib::extname_ebounds+"\" or" " \"ENERGYBINS\" found in FITS file" - " \""+ebinfile+"\". An \"EBOUNDS\" or " + " \""+ebinfile+"\". An \""+ + gammalib::extname_ebounds+"\" or " "\"ENERGYBINS\" extension is required if " "the parameter \"ebinalg\" is set to " "\"FILE\"."; -- libgit2 0.21.4