Commit 8ebdfced8b8eed3d3eaf6ce2be4d7328d19e39df

Authored by Jürgen Knödlseder
1 parent 914ed611

Define extension names as constant strings

include/GArf.hpp
@@ -38,6 +38,11 @@ @@ -38,6 +38,11 @@
38 class GFits; 38 class GFits;
39 class GFitsTable; 39 class GFitsTable;
40 40
  41 +/* __ Constants __________________________________________________________ */
  42 +namespace gammalib {
  43 + const std::string extname_arf = "SPECRESP";
  44 +}
  45 +
41 46
42 /***********************************************************************//** 47 /***********************************************************************//**
43 * @class GArf 48 * @class GArf
include/GEbounds.hpp
@@ -39,6 +39,11 @@ class GFitsTable; @@ -39,6 +39,11 @@ class GFitsTable;
39 class GFilename; 39 class GFilename;
40 class GEnergies; 40 class GEnergies;
41 41
  42 +/* __ Constants __________________________________________________________ */
  43 +namespace gammalib {
  44 + const std::string extname_ebounds = "EBOUNDS";
  45 +}
  46 +
42 47
43 /***********************************************************************//** 48 /***********************************************************************//**
44 * @class GEbounds 49 * @class GEbounds
@@ -91,7 +96,7 @@ public: @@ -91,7 +96,7 @@ public:
91 const std::string& unit = "keV") const; 96 const std::string& unit = "keV") const;
92 void read(const GFitsTable& table); 97 void read(const GFitsTable& table);
93 void write(GFits& file, 98 void write(GFits& file,
94 - const std::string& extname = "EBOUNDS", 99 + const std::string& extname = gammalib::extname_ebounds,
95 const std::string& unit = "keV") const; 100 const std::string& unit = "keV") const;
96 void read(const GXmlElement& xml); 101 void read(const GXmlElement& xml);
97 void write(GXmlElement& xml) const; 102 void write(GXmlElement& xml) const;
include/GEnergies.hpp
@@ -39,6 +39,11 @@ @@ -39,6 +39,11 @@
39 class GFilename; 39 class GFilename;
40 class GEbounds; 40 class GEbounds;
41 41
  42 +/* __ Constants __________________________________________________________ */
  43 +namespace gammalib {
  44 + const std::string extname_energies = "ENERGIES";
  45 +}
  46 +
42 47
43 /***********************************************************************//** 48 /***********************************************************************//**
44 * @class GEnergies 49 * @class GEnergies
@@ -92,7 +97,7 @@ public: @@ -92,7 +97,7 @@ public:
92 const bool& clobber = false) const; 97 const bool& clobber = false) const;
93 void read(const GFitsTable& table); 98 void read(const GFitsTable& table);
94 void write(GFits& file, 99 void write(GFits& file,
95 - const std::string& extname = "ENERGIES") const; 100 + const std::string& extname = gammalib::extname_energies) const;
96 std::string print(const GChatter& chatter = NORMAL) const; 101 std::string print(const GChatter& chatter = NORMAL) const;
97 102
98 protected: 103 protected:
include/GGti.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GGti.hpp - Good time interval class * 2 * GGti.hpp - Good time interval class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2008-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2008-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -39,6 +39,11 @@ class GXmlElement; @@ -39,6 +39,11 @@ class GXmlElement;
39 class GFits; 39 class GFits;
40 class GFitsTable; 40 class GFitsTable;
41 41
  42 +/* __ Constants __________________________________________________________ */
  43 +namespace gammalib {
  44 + const std::string extname_gti = "GTI";
  45 +}
  46 +
42 47
43 /***********************************************************************//** 48 /***********************************************************************//**
44 * @class GGti 49 * @class GGti
@@ -88,7 +93,7 @@ public: @@ -88,7 +93,7 @@ public:
88 const bool& clobber = false) const; 93 const bool& clobber = false) const;
89 void read(const GFitsTable& table); 94 void read(const GFitsTable& table);
90 void write(GFits& fits, 95 void write(GFits& fits,
91 - const std::string& extname = "GTI") const; 96 + const std::string& extname = gammalib::extname_gti) const;
92 void read(const GXmlElement& xml); 97 void read(const GXmlElement& xml);
93 void write(GXmlElement& xml) const; 98 void write(GXmlElement& xml) const;
94 const GTime& tstart(void) const; 99 const GTime& tstart(void) const;
include/GPha.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GPha.hpp - XSPEC Pulse Height Analyzer class * 2 * GPha.hpp - XSPEC Pulse Height Analyzer class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2013-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -38,6 +38,11 @@ class GEnergy; @@ -38,6 +38,11 @@ class GEnergy;
38 class GFits; 38 class GFits;
39 class GFitsTable; 39 class GFitsTable;
40 40
  41 +/* __ Constants __________________________________________________________ */
  42 +namespace gammalib {
  43 + const std::string extname_pha = "SPECTRUM";
  44 +}
  45 +
41 46
42 /***********************************************************************//** 47 /***********************************************************************//**
43 * @class GPha 48 * @class GPha
include/GRmf.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GRmf.hpp - XSPEC Redistribution Matrix File class * 2 * GRmf.hpp - XSPEC Redistribution Matrix File class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2013-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -38,6 +38,11 @@ @@ -38,6 +38,11 @@
38 class GFits; 38 class GFits;
39 class GFitsTable; 39 class GFitsTable;
40 40
  41 +/* __ Constants __________________________________________________________ */
  42 +namespace gammalib {
  43 + const std::string extname_rmf = "MATRIX";
  44 +}
  45 +
41 46
42 /***********************************************************************//** 47 /***********************************************************************//**
43 * @class GRmf 48 * @class GRmf
inst/cta/include/GCTAAeff2D.hpp
@@ -37,6 +37,11 @@ @@ -37,6 +37,11 @@
37 class GFitsTable; 37 class GFitsTable;
38 class GFitsBinTable; 38 class GFitsBinTable;
39 39
  40 +/* __ Constants __________________________________________________________ */
  41 +namespace gammalib {
  42 + const std::string extname_cta_aeff2d = "EFFECTIVE AREA";
  43 +}
  44 +
40 45
41 /***********************************************************************//** 46 /***********************************************************************//**
42 * @class GCTAAeff2D 47 * @class GCTAAeff2D
inst/cta/include/GCTABackground3D.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTABackground3D.hpp - CTA 3D background class * 2 * GCTABackground3D.hpp - CTA 3D background class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2014-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -37,6 +37,11 @@ @@ -37,6 +37,11 @@
37 class GFits; 37 class GFits;
38 class GFitsBinTable; 38 class GFitsBinTable;
39 39
  40 +/* __ Constants __________________________________________________________ */
  41 +namespace gammalib {
  42 + const std::string extname_cta_background3d = "BACKGROUND";
  43 +}
  44 +
40 45
41 /***********************************************************************//** 46 /***********************************************************************//**
42 * @class GCTABackground3D 47 * @class GCTABackground3D
inst/cta/include/GCTACubeEdisp.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTACubeEdisp.hpp - CTA cube analysis energy dispersion class * 2 * GCTACubeEdisp.hpp - CTA cube analysis energy dispersion class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2016 by Michael Mayer * 4 + * copyright (C) 2016-2017 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -43,6 +43,11 @@ class GObservations; @@ -43,6 +43,11 @@ class GObservations;
43 class GCTAEventCube; 43 class GCTAEventCube;
44 class GCTAObservation; 44 class GCTAObservation;
45 45
  46 +/* __ Constants __________________________________________________________ */
  47 +namespace gammalib {
  48 + const std::string extname_cta_migras = "MIGRAS";
  49 +}
  50 +
46 51
47 /***********************************************************************//** 52 /***********************************************************************//**
48 * @class GCTACubeEdisp 53 * @class GCTACubeEdisp
inst/cta/include/GCTACubePsf.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTACubePsf.hpp - CTA cube analysis point spread function class * 2 * GCTACubePsf.hpp - CTA cube analysis point spread function class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2014-2016 by Chia-Chun Lu * 4 + * copyright (C) 2014-2017 by Chia-Chun Lu *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -42,6 +42,11 @@ class GObservations; @@ -42,6 +42,11 @@ class GObservations;
42 class GCTAEventCube; 42 class GCTAEventCube;
43 class GCTAObservation; 43 class GCTAObservation;
44 44
  45 +/* __ Constants __________________________________________________________ */
  46 +namespace gammalib {
  47 + const std::string extname_deltas = "DELTAS";
  48 +}
  49 +
45 50
46 51
47 /***********************************************************************//** 52 /***********************************************************************//**
inst/cta/include/GCTAEdisp2D.hpp
@@ -39,6 +39,11 @@ class GRan; @@ -39,6 +39,11 @@ class GRan;
39 class GFits; 39 class GFits;
40 class GFitsBinTable; 40 class GFitsBinTable;
41 41
  42 +/* __ Constants __________________________________________________________ */
  43 +namespace gammalib {
  44 + const std::string extname_cta_edisp2d = "ENERGY DISPERSION";
  45 +}
  46 +
42 47
43 /***********************************************************************//** 48 /***********************************************************************//**
44 * @class GCTAEdisp2D 49 * @class GCTAEdisp2D
inst/cta/include/GCTAEventCube.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAEventCube.hpp - CTA event bin container class * 2 * GCTAEventCube.hpp - CTA event bin container class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -44,6 +44,12 @@ @@ -44,6 +44,12 @@
44 /* __ Forward declarations _______________________________________________ */ 44 /* __ Forward declarations _______________________________________________ */
45 class GFilename; 45 class GFilename;
46 46
  47 +/* __ Constants __________________________________________________________ */
  48 +namespace gammalib {
  49 + const std::string extname_cta_counts = "COUNTS";
  50 + const std::string extname_cta_weights = "WEIGHTS";
  51 +}
  52 +
47 53
48 /***********************************************************************//** 54 /***********************************************************************//**
49 * @class GCTAEventCube 55 * @class GCTAEventCube
inst/cta/include/GCTAEventList.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAEventList.hpp - CTA event list class * 2 * GCTAEventList.hpp - CTA event list class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -41,6 +41,11 @@ class GFitsHDU; @@ -41,6 +41,11 @@ class GFitsHDU;
41 class GFitsTable; 41 class GFitsTable;
42 class GFitsBinTable; 42 class GFitsBinTable;
43 43
  44 +/* __ Constants __________________________________________________________ */
  45 +namespace gammalib {
  46 + const std::string extname_cta_events = "EVENTS";
  47 +}
  48 +
44 49
45 /***********************************************************************//** 50 /***********************************************************************//**
46 * @class GCTAEventList 51 * @class GCTAEventList
@@ -100,7 +105,8 @@ protected: @@ -100,7 +105,8 @@ protected:
100 virtual void set_times(void) { return; } 105 virtual void set_times(void) { return; }
101 void read_events(const GFitsTable& table) const; 106 void read_events(const GFitsTable& table) const;
102 void write_events(GFitsBinTable& table) const; 107 void write_events(GFitsBinTable& table) const;
103 - void write_ds_keys(GFitsHDU& hdu, const std::string& gtiname = "GTI") const; 108 + void write_ds_keys(GFitsHDU& hdu,
  109 + const std::string& gtiname = gammalib::extname_gti) const;
104 int irf_cache_init(const std::string& name) const; 110 int irf_cache_init(const std::string& name) const;
105 int irf_cache_index(const std::string& name) const; 111 int irf_cache_index(const std::string& name) const;
106 112
inst/cta/include/GCTAObservation.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAObservation.hpp - CTA Observation class * 2 * GCTAObservation.hpp - CTA Observation class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -33,6 +33,7 @@ @@ -33,6 +33,7 @@
33 #include "GObservation.hpp" 33 #include "GObservation.hpp"
34 #include "GCTAResponse.hpp" 34 #include "GCTAResponse.hpp"
35 #include "GCTAPointing.hpp" 35 #include "GCTAPointing.hpp"
  36 +#include "GCTAEventList.hpp"
36 37
37 /* __ Forward declarations _______________________________________________ */ 38 /* __ Forward declarations _______________________________________________ */
38 class GTime; 39 class GTime;
@@ -100,8 +101,8 @@ public: @@ -100,8 +101,8 @@ public:
100 bool has_events(void) const; 101 bool has_events(void) const;
101 void read(const GFits& fits); 102 void read(const GFits& fits);
102 void write(GFits& fits, 103 void write(GFits& fits,
103 - const std::string& evtname = "EVENTS",  
104 - const std::string& gtiname = "GTI") const; 104 + const std::string& evtname = gammalib::extname_cta_events,
  105 + const std::string& gtiname = gammalib::extname_gti) const;
105 void load(const GFilename& filename); 106 void load(const GFilename& filename);
106 void load(const GFilename& cntcube, 107 void load(const GFilename& cntcube,
107 const GFilename& expcube, 108 const GFilename& expcube,
inst/cta/include/GCTAPsf2D.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAPsf2D.hpp - CTA 2D point spread function class * 2 * GCTAPsf2D.hpp - CTA 2D point spread function class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -29,7 +29,6 @@ @@ -29,7 +29,6 @@
29 29
30 /* __ Includes ___________________________________________________________ */ 30 /* __ Includes ___________________________________________________________ */
31 #include <string> 31 #include <string>
32 -//#include "GRan.hpp"  
33 #include "GFilename.hpp" 32 #include "GFilename.hpp"
34 #include "GCTAPsf.hpp" 33 #include "GCTAPsf.hpp"
35 #include "GCTAResponseTable.hpp" 34 #include "GCTAResponseTable.hpp"
@@ -38,6 +37,11 @@ @@ -38,6 +37,11 @@
38 class GRan; 37 class GRan;
39 class GFitsBinTable; 38 class GFitsBinTable;
40 39
  40 +/* __ Constants __________________________________________________________ */
  41 +namespace gammalib {
  42 + const std::string extname_cta_psf2d = "POINT SPREAD FUNCTION";
  43 +}
  44 +
41 45
42 /***********************************************************************//** 46 /***********************************************************************//**
43 * @class GCTAPsf2D 47 * @class GCTAPsf2D
inst/cta/include/GCTAPsfKing.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAPsfKing.hpp - King profile CTA point spread function class * 2 * GCTAPsfKing.hpp - King profile CTA point spread function class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Michael Mayer * 4 + * copyright (C) 2013-2017 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -37,6 +37,11 @@ @@ -37,6 +37,11 @@
37 class GRan; 37 class GRan;
38 class GFitsTable; 38 class GFitsTable;
39 39
  40 +/* __ Constants __________________________________________________________ */
  41 +namespace gammalib {
  42 + const std::string extname_cta_psfking = "POINT SPREAD FUNCTION";
  43 +}
  44 +
40 45
41 /***********************************************************************//** 46 /***********************************************************************//**
42 * @class GCTAPsfKing 47 * @class GCTAPsfKing
inst/cta/include/GCTAPsfTable.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAPsfTable.hpp - CTA point spread function table class * 2 * GCTAPsfTable.hpp - CTA point spread function table class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2016 by Juergen Knoedlseder * 4 + * copyright (C) 2016-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -37,6 +37,11 @@ @@ -37,6 +37,11 @@
37 class GRan; 37 class GRan;
38 class GFitsTable; 38 class GFitsTable;
39 39
  40 +/* __ Constants __________________________________________________________ */
  41 +namespace gammalib {
  42 + const std::string extname_cta_psftable = "POINT SPREAD FUNCTION";
  43 +}
  44 +
40 45
41 /***********************************************************************//** 46 /***********************************************************************//**
42 * @class GCTAPsfTable 47 * @class GCTAPsfTable
inst/cta/src/GCTAAeff2D.cpp
@@ -356,7 +356,7 @@ void GCTAAeff2D::write(GFitsBinTable&amp; table) const @@ -356,7 +356,7 @@ void GCTAAeff2D::write(GFitsBinTable&amp; table) const
356 * @param[in] filename FITS file name. 356 * @param[in] filename FITS file name.
357 * 357 *
358 * Loads the effective area from a FITS file. If no extension name is given 358 * Loads the effective area from a FITS file. If no extension name is given
359 - * the effective area will be loaded from the "EFFECTIVE AREA" extension. 359 + * the effective area will be loaded from the `EFFECTIVE AREA` extension.
360 ***************************************************************************/ 360 ***************************************************************************/
361 void GCTAAeff2D::load(const GFilename& filename) 361 void GCTAAeff2D::load(const GFilename& filename)
362 { 362 {
@@ -364,7 +364,8 @@ void GCTAAeff2D::load(const GFilename&amp; filename) @@ -364,7 +364,8 @@ void GCTAAeff2D::load(const GFilename&amp; filename)
364 GFits fits(filename); 364 GFits fits(filename);
365 365
366 // Get effective area table 366 // Get effective area table
367 - const GFitsTable& table = *fits.table(filename.extname("EFFECTIVE AREA")); 367 + const GFitsTable& table =
  368 + *fits.table(filename.extname(gammalib::extname_cta_aeff2d));
368 369
369 // Read effective area from table 370 // Read effective area from table
370 read(table); 371 read(table);
@@ -391,7 +392,7 @@ void GCTAAeff2D::load(const GFilename&amp; filename) @@ -391,7 +392,7 @@ void GCTAAeff2D::load(const GFilename&amp; filename)
391 * opens the existing file. The method will create a (or replace an existing) 392 * opens the existing file. The method will create a (or replace an existing)
392 * effective area extension. The extension name can be specified as part 393 * effective area extension. The extension name can be specified as part
393 * of the @p filename, or if no extension name is given, is assumed to be 394 * of the @p filename, or if no extension name is given, is assumed to be
394 - * "EFFECTIVE AREA". 395 + * `EFFECTIVE AREA`.
395 * 396 *
396 * An existing file will only be modified if the @p clobber flag is set to 397 * An existing file will only be modified if the @p clobber flag is set to
397 * true. 398 * true.
@@ -399,7 +400,7 @@ void GCTAAeff2D::load(const GFilename&amp; filename) @@ -399,7 +400,7 @@ void GCTAAeff2D::load(const GFilename&amp; filename)
399 void GCTAAeff2D::save(const GFilename& filename, const bool& clobber) const 400 void GCTAAeff2D::save(const GFilename& filename, const bool& clobber) const
400 { 401 {
401 // Get extension name 402 // Get extension name
402 - std::string extname = filename.extname("EFFECTIVE AREA"); 403 + std::string extname = filename.extname(gammalib::extname_cta_aeff2d);
403 404
404 // Open or create FITS file (without extension name since the requested 405 // Open or create FITS file (without extension name since the requested
405 // extension may not yet exist in the file) 406 // extension may not yet exist in the file)
inst/cta/src/GCTAAeffArf.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAAeffArf.cpp - CTA ARF effective area class * 2 * GCTAAeffArf.cpp - CTA ARF effective area class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2012-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2012-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 #include "GFilename.hpp" 34 #include "GFilename.hpp"
35 #include "GFitsTable.hpp" 35 #include "GFitsTable.hpp"
36 #include "GFitsTableCol.hpp" 36 #include "GFitsTableCol.hpp"
  37 +#include "GArf.hpp"
37 #include "GCTAAeffArf.hpp" 38 #include "GCTAAeffArf.hpp"
38 #include "GCTAResponseIrf.hpp" 39 #include "GCTAResponseIrf.hpp"
39 #include "GCTAResponse_helpers.hpp" 40 #include "GCTAResponse_helpers.hpp"
@@ -245,7 +246,7 @@ GCTAAeffArf* GCTAAeffArf::clone(void) const @@ -245,7 +246,7 @@ GCTAAeffArf* GCTAAeffArf::clone(void) const
245 * Loads the effective area from an ARF FITS file. 246 * Loads the effective area from an ARF FITS file.
246 * 247 *
247 * If no extension name is provided, the effective area will be loaded from 248 * If no extension name is provided, the effective area will be loaded from
248 - * the "SPECRESP" extension. 249 + * the `SPECRESP` extension.
249 ***************************************************************************/ 250 ***************************************************************************/
250 void GCTAAeffArf::load(const GFilename& filename) 251 void GCTAAeffArf::load(const GFilename& filename)
251 { 252 {
@@ -253,7 +254,7 @@ void GCTAAeffArf::load(const GFilename&amp; filename) @@ -253,7 +254,7 @@ void GCTAAeffArf::load(const GFilename&amp; filename)
253 GFits fits(filename); 254 GFits fits(filename);
254 255
255 // Get ARF table 256 // Get ARF table
256 - const GFitsTable& table = *fits.table(filename.extname("SPECRESP")); 257 + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_arf));
257 258
258 // Read ARF from table 259 // Read ARF from table
259 read(table); 260 read(table);
inst/cta/src/GCTABackground3D.cpp
@@ -401,7 +401,7 @@ void GCTABackground3D::write(GFitsBinTable&amp; table) const @@ -401,7 +401,7 @@ void GCTABackground3D::write(GFitsBinTable&amp; table) const
401 * Loads the background from a FITS file. 401 * Loads the background from a FITS file.
402 * 402 *
403 * If no extension name is provided, the background will be loaded from the 403 * If no extension name is provided, the background will be loaded from the
404 - * "BACKGROUND" extension. 404 + * `BACKGROUND` extension.
405 ***************************************************************************/ 405 ***************************************************************************/
406 void GCTABackground3D::load(const GFilename& filename) 406 void GCTABackground3D::load(const GFilename& filename)
407 { 407 {
@@ -409,7 +409,8 @@ void GCTABackground3D::load(const GFilename&amp; filename) @@ -409,7 +409,8 @@ void GCTABackground3D::load(const GFilename&amp; filename)
409 GFits fits(filename); 409 GFits fits(filename);
410 410
411 // Get background table 411 // Get background table
412 - const GFitsTable& table = *fits.table(filename.extname("BACKGROUND")); 412 + const GFitsTable& table =
  413 + *fits.table(filename.extname(gammalib::extname_cta_background3d));
413 414
414 // Read effective area from table 415 // Read effective area from table
415 read(table); 416 read(table);
@@ -436,7 +437,7 @@ void GCTABackground3D::load(const GFilename&amp; filename) @@ -436,7 +437,7 @@ void GCTABackground3D::load(const GFilename&amp; filename)
436 * existing file. The method will create a (or replace an existing) 437 * existing file. The method will create a (or replace an existing)
437 * background extension. The extension name can be specified as part 438 * background extension. The extension name can be specified as part
438 * of the @p filename, or if no extension name is given, is assumed to be 439 * of the @p filename, or if no extension name is given, is assumed to be
439 - * "BACKGROUND". 440 + * `BACKGROUND`.
440 * 441 *
441 * An existing file will only be modified if the @p clobber flag is set to 442 * An existing file will only be modified if the @p clobber flag is set to
442 * true. 443 * true.
@@ -444,7 +445,7 @@ void GCTABackground3D::load(const GFilename&amp; filename) @@ -444,7 +445,7 @@ void GCTABackground3D::load(const GFilename&amp; filename)
444 void GCTABackground3D::save(const GFilename& filename, const bool& clobber) const 445 void GCTABackground3D::save(const GFilename& filename, const bool& clobber) const
445 { 446 {
446 // Get extension name 447 // Get extension name
447 - std::string extname = filename.extname("BACKGROUND"); 448 + std::string extname = filename.extname(gammalib::extname_cta_background3d);
448 449
449 // Open or create FITS file (without extension name since the requested 450 // Open or create FITS file (without extension name since the requested
450 // extension may not yet exist in the file) 451 // extension may not yet exist in the file)
inst/cta/src/GCTACubeBackground.cpp
@@ -520,7 +520,7 @@ void GCTACubeBackground::read(const GFits&amp; fits) @@ -520,7 +520,7 @@ void GCTACubeBackground::read(const GFits&amp; fits)
520 520
521 // Get HDUs 521 // Get HDUs
522 const GFitsImage& hdu_bgdcube = *fits.image("Primary"); 522 const GFitsImage& hdu_bgdcube = *fits.image("Primary");
523 - const GFitsTable& hdu_energies = *fits.table("ENERGIES"); 523 + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies);
524 524
525 // Read cube 525 // Read cube
526 m_cube.read(hdu_bgdcube); 526 m_cube.read(hdu_bgdcube);
inst/cta/src/GCTACubeEdisp.cpp
@@ -496,8 +496,8 @@ void GCTACubeEdisp::fill(const GObservations&amp; obs, GLog* log) @@ -496,8 +496,8 @@ void GCTACubeEdisp::fill(const GObservations&amp; obs, GLog* log)
496 * 496 *
497 * Reads the energy dispersion cube from a FITS file. The energy dispersion 497 * Reads the energy dispersion cube from a FITS file. The energy dispersion
498 * cube values are expected in the primary extension of the FITS file, the 498 * cube values are expected in the primary extension of the FITS file, the
499 - * true energy boundaries are expected in the "ENERGIES" extension, and the  
500 - * migration values are expected in the "MIGRAS" extension. 499 + * true energy boundaries are expected in the `ENERGIES` extension, and the
  500 + * migration values are expected in the `MIGRAS` extension.
501 ***************************************************************************/ 501 ***************************************************************************/
502 void GCTACubeEdisp::read(const GFits& fits) 502 void GCTACubeEdisp::read(const GFits& fits)
503 { 503 {
@@ -506,8 +506,8 @@ void GCTACubeEdisp::read(const GFits&amp; fits) @@ -506,8 +506,8 @@ void GCTACubeEdisp::read(const GFits&amp; fits)
506 506
507 // Get HDUs 507 // Get HDUs
508 const GFitsImage& hdu_edispcube = *fits.image("Primary"); 508 const GFitsImage& hdu_edispcube = *fits.image("Primary");
509 - const GFitsTable& hdu_energies = *fits.table("ENERGIES");  
510 - const GFitsTable& hdu_migras = *fits.table("MIGRAS"); 509 + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies);
  510 + const GFitsTable& hdu_migras = *fits.table(gammalib::extname_cta_migras);
511 511
512 // Read energy dispersion cube 512 // Read energy dispersion cube
513 m_cube.read(hdu_edispcube); 513 m_cube.read(hdu_edispcube);
@@ -536,17 +536,17 @@ void GCTACubeEdisp::read(const GFits&amp; fits) @@ -536,17 +536,17 @@ void GCTACubeEdisp::read(const GFits&amp; fits)
536 * 536 *
537 * Write the energy dispersion cube into a FITS file. The energy dispersion 537 * Write the energy dispersion cube into a FITS file. The energy dispersion
538 * cube values are written into the primary extension of the FITS file, the 538 * cube values are written into the primary extension of the FITS file, the
539 - * true energy boundaries are written into the "EBOUNDS" extension, and the  
540 - * migration values are written into the "MIGRAS" extension. 539 + * true energy boundaries are written into the `ENERGIES` extension, and the
  540 + * migration values are written into the `MIGRAS` extension.
541 ***************************************************************************/ 541 ***************************************************************************/
542 void GCTACubeEdisp::write(GFits& fits) const 542 void GCTACubeEdisp::write(GFits& fits) const
543 { 543 {
544 // Remove extensions from FITS file 544 // Remove extensions from FITS file
545 - if (fits.contains("MIGRAS")) {  
546 - fits.remove("MIGRAS"); 545 + if (fits.contains(gammalib::extname_cta_migras)) {
  546 + fits.remove(gammalib::extname_cta_migras);
547 } 547 }
548 - if (fits.contains("ENERGIES")) {  
549 - fits.remove("ENERGIES"); 548 + if (fits.contains(gammalib::extname_energies)) {
  549 + fits.remove(gammalib::extname_energies);
550 } 550 }
551 if (fits.contains("Primary")) { 551 if (fits.contains("Primary")) {
552 fits.remove("Primary"); 552 fits.remove("Primary");
@@ -556,10 +556,10 @@ void GCTACubeEdisp::write(GFits&amp; fits) const @@ -556,10 +556,10 @@ void GCTACubeEdisp::write(GFits&amp; fits) const
556 m_cube.write(fits); 556 m_cube.write(fits);
557 557
558 // Write energy boundaries 558 // Write energy boundaries
559 - m_energies.write(fits, "ENERGIES"); 559 + m_energies.write(fits, gammalib::extname_energies);
560 560
561 // Write migration nodes 561 // Write migration nodes
562 - m_migras.write(fits, "MIGRAS"); 562 + m_migras.write(fits, gammalib::extname_cta_migras);
563 563
564 // Return 564 // Return
565 return; 565 return;
inst/cta/src/GCTACubeExposure.cpp
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 #include "GCTAEventList.hpp" 39 #include "GCTAEventList.hpp"
40 40
41 /* __ Method name definitions ____________________________________________ */ 41 /* __ Method name definitions ____________________________________________ */
42 -#define G_FILL_CUBE "GCTACubeExposure::fill_cube(GCTAObservation&, GLog*)" 42 +#define G_FILL_CUBE "GCTACubeExposure::fill_cube(GCTAObservation&, GLog*)"
43 43
44 /* __ Macros _____________________________________________________________ */ 44 /* __ Macros _____________________________________________________________ */
45 45
@@ -386,8 +386,8 @@ void GCTACubeExposure::read(const GFits&amp; fits) @@ -386,8 +386,8 @@ void GCTACubeExposure::read(const GFits&amp; fits)
386 386
387 // Get HDUs 387 // Get HDUs
388 const GFitsImage& hdu_expcube = *fits.image("Primary"); 388 const GFitsImage& hdu_expcube = *fits.image("Primary");
389 - const GFitsTable& hdu_energies = *fits.table("ENERGIES");  
390 - const GFitsTable& hdu_gti = *fits.table("GTI"); 389 + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies);
  390 + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti);
391 391
392 // Read cube 392 // Read cube
393 m_cube.read(hdu_expcube); 393 m_cube.read(hdu_expcube);
inst/cta/src/GCTACubePsf.cpp
@@ -478,8 +478,8 @@ void GCTACubePsf::read(const GFits&amp; fits) @@ -478,8 +478,8 @@ void GCTACubePsf::read(const GFits&amp; fits)
478 478
479 // Get HDUs 479 // Get HDUs
480 const GFitsImage& hdu_psfcube = *fits.image("Primary"); 480 const GFitsImage& hdu_psfcube = *fits.image("Primary");
481 - const GFitsTable& hdu_energies = *fits.table("ENERGIES");  
482 - const GFitsTable& hdu_deltas = *fits.table("DELTAS"); 481 + const GFitsTable& hdu_energies = *fits.table(gammalib::extname_energies);
  482 + const GFitsTable& hdu_deltas = *fits.table(gammalib::extname_deltas);
483 483
484 // Read cube 484 // Read cube
485 m_cube.read(hdu_psfcube); 485 m_cube.read(hdu_psfcube);
@@ -522,10 +522,10 @@ void GCTACubePsf::write(GFits&amp; fits) const @@ -522,10 +522,10 @@ void GCTACubePsf::write(GFits&amp; fits) const
522 m_energies.write(fits); 522 m_energies.write(fits);
523 523
524 // Write delta nodes 524 // Write delta nodes
525 - m_deltas.write(fits, "DELTAS"); 525 + m_deltas.write(fits, gammalib::extname_deltas);
526 526
527 // Set the nodes unit to "deg" 527 // Set the nodes unit to "deg"
528 - (*fits.table("DELTAS"))["Value"]->unit("deg"); 528 + (*fits.table(gammalib::extname_deltas))["Value"]->unit("deg");
529 529
530 // Return 530 // Return
531 return; 531 return;
inst/cta/src/GCTAEdisp2D.cpp
@@ -430,7 +430,7 @@ void GCTAEdisp2D::write(GFitsBinTable&amp; table) const @@ -430,7 +430,7 @@ void GCTAEdisp2D::write(GFitsBinTable&amp; table) const
430 * Loads the energy dispersion from a FITS file. 430 * Loads the energy dispersion from a FITS file.
431 * 431 *
432 * If no extension name is provided, the energy dispersion will be loaded 432 * If no extension name is provided, the energy dispersion will be loaded
433 - * from the "ENERGY DISPERSION" extension. 433 + * from the `ENERGY DISPERSION` extension.
434 ***************************************************************************/ 434 ***************************************************************************/
435 void GCTAEdisp2D::load(const GFilename& filename) 435 void GCTAEdisp2D::load(const GFilename& filename)
436 { 436 {
@@ -456,7 +456,7 @@ void GCTAEdisp2D::load(const GFilename&amp; filename) @@ -456,7 +456,7 @@ void GCTAEdisp2D::load(const GFilename&amp; filename)
456 * opens the existing file. The method will create a (or replace an existing) 456 * opens the existing file. The method will create a (or replace an existing)
457 * energy dispersion extension. The extension name can be specified as part 457 * energy dispersion extension. The extension name can be specified as part
458 * of the @p filename, or if no extension name is given, is assumed to be 458 * of the @p filename, or if no extension name is given, is assumed to be
459 - * "ENERGY DISPERSION". 459 + * `ENERGY DISPERSION`.
460 * 460 *
461 * An existing file will only be modified if the @p clobber flag is set to 461 * An existing file will only be modified if the @p clobber flag is set to
462 * true. 462 * true.
@@ -464,7 +464,7 @@ void GCTAEdisp2D::load(const GFilename&amp; filename) @@ -464,7 +464,7 @@ void GCTAEdisp2D::load(const GFilename&amp; filename)
464 void GCTAEdisp2D::save(const GFilename& filename, const bool& clobber) const 464 void GCTAEdisp2D::save(const GFilename& filename, const bool& clobber) const
465 { 465 {
466 // Get extension name 466 // Get extension name
467 - std::string extname = filename.extname("ENERGY DISPERSION"); 467 + std::string extname = filename.extname(gammalib::extname_cta_edisp2d);
468 468
469 // Open or create FITS file (without extension name since the requested 469 // Open or create FITS file (without extension name since the requested
470 // extension may not yet exist in the file) 470 // extension may not yet exist in the file)
@@ -745,7 +745,8 @@ void GCTAEdisp2D::fetch(void) const @@ -745,7 +745,8 @@ void GCTAEdisp2D::fetch(void) const
745 GFits fits(m_filename); 745 GFits fits(m_filename);
746 746
747 // Initialise energy dispersion extension name 747 // Initialise energy dispersion extension name
748 - std::string extname = m_filename.extname("ENERGY DISPERSION"); 748 + std::string extname =
  749 + m_filename.extname(gammalib::extname_cta_edisp2d);
749 750
750 // Get energy dispersion table 751 // Get energy dispersion table
751 const GFitsTable& table = *fits.table(extname); 752 const GFitsTable& table = *fits.table(extname);
inst/cta/src/GCTAEventCube.cpp
@@ -437,14 +437,14 @@ void GCTAEventCube::read(const GFits&amp; fits) @@ -437,14 +437,14 @@ void GCTAEventCube::read(const GFits&amp; fits)
437 437
438 // Set counts cube HDU 438 // Set counts cube HDU
439 std::string counts_hdu("Primary"); 439 std::string counts_hdu("Primary");
440 - if (fits.contains("COUNTS")) {  
441 - counts_hdu = "COUNTS"; 440 + if (fits.contains(gammalib::extname_cta_counts)) {
  441 + counts_hdu = gammalib::extname_cta_counts;
442 } 442 }
443 443
444 // Get HDUs 444 // Get HDUs
445 const GFitsImage& hdu_cntmap = *fits.image(counts_hdu); 445 const GFitsImage& hdu_cntmap = *fits.image(counts_hdu);
446 - const GFitsTable& hdu_ebounds = *fits.table("EBOUNDS");  
447 - const GFitsTable& hdu_gti = *fits.table("GTI"); 446 + const GFitsTable& hdu_ebounds = *fits.table(gammalib::extname_ebounds);
  447 + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti);
448 448
449 // Load counts map 449 // Load counts map
450 read_cntmap(hdu_cntmap); 450 read_cntmap(hdu_cntmap);
@@ -456,10 +456,10 @@ void GCTAEventCube::read(const GFits&amp; fits) @@ -456,10 +456,10 @@ void GCTAEventCube::read(const GFits&amp; fits)
456 read_gti(hdu_gti); 456 read_gti(hdu_gti);
457 457
458 // If a WEIGHTS HDU exist then load it from the FITS file ... 458 // If a WEIGHTS HDU exist then load it from the FITS file ...
459 - if (fits.contains("WEIGHTS")) { 459 + if (fits.contains(gammalib::extname_cta_weights)) {
460 460
461 // Get WEIGHTS HDU 461 // Get WEIGHTS HDU
462 - const GFitsImage& hdu_weights = *fits.image("WEIGHTS"); 462 + const GFitsImage& hdu_weights = *fits.image(gammalib::extname_cta_weights);
463 463
464 // Read HDU 464 // Read HDU
465 m_weights.read(hdu_weights); 465 m_weights.read(hdu_weights);
@@ -500,27 +500,27 @@ void GCTAEventCube::read(const GFits&amp; fits) @@ -500,27 +500,27 @@ void GCTAEventCube::read(const GFits&amp; fits)
500 void GCTAEventCube::write(GFits& fits) const 500 void GCTAEventCube::write(GFits& fits) const
501 { 501 {
502 // Remove HDUs if they exist already 502 // Remove HDUs if they exist already
503 - if (fits.contains("GTI")) {  
504 - fits.remove("GTI"); 503 + if (fits.contains(gammalib::extname_gti)) {
  504 + fits.remove(gammalib::extname_gti);
505 } 505 }
506 - if (fits.contains("EBOUNDS")) {  
507 - fits.remove("EBOUNDS"); 506 + if (fits.contains(gammalib::extname_ebounds)) {
  507 + fits.remove(gammalib::extname_ebounds);
508 } 508 }
509 - if (fits.contains("WEIGHTS")) {  
510 - fits.remove("WEIGHTS"); 509 + if (fits.contains(gammalib::extname_cta_weights)) {
  510 + fits.remove(gammalib::extname_cta_weights);
511 } 511 }
512 - if (fits.contains("COUNTS")) {  
513 - fits.remove("COUNTS"); 512 + if (fits.contains(gammalib::extname_cta_counts)) {
  513 + fits.remove(gammalib::extname_cta_counts);
514 } 514 }
515 if (fits.contains("Primary")) { 515 if (fits.contains("Primary")) {
516 fits.remove("Primary"); 516 fits.remove("Primary");
517 } 517 }
518 518
519 // Write counts cube 519 // Write counts cube
520 - m_map.write(fits, "COUNTS"); 520 + m_map.write(fits, gammalib::extname_cta_counts);
521 521
522 // Write cube weighting 522 // Write cube weighting
523 - m_weights.write(fits, "WEIGHTS"); 523 + m_weights.write(fits, gammalib::extname_cta_weights);
524 524
525 // Write energy boundaries 525 // Write energy boundaries
526 ebounds().write(fits); 526 ebounds().write(fits);
inst/cta/src/GCTAEventList.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAEventList.cpp - CTA event list class * 2 * GCTAEventList.cpp - CTA event list class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -325,17 +325,17 @@ void GCTAEventList::save(const GFilename&amp; filename, @@ -325,17 +325,17 @@ void GCTAEventList::save(const GFilename&amp; filename,
325 * 325 *
326 * Reads the event list from a FITS file. 326 * Reads the event list from a FITS file.
327 * 327 *
328 - * The events will be read by default from the extension "EVENTS" unless 328 + * The events will be read by default from the extension `EVENTS` unless
329 * an extension name is explicitly specified in the FITS file name. The 329 * an extension name is explicitly specified in the FITS file name. The
330 * FITS header of the extension will be scanned for data sub-space keywords 330 * FITS header of the extension will be scanned for data sub-space keywords
331 * to extract the energy boundaries, the region of interest, as well as the 331 * to extract the energy boundaries, the region of interest, as well as the
332 * extension name for the Good Time Intervals. If no extension name for 332 * extension name for the Good Time Intervals. If no extension name for
333 * Good Time Intervals is found it is expected that the Good Time Intervals 333 * Good Time Intervals is found it is expected that the Good Time Intervals
334 - * reside in the "GTI" extension. 334 + * reside in the `GTI` extension.
335 * 335 *
336 * If a Good Time Intervals is found in the same FITS file, the Good Time 336 * If a Good Time Intervals is found in the same FITS file, the Good Time
337 * Intervals will be loaded. Otherwise, a single Good Time Interval will 337 * Intervals will be loaded. Otherwise, a single Good Time Interval will
338 - * be assumed based on the "TSTART" and "TSTOP" keywords found in the header 338 + * be assumed based on the `TSTART` and `TSTOP` keywords found in the header
339 * of the event list. 339 * of the event list.
340 * 340 *
341 * The method clears the event list before reading, thus any events that 341 * The method clears the event list before reading, thus any events that
@@ -356,7 +356,7 @@ void GCTAEventList::read(const GFits&amp; fits) @@ -356,7 +356,7 @@ void GCTAEventList::read(const GFits&amp; fits)
356 m_filename = fits.filename(); 356 m_filename = fits.filename();
357 357
358 // Initialise events extension name 358 // Initialise events extension name
359 - std::string extname = fits.filename().extname("EVENTS"); 359 + std::string extname = fits.filename().extname(gammalib::extname_cta_events);
360 360
361 // Get event list HDU 361 // Get event list HDU
362 const GFitsTable& events = *fits.table(extname); 362 const GFitsTable& events = *fits.table(extname);
@@ -385,7 +385,7 @@ void GCTAEventList::read(const GFits&amp; fits) @@ -385,7 +385,7 @@ void GCTAEventList::read(const GFits&amp; fits)
385 385
386 // If no GTI extension name was found then 386 // If no GTI extension name was found then
387 if (gti_extname.empty()) { 387 if (gti_extname.empty()) {
388 - gti_extname = "GTI"; 388 + gti_extname = gammalib::extname_gti;
389 } 389 }
390 390
391 // If GTI extension is present in FITS file then read Good Time Intervals 391 // If GTI extension is present in FITS file then read Good Time Intervals
@@ -443,7 +443,7 @@ void GCTAEventList::read(const GFits&amp; fits) @@ -443,7 +443,7 @@ void GCTAEventList::read(const GFits&amp; fits)
443 * 443 *
444 * Writes the CTA event list and the Good Time intervals into a FITS file. 444 * Writes the CTA event list and the Good Time intervals into a FITS file.
445 * 445 *
446 - * The events will be written by default into the extension "EVENTS" unless 446 + * The events will be written by default into the extension `EVENTS` unless
447 * an extension name is explicitly specified in the FITS file name. The 447 * an extension name is explicitly specified in the FITS file name. The
448 * method also writes the data sub-space keywords in the FITS header of the 448 * method also writes the data sub-space keywords in the FITS header of the
449 * events table. 449 * events table.
@@ -451,15 +451,16 @@ void GCTAEventList::read(const GFits&amp; fits) @@ -451,15 +451,16 @@ void GCTAEventList::read(const GFits&amp; fits)
451 * In addition, the method will also append a table containing the Good Time 451 * In addition, the method will also append a table containing the Good Time
452 * Intervals of the events to the FITS file. The extension name for the Good 452 * Intervals of the events to the FITS file. The extension name for the Good
453 * Time Intervals is either taken from the m_gti_extname member, or if empty, 453 * Time Intervals is either taken from the m_gti_extname member, or if empty,
454 - * is set to "GTI". 454 + * is set to `GTI`.
455 ***************************************************************************/ 455 ***************************************************************************/
456 void GCTAEventList::write(GFits& fits) const 456 void GCTAEventList::write(GFits& fits) const
457 { 457 {
458 // Set event extension name 458 // Set event extension name
459 - std::string evtname = fits.filename().extname("EVENTS"); 459 + std::string evtname = fits.filename().extname(gammalib::extname_cta_events);
460 460
461 // Set GTI extension name 461 // Set GTI extension name
462 - std::string gtiname = (m_gti_extname.empty()) ? "GTI" : m_gti_extname; 462 + std::string gtiname = (m_gti_extname.empty())
  463 + ? gammalib::extname_gti : m_gti_extname;
463 464
464 // Write events and GTIs 465 // Write events and GTIs
465 write(fits, evtname, gtiname); 466 write(fits, evtname, gtiname);
@@ -662,7 +663,7 @@ void GCTAEventList::fetch(void) const @@ -662,7 +663,7 @@ void GCTAEventList::fetch(void) const
662 GFits fits(m_filename); 663 GFits fits(m_filename);
663 664
664 // Initialise events extension name 665 // Initialise events extension name
665 - std::string extname = fits.filename().extname("EVENTS"); 666 + std::string extname = fits.filename().extname(gammalib::extname_cta_events);
666 667
667 // Get event list HDU 668 // Get event list HDU
668 const GFitsTable& events = *fits.table(extname); 669 const GFitsTable& events = *fits.table(extname);
@@ -869,7 +870,7 @@ void GCTAEventList::init_members(void) @@ -869,7 +870,7 @@ void GCTAEventList::init_members(void)
869 m_columns.clear(); 870 m_columns.clear();
870 m_filename.clear(); 871 m_filename.clear();
871 m_num_events = 0; 872 m_num_events = 0;
872 - m_gti_extname = "GTI"; //!< Default GTI extension name 873 + m_gti_extname = gammalib::extname_gti; //!< Default GTI extension name
873 m_has_phase = false; 874 m_has_phase = false;
874 m_has_detxy = true; 875 m_has_detxy = true;
875 876
@@ -1075,7 +1076,7 @@ void GCTAEventList::write_events(GFitsBinTable&amp; hdu) const @@ -1075,7 +1076,7 @@ void GCTAEventList::write_events(GFitsBinTable&amp; hdu) const
1075 fetch(); 1076 fetch();
1076 1077
1077 // Set extension name 1078 // Set extension name
1078 - hdu.extname("EVENTS"); 1079 + hdu.extname(gammalib::extname_cta_events);
1079 1080
1080 // If there are events then write them now 1081 // If there are events then write them now
1081 if (size() > 0) { 1082 if (size() > 0) {
inst/cta/src/GCTAObservation.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAObservation.cpp - CTA Observation class * 2 * GCTAObservation.cpp - CTA Observation class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -998,7 +998,7 @@ void GCTAObservation::write(GXmlElement&amp; xml) const @@ -998,7 +998,7 @@ void GCTAObservation::write(GXmlElement&amp; xml) const
998 * depending of the information provided in the FITS file. If an extension 998 * depending of the information provided in the FITS file. If an extension
999 * name is specified, the method checks whether the extension exists and 999 * name is specified, the method checks whether the extension exists and
1000 * loads the extension as event list. Otherwise, it checks whether the file 1000 * loads the extension as event list. Otherwise, it checks whether the file
1001 - * contains an "EVENTS" extension and loads the extension as event list. 1001 + * contains an `EVENTS` extension and loads the extension as event list.
1002 * If none of the above are satistified, the method loads a counts cube. 1002 * If none of the above are satistified, the method loads a counts cube.
1003 ***************************************************************************/ 1003 ***************************************************************************/
1004 void GCTAObservation::read(const GFits& fits) 1004 void GCTAObservation::read(const GFits& fits)
@@ -1012,7 +1012,7 @@ void GCTAObservation::read(const GFits&amp; fits) @@ -1012,7 +1012,7 @@ void GCTAObservation::read(const GFits&amp; fits)
1012 GFilename filename(fits.filename()); 1012 GFilename filename(fits.filename());
1013 1013
1014 // Get extension name 1014 // Get extension name
1015 - std::string extname = filename.extname("EVENTS"); 1015 + std::string extname = filename.extname(gammalib::extname_cta_events);
1016 1016
1017 // If FITS file contains an EVENTS extension we have an unbinned 1017 // If FITS file contains an EVENTS extension we have an unbinned
1018 // observation ... 1018 // observation ...
@@ -1060,8 +1060,8 @@ void GCTAObservation::read(const GFits&amp; fits) @@ -1060,8 +1060,8 @@ void GCTAObservation::read(const GFits&amp; fits)
1060 * @brief Write observation into FITS file. 1060 * @brief Write observation into FITS file.
1061 * 1061 *
1062 * @param[in] fits FITS file. 1062 * @param[in] fits FITS file.
1063 - * @param[in] evtname Events FITS extension name (default: "EVENTS").  
1064 - * @param[in] gtiname Good Time Intervals FITS extension name (default: "GTI"). 1063 + * @param[in] evtname Events FITS extension name.
  1064 + * @param[in] gtiname Good Time Intervals FITS extension name.
1065 * 1065 *
1066 * Writes the observation into a FITS file. 1066 * Writes the observation into a FITS file.
1067 * 1067 *
@@ -1264,7 +1264,7 @@ void GCTAObservation::load(const GFilename&amp; cntcube, @@ -1264,7 +1264,7 @@ void GCTAObservation::load(const GFilename&amp; cntcube,
1264 * If the CTA observation contains an event cube, the method will write the 1264 * If the CTA observation contains an event cube, the method will write the
1265 * cube into the primary image, followed by binary tables containing the 1265 * cube into the primary image, followed by binary tables containing the
1266 * energy boundaries and the Good Time Intervals. The extension names of 1266 * energy boundaries and the Good Time Intervals. The extension names of
1267 - * these binary tables are "EBOUNDS" and "GTI", and cannot be modified. 1267 + * these binary tables are `EBOUNDS` and `GTI`, and cannot be modified.
1268 ***************************************************************************/ 1268 ***************************************************************************/
1269 void GCTAObservation::save(const GFilename& filename, 1269 void GCTAObservation::save(const GFilename& filename,
1270 const bool& clobber) const 1270 const bool& clobber) const
@@ -1274,8 +1274,8 @@ void GCTAObservation::save(const GFilename&amp; filename, @@ -1274,8 +1274,8 @@ void GCTAObservation::save(const GFilename&amp; filename,
1274 // The specific format that is implemented is [events;gti], where the 1274 // The specific format that is implemented is [events;gti], where the
1275 // part before the semi-colon is the events extension name and the part 1275 // part before the semi-colon is the events extension name and the part
1276 // after the semi-colon is the Good Time Intervals extension name. 1276 // after the semi-colon is the Good Time Intervals extension name.
1277 - std::string evtname = "EVENTS";  
1278 - std::string gtiname = "GTI"; 1277 + std::string evtname = gammalib::extname_cta_events;
  1278 + std::string gtiname = gammalib::extname_gti;
1279 if (filename.has_extname()) { 1279 if (filename.has_extname()) {
1280 std::vector<std::string> extnames = gammalib::split(filename.extname(), ";"); 1280 std::vector<std::string> extnames = gammalib::split(filename.extname(), ";");
1281 if (extnames.size() > 0) { 1281 if (extnames.size() > 0) {
inst/cta/src/GCTAOnOffObservation.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAOnOffObservation.cpp - CTA On/Off observation class * 2 * GCTAOnOffObservation.cpp - CTA On/Off observation class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Chia-Chun Lu & Christoph Deil * 4 + * copyright (C) 2013-2017 by Chia-Chun Lu & Christoph Deil *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -1007,7 +1007,7 @@ void GCTAOnOffObservation::compute_arf(const GCTAObservation&amp; obs) @@ -1007,7 +1007,7 @@ void GCTAOnOffObservation::compute_arf(const GCTAObservation&amp; obs)
1007 * 1007 *
1008 * Compute the background rate in units of events/s/MeV in all Off regions 1008 * Compute the background rate in units of events/s/MeV in all Off regions
1009 * and stores the background rate as additional column with name 1009 * and stores the background rate as additional column with name
1010 - * "BACKGROUND" in the Auxiliary Response File (ARF). 1010 + * `BACKGROUND` in the Auxiliary Response File (ARF).
1011 * 1011 *
1012 * @todo Should implement integration of background model over region. 1012 * @todo Should implement integration of background model over region.
1013 * @todo Allow general region, not only circles. 1013 * @todo Allow general region, not only circles.
inst/cta/src/GCTAPsf2D.cpp
@@ -385,7 +385,7 @@ void GCTAPsf2D::write(GFitsBinTable&amp; table) const @@ -385,7 +385,7 @@ void GCTAPsf2D::write(GFitsBinTable&amp; table) const
385 * Loads the point spread function from a FITS file. 385 * Loads the point spread function from a FITS file.
386 * 386 *
387 * If no extension name is provided, the point spread function will be loaded 387 * If no extension name is provided, the point spread function will be loaded
388 - * from the "POINT SPREAD FUNCTION" extension. 388 + * from the `POINT SPREAD FUNCTION` extension.
389 ***************************************************************************/ 389 ***************************************************************************/
390 void GCTAPsf2D::load(const GFilename& filename) 390 void GCTAPsf2D::load(const GFilename& filename)
391 { 391 {
@@ -393,7 +393,8 @@ void GCTAPsf2D::load(const GFilename&amp; filename) @@ -393,7 +393,8 @@ void GCTAPsf2D::load(const GFilename&amp; filename)
393 GFits fits(filename); 393 GFits fits(filename);
394 394
395 // Get PSFa table 395 // Get PSFa table
396 - const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION")); 396 + const GFitsTable& table =
  397 + *fits.table(filename.extname(gammalib::extname_cta_psf2d));
397 398
398 // Read PSF from table 399 // Read PSF from table
399 read(table); 400 read(table);
@@ -413,17 +414,17 @@ void GCTAPsf2D::load(const GFilename&amp; filename) @@ -413,17 +414,17 @@ void GCTAPsf2D::load(const GFilename&amp; filename)
413 * @brief Save point spread function table into FITS file 414 * @brief Save point spread function table into FITS file
414 * 415 *
415 * @param[in] filename FITS file name. 416 * @param[in] filename FITS file name.
416 - * @param[in] clobber Overwrite existing file? (default: false) 417 + * @param[in] clobber Overwrite existing file?
417 * 418 *
418 * Save the point spread function into a FITS file. 419 * Save the point spread function into a FITS file.
419 * 420 *
420 * If no extension name is provided, the point spread function will be saved 421 * If no extension name is provided, the point spread function will be saved
421 - * into the "POINT SPREAD FUNCTION" extension. 422 + * into the `POINT SPREAD FUNCTION` extension.
422 ***************************************************************************/ 423 ***************************************************************************/
423 void GCTAPsf2D::save(const GFilename& filename, const bool& clobber) const 424 void GCTAPsf2D::save(const GFilename& filename, const bool& clobber) const
424 { 425 {
425 // Get extension name 426 // Get extension name
426 - std::string extname = filename.extname("POINT SPREAD FUNCTION"); 427 + std::string extname = filename.extname(gammalib::extname_cta_psf2d);
427 428
428 // Open or create FITS file (without extension name since the requested 429 // Open or create FITS file (without extension name since the requested
429 // extension may not yet exist in the file) 430 // extension may not yet exist in the file)
inst/cta/src/GCTAPsfKing.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAPsfKing.cpp - King profile CTA point spread function class * 2 * GCTAPsfKing.cpp - King profile CTA point spread function class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Michael Mayer * 4 + * copyright (C) 2013-2017 by Michael Mayer *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -379,7 +379,7 @@ void GCTAPsfKing::write(GFitsBinTable&amp; table) const @@ -379,7 +379,7 @@ void GCTAPsfKing::write(GFitsBinTable&amp; table) const
379 * Loads the point spread function from a FITS file. 379 * Loads the point spread function from a FITS file.
380 * 380 *
381 * If no extension name is provided, the point spread function will be loaded 381 * If no extension name is provided, the point spread function will be loaded
382 - * from the "POINT SPREAD FUNCTION" extension. 382 + * from the `POINT SPREAD FUNCTION` extension.
383 ***************************************************************************/ 383 ***************************************************************************/
384 void GCTAPsfKing::load(const GFilename& filename) 384 void GCTAPsfKing::load(const GFilename& filename)
385 { 385 {
@@ -387,7 +387,8 @@ void GCTAPsfKing::load(const GFilename&amp; filename) @@ -387,7 +387,8 @@ void GCTAPsfKing::load(const GFilename&amp; filename)
387 GFits fits(filename); 387 GFits fits(filename);
388 388
389 // Get PSFa table 389 // Get PSFa table
390 - const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION")); 390 + const GFitsTable& table =
  391 + *fits.table(filename.extname(gammalib::extname_cta_psfking));
391 392
392 // Read PSF from table 393 // Read PSF from table
393 read(table); 394 read(table);
@@ -406,14 +407,14 @@ void GCTAPsfKing::load(const GFilename&amp; filename) @@ -406,14 +407,14 @@ void GCTAPsfKing::load(const GFilename&amp; filename)
406 * @brief Save point spread function table into FITS file 407 * @brief Save point spread function table into FITS file
407 * 408 *
408 * @param[in] filename FITS file name. 409 * @param[in] filename FITS file name.
409 - * @param[in] clobber Overwrite existing file? (default: false) 410 + * @param[in] clobber Overwrite existing file?
410 * 411 *
411 * Saves point spread function into a FITS file. If a file with the given 412 * Saves point spread function into a FITS file. If a file with the given
412 * @p filename does not yet exist it will be created, otherwise the method 413 * @p filename does not yet exist it will be created, otherwise the method
413 * opens the existing file. The method will create a (or replace an existing) 414 * opens the existing file. The method will create a (or replace an existing)
414 * point spread function extension. The extension name can be specified as 415 * point spread function extension. The extension name can be specified as
415 * part of the @p filename, or if no extension name is given, is assumed to 416 * part of the @p filename, or if no extension name is given, is assumed to
416 - * be "POINT SPREAD FUNCTION". 417 + * be `POINT SPREAD FUNCTION`.
417 * 418 *
418 * An existing file will only be modified if the @p clobber flag is set to 419 * An existing file will only be modified if the @p clobber flag is set to
419 * true. 420 * true.
@@ -421,7 +422,7 @@ void GCTAPsfKing::load(const GFilename&amp; filename) @@ -421,7 +422,7 @@ void GCTAPsfKing::load(const GFilename&amp; filename)
421 void GCTAPsfKing::save(const GFilename& filename, const bool& clobber) const 422 void GCTAPsfKing::save(const GFilename& filename, const bool& clobber) const
422 { 423 {
423 // Get extension name 424 // Get extension name
424 - std::string extname = filename.extname("POINT SPREAD FUNCTION"); 425 + std::string extname = filename.extname(gammalib::extname_cta_psfking);
425 426
426 // Open or create FITS file (without extension name since the requested 427 // Open or create FITS file (without extension name since the requested
427 // extension may not yet exist in the file) 428 // extension may not yet exist in the file)
inst/cta/src/GCTAPsfTable.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAPsfTable.cpp - CTA point spread function table class * 2 * GCTAPsfTable.cpp - CTA point spread function table class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2016 by Juergen Knoedlseder * 4 + * copyright (C) 2016-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -355,7 +355,7 @@ void GCTAPsfTable::write(GFitsBinTable&amp; table) const @@ -355,7 +355,7 @@ void GCTAPsfTable::write(GFitsBinTable&amp; table) const
355 * Loads the point spread function from a FITS file. 355 * Loads the point spread function from a FITS file.
356 * 356 *
357 * If no extension name is provided, the point spread function will be loaded 357 * If no extension name is provided, the point spread function will be loaded
358 - * from the "POINT SPREAD FUNCTION" extension. 358 + * from the `POINT SPREAD FUNCTION` extension.
359 ***************************************************************************/ 359 ***************************************************************************/
360 void GCTAPsfTable::load(const GFilename& filename) 360 void GCTAPsfTable::load(const GFilename& filename)
361 { 361 {
@@ -363,7 +363,8 @@ void GCTAPsfTable::load(const GFilename&amp; filename) @@ -363,7 +363,8 @@ void GCTAPsfTable::load(const GFilename&amp; filename)
363 GFits fits(filename); 363 GFits fits(filename);
364 364
365 // Get PSF table 365 // Get PSF table
366 - const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION")); 366 + const GFitsTable& table =
  367 + *fits.table(filename.extname(gammalib::extname_cta_psftable));
367 368
368 // Read PSF from table 369 // Read PSF from table
369 read(table); 370 read(table);
@@ -382,14 +383,14 @@ void GCTAPsfTable::load(const GFilename&amp; filename) @@ -382,14 +383,14 @@ void GCTAPsfTable::load(const GFilename&amp; filename)
382 * @brief Save point spread function table into FITS file 383 * @brief Save point spread function table into FITS file
383 * 384 *
384 * @param[in] filename FITS file name. 385 * @param[in] filename FITS file name.
385 - * @param[in] clobber Overwrite existing file? (default: false) 386 + * @param[in] clobber Overwrite existing file?
386 * 387 *
387 * Saves point spread function into a FITS file. If a file with the given 388 * Saves point spread function into a FITS file. If a file with the given
388 * @p filename does not yet exist it will be created, otherwise the method 389 * @p filename does not yet exist it will be created, otherwise the method
389 * opens the existing file. The method will create a (or replace an existing) 390 * opens the existing file. The method will create a (or replace an existing)
390 * point spread function extension. The extension name can be specified as 391 * point spread function extension. The extension name can be specified as
391 * part of the @p filename, or if no extension name is given, is assumed to 392 * part of the @p filename, or if no extension name is given, is assumed to
392 - * be "POINT SPREAD FUNCTION". 393 + * be `POINT SPREAD FUNCTION`.
393 * 394 *
394 * An existing file will only be modified if the @p clobber flag is set to 395 * An existing file will only be modified if the @p clobber flag is set to
395 * true. 396 * true.
@@ -397,7 +398,7 @@ void GCTAPsfTable::load(const GFilename&amp; filename) @@ -397,7 +398,7 @@ void GCTAPsfTable::load(const GFilename&amp; filename)
397 void GCTAPsfTable::save(const GFilename& filename, const bool& clobber) const 398 void GCTAPsfTable::save(const GFilename& filename, const bool& clobber) const
398 { 399 {
399 // Get extension name 400 // Get extension name
400 - std::string extname = filename.extname("POINT SPREAD FUNCTION"); 401 + std::string extname = filename.extname(gammalib::extname_cta_psftable);
401 402
402 // Open or create FITS file (without extension name since the requested 403 // Open or create FITS file (without extension name since the requested
403 // extension may not yet exist in the file) 404 // extension may not yet exist in the file)
inst/cta/src/GCTAResponseIrf.cpp
@@ -45,6 +45,7 @@ @@ -45,6 +45,7 @@
45 #include "GModelSpatialRadialShell.hpp" 45 #include "GModelSpatialRadialShell.hpp"
46 #include "GModelSpatialElliptical.hpp" 46 #include "GModelSpatialElliptical.hpp"
47 #include "GModelSpatialComposite.hpp" 47 #include "GModelSpatialComposite.hpp"
  48 +#include "GArf.hpp"
48 #include "GCTAObservation.hpp" 49 #include "GCTAObservation.hpp"
49 #include "GCTAResponseIrf.hpp" 50 #include "GCTAResponseIrf.hpp"
50 #include "GCTAResponse_helpers.hpp" 51 #include "GCTAResponse_helpers.hpp"
@@ -1088,11 +1089,11 @@ void GCTAResponseIrf::load(const std::string&amp; rspname) @@ -1088,11 +1089,11 @@ void GCTAResponseIrf::load(const std::string&amp; rspname)
1088 * 1089 *
1089 * If the file is a FITS file, the method will either use the extension name 1090 * If the file is a FITS file, the method will either use the extension name
1090 * specified with the filename, or if no extension name is given, search for 1091 * specified with the filename, or if no extension name is given, search for
1091 - * an "EFFECTIVE AREA" or "SPECRESP" extension in the file and open the  
1092 - * corresponding FITS table. If a column named "SPECRESP" is found in the 1092 + * an `EFFECTIVE AREA` or `SPECRESP` extension in the file and open the
  1093 + * corresponding FITS table. If a column named `SPECRESP` is found in the
1093 * table, a GCTAAeffArf object will be allocated. Otherwise, a GCTAAeff2D 1094 * table, a GCTAAeffArf object will be allocated. Otherwise, a GCTAAeff2D
1094 * object will be allocated. In both cases, the method will extract the 1095 * object will be allocated. In both cases, the method will extract the
1095 - * optional "LO_THRES" and "HI_THRES" save energy thresholds from the FITS 1096 + * optional `LO_THRES` and `HI_THRES` save energy thresholds from the FITS
1096 * file header. 1097 * file header.
1097 * 1098 *
1098 * If the file is not a FITS file, it will be interpreted as a 1099 * If the file is not a FITS file, it will be interpreted as a
@@ -1125,11 +1126,11 @@ void GCTAResponseIrf::load_aeff(const GFilename&amp; filename) @@ -1125,11 +1126,11 @@ void GCTAResponseIrf::load_aeff(const GFilename&amp; filename)
1125 extname = filename.extname(); 1126 extname = filename.extname();
1126 } 1127 }
1127 else { 1128 else {
1128 - if (fits.contains("EFFECTIVE AREA")) {  
1129 - extname = "EFFECTIVE AREA"; 1129 + if (fits.contains(gammalib::extname_cta_aeff2d)) {
  1130 + extname = gammalib::extname_cta_aeff2d;
1130 } 1131 }
1131 - else if (fits.contains("SPECRESP")) {  
1132 - extname = "SPECRESP"; 1132 + else if (fits.contains(gammalib::extname_arf)) {
  1133 + extname = gammalib::extname_arf;
1133 } 1134 }
1134 } 1135 }
1135 1136
@@ -1148,7 +1149,7 @@ void GCTAResponseIrf::load_aeff(const GFilename&amp; filename) @@ -1148,7 +1149,7 @@ void GCTAResponseIrf::load_aeff(const GFilename&amp; filename)
1148 } 1149 }
1149 1150
1150 // Check for specific table column 1151 // Check for specific table column
1151 - if (table.contains("SPECRESP")) { 1152 + if (table.contains(gammalib::extname_arf)) {
1152 1153
1153 // Close file 1154 // Close file
1154 fits.close(); 1155 fits.close();
@@ -1212,13 +1213,13 @@ void GCTAResponseIrf::load_aeff(const GFilename&amp; filename) @@ -1212,13 +1213,13 @@ void GCTAResponseIrf::load_aeff(const GFilename&amp; filename)
1212 * PSF 1213 * PSF
1213 * PSF_2D_TABLE 1214 * PSF_2D_TABLE
1214 * 1215 *
1215 - * in the file and open the corresponding FITS table. If columns named "GAMMA"  
1216 - * and "SIGMA" are found in the table, a GCTAPsfKing object will be allocated. 1216 + * in the file and open the corresponding FITS table. If columns named `GAMMA`
  1217 + * and `SIGMA` are found in the table, a GCTAPsfKing object will be allocated.
1217 * 1218 *
1218 - * If columns named "SCALE", "SIGMA_1", "AMPL_2", "SIGMA_2", "AMPL_3" and  
1219 - * "SIGMA_3" are found in the table, a GCTAPsf2D object will be allocated. 1219 + * If columns named `SCALE`, `SIGMA_1`, `AMPL_2`, `SIGMA_2`, `AMPL_3` and
  1220 + * `SIGMA_3` are found in the table, a GCTAPsf2D object will be allocated.
1220 * 1221 *
1221 - * If columns named "RAD_LO", "RAD_HI", and "RPSF" are found in the table, a 1222 + * If columns named `RAD_LO`, `RAD_HI`, and `RPSF` are found in the table, a
1222 * GCTAPsfTable object will be allocated. 1223 * GCTAPsfTable object will be allocated.
1223 * 1224 *
1224 * Otherwise, a CTAPsfVector object will be allocated. 1225 * Otherwise, a CTAPsfVector object will be allocated.
@@ -1359,7 +1360,7 @@ void GCTAResponseIrf::load_psf(const GFilename&amp; filename) @@ -1359,7 +1360,7 @@ void GCTAResponseIrf::load_psf(const GFilename&amp; filename)
1359 * 1360 *
1360 * If the file is a FITS file, the method will either use the extension name 1361 * If the file is a FITS file, the method will either use the extension name
1361 * specified with the filename, or if no extension name is given, search for 1362 * specified with the filename, or if no extension name is given, search for
1362 - * an "ENERGY DISPERSION" or "MATRIX" extension in the file and open the 1363 + * an `ENERGY DISPERSION` or `MATRIX` extension in the file and open the
1363 * corresponding FITS table. If columns named "MIGRA_LO" and "MIGRA_HI" are 1364 * corresponding FITS table. If columns named "MIGRA_LO" and "MIGRA_HI" are
1364 * found in the table, a GCTAEdisp2D object will be allocated. Otherwise, a 1365 * found in the table, a GCTAEdisp2D object will be allocated. Otherwise, a
1365 * GCTAEdispRmf object will be allocated. 1366 * GCTAEdispRmf object will be allocated.
@@ -1387,18 +1388,18 @@ void GCTAResponseIrf::load_edisp(const GFilename&amp; filename) @@ -1387,18 +1388,18 @@ void GCTAResponseIrf::load_edisp(const GFilename&amp; filename)
1387 GFits fits(filename); 1388 GFits fits(filename);
1388 1389
1389 // Get the extension name. If an extension name has been specified 1390 // Get the extension name. If an extension name has been specified
1390 - // then use this name, otherwise use either the "EFFECTIVE AREA"  
1391 - // or the "SPECRESP" extension. 1391 + // then use this name, otherwise use either the "ENERGY DISPERSION"
  1392 + // or the "MATRIX" extension.
1392 std::string extname = ""; 1393 std::string extname = "";
1393 if (filename.has_extname()) { 1394 if (filename.has_extname()) {
1394 extname = filename.extname(); 1395 extname = filename.extname();
1395 } 1396 }
1396 else { 1397 else {
1397 - if (fits.contains("ENERGY DISPERSION")) {  
1398 - extname = "ENERGY DISPERSION"; 1398 + if (fits.contains(gammalib::extname_cta_edisp2d)) {
  1399 + extname = gammalib::extname_cta_edisp2d;
1399 } 1400 }
1400 - else if (fits.contains("MATRIX")) {  
1401 - extname = "MATRIX"; 1401 + else if (fits.contains(gammalib::extname_rmf)) {
  1402 + extname = gammalib::extname_rmf;
1402 } 1403 }
1403 } 1404 }
1404 1405
inst/lat/include/GLATAeff.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATAeff.hpp - Fermi LAT effective area * 2 * GLATAeff.hpp - Fermi LAT effective area *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -40,6 +40,12 @@ class GEnergy; @@ -40,6 +40,12 @@ class GEnergy;
40 class GFits; 40 class GFits;
41 class GFitsTable; 41 class GFitsTable;
42 42
  43 +/* __ Constants __________________________________________________________ */
  44 +namespace gammalib {
  45 + const std::string extname_lat_aeff = "EFFECTIVE AREA";
  46 + const std::string extname_lat_efficiency = "EFFICIENCY_PARAMS";
  47 +}
  48 +
43 49
44 /***********************************************************************//** 50 /***********************************************************************//**
45 * @class GLATAeff 51 * @class GLATAeff
inst/lat/include/GLATEdisp.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATEdisp.hpp - Fermi LAT energy dispersion * 2 * GLATEdisp.hpp - Fermi LAT energy dispersion *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -38,6 +38,12 @@ class GFilename; @@ -38,6 +38,12 @@ class GFilename;
38 class GFits; 38 class GFits;
39 class GFitsTable; 39 class GFitsTable;
40 40
  41 +/* __ Constants __________________________________________________________ */
  42 +namespace gammalib {
  43 + const std::string extname_lat_edisp = "ENERGY DISPERSION";
  44 + const std::string extname_lat_edisp_scale = "EDISP_SCALING_PARAMS";
  45 +}
  46 +
41 47
42 /***********************************************************************//** 48 /***********************************************************************//**
43 * @class GLATEdisp 49 * @class GLATEdisp
inst/lat/include/GLATEventList.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATEventList.hpp - Fermi/LAT event list class * 2 * GLATEventList.hpp - Fermi/LAT event list class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2009-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2009-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -40,6 +40,11 @@ @@ -40,6 +40,11 @@
40 /* __ Forward declarations _______________________________________________ */ 40 /* __ Forward declarations _______________________________________________ */
41 class GFilename; 41 class GFilename;
42 42
  43 +/* __ Constants __________________________________________________________ */
  44 +namespace gammalib {
  45 + const std::string extname_lat_events = "EVENTS";
  46 +}
  47 +
43 48
44 /***********************************************************************//** 49 /***********************************************************************//**
45 * @class GLATEventList 50 * @class GLATEventList
inst/lat/include/GLATLtCube.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATLtCube.hpp - Fermi/LAT livetime cube class * 2 * GLATLtCube.hpp - Fermi/LAT livetime cube class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -40,6 +40,13 @@ class GEnergy; @@ -40,6 +40,13 @@ class GEnergy;
40 class GLATAeff; 40 class GLATAeff;
41 class GLATPsf; 41 class GLATPsf;
42 42
  43 +/* __ Constants __________________________________________________________ */
  44 +namespace gammalib {
  45 + const std::string extname_lat_exposure = "EXPOSURE";
  46 + const std::string extname_lat_wgtexposure = "WEIGHTED_EXPOSURE";
  47 + const std::string extname_lat_cthetabounds = "CTHETABOUNDS";
  48 +}
  49 +
43 50
44 /***********************************************************************//** 51 /***********************************************************************//**
45 * @class GLATLtCube 52 * @class GLATLtCube
inst/lat/src/GLATAeff.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATAeff.cpp - Fermi LAT effective area * 2 * GLATAeff.cpp - Fermi LAT effective area *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2008-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2008-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -309,10 +309,10 @@ void GLATAeff::save(const GFilename&amp; filename, const bool&amp; clobber) @@ -309,10 +309,10 @@ void GLATAeff::save(const GFilename&amp; filename, const bool&amp; clobber)
309 * @param[in] fits FITS file. 309 * @param[in] fits FITS file.
310 * 310 *
311 * Reads the effective area and efficiency parameter information form the 311 * Reads the effective area and efficiency parameter information form the
312 - * FITS file. The effective area is read from the extension EFFECTIVE AREA  
313 - * (or EFFECTIVE AREA_<evtype> for Pass 8), the efficiency parameter  
314 - * information from the extension EFFICIENCY_PARAMS (or  
315 - * EFFICIENCY_PARAMS_<evtype> for Pass 8). If the latter extension does not 312 + * FITS file. The effective area is read from the extension `EFFECTIVE AREA`
  313 + * (or `EFFECTIVE AREA_<evtype>` for Pass 8), the efficiency parameter
  314 + * information from the extension `EFFICIENCY_PARAMS` (or
  315 + * `EFFICIENCY_PARAMS_<evtype>` for Pass 8). If the latter extension does not
316 * exist, no efficiency parameters will be loaded. 316 * exist, no efficiency parameters will be loaded.
317 * 317 *
318 * @todo Implement reading of Phi-dependence information. 318 * @todo Implement reading of Phi-dependence information.
@@ -325,8 +325,8 @@ void GLATAeff::read(const GFits&amp; fits) @@ -325,8 +325,8 @@ void GLATAeff::read(const GFits&amp; fits)
325 m_evtype = evtype; 325 m_evtype = evtype;
326 326
327 // Set extension names 327 // Set extension names
328 - std::string effarea = "EFFECTIVE AREA";  
329 - std::string effparms = "EFFICIENCY_PARAMS"; 328 + std::string effarea = gammalib::extname_lat_aeff;
  329 + std::string effparms = gammalib::extname_lat_efficiency;
330 if (!fits.contains(effarea)) { 330 if (!fits.contains(effarea)) {
331 effarea += "_" + m_evtype; 331 effarea += "_" + m_evtype;
332 } 332 }
@@ -702,7 +702,7 @@ void GLATAeff::write_aeff(GFits&amp; file) const @@ -702,7 +702,7 @@ void GLATAeff::write_aeff(GFits&amp; file) const
702 GFitsBinTable* hdu_aeff = new GFitsBinTable; 702 GFitsBinTable* hdu_aeff = new GFitsBinTable;
703 703
704 // Set table attributes 704 // Set table attributes
705 - hdu_aeff->extname("EFFECTIVE AREA"); 705 + hdu_aeff->extname(gammalib::extname_lat_aeff);
706 706
707 // Write boundaries into table 707 // Write boundaries into table
708 m_aeff_bins.write(*hdu_aeff); 708 m_aeff_bins.write(*hdu_aeff);
inst/lat/src/GLATEdisp.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATEdisp.cpp - Fermi LAT energy dispersion * 2 * GLATEdisp.cpp - Fermi LAT energy dispersion *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2008-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2008-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -249,8 +249,8 @@ void GLATEdisp::read(const GFits&amp; fits) @@ -249,8 +249,8 @@ void GLATEdisp::read(const GFits&amp; fits)
249 m_evtype = evtype; 249 m_evtype = evtype;
250 250
251 // Set extension names 251 // Set extension names
252 - std::string engdisp = "ENERGY DISPERSION";  
253 - std::string escales = "EDISP_SCALING_PARAMS"; 252 + std::string engdisp = gammalib::extname_lat_edisp;
  253 + std::string escales = gammalib::extname_lat_edisp_scale;
254 if (!fits.contains(engdisp)) { 254 if (!fits.contains(engdisp)) {
255 engdisp += "_" + m_evtype; 255 engdisp += "_" + m_evtype;
256 } 256 }
@@ -436,7 +436,7 @@ void GLATEdisp::write_edisp(GFits&amp; file) const @@ -436,7 +436,7 @@ void GLATEdisp::write_edisp(GFits&amp; file) const
436 GFitsBinTable* hdu_edisp = new GFitsBinTable; 436 GFitsBinTable* hdu_edisp = new GFitsBinTable;
437 437
438 // Set table attributes 438 // Set table attributes
439 - hdu_edisp->extname("ENERGY DISPERSION"); 439 + hdu_edisp->extname(gammalib::extname_lat_edisp);
440 440
441 // Write boundaries into table 441 // Write boundaries into table
442 m_edisp_bins.write(*hdu_edisp); 442 m_edisp_bins.write(*hdu_edisp);
inst/lat/src/GLATEventCube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATEventCube.cpp - Fermi/LAT event cube class * 2 * GLATEventCube.cpp - Fermi/LAT event cube class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2009-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2009-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -354,8 +354,8 @@ void GLATEventCube::save(const GFilename&amp; filename, @@ -354,8 +354,8 @@ void GLATEventCube::save(const GFilename&amp; filename,
354 * @param[in] fits FITS file. 354 * @param[in] fits FITS file.
355 * 355 *
356 * It is assumed that the counts map resides in the primary extension of the 356 * It is assumed that the counts map resides in the primary extension of the
357 - * FITS file, the energy boundaries reside in the EBOUNDS extension and the  
358 - * Good Time Intervals reside in the GTI extension. The method clears the 357 + * FITS file, the energy boundaries reside in the `EBOUNDS` extension and the
  358 + * Good Time Intervals reside in the `GTI` extension. The method clears the
359 * object before loading, thus any events residing in the object before 359 * object before loading, thus any events residing in the object before
360 * loading will be lost. 360 * loading will be lost.
361 ***************************************************************************/ 361 ***************************************************************************/
@@ -366,8 +366,8 @@ void GLATEventCube::read(const GFits&amp; fits) @@ -366,8 +366,8 @@ void GLATEventCube::read(const GFits&amp; fits)
366 366
367 // Get HDUs 367 // Get HDUs
368 const GFitsImage& hdu_cntmap = *fits.image("Primary"); 368 const GFitsImage& hdu_cntmap = *fits.image("Primary");
369 - const GFitsTable& hdu_ebounds = *fits.table("EBOUNDS");  
370 - const GFitsTable& hdu_gti = *fits.table("GTI"); 369 + const GFitsTable& hdu_ebounds = *fits.table(gammalib::extname_ebounds);
  370 + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti);
371 371
372 // Load counts map 372 // Load counts map
373 read_cntmap(hdu_cntmap); 373 read_cntmap(hdu_cntmap);
inst/lat/src/GLATEventList.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATEventList.cpp - Fermi/LAT event list class * 2 * GLATEventList.cpp - Fermi/LAT event list class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2009-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2009-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -299,7 +299,7 @@ void GLATEventList::read(const GFits&amp; file) @@ -299,7 +299,7 @@ void GLATEventList::read(const GFits&amp; file)
299 clear(); 299 clear();
300 300
301 // Get HDU (pointer is always valid) 301 // Get HDU (pointer is always valid)
302 - const GFitsTable& hdu = *file.table("EVENTS"); 302 + const GFitsTable& hdu = *file.table(gammalib::extname_lat_events);
303 303
304 // Read event data 304 // Read event data
305 read_events(hdu); 305 read_events(hdu);
@@ -309,8 +309,8 @@ void GLATEventList::read(const GFits&amp; file) @@ -309,8 +309,8 @@ void GLATEventList::read(const GFits&amp; file)
309 309
310 // If we have a GTI extension, then read Good Time Intervals from that 310 // If we have a GTI extension, then read Good Time Intervals from that
311 // extension 311 // extension
312 - if (file.contains("GTI")) {  
313 - const GFitsTable& gti = *file.table("GTI"); 312 + if (file.contains(gammalib::extname_gti)) {
  313 + const GFitsTable& gti = *file.table(gammalib::extname_gti);
314 m_gti.read(gti); 314 m_gti.read(gti);
315 } 315 }
316 316
inst/lat/src/GLATLtCube.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GLATLtCube.cpp - Fermi/LAT livetime cube class * 2 * GLATLtCube.cpp - Fermi/LAT livetime cube class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -399,10 +399,10 @@ void GLATLtCube::load(const GFilename&amp; filename) @@ -399,10 +399,10 @@ void GLATLtCube::load(const GFilename&amp; filename)
399 GFits fits(filename); 399 GFits fits(filename);
400 400
401 // Get HDUs 401 // Get HDUs
402 - const GFitsTable& hdu_exposure = *fits.table("EXPOSURE");  
403 - const GFitsTable& hdu_weighted_exposure = *fits.table("WEIGHTED_EXPOSURE");  
404 - //const GFitsTable& hdu_cthetabounds = *fits.table("CTHETABOUNDS");  
405 - const GFitsTable& hdu_gti = *fits.table("GTI"); 402 + const GFitsTable& hdu_exposure = *fits.table(gammalib::extname_lat_exposure);
  403 + const GFitsTable& hdu_weighted_exposure = *fits.table(gammalib::extname_lat_wgtexposure);
  404 + //const GFitsTable& hdu_cthetabounds = *fits.table(gammalib::extname_lat_cthetabounds);
  405 + const GFitsTable& hdu_gti = *fits.table(gammalib::extname_gti);
406 406
407 // Load exposure 407 // Load exposure
408 m_exposure.read(hdu_exposure); 408 m_exposure.read(hdu_exposure);
pyext/GEbounds.i
@@ -70,7 +70,7 @@ public: @@ -70,7 +70,7 @@ public:
70 const std::string& unit = "keV") const; 70 const std::string& unit = "keV") const;
71 void read(const GFitsTable& table); 71 void read(const GFitsTable& table);
72 void write(GFits& file, 72 void write(GFits& file,
73 - const std::string& extname = "EBOUNDS", 73 + const std::string& extname = gammalib::extname_ebounds,
74 const std::string& unit = "keV") const; 74 const std::string& unit = "keV") const;
75 void read(const GXmlElement& xml); 75 void read(const GXmlElement& xml);
76 void write(GXmlElement& xml) const; 76 void write(GXmlElement& xml) const;
pyext/GEnergies.i
@@ -70,7 +70,7 @@ public: @@ -70,7 +70,7 @@ public:
70 const bool& clobber = false) const; 70 const bool& clobber = false) const;
71 void read(const GFitsTable& table); 71 void read(const GFitsTable& table);
72 void write(GFits& file, 72 void write(GFits& file,
73 - const std::string& extname = "ENERGIES") const; 73 + const std::string& extname = gammalib::extname_energies) const;
74 }; 74 };
75 75
76 76
pyext/GGti.i
1 /*************************************************************************** 1 /***************************************************************************
2 * GGti.i - Good time interval class * 2 * GGti.i - Good time interval class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -66,7 +66,7 @@ public: @@ -66,7 +66,7 @@ public:
66 const bool& clobber = false) const; 66 const bool& clobber = false) const;
67 void read(const GFitsTable& table); 67 void read(const GFitsTable& table);
68 void write(GFits& fits, 68 void write(GFits& fits,
69 - const std::string& extname = "GTI") const; 69 + const std::string& extname = gammalib::extname_gti) const;
70 void read(const GXmlElement& xml); 70 void read(const GXmlElement& xml);
71 void write(GXmlElement& xml) const; 71 void write(GXmlElement& xml) const;
72 const GTime& tstart(void) const; 72 const GTime& tstart(void) const;
src/obs/GEbounds.cpp
@@ -642,7 +642,7 @@ void GEbounds::set_log(const int&amp; num, const GEnergy&amp; emin, const GEnergy&amp; emax) @@ -642,7 +642,7 @@ void GEbounds::set_log(const int&amp; num, const GEnergy&amp; emin, const GEnergy&amp; emax)
642 * Loads the energy boundaries from a FITS file. 642 * Loads the energy boundaries from a FITS file.
643 * 643 *
644 * If no extension name is provided, the energy boundaries are loaded from 644 * If no extension name is provided, the energy boundaries are loaded from
645 - * the "EBOUNDS" extension. 645 + * the `EBOUNDS` extension.
646 ***************************************************************************/ 646 ***************************************************************************/
647 void GEbounds::load(const GFilename& filename) 647 void GEbounds::load(const GFilename& filename)
648 { 648 {
@@ -650,7 +650,7 @@ void GEbounds::load(const GFilename&amp; filename) @@ -650,7 +650,7 @@ void GEbounds::load(const GFilename&amp; filename)
650 GFits fits(filename); 650 GFits fits(filename);
651 651
652 // Get energy boundary table 652 // Get energy boundary table
653 - const GFitsTable& table = *fits.table(filename.extname("EBOUNDS")); 653 + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_ebounds));
654 654
655 // Read energy boundaries from table 655 // Read energy boundaries from table
656 read(table); 656 read(table);
@@ -673,7 +673,7 @@ void GEbounds::load(const GFilename&amp; filename) @@ -673,7 +673,7 @@ void GEbounds::load(const GFilename&amp; filename)
673 * Saves energy boundaries into a FITS file. If a file with the given 673 * Saves energy boundaries into a FITS file. If a file with the given
674 * @p filename does not yet exist it will be created, otherwise the method 674 * @p filename does not yet exist it will be created, otherwise the method
675 * opens the existing file. Energy boundaries can only be appended to an 675 * opens the existing file. Energy boundaries can only be appended to an
676 - * existing file if the @p clobber flag is set to `true` (otherwise an 676 + * existing file if the @p clobber flag is set to "true" (otherwise an
677 * exception is thrown). 677 * exception is thrown).
678 * 678 *
679 * The method will append a binary FITS table containing the energy 679 * The method will append a binary FITS table containing the energy
@@ -683,7 +683,7 @@ void GEbounds::load(const GFilename&amp; filename) @@ -683,7 +683,7 @@ void GEbounds::load(const GFilename&amp; filename)
683 * myfile.fits[ENERGY BOUNDARIES] 683 * myfile.fits[ENERGY BOUNDARIES]
684 * 684 *
685 * will save the energy boundaries in the `ENERGY BOUNDARIES` extension of 685 * will save the energy boundaries in the `ENERGY BOUNDARIES` extension of
686 - * the `myfile.fits` file. If the extension exists already in the file it 686 + * the "myfile.fits" file. If the extension exists already in the file it
687 * will be replaced, otherwise a new extension will be created. If no 687 * will be replaced, otherwise a new extension will be created. If no
688 * extension name is provided, the method will use `EBOUNDS` as the default 688 * extension name is provided, the method will use `EBOUNDS` as the default
689 * extension name for energy boundaries. 689 * extension name for energy boundaries.
@@ -697,7 +697,7 @@ void GEbounds::save(const GFilename&amp; filename, @@ -697,7 +697,7 @@ void GEbounds::save(const GFilename&amp; filename,
697 GFits fits(filename.url(), true); 697 GFits fits(filename.url(), true);
698 698
699 // Write energy boundaries to FITS file 699 // Write energy boundaries to FITS file
700 - write(fits, filename.extname("EBOUNDS"), unit); 700 + write(fits, filename.extname(gammalib::extname_ebounds), unit);
701 701
702 // Save to file 702 // Save to file
703 fits.save(clobber); 703 fits.save(clobber);
@@ -762,8 +762,8 @@ void GEbounds::read(const GFitsTable&amp; table) @@ -762,8 +762,8 @@ void GEbounds::read(const GFitsTable&amp; table)
762 * @brief Write energy boundaries into FITS object 762 * @brief Write energy boundaries into FITS object
763 * 763 *
764 * @param[in] fits FITS file. 764 * @param[in] fits FITS file.
765 - * @param[in] extname Energy boundary extension name (defaults to "EBOUNDS")  
766 - * @param[in] unit Energy units (defaults to "keV") 765 + * @param[in] extname Energy boundary extension name.
  766 + * @param[in] unit Energy units.
767 * 767 *
768 * Writes the energy boundaries into a FITS object. The @p unit parameter 768 * Writes the energy boundaries into a FITS object. The @p unit parameter
769 * specifies in which unit the energies are written. By default, the energy 769 * specifies in which unit the energies are written. By default, the energy
@@ -801,7 +801,7 @@ void GEbounds::write(GFits&amp; fits, @@ -801,7 +801,7 @@ void GEbounds::write(GFits&amp; fits,
801 fits.remove(extname); 801 fits.remove(extname);
802 } 802 }
803 803
804 - // Append EBOUNDS table to FITS file 804 + // Append energy boundary table to FITS file
805 fits.append(table); 805 fits.append(table);
806 806
807 // Return 807 // Return
src/obs/GEnergies.cpp
@@ -610,7 +610,7 @@ void GEnergies::set_log(const int&amp; num, @@ -610,7 +610,7 @@ void GEnergies::set_log(const int&amp; num,
610 * Loads the energies from FITS file. 610 * Loads the energies from FITS file.
611 * 611 *
612 * If no extension name is provided, the energies are loaded from the 612 * If no extension name is provided, the energies are loaded from the
613 - * "ENERGIES" extension. 613 + * `ENERGIES` extension.
614 ***************************************************************************/ 614 ***************************************************************************/
615 void GEnergies::load(const GFilename& filename) 615 void GEnergies::load(const GFilename& filename)
616 { 616 {
@@ -618,7 +618,7 @@ void GEnergies::load(const GFilename&amp; filename) @@ -618,7 +618,7 @@ void GEnergies::load(const GFilename&amp; filename)
618 GFits fits(filename); 618 GFits fits(filename);
619 619
620 // Get energies table 620 // Get energies table
621 - const GFitsTable& table = *fits.table(filename.extname("ENERGIES")); 621 + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_energies));
622 622
623 // Read energies from table 623 // Read energies from table
624 read(table); 624 read(table);
@@ -661,7 +661,7 @@ void GEnergies::save(const GFilename&amp; filename, const bool&amp; clobber) const @@ -661,7 +661,7 @@ void GEnergies::save(const GFilename&amp; filename, const bool&amp; clobber) const
661 GFits fits(filename.url(), true); 661 GFits fits(filename.url(), true);
662 662
663 // Write energies to FITS file 663 // Write energies to FITS file
664 - write(fits, filename.extname("ENERGIES")); 664 + write(fits, filename.extname(gammalib::extname_energies));
665 665
666 // Save to file 666 // Save to file
667 fits.save(clobber); 667 fits.save(clobber);
@@ -718,7 +718,7 @@ void GEnergies::read(const GFitsTable&amp; table) @@ -718,7 +718,7 @@ void GEnergies::read(const GFitsTable&amp; table)
718 * @brief Write energies into FITS object 718 * @brief Write energies into FITS object
719 * 719 *
720 * @param[in] fits FITS file. 720 * @param[in] fits FITS file.
721 - * @param[in] extname Energy extension name (default: "ENERGIES") 721 + * @param[in] extname Energy extension name.
722 * 722 *
723 * Writes energies into FITS object. 723 * Writes energies into FITS object.
724 ***************************************************************************/ 724 ***************************************************************************/
@@ -747,7 +747,7 @@ void GEnergies::write(GFits&amp; fits, const std::string&amp; extname) const @@ -747,7 +747,7 @@ void GEnergies::write(GFits&amp; fits, const std::string&amp; extname) const
747 fits.remove(extname); 747 fits.remove(extname);
748 } 748 }
749 749
750 - // Append ENERGIES table to FITS file 750 + // Append energies table to FITS file
751 fits.append(table); 751 fits.append(table);
752 752
753 // Return 753 // Return
src/obs/GGti.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GGti.cpp - Good time interval class * 2 * GGti.cpp - Good time interval class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2008-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2008-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -580,7 +580,7 @@ void GGti::extend(const GGti&amp; gti) @@ -580,7 +580,7 @@ void GGti::extend(const GGti&amp; gti)
580 * Loads the Good Time Intervals from FITS file. 580 * Loads the Good Time Intervals from FITS file.
581 * 581 *
582 * If no extension name is provided in the @p filename, the Good Time 582 * If no extension name is provided in the @p filename, the Good Time
583 - * Intervals are loaded from the "GTI" extension. 583 + * Intervals are loaded from the `GTI` extension.
584 ***************************************************************************/ 584 ***************************************************************************/
585 void GGti::load(const GFilename& filename) 585 void GGti::load(const GFilename& filename)
586 { 586 {
@@ -588,7 +588,7 @@ void GGti::load(const GFilename&amp; filename) @@ -588,7 +588,7 @@ void GGti::load(const GFilename&amp; filename)
588 GFits fits(filename); 588 GFits fits(filename);
589 589
590 // Get GTI table 590 // Get GTI table
591 - const GFitsTable& table = *fits.table(filename.extname("GTI")); 591 + const GFitsTable& table = *fits.table(filename.extname(gammalib::extname_gti));
592 592
593 // Read GTI from table 593 // Read GTI from table
594 read(table); 594 read(table);
@@ -632,7 +632,7 @@ void GGti::save(const GFilename&amp; filename, const bool&amp; clobber) const @@ -632,7 +632,7 @@ void GGti::save(const GFilename&amp; filename, const bool&amp; clobber) const
632 GFits fits(filename.url(), true); 632 GFits fits(filename.url(), true);
633 633
634 // Write GTI to FITS object 634 // Write GTI to FITS object
635 - write(fits, filename.extname("GTI")); 635 + write(fits, filename.extname(gammalib::extname_gti));
636 636
637 // Save to file 637 // Save to file
638 fits.save(clobber); 638 fits.save(clobber);
@@ -685,14 +685,14 @@ void GGti::read(const GFitsTable&amp; table) @@ -685,14 +685,14 @@ void GGti::read(const GFitsTable&amp; table)
685 * @brief Write Good Time Intervals and time reference into FITS object 685 * @brief Write Good Time Intervals and time reference into FITS object
686 * 686 *
687 * @param[in] fits FITS file. 687 * @param[in] fits FITS file.
688 - * @param[in] extname GTI extension name (defaults to "GTI") 688 + * @param[in] extname GTI extension name.
689 * 689 *
690 * Writes Good Time Intervals and time reference into a FITS object. If an 690 * Writes Good Time Intervals and time reference into a FITS object. If an
691 * extension with the same name does already exist in the FITS object, the 691 * extension with the same name does already exist in the FITS object, the
692 * values in that extension will be replaced. 692 * values in that extension will be replaced.
693 * 693 *
694 * The start and stop tims of the Good Time Intervals will be written into 694 * The start and stop tims of the Good Time Intervals will be written into
695 - * double precision columns named "START" and "STOP". 695 + * double precision columns named `START` and `STOP`.
696 ***************************************************************************/ 696 ***************************************************************************/
697 void GGti::write(GFits& fits, const std::string& extname) const 697 void GGti::write(GFits& fits, const std::string& extname) const
698 { 698 {
src/xspec/GArf.cpp
@@ -399,7 +399,7 @@ void GArf::load(const GFilename&amp; filename) @@ -399,7 +399,7 @@ void GArf::load(const GFilename&amp; filename)
399 GFits fits(filename.url()); 399 GFits fits(filename.url());
400 400
401 // Get ARF table 401 // Get ARF table
402 - const GFitsTable& table = *fits.table("SPECRESP"); 402 + const GFitsTable& table = *fits.table(gammalib::extname_arf);
403 403
404 // Read ARF data 404 // Read ARF data
405 read(table); 405 read(table);
@@ -554,8 +554,8 @@ void GArf::write(GFits&amp; fits) const @@ -554,8 +554,8 @@ void GArf::write(GFits&amp; fits) const
554 { 554 {
555 // If the FITS object contains already an extension with the same 555 // If the FITS object contains already an extension with the same
556 // name then remove now this extension 556 // name then remove now this extension
557 - if (fits.contains("SPECRESP")) {  
558 - fits.remove("SPECRESP"); 557 + if (fits.contains(gammalib::extname_arf)) {
  558 + fits.remove(gammalib::extname_arf);
559 } 559 }
560 560
561 // Set column length 561 // Set column length
@@ -585,7 +585,7 @@ void GArf::write(GFits&amp; fits) const @@ -585,7 +585,7 @@ void GArf::write(GFits&amp; fits) const
585 specresp.unit("cm^2"); 585 specresp.unit("cm^2");
586 586
587 // Set table attributes 587 // Set table attributes
588 - hdu.extname("SPECRESP"); 588 + hdu.extname(gammalib::extname_arf);
589 589
590 // Append columns to table 590 // Append columns to table
591 hdu.append(energy_lo); 591 hdu.append(energy_lo);
src/xspec/GPha.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GPha.cpp - XSPEC Pulse Height Analyzer class * 2 * GPha.cpp - XSPEC Pulse Height Analyzer class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2013-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -344,21 +344,21 @@ void GPha::load(const GFilename&amp; filename) @@ -344,21 +344,21 @@ void GPha::load(const GFilename&amp; filename)
344 GFits fits(filename.url()); 344 GFits fits(filename.url());
345 345
346 // Get PHA table 346 // Get PHA table
347 - const GFitsTable& pha = *fits.table("SPECTRUM"); 347 + const GFitsTable& pha = *fits.table(gammalib::extname_pha);
348 348
349 // Read PHA data 349 // Read PHA data
350 read(pha); 350 read(pha);
351 351
352 - // Optionally read EBOUNDS data  
353 - if (fits.contains("EBOUNDS")) { 352 + // Optionally read energy boundaries
  353 + if (fits.contains(gammalib::extname_ebounds)) {
354 354
355 - // Get EBOUNDS table  
356 - const GFitsTable& ebounds = *fits.table("EBOUNDS"); 355 + // Get energy boundary table
  356 + const GFitsTable& ebounds = *fits.table(gammalib::extname_ebounds);
357 357
358 - // Read EBOUNDS data 358 + // Read energy boundaries
359 m_ebounds.read(ebounds); 359 m_ebounds.read(ebounds);
360 360
361 - } // endif: has EBOUNDS table 361 + } // endif: had energy boundary table
362 362
363 // Close FITS file 363 // Close FITS file
364 fits.close(); 364 fits.close();
@@ -484,11 +484,11 @@ void GPha::read(const GFitsTable&amp; table) @@ -484,11 +484,11 @@ void GPha::read(const GFitsTable&amp; table)
484 void GPha::write(GFits& fits) const 484 void GPha::write(GFits& fits) const
485 { 485 {
486 // Remove extensions if they exist already 486 // Remove extensions if they exist already
487 - if (fits.contains("EBOUNDS")) {  
488 - fits.remove("EBOUNDS"); 487 + if (fits.contains(gammalib::extname_ebounds)) {
  488 + fits.remove(gammalib::extname_ebounds);
489 } 489 }
490 - if (fits.contains("SPECTRUM")) {  
491 - fits.remove("SPECTRUM"); 490 + if (fits.contains(gammalib::extname_pha)) {
  491 + fits.remove(gammalib::extname_pha);
492 } 492 }
493 493
494 // Set column length 494 // Set column length
@@ -517,7 +517,7 @@ void GPha::write(GFits&amp; fits) const @@ -517,7 +517,7 @@ void GPha::write(GFits&amp; fits) const
517 } 517 }
518 518
519 // Set table attributes 519 // Set table attributes
520 - hdu.extname("SPECTRUM"); 520 + hdu.extname(gammalib::extname_pha);
521 521
522 // Append columns to table 522 // Append columns to table
523 hdu.append(col_chan); 523 hdu.append(col_chan);
src/xspec/GRmf.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GRmf.cpp - XSPEC Redistribution Matrix File class * 2 * GRmf.cpp - XSPEC Redistribution Matrix File class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2013-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2013-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -387,7 +387,7 @@ void GRmf::load(const GFilename&amp; filename) @@ -387,7 +387,7 @@ void GRmf::load(const GFilename&amp; filename)
387 m_ebds_measured.load(filename.url()); 387 m_ebds_measured.load(filename.url());
388 388
389 // Get RMF table 389 // Get RMF table
390 - const GFitsTable& table = *fits.table("MATRIX"); 390 + const GFitsTable& table = *fits.table(gammalib::extname_rmf);
391 391
392 // Read RMF data 392 // Read RMF data
393 read(table); 393 read(table);
@@ -547,11 +547,11 @@ void GRmf::read(const GFitsTable&amp; table) @@ -547,11 +547,11 @@ void GRmf::read(const GFitsTable&amp; table)
547 void GRmf::write(GFits& fits, const std::string& unit) const 547 void GRmf::write(GFits& fits, const std::string& unit) const
548 { 548 {
549 // Remove extensions if they exist already 549 // Remove extensions if they exist already
550 - if (fits.contains("MATRIX")) {  
551 - fits.remove("MATRIX"); 550 + if (fits.contains(gammalib::extname_rmf)) {
  551 + fits.remove(gammalib::extname_rmf);
552 } 552 }
553 - if (fits.contains("EBOUNDS")) {  
554 - fits.remove("EBOUNDS"); 553 + if (fits.contains(gammalib::extname_ebounds)) {
  554 + fits.remove(gammalib::extname_ebounds);
555 } 555 }
556 556
557 // Set table length 557 // Set table length
@@ -648,7 +648,7 @@ void GRmf::write(GFits&amp; fits, const std::string&amp; unit) const @@ -648,7 +648,7 @@ void GRmf::write(GFits&amp; fits, const std::string&amp; unit) const
648 energy_hi.unit(unit); 648 energy_hi.unit(unit);
649 649
650 // Set table attributes 650 // Set table attributes
651 - hdu.extname("MATRIX"); 651 + hdu.extname(gammalib::extname_rmf);
652 652
653 // Append columns to table 653 // Append columns to table
654 hdu.append(energy_lo); 654 hdu.append(energy_lo);