Commit 9617e53e599e3618c35b5af195b9a8644e62aba2
1 parent
30dce101
Define extension names as constant strings
Showing
4 changed files
with
16 additions
and
14 deletions
src/ctmapcube/ctmapcube.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * ctmapcube - Map cube generation tool * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2016-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -392,7 +392,7 @@ void ctmapcube::get_parameters(void) |
| 392 | 392 | * @p ebinfile parameter is "FILE" the method loads the energy information |
| 393 | 393 | * from a FITS file. The name of the FITS file is given by the @p ebinfile |
| 394 | 394 | * parameter. If no extension name is specified the method will use assume |
| 395 | - * the name to be "ENERGIES". | |
| 395 | + * the name to be `ENERGIES`. | |
| 396 | 396 | * |
| 397 | 397 | * If the @p ebinfile parameter is "LIN" the method will create a linearly |
| 398 | 398 | * spaced series of @p enumbins energies in the interval @p emin to @p emax. | ... | ... |
src/ctobssim/ctobssim.cpp
src/ctselect/ctselect.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * ctselect - Data selection tool * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2010-2016 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2010-2017 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -240,8 +240,8 @@ void ctselect::run(void) |
| 240 | 240 | // Initialise event input and output filenames and the event |
| 241 | 241 | // and GTI extension names |
| 242 | 242 | m_infiles.push_back(""); |
| 243 | - m_evtname.push_back("EVENTS"); | |
| 244 | - m_gtiname.push_back("GTI"); | |
| 243 | + m_evtname.push_back(gammalib::extname_cta_events); | |
| 244 | + m_gtiname.push_back(gammalib::extname_gti); | |
| 245 | 245 | |
| 246 | 246 | // Get CTA observation |
| 247 | 247 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| ... | ... | @@ -438,7 +438,7 @@ void ctselect::publish(const std::string& name) |
| 438 | 438 | obs->write(fits); |
| 439 | 439 | |
| 440 | 440 | // Publish |
| 441 | - fits.publish("EVENTS", user_name); | |
| 441 | + fits.publish(gammalib::extname_cta_events, user_name); | |
| 442 | 442 | |
| 443 | 443 | } // endif: there were events |
| 444 | 444 | |
| ... | ... | @@ -1183,13 +1183,13 @@ std::string ctselect::set_outfile_name(const std::string& filename) const |
| 1183 | 1183 | * Extracts the Good Time Intervals extension name from the event file. We |
| 1184 | 1184 | * do this by loading the events and accessing the Good Time Intervals |
| 1185 | 1185 | * extension name using the GCTAEventList::gtiname() method. If the file name |
| 1186 | - * is empty, the method returns "GTI". | |
| 1186 | + * is empty, the method returns `GTI`. | |
| 1187 | 1187 | ***************************************************************************/ |
| 1188 | 1188 | std::string ctselect::get_gtiname(const std::string& filename, |
| 1189 | 1189 | const std::string& evtname) const |
| 1190 | 1190 | { |
| 1191 | 1191 | // Initialise GTI name |
| 1192 | - std::string gtiname = "GTI"; | |
| 1192 | + std::string gtiname = gammalib::extname_gti; | |
| 1193 | 1193 | |
| 1194 | 1194 | // Continue only if the filename is not empty |
| 1195 | 1195 | if (!filename.empty()) { | ... | ... |
src/support/ctool.cpp
| ... | ... | @@ -506,8 +506,8 @@ void ctool::setup_models(GObservations& obs, |
| 506 | 506 | * No valid energy boundary extension found. |
| 507 | 507 | * |
| 508 | 508 | * Get the energy boundaries according to the user parameters. The method |
| 509 | - * supports loading of energy boundary information from the EBOUNDS or | |
| 510 | - * ENERGYBINS extension, or setting energy boundaries using a linear | |
| 509 | + * supports loading of energy boundary information from the `EBOUNDS` or | |
| 510 | + * `ENERGYBINS` extension, or setting energy boundaries using a linear | |
| 511 | 511 | * or logarithmical spacing. |
| 512 | 512 | * |
| 513 | 513 | * The following parameters are read: |
| ... | ... | @@ -540,7 +540,7 @@ GEbounds ctool::create_ebounds(void) |
| 540 | 540 | // Open energy boundary file using the EBOUNDS or ENERGYBINS |
| 541 | 541 | // extension. Throw an exception if opening fails. |
| 542 | 542 | GFits file(ebinfile); |
| 543 | - if (file.contains("EBOUNDS")) { | |
| 543 | + if (file.contains(gammalib::extname_ebounds)) { | |
| 544 | 544 | file.close(); |
| 545 | 545 | ebounds.load(ebinfile); |
| 546 | 546 | } |
| ... | ... | @@ -551,9 +551,11 @@ GEbounds ctool::create_ebounds(void) |
| 551 | 551 | } |
| 552 | 552 | else { |
| 553 | 553 | file.close(); |
| 554 | - std::string msg = "No extension with name \"EBOUNDS\" or" | |
| 554 | + std::string msg = "No extension with name \""+ | |
| 555 | + gammalib::extname_ebounds+"\" or" | |
| 555 | 556 | " \"ENERGYBINS\" found in FITS file" |
| 556 | - " \""+ebinfile+"\". An \"EBOUNDS\" or " | |
| 557 | + " \""+ebinfile+"\". An \""+ | |
| 558 | + gammalib::extname_ebounds+"\" or " | |
| 557 | 559 | "\"ENERGYBINS\" extension is required if " |
| 558 | 560 | "the parameter \"ebinalg\" is set to " |
| 559 | 561 | "\"FILE\"."; | ... | ... |