Commit fae992c15c989b107d21553d13cf0e13b749fd40

Authored by Jürgen Knödlseder
1 parent d26f54c0

Use GFilename of filename arguments.

Showing 83 changed files with 870 additions and 871 deletions
... ... @@ -54,6 +54,14 @@ of std::string:
54 54 - GSkyRegions
55 55 - GTestSuites
56 56 - GXml
  57 +- GCTAAeff, GCTAAeff2D, GCTAAeffArf, GCTAAeffPerfTable
  58 +- GCTABackground, GCTABackground3D, GCTABackgroundPerfTable
  59 +- GCTACubeBackground, GCTACubeExposure, GCTACubePsf
  60 +- GCTAEdisp, GCTAEdisp2D, GCTAEdispPerfTable, GCTAEdispRmf
  61 +- GCTAObservation
  62 +- GCTAOnOffObservations
  63 +- GCTAPointing
  64 +- GCTAPsf, GCTAPsf2D, GCTAPsfKing, GCTAPsfPerfTable, GCTAPsfVector
57 65  
58 66 The return value has been changed for the following methods:
59 67 - GFits::filename() returns now GFilename instead of std::string
... ...
inst/cta/include/GCTAAeff.hpp
1 1 /***************************************************************************
2 2 * GCTAAeff.hpp - CTA effective area base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -32,6 +32,9 @@
32 32 #include "GBase.hpp"
33 33 #include "GFits.hpp"
34 34  
  35 +/* __ Forward declarations _______________________________________________ */
  36 +class GFilename;
  37 +
35 38  
36 39 /***********************************************************************//**
37 40 * @class GCTAAeff
... ... @@ -70,8 +73,8 @@ public:
70 73 virtual void clear(void) = 0;
71 74 virtual GCTAAeff* clone(void) const = 0;
72 75 virtual std::string classname(void) const = 0;
73   - virtual void load(const std::string& filename) = 0;
74   - virtual std::string filename(void) const = 0;
  76 + virtual void load(const GFilename& filename) = 0;
  77 + virtual GFilename filename(void) const = 0;
75 78 virtual double max(const double& logE,
76 79 const double& zenith,
77 80 const double& azimuth,
... ...
inst/cta/include/GCTAAeff2D.hpp
1 1 /***************************************************************************
2 2 * GCTAAeff2D.hpp - CTA 2D effective area class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -29,10 +29,14 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include "GFits.hpp"
  32 +#include "GFilename.hpp"
33 33 #include "GCTAAeff.hpp"
34 34 #include "GCTAResponseTable.hpp"
35 35  
  36 +/* __ Forward declarations _______________________________________________ */
  37 +class GFitsTable;
  38 +class GFitsBinTable;
  39 +
36 40  
37 41 /***********************************************************************//**
38 42 * @class GCTAAeff2D
... ... @@ -47,7 +51,7 @@ class GCTAAeff2D : public GCTAAeff {
47 51 public:
48 52 // Constructors and destructors
49 53 GCTAAeff2D(void);
50   - explicit GCTAAeff2D(const std::string& filename);
  54 + explicit GCTAAeff2D(const GFilename& filename);
51 55 GCTAAeff2D(const GCTAAeff2D& cta);
52 56 virtual ~GCTAAeff2D(void);
53 57  
... ... @@ -64,8 +68,8 @@ public:
64 68 void clear(void);
65 69 GCTAAeff2D* clone(void) const;
66 70 std::string classname(void) const;
67   - void load(const std::string& filename);
68   - std::string filename(void) const;
  71 + void load(const GFilename& filename);
  72 + GFilename filename(void) const;
69 73 double max(const double& logE,
70 74 const double& zenith,
71 75 const double& azimuth,
... ... @@ -77,8 +81,8 @@ public:
77 81 void table(const GCTAResponseTable& table);
78 82 void read(const GFitsTable& table);
79 83 void write(GFitsBinTable& table) const;
80   - void save(const std::string& filename,
81   - const bool& clobber = false) const;
  84 + void save(const GFilename& filename,
  85 + const bool& clobber = false) const;
82 86  
83 87 private:
84 88 // Methods
... ... @@ -87,7 +91,7 @@ private:
87 91 void free_members(void);
88 92  
89 93 // Members
90   - std::string m_filename; //!< Name of Aeff response file
  94 + GFilename m_filename; //!< Name of Aeff response file
91 95 GCTAResponseTable m_aeff; //!< Aeff response table
92 96 int m_inx_energy; //!< Energy index
93 97 int m_inx_theta; //!< Theta index
... ... @@ -114,7 +118,7 @@ std::string GCTAAeff2D::classname(void) const
114 118 * @return Returns filename from which effective area was loaded
115 119 ***************************************************************************/
116 120 inline
117   -std::string GCTAAeff2D::filename(void) const
  121 +GFilename GCTAAeff2D::filename(void) const
118 122 {
119 123 // Return filename
120 124 return m_filename;
... ...
inst/cta/include/GCTAAeffArf.hpp
1 1 /***************************************************************************
2 2 * GCTAAeffArf.hpp - CTA ARF effective area class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,12 +30,12 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include <vector>
33   -#include "GFits.hpp"
34 33 #include "GNodeArray.hpp"
35   -#include "GFitsTable.hpp"
  34 +#include "GFilename.hpp"
36 35 #include "GCTAAeff.hpp"
37 36  
38 37 /* __ Forward declarations _______________________________________________ */
  38 +class GFitsTable;
39 39 class GCTAResponseIrf;
40 40  
41 41  
... ... @@ -52,7 +52,7 @@ class GCTAAeffArf : public GCTAAeff {
52 52 public:
53 53 // Constructors and destructors
54 54 GCTAAeffArf(void);
55   - explicit GCTAAeffArf(const std::string& filename);
  55 + explicit GCTAAeffArf(const GFilename& filename);
56 56 GCTAAeffArf(const GCTAAeffArf& cta);
57 57 virtual ~GCTAAeffArf(void);
58 58  
... ... @@ -69,8 +69,8 @@ public:
69 69 void clear(void);
70 70 GCTAAeffArf* clone(void) const;
71 71 std::string classname(void) const;
72   - void load(const std::string& filename);
73   - std::string filename(void) const;
  72 + void load(const GFilename& filename);
  73 + GFilename filename(void) const;
74 74 double max(const double& logE,
75 75 const double& zenith,
76 76 const double& azimuth,
... ... @@ -95,7 +95,7 @@ private:
95 95 void free_members(void);
96 96  
97 97 // Members
98   - std::string m_filename; //!< Name of Aeff response file
  98 + GFilename m_filename; //!< Name of Aeff response file
99 99 GNodeArray m_logE; //!< log(E) nodes for Aeff interpolation
100 100 std::vector<double> m_aeff; //!< Effective area in cm2
101 101 double m_sigma; //!< Sigma for offset angle computation (0=none)
... ... @@ -122,7 +122,7 @@ std::string GCTAAeffArf::classname(void) const
122 122 * @return Returns filename from which effective area was loaded.
123 123 ***************************************************************************/
124 124 inline
125   -std::string GCTAAeffArf::filename(void) const
  125 +GFilename GCTAAeffArf::filename(void) const
126 126 {
127 127 return m_filename;
128 128 }
... ...
inst/cta/include/GCTAAeffPerfTable.hpp
1 1 /***************************************************************************
2 2 * GCTAAeffPerfTable.hpp - CTA performance table effective area class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -49,7 +49,7 @@ class GCTAAeffPerfTable : public GCTAAeff {
49 49 public:
50 50 // Constructors and destructors
51 51 GCTAAeffPerfTable(void);
52   - explicit GCTAAeffPerfTable(const std::string& filename);
  52 + explicit GCTAAeffPerfTable(const GFilename& filename);
53 53 GCTAAeffPerfTable(const GCTAAeffPerfTable& cta);
54 54 virtual ~GCTAAeffPerfTable(void);
55 55  
... ... @@ -66,8 +66,8 @@ public:
66 66 void clear(void);
67 67 GCTAAeffPerfTable* clone(void) const;
68 68 std::string classname(void) const;
69   - void load(const std::string& filename);
70   - std::string filename(void) const;
  69 + void load(const GFilename& filename);
  70 + GFilename filename(void) const;
71 71 double max(const double& logE,
72 72 const double& zenith,
73 73 const double& azimuth,
... ... @@ -86,7 +86,7 @@ private:
86 86 void free_members(void);
87 87  
88 88 // Members
89   - std::string m_filename; //!< Name of Aeff response file
  89 + GFilename m_filename; //!< Name of Aeff response file
90 90 GNodeArray m_logE; //!< log(E) nodes for Aeff interpolation
91 91 std::vector<double> m_aeff; //!< Effective area in cm2
92 92 double m_sigma; //!< Sigma for offset angle computation (0=none)
... ... @@ -111,7 +111,7 @@ std::string GCTAAeffPerfTable::classname(void) const
111 111 * @return Returns filename from which effective area was loaded.
112 112 ***************************************************************************/
113 113 inline
114   -std::string GCTAAeffPerfTable::filename(void) const
  114 +GFilename GCTAAeffPerfTable::filename(void) const
115 115 {
116 116 return m_filename;
117 117 }
... ...
inst/cta/include/GCTABackground.hpp
1 1 /***************************************************************************
2 2 * GCTABackground.hpp - CTA background model base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,6 +30,7 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include "GBase.hpp"
  33 +#include "GFilename.hpp"
33 34 #include "GModelSpectralNodes.hpp"
34 35 #include "GCTAInstDir.hpp"
35 36  
... ... @@ -61,8 +62,8 @@ public:
61 62 virtual void clear(void) = 0;
62 63 virtual GCTABackground* clone(void) const = 0;
63 64 virtual std::string classname(void) const = 0;
64   - virtual void load(const std::string& filename) = 0;
65   - virtual std::string filename(void) const = 0;
  65 + virtual void load(const GFilename& filename) = 0;
  66 + virtual GFilename filename(void) const = 0;
66 67 virtual GCTAInstDir mc(const GEnergy& energy,
67 68 const GTime& time,
68 69 GRan& ran) const = 0;
... ...
inst/cta/include/GCTABackground3D.hpp
... ... @@ -29,6 +29,7 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
  32 +#include "GFilename.hpp"
32 33 #include "GCTABackground.hpp"
33 34 #include "GCTAResponseTable.hpp"
34 35  
... ... @@ -47,7 +48,7 @@ class GCTABackground3D : public GCTABackground {
47 48 public:
48 49 // Constructors and destructors
49 50 GCTABackground3D(void);
50   - explicit GCTABackground3D(const std::string& filename);
  51 + explicit GCTABackground3D(const GFilename& filename);
51 52 GCTABackground3D(const GCTABackground3D& bgd);
52 53 virtual ~GCTABackground3D(void);
53 54  
... ... @@ -63,8 +64,8 @@ public:
63 64 void clear(void);
64 65 GCTABackground3D* clone(void) const;
65 66 std::string classname(void) const;
66   - void load(const std::string& filename);
67   - std::string filename(void) const;
  67 + void load(const GFilename& filename);
  68 + GFilename filename(void) const;
68 69 GCTAInstDir mc(const GEnergy& energy,
69 70 const GTime& time,
70 71 GRan& ran) const;
... ... @@ -77,8 +78,8 @@ public:
77 78 void table(const GCTAResponseTable& table);
78 79 void read(const GFitsTable& table);
79 80 void write(GFitsBinTable& table) const;
80   - void save(const std::string& filename,
81   - const bool& clobber = false) const;
  81 + void save(const GFilename& filename,
  82 + const bool& clobber = false) const;
82 83  
83 84 private:
84 85 // Methods
... ... @@ -88,7 +89,7 @@ private:
88 89 void init_mc_cache(void) const;
89 90  
90 91 // Members
91   - std::string m_filename; //!< Name of background response file
  92 + GFilename m_filename; //!< Name of background response file
92 93 GCTAResponseTable m_background; //!< Background response table
93 94 double m_mc_max_bin; //!< Maximum spatial binsize for MC
94 95 double m_mc_max_logE; //!< Maximum log energy binsize for MC
... ... @@ -134,7 +135,7 @@ std::string GCTABackground3D::classname(void) const
134 135 * @return Returns filename from which the background was loaded.
135 136 ***************************************************************************/
136 137 inline
137   -std::string GCTABackground3D::filename(void) const
  138 +GFilename GCTABackground3D::filename(void) const
138 139 {
139 140 // Return filename
140 141 return m_filename;
... ...
inst/cta/include/GCTABackgroundPerfTable.hpp
1 1 /***************************************************************************
2 2 * GCTABackgroundPerfTable.hpp - CTA performance table background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -29,11 +29,11 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
  32 +#include "GFilename.hpp"
32 33 #include "GCTABackground.hpp"
33 34 #include "GCTAResponseTable.hpp"
34 35  
35 36 /* __ Forward declarations _______________________________________________ */
36   -class GFits;
37 37  
38 38  
39 39 /***********************************************************************//**
... ... @@ -46,7 +46,7 @@ class GCTABackgroundPerfTable : public GCTABackground {
46 46 public:
47 47 // Constructors and destructors
48 48 GCTABackgroundPerfTable(void);
49   - explicit GCTABackgroundPerfTable(const std::string& filename);
  49 + explicit GCTABackgroundPerfTable(const GFilename& filename);
50 50 GCTABackgroundPerfTable(const GCTABackgroundPerfTable& bgd);
51 51 virtual ~GCTABackgroundPerfTable(void);
52 52  
... ... @@ -62,8 +62,8 @@ public:
62 62 void clear(void);
63 63 GCTABackgroundPerfTable* clone(void) const;
64 64 std::string classname(void) const;
65   - void load(const std::string& filename);
66   - std::string filename(void) const;
  65 + void load(const GFilename& filename);
  66 + GFilename filename(void) const;
67 67 GCTAInstDir mc(const GEnergy& energy,
68 68 const GTime& time,
69 69 GRan& ran) const;
... ... @@ -99,7 +99,7 @@ private:
99 99 };
100 100  
101 101 // Members
102   - std::string m_filename; //!< Name of background response file
  102 + GFilename m_filename; //!< Name of background response file
103 103 GNodeArray m_logE; //!< log(E) nodes for background interpolation
104 104 std::vector<double> m_background; //!< Background rate
105 105 double m_sigma; //!< Sigma for offset angle computation (0=none)
... ... @@ -127,7 +127,7 @@ std::string GCTABackgroundPerfTable::classname(void) const
127 127 * @return Returns filename from which the background was loaded.
128 128 ***************************************************************************/
129 129 inline
130   -std::string GCTABackgroundPerfTable::filename(void) const
  130 +GFilename GCTABackgroundPerfTable::filename(void) const
131 131 {
132 132 // Return filename
133 133 return m_filename;
... ...
inst/cta/include/GCTACubeBackground.hpp
1 1 /***************************************************************************
2 2 * GCTACubeBackground.hpp - CTA cube background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2015 by Michael Mayer *
  4 + * copyright (C) 2015-2016 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -29,6 +29,7 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
  32 +#include "GFilename.hpp"
32 33 #include "GSkyMap.hpp"
33 34 #include "GNodeArray.hpp"
34 35 #include "GEbounds.hpp"
... ... @@ -51,7 +52,7 @@ class GCTACubeBackground : public GBase {
51 52 public:
52 53 // Constructors and destructors
53 54 GCTACubeBackground(void);
54   - explicit GCTACubeBackground(const std::string& filename);
  55 + explicit GCTACubeBackground(const GFilename& filename);
55 56 explicit GCTACubeBackground(const GCTAEventCube& cube);
56 57 GCTACubeBackground(const GCTACubeBackground& bgd);
57 58 virtual ~GCTACubeBackground(void);
... ... @@ -69,13 +70,13 @@ public:
69 70 double integral(const double& logE) const;
70 71 void read(const GFits& fits);
71 72 void write(GFits& file) const;
72   - void load(const std::string& filename);
73   - void save(const std::string& filename,
74   - const bool& clobber = false) const;
  73 + void load(const GFilename& filename);
  74 + void save(const GFilename& filename,
  75 + const bool& clobber = false) const;
75 76 const GSkyMap& cube(void) const;
76 77 const GEbounds& ebounds(void) const;
77 78 const GNodeArray& elogmeans(void) const;
78   - const std::string& filename(void) const;
  79 + const GFilename& filename(void) const;
79 80 std::string print(const GChatter& chatter = NORMAL) const;
80 81  
81 82 private:
... ... @@ -87,10 +88,10 @@ private:
87 88 void update(const double& logE) const;
88 89  
89 90 // Members
90   - mutable std::string m_filename; //!< Name of background response file
91   - GSkyMap m_cube; //!< Background cube
92   - GEbounds m_ebounds; //!< Energy bounds for the background cube
93   - GNodeArray m_elogmeans; //!< Mean energy for the background cube
  91 + mutable GFilename m_filename; //!< Name of background response file
  92 + GSkyMap m_cube; //!< Background cube
  93 + GEbounds m_ebounds; //!< Energy bounds for the background cube
  94 + GNodeArray m_elogmeans; //!< Mean energy for the background cube
94 95  
95 96 // Response table computation cache for 1D access
96 97 mutable int m_inx_left; //!< Index of left node
... ... @@ -161,7 +162,7 @@ const GNodeArray&amp; GCTACubeBackground::elogmeans(void) const
161 162 * which the background cube has been saved.
162 163 ***************************************************************************/
163 164 inline
164   -const std::string& GCTACubeBackground::filename(void) const
  165 +const GFilename& GCTACubeBackground::filename(void) const
165 166 {
166 167 return (m_filename);
167 168 }
... ...
inst/cta/include/GCTACubeExposure.hpp
1 1 /***************************************************************************
2 2 * GCTACubeExposure.hpp - CTA cube analysis exposure class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,11 +30,18 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include "GBase.hpp"
33   -#include "GFits.hpp"
  33 +#include "GFilename.hpp"
34 34 #include "GSkyMap.hpp"
35   -#include "GObservations.hpp"
36   -#include "GCTAObservation.hpp"
37   -#include "GCTAEventCube.hpp"
  35 +#include "GEbounds.hpp"
  36 +#include "GNodeArray.hpp"
  37 +#include "GGti.hpp"
  38 +
  39 +/* __ Forward declarations _______________________________________________ */
  40 +class GFits;
  41 +class GFitsHDU;
  42 +class GObservations;
  43 +class GCTAObservation;
  44 +class GCTAEventCube;
38 45  
39 46  
40 47 /***********************************************************************//**
... ... @@ -52,7 +59,7 @@ public:
52 59 // Constructors and destructors
53 60 GCTACubeExposure(void);
54 61 GCTACubeExposure(const GCTACubeExposure& cube);
55   - explicit GCTACubeExposure(const std::string& filename);
  62 + explicit GCTACubeExposure(const GFilename& filename);
56 63 explicit GCTACubeExposure(const GCTAEventCube& cube);
57 64 GCTACubeExposure(const std::string& wcs,
58 65 const std::string& coords,
... ... @@ -84,10 +91,10 @@ public:
84 91 double deadc(void) const;
85 92 void read(const GFits& fits);
86 93 void write(GFits& file) const;
87   - void load(const std::string& filename);
88   - void save(const std::string& filename,
89   - const bool& clobber = false) const;
90   - const std::string& filename(void) const;
  94 + void load(const GFilename& filename);
  95 + void save(const GFilename& filename,
  96 + const bool& clobber = false) const;
  97 + const GFilename& filename(void) const;
91 98 std::string print(const GChatter& chatter = NORMAL) const;
92 99  
93 100 protected:
... ... @@ -101,14 +108,14 @@ protected:
101 108 void write_attributes(GFitsHDU& hdu) const;
102 109  
103 110 // Members
104   - mutable std::string m_filename; //!< Filename
105   - GSkyMap m_cube; //!< Average Exposure cube
106   - GEbounds m_ebounds; //!< Energy bounds for the Exposure cube
107   - GNodeArray m_elogmeans; //!< Mean energy for the Exposure cube
108   - GGti m_gti; //!< Good time interval for the Exposure cube
  111 + mutable GFilename m_filename; //!< Filename
  112 + GSkyMap m_cube; //!< Average Exposure cube
  113 + GEbounds m_ebounds; //!< Energy bounds for the Exposure cube
  114 + GNodeArray m_elogmeans; //!< Mean energy for the Exposure cube
  115 + GGti m_gti; //!< Good time interval for the Exposure cube
109 116  
110 117 // Exposure attributes
111   - double m_livetime; //!< Livetime (sec)
  118 + double m_livetime; //!< Livetime (sec)
112 119  
113 120 private:
114 121 // Response table computation cache for 1D access
... ... @@ -227,7 +234,7 @@ double GCTACubeExposure::deadc(void) const
227 234 * the exposure cube has been saved.
228 235 ***************************************************************************/
229 236 inline
230   -const std::string& GCTACubeExposure::filename(void) const
  237 +const GFilename& GCTACubeExposure::filename(void) const
231 238 {
232 239 return (m_filename);
233 240 }
... ...
inst/cta/include/GCTACubePsf.hpp
1 1 /***************************************************************************
2 2 * GCTACubePsf.hpp - CTA cube analysis point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,12 +30,18 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include "GBase.hpp"
  33 +#include "GMath.hpp"
33 34 #include "GFits.hpp"
34 35 #include "GSkyMap.hpp"
35   -#include "GObservations.hpp"
36   -#include "GCTAObservation.hpp"
  36 +#include "GEbounds.hpp"
37 37 #include "GNodeArray.hpp"
38   -#include "GCTAEventCube.hpp"
  38 +
  39 +/* __ Forward declarations _______________________________________________ */
  40 +class GFilename;
  41 +class GObservations;
  42 +class GCTAEventCube;
  43 +class GCTAObservation;
  44 +
39 45  
40 46  
41 47 /***********************************************************************//**
... ... @@ -55,7 +61,7 @@ public:
55 61 // Constructors and destructors
56 62 GCTACubePsf(void);
57 63 GCTACubePsf(const GCTACubePsf& cube);
58   - explicit GCTACubePsf(const std::string& filename);
  64 + explicit GCTACubePsf(const GFilename& filename);
59 65 GCTACubePsf(const GCTAEventCube& cube,
60 66 const double& dmax, const int& ndbins);
61 67 GCTACubePsf(const std::string& wcs,
... ... @@ -78,23 +84,24 @@ public:
78 84 const GEnergy& energy) const;
79 85  
80 86 // Methods
81   - void clear(void);
82   - GCTACubePsf* clone(void) const;
83   - std::string classname(void) const;
84   - void set(const GCTAObservation& obs);
85   - void fill(const GObservations& obs, GLog* log = NULL);
86   - const GSkyMap& map(void) const;
87   - const GEbounds& ebounds(void) const;
88   - const GNodeArray& deltas(void) const;
89   - const GNodeArray& elogmeans(void) const;
90   - double delta_max(void) const;
91   - int offset(const int& idelta, const int& iebin) const;
92   - void read(const GFits& fits);
93   - void write(GFits& file) const;
94   - void load(const std::string& filename);
95   - void save(const std::string& filename, const bool& clobber = false) const;
96   - const std::string& filename(void) const;
97   - std::string print(const GChatter& chatter = NORMAL) const;
  87 + void clear(void);
  88 + GCTACubePsf* clone(void) const;
  89 + std::string classname(void) const;
  90 + void set(const GCTAObservation& obs);
  91 + void fill(const GObservations& obs, GLog* log = NULL);
  92 + const GSkyMap& map(void) const;
  93 + const GEbounds& ebounds(void) const;
  94 + const GNodeArray& deltas(void) const;
  95 + const GNodeArray& elogmeans(void) const;
  96 + double delta_max(void) const;
  97 + int offset(const int& idelta, const int& iebin) const;
  98 + void read(const GFits& fits);
  99 + void write(GFits& file) const;
  100 + void load(const GFilename& filename);
  101 + void save(const GFilename& filename,
  102 + const bool& clobber = false) const;
  103 + const GFilename& filename(void) const;
  104 + std::string print(const GChatter& chatter = NORMAL) const;
98 105  
99 106 protected:
100 107 // Methods
... ... @@ -108,13 +115,13 @@ protected:
108 115 void set_to_smooth(void);
109 116  
110 117 // Data
111   - mutable std::string m_filename; //!< Filename
112   - GSkyMap m_cube; //!< PSF cube
113   - GEbounds m_ebounds; //!< Energy bounds for the PSF cube
114   - GNodeArray m_elogmeans; //!< Mean log10TeV energy for the PSF cube
115   - GNodeArray m_deltas; //!< Delta bins (deg) for the PSF cube
116   - GNodeArray m_deltas_cache; //!< Internal delta bins (rad)
117   - bool m_quadratic_binning; //!< Internal binning is linear
  118 + mutable GFilename m_filename; //!< Filename
  119 + GSkyMap m_cube; //!< PSF cube
  120 + GEbounds m_ebounds; //!< Energy bounds for the PSF cube
  121 + GNodeArray m_elogmeans; //!< Mean log10TeV energy for the PSF cube
  122 + GNodeArray m_deltas; //!< Delta bins (deg) for the PSF cube
  123 + GNodeArray m_deltas_cache; //!< Internal delta bins (rad)
  124 + bool m_quadratic_binning; //!< Internal binning is linear
118 125  
119 126 private:
120 127 // Response table computation cache for 2D access
... ... @@ -218,7 +225,7 @@ const GNodeArray&amp; GCTACubePsf::elogmeans(void) const
218 225 * the exposure cube has been saved.
219 226 ***************************************************************************/
220 227 inline
221   -const std::string& GCTACubePsf::filename(void) const
  228 +const GFilename& GCTACubePsf::filename(void) const
222 229 {
223 230 return (m_filename);
224 231 }
... ...
inst/cta/include/GCTAEdisp.hpp
1 1 /***************************************************************************
2 2 * GCTAEdisp.hpp - Abstract CTA energy dispersion base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,10 +30,11 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include "GBase.hpp"
33   -#include "GFits.hpp"
34 33 #include "GEbounds.hpp"
35   -#include "GRan.hpp"
  34 +#include "GFilename.hpp"
36 35  
  36 +/* __ Forward declarations _______________________________________________ */
  37 +class GRan;
37 38  
38 39 /***********************************************************************//**
39 40 * @class GCTAEdisp
... ... @@ -66,8 +67,8 @@ public:
66 67 virtual void clear(void) = 0;
67 68 virtual GCTAEdisp* clone(void) const = 0;
68 69 virtual std::string classname(void) const = 0;
69   - virtual void load(const std::string& filename) = 0;
70   - virtual std::string filename(void) const = 0;
  70 + virtual void load(const GFilename& filename) = 0;
  71 + virtual GFilename filename(void) const = 0;
71 72 virtual GEnergy mc(GRan& ran,
72 73 const double& logE,
73 74 const double& theta = 0.0,
... ...
inst/cta/include/GCTAEdisp2D.hpp
... ... @@ -29,9 +29,10 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
  32 +#include "GFilename.hpp"
  33 +#include "GFunction.hpp"
32 34 #include "GCTAEdisp.hpp"
33 35 #include "GCTAResponseTable.hpp"
34   -#include "GFunction.hpp"
35 36  
36 37 /* __ Forward declarations _______________________________________________ */
37 38 class GRan;
... ... @@ -51,7 +52,7 @@ class GCTAEdisp2D : public GCTAEdisp {
51 52 public:
52 53 // Constructors and destructors
53 54 GCTAEdisp2D(void);
54   - explicit GCTAEdisp2D(const std::string& filename);
  55 + explicit GCTAEdisp2D(const GFilename& filename);
55 56 GCTAEdisp2D(const GCTAEdisp2D& edisp);
56 57 virtual ~GCTAEdisp2D(void);
57 58  
... ... @@ -68,8 +69,8 @@ public:
68 69 void clear(void);
69 70 GCTAEdisp2D* clone(void) const;
70 71 std::string classname(void) const;
71   - void load(const std::string& filename);
72   - std::string filename(void) const;
  72 + void load(const GFilename& filename);
  73 + GFilename filename(void) const;
73 74 GEnergy mc(GRan& ran,
74 75 const double& logE,
75 76 const double& theta = 0.0,
... ... @@ -93,8 +94,8 @@ public:
93 94 void table(const GCTAResponseTable& table);
94 95 void read(const GFitsTable& table);
95 96 void write(GFitsBinTable& table) const;
96   - void save(const std::string& filename,
97   - const bool& clobber = false) const;
  97 + void save(const GFilename& filename,
  98 + const bool& clobber = false) const;
98 99 private:
99 100 // Methods
100 101 void init_members(void);
... ... @@ -130,7 +131,7 @@ private:
130 131 };
131 132  
132 133 // Members
133   - std::string m_filename; //!< Name of Edisp response file
  134 + mutable GFilename m_filename; //!< Name of Edisp response file
134 135 GCTAResponseTable m_edisp; //!< Edisp response table
135 136 int m_inx_etrue; //!< True energy index
136 137 int m_inx_migra; //!< Migration index
... ... @@ -170,7 +171,7 @@ std::string GCTAEdisp2D::classname(void) const
170 171 * @return Name of FITS file from which energy dispersion was loaded.
171 172 ***************************************************************************/
172 173 inline
173   -std::string GCTAEdisp2D::filename(void) const
  174 +GFilename GCTAEdisp2D::filename(void) const
174 175 {
175 176 // Return filename
176 177 return (m_filename);
... ...
inst/cta/include/GCTAEdispPerfTable.hpp
1 1 /***************************************************************************
2 2 * GCTAEdispPerfTable.hpp - CTA performance table energy dispersion class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014 by Christoph Deil & Ellis Owen *
  4 + * copyright (C) 2014-2016 by Christoph Deil & Ellis Owen *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,10 +30,13 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include "GFits.hpp"
33   -#include "GRan.hpp"
  33 +#include "GFilename.hpp"
34 34 #include "GNodeArray.hpp"
35 35 #include "GCTAEdisp.hpp"
36 36  
  37 +/* __ Forward declarations _______________________________________________ */
  38 +class GRan;
  39 +
37 40  
38 41 /***********************************************************************//**
39 42 * @class GCTAEdispPerfTable
... ... @@ -50,7 +53,7 @@ class GCTAEdispPerfTable : public GCTAEdisp {
50 53 public:
51 54 // Constructors and destructors
52 55 GCTAEdispPerfTable(void);
53   - explicit GCTAEdispPerfTable(const std::string& filename);
  56 + explicit GCTAEdispPerfTable(const GFilename& filename);
54 57 GCTAEdispPerfTable(const GCTAEdispPerfTable& psf);
55 58 virtual ~GCTAEdispPerfTable(void);
56 59  
... ... @@ -67,8 +70,8 @@ public:
67 70 void clear(void);
68 71 GCTAEdispPerfTable* clone(void) const;
69 72 std::string classname(void) const;
70   - void load(const std::string& filename);
71   - std::string filename(void) const;
  73 + void load(const GFilename& filename);
  74 + GFilename filename(void) const;
72 75 GEnergy mc(GRan& ran,
73 76 const double& logE,
74 77 const double& theta = 0.0,
... ... @@ -95,7 +98,7 @@ private:
95 98 void update(const double& logE) const;
96 99  
97 100 // Members
98   - std::string m_filename; //!< Name of response file
  101 + mutable GFilename m_filename; //!< Name of response file
99 102 GNodeArray m_logE; //!< log(E) nodes for interpolation
100 103 std::vector<double> m_sigma; //!< Sigma value (rms) of energy resolution
101 104  
... ... @@ -125,7 +128,7 @@ std::string GCTAEdispPerfTable::classname(void) const
125 128 * @return Returns filename from which the energy resolution was loaded
126 129 ***************************************************************************/
127 130 inline
128   -std::string GCTAEdispPerfTable::filename(void) const
  131 +GFilename GCTAEdispPerfTable::filename(void) const
129 132 {
130 133 return m_filename;
131 134 }
... ...
inst/cta/include/GCTAEdispRmf.hpp
1 1 /***************************************************************************
2 2 * GCTAEdispRmf.hpp - CTA RMF energy dispersion class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Christoph Deil & Ellis Owen *
  4 + * copyright (C) 2014-2016 by Christoph Deil & Ellis Owen *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -27,15 +27,16 @@
27 27 #ifndef GCTAEDISPRMF_HPP
28 28 #define GCTAEDISPRMF_HPP
29 29  
30   -/* __ Includes ___________________________________________________________ */
  30 +/* __ Includes (members required) ________________________________________ */
31 31 #include <string>
  32 +#include "GFilename.hpp"
32 33 #include "GRmf.hpp"
33   -#include "GVector.hpp"
34   -#include "GFunction.hpp"
35   -#include "GCTAEdisp.hpp"
  34 +#include "GMatrixSparse.hpp"
36 35 #include "GNodeArray.hpp"
  36 +#include "GCTAEdisp.hpp"
37 37  
38 38 /* __ Forward declarations _______________________________________________ */
  39 +class GFunction;
39 40 class GRan;
40 41 class GEnergy;
41 42 class GEbounds;
... ... @@ -51,7 +52,7 @@ class GCTAEdispRmf : public GCTAEdisp {
51 52 public:
52 53 // Constructors and destructors
53 54 GCTAEdispRmf(void);
54   - explicit GCTAEdispRmf(const std::string& filename);
  55 + explicit GCTAEdispRmf(const GFilename& filename);
55 56 GCTAEdispRmf(const GCTAEdispRmf& edisp);
56 57 virtual ~GCTAEdispRmf(void);
57 58  
... ... @@ -68,8 +69,8 @@ public:
68 69 void clear(void);
69 70 GCTAEdispRmf* clone(void) const;
70 71 std::string classname(void) const;
71   - void load(const std::string& filename);
72   - std::string filename(void) const;
  72 + void load(const GFilename& filename);
  73 + GFilename filename(void) const;
73 74 GEnergy mc(GRan& ran,
74 75 const double& logEsrc,
75 76 const double& theta = 0.0,
... ... @@ -127,7 +128,7 @@ private:
127 128 };
128 129  
129 130 // Members
130   - std::string m_filename; //!< Name of response file
  131 + GFilename m_filename; //!< Name of response file
131 132 GRmf m_rmf; //!< Redistribution matrix file
132 133 GMatrixSparse m_matrix; //!< Normalised redistribution matrix
133 134  
... ... @@ -178,7 +179,7 @@ std::string GCTAEdispRmf::classname(void) const
178 179 * @return Returns filename from which the Redistribution Matrix was loaded.
179 180 ***************************************************************************/
180 181 inline
181   -std::string GCTAEdispRmf::filename(void) const
  182 +GFilename GCTAEdispRmf::filename(void) const
182 183 {
183 184 return (m_filename);
184 185 }
... ...
inst/cta/include/GCTAObservation.hpp
... ... @@ -29,6 +29,7 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
  32 +#include "GFilename.hpp"
32 33 #include "GObservation.hpp"
33 34 #include "GCTAResponse.hpp"
34 35 #include "GCTAPointing.hpp"
... ... @@ -63,10 +64,10 @@ public:
63 64 // Constructors and destructors
64 65 GCTAObservation(void);
65 66 explicit GCTAObservation(const std::string& instrument);
66   - GCTAObservation(const std::string& cntcube,
67   - const std::string& expcube,
68   - const std::string& psfcube,
69   - const std::string& bkgcube);
  67 + GCTAObservation(const GFilename& cntcube,
  68 + const GFilename& expcube,
  69 + const GFilename& psfcube,
  70 + const GFilename& bkgcube);
70 71 GCTAObservation(const GCTAObservation& obs);
71 72 virtual ~GCTAObservation(void);
72 73  
... ... @@ -94,15 +95,15 @@ public:
94 95 void write(GFits& fits,
95 96 const std::string& evtname = "EVENTS",
96 97 const std::string& gtiname = "GTI") const;
97   - void load(const std::string& filename);
98   - void load(const std::string& cntcube,
99   - const std::string& expcube,
100   - const std::string& psfcube,
101   - const std::string& bkgcube);
102   - void save(const std::string& filename,
103   - const bool& clobber = false) const;
  98 + void load(const GFilename& filename);
  99 + void load(const GFilename& cntcube,
  100 + const GFilename& expcube,
  101 + const GFilename& psfcube,
  102 + const GFilename& bkgcube);
  103 + void save(const GFilename& filename,
  104 + const bool& clobber = false) const;
104 105 void response(const std::string& rspname,
105   - const GCaldb& caldb);
  106 + const GCaldb& caldb);
106 107 void response(const GCTACubeExposure& expcube,
107 108 const GCTACubePsf& psfcube,
108 109 const GCTACubeBackground& bkgcube);
... ... @@ -122,8 +123,8 @@ public:
122 123 void ontime(const double& ontime);
123 124 void livetime(const double& livetime);
124 125 void deadc(const double& deadc);
125   - void eventfile(const std::string& filename);
126   - const std::string& eventfile(void) const;
  126 + void eventfile(const GFilename& filename);
  127 + const GFilename& eventfile(void) const;
127 128 std::string eventtype(void) const;
128 129 void dispose_events(void);
129 130 const double& lo_user_thres(void) const;
... ... @@ -141,7 +142,7 @@ protected:
141 142  
142 143 // Protected members
143 144 std::string m_instrument; //!< Instrument name
144   - std::string m_eventfile; //!< Event filename
  145 + GFilename m_eventfile; //!< Event filename
145 146 GCTAResponse* m_response; //!< Pointer to instrument response functions
146 147 GCTAPointing m_pointing; //!< Pointing direction
147 148 int m_obs_id; //!< Observation ID
... ... @@ -423,7 +424,7 @@ void GCTAObservation::deadc(const double&amp; deadc)
423 424 * @param[in] filename Event file name.
424 425 ***************************************************************************/
425 426 inline
426   -void GCTAObservation::eventfile(const std::string& filename)
  427 +void GCTAObservation::eventfile(const GFilename& filename)
427 428 {
428 429 m_eventfile = filename;
429 430 return;
... ... @@ -436,7 +437,7 @@ void GCTAObservation::eventfile(const std::string&amp; filename)
436 437 * @return Event file name.
437 438 ***************************************************************************/
438 439 inline
439   -const std::string& GCTAObservation::eventfile(void) const
  440 +const GFilename& GCTAObservation::eventfile(void) const
440 441 {
441 442 return m_eventfile;
442 443 }
... ...
inst/cta/include/GCTAOnOffObservations.hpp
1 1 /***************************************************************************
2 2 * GCTAOnOffObservations.hpp - CTA on-off observation container class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2013-2015 by Pierrick Martin *
  4 + * copyright (C) 2013-2016 by Pierrick Martin *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -34,6 +34,9 @@
34 34 #include "GCTAOnOffObservation.hpp"
35 35 #include "GModels.hpp"
36 36  
  37 +/* __ Forward declarations _______________________________________________ */
  38 +class GFilename;
  39 +
37 40  
38 41 /***********************************************************************//**
39 42 * @class GCTAOnOffObservations
... ... @@ -49,7 +52,7 @@ public:
49 52 // Constructors and destructors
50 53 GCTAOnOffObservations(void);
51 54 GCTAOnOffObservations(const GCTAOnOffObservations& obs);
52   - explicit GCTAOnOffObservations(const std::string& filename);
  55 + explicit GCTAOnOffObservations(const GFilename& filename);
53 56 virtual ~GCTAOnOffObservations(void);
54 57  
55 58 // Operators
... ... @@ -73,12 +76,12 @@ public:
73 76 void extend(const GCTAOnOffObservations& obs);
74 77 bool contains(const std::string& instrument,
75 78 const std::string& id) const;
76   - void load(const std::string& filename);
77   - void save(const std::string& filename) const;
  79 + void load(const GFilename& filename);
  80 + void save(const GFilename& filename) const;
78 81 void read(const GXml& xml);
79 82 void write(GXml& xml) const;
80 83 void models(const GModels& models);
81   - void models(const std::string& filename);
  84 + void models(const GFilename& filename);
82 85 const GModels& models(void) const;
83 86 std::string print(const GChatter& chatter = NORMAL) const;
84 87  
... ...
inst/cta/include/GCTAPointing.hpp
1 1 /***************************************************************************
2 2 * GCTAPointing.hpp - CTA pointing class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -29,17 +29,18 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include "GSkyDir.hpp"
33   -#include "GTime.hpp"
34   -#include "GTimeReference.hpp"
35 32 #include "GMatrix.hpp"
36   -#include "GHorizDir.hpp"
37 33 #include "GNodeArray.hpp"
38   -#include "GFitsTable.hpp"
39   -#include "GCTAInstDir.hpp"
  34 +#include "GSkyDir.hpp"
40 35  
41 36 /* __ Forward declarations _______________________________________________ */
  37 +class GFilename;
  38 +class GTime;
  39 +class GTimeReference;
  40 +class GHorizDir;
  41 +class GFitsTable;
42 42 class GXmlElement;
  43 +class GCTAInstDir;
43 44  
44 45  
45 46 /***********************************************************************//**
... ... @@ -61,7 +62,7 @@ public:
61 62 GCTAPointing(void);
62 63 explicit GCTAPointing(const GSkyDir& dir);
63 64 explicit GCTAPointing(const GXmlElement& xml);
64   - explicit GCTAPointing(const std::string& filename);
  65 + explicit GCTAPointing(const GFilename& filename);
65 66 GCTAPointing(const GCTAPointing& pnt);
66 67 virtual ~GCTAPointing(void);
67 68  
... ... @@ -82,7 +83,7 @@ public:
82 83 void zenith(const double& zenith);
83 84 void azimuth(const double& azimuth);
84 85 GHorizDir dir_horiz(const GTime& time) const;
85   - void load(const std::string& filename);
  86 + void load(const GFilename& filename);
86 87 void read(const GFitsTable& table);
87 88 void read(const GXmlElement& xml);
88 89 void write(GXmlElement& xml) const;
... ...
inst/cta/include/GCTAPsf.hpp
1 1 /***************************************************************************
2 2 * GCTAPsf.hpp - CTA point spread function base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,8 +30,10 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include "GBase.hpp"
33   -#include "GFits.hpp"
34   -#include "GRan.hpp"
  33 +
  34 +/* __ Forward declarations _______________________________________________ */
  35 +class GFilename;
  36 +class GRan;
35 37  
36 38  
37 39 /***********************************************************************//**
... ... @@ -66,8 +68,8 @@ public:
66 68 virtual void clear(void) = 0;
67 69 virtual GCTAPsf* clone(void) const = 0;
68 70 virtual std::string classname(void) const = 0;
69   - virtual void load(const std::string& filename) = 0;
70   - virtual std::string filename(void) const = 0;
  71 + virtual void load(const GFilename& filename) = 0;
  72 + virtual GFilename filename(void) const = 0;
71 73 virtual double mc(GRan& ran,
72 74 const double& logE,
73 75 const double& theta = 0.0,
... ...
inst/cta/include/GCTAPsf2D.hpp
1 1 /***************************************************************************
2 2 * GCTAPsf2D.hpp - CTA 2D point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -29,15 +29,16 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include "GFits.hpp"
33   -#include "GRan.hpp"
  32 +//#include "GRan.hpp"
  33 +#include "GFilename.hpp"
34 34 #include "GCTAPsf.hpp"
35 35 #include "GCTAResponseTable.hpp"
36 36  
37 37 /* __ Forward declarations _______________________________________________ */
38   -class GFits;
  38 +class GRan;
39 39 class GFitsBinTable;
40 40  
  41 +
41 42 /***********************************************************************//**
42 43 * @class GCTAPsf2D
43 44 *
... ... @@ -51,7 +52,7 @@ class GCTAPsf2D : public GCTAPsf {
51 52 public:
52 53 // Constructors and destructors
53 54 GCTAPsf2D(void);
54   - explicit GCTAPsf2D(const std::string& filename);
  55 + explicit GCTAPsf2D(const GFilename& filename);
55 56 GCTAPsf2D(const GCTAPsf2D& psf);
56 57 virtual ~GCTAPsf2D(void);
57 58  
... ... @@ -69,8 +70,8 @@ public:
69 70 void clear(void);
70 71 GCTAPsf2D* clone(void) const;
71 72 std::string classname(void) const;
72   - void load(const std::string& filename);
73   - std::string filename(void) const;
  73 + void load(const GFilename& filename);
  74 + GFilename filename(void) const;
74 75 double mc(GRan& ran,
75 76 const double& logE,
76 77 const double& theta = 0.0,
... ... @@ -98,8 +99,8 @@ public:
98 99 void table(const GCTAResponseTable& table);
99 100 void read(const GFitsTable& table);
100 101 void write(GFitsBinTable& table) const;
101   - void save(const std::string& filename,
102   - const bool& clobber = false) const;
  102 + void save(const GFilename& filename,
  103 + const bool& clobber = false) const;
103 104  
104 105  
105 106 private:
... ... @@ -110,7 +111,7 @@ private:
110 111 void update(const double& logE, const double& theta) const;
111 112  
112 113 // Members
113   - std::string m_filename; //!< Name of Aeff response file
  114 + GFilename m_filename; //!< Name of Aeff response file
114 115 GCTAResponseTable m_psf; //!< PSF response table
115 116 int m_inx_energy; //!< Energy index
116 117 int m_inx_theta; //!< Theta index
... ... @@ -153,7 +154,7 @@ std::string GCTAPsf2D::classname(void) const
153 154 * @return Returns filename from which point spread function was loaded
154 155 ***************************************************************************/
155 156 inline
156   -std::string GCTAPsf2D::filename(void) const
  157 +GFilename GCTAPsf2D::filename(void) const
157 158 {
158 159 return m_filename;
159 160 }
... ...
inst/cta/include/GCTAPsfKing.hpp
... ... @@ -29,11 +29,14 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include "GFits.hpp"
33   -#include "GRan.hpp"
  32 +#include "GFilename.hpp"
34 33 #include "GCTAPsf.hpp"
35 34 #include "GCTAResponseTable.hpp"
36 35  
  36 +/* __ Forward declarations _______________________________________________ */
  37 +class GRan;
  38 +class GFitsTable;
  39 +
37 40  
38 41 /***********************************************************************//**
39 42 * @class GCTAPsfKing
... ... @@ -48,7 +51,7 @@ class GCTAPsfKing : public GCTAPsf {
48 51 public:
49 52 // Constructors and destructors
50 53 GCTAPsfKing(void);
51   - explicit GCTAPsfKing(const std::string& filename);
  54 + explicit GCTAPsfKing(const GFilename& filename);
52 55 GCTAPsfKing(const GCTAPsfKing& psf);
53 56 virtual ~GCTAPsfKing(void);
54 57  
... ... @@ -66,8 +69,8 @@ public:
66 69 void clear(void);
67 70 GCTAPsfKing* clone(void) const;
68 71 std::string classname(void) const;
69   - void load(const std::string& filename);
70   - std::string filename(void) const;
  72 + void load(const GFilename& filename);
  73 + GFilename filename(void) const;
71 74 double mc(GRan& ran,
72 75 const double& logE,
73 76 const double& theta = 0.0,
... ... @@ -96,8 +99,8 @@ public:
96 99 void table(const GCTAResponseTable& table);
97 100 void read(const GFitsTable& table);
98 101 void write(GFitsBinTable& table) const;
99   - void save(const std::string& filename,
100   - const bool& clobber = false) const;
  102 + void save(const GFilename& filename,
  103 + const bool& clobber = false) const;
101 104  
102 105  
103 106  
... ... @@ -109,7 +112,7 @@ private:
109 112 void update(const double& logE, const double& theta) const;
110 113  
111 114 // Members
112   - std::string m_filename; //!< Name of Aeff response file
  115 + GFilename m_filename; //!< Name of Aeff response file
113 116 GCTAResponseTable m_psf; //!< PSF response table
114 117 int m_inx_energy; //!< Energy index
115 118 int m_inx_theta; //!< Theta index
... ... @@ -146,7 +149,7 @@ std::string GCTAPsfKing::classname(void) const
146 149 * Returns filename from which point spread function was loaded.
147 150 ***************************************************************************/
148 151 inline
149   -std::string GCTAPsfKing::filename(void) const
  152 +GFilename GCTAPsfKing::filename(void) const
150 153 {
151 154 return m_filename;
152 155 }
... ...
inst/cta/include/GCTAPsfPerfTable.hpp
1 1 /***************************************************************************
2 2 * GCTAPsfPerfTable.hpp - CTA performance table PSF class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -29,11 +29,13 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include "GFits.hpp"
33   -#include "GRan.hpp"
  32 +#include "GFilename.hpp"
34 33 #include "GNodeArray.hpp"
35 34 #include "GCTAPsf.hpp"
36 35  
  36 +/* __ Forward declarations _______________________________________________ */
  37 +class GRan;
  38 +
37 39  
38 40 /***********************************************************************//**
39 41 * @class GCTAPsfPerfTable
... ... @@ -50,7 +52,7 @@ class GCTAPsfPerfTable : public GCTAPsf {
50 52 public:
51 53 // Constructors and destructors
52 54 GCTAPsfPerfTable(void);
53   - GCTAPsfPerfTable(const std::string& filename);
  55 + GCTAPsfPerfTable(const GFilename& filename);
54 56 GCTAPsfPerfTable(const GCTAPsfPerfTable& psf);
55 57 virtual ~GCTAPsfPerfTable(void);
56 58  
... ... @@ -68,8 +70,8 @@ public:
68 70 void clear(void);
69 71 GCTAPsfPerfTable* clone(void) const;
70 72 std::string classname(void) const;
71   - void load(const std::string& filename);
72   - std::string filename(void) const;
  73 + void load(const GFilename& filename);
  74 + GFilename filename(void) const;
73 75 double mc(GRan& ran,
74 76 const double& logE,
75 77 const double& theta = 0.0,
... ... @@ -100,7 +102,7 @@ private:
100 102 void update(const double& logE) const;
101 103  
102 104 // Members
103   - std::string m_filename; //!< Name of Aeff response file
  105 + GFilename m_filename; //!< Name of Aeff response file
104 106 GNodeArray m_logE; //!< log(E) nodes for Aeff interpolation
105 107 std::vector<double> m_r68; //!< 68% containment radius of PSF in degrees
106 108 std::vector<double> m_r80; //!< 80% containment radius of PSF in degrees
... ... @@ -132,7 +134,7 @@ std::string GCTAPsfPerfTable::classname(void) const
132 134 * @return Returns filename from which point spread function was loaded
133 135 ***************************************************************************/
134 136 inline
135   -std::string GCTAPsfPerfTable::filename(void) const
  137 +GFilename GCTAPsfPerfTable::filename(void) const
136 138 {
137 139 return m_filename;
138 140 }
... ...
inst/cta/include/GCTAPsfVector.hpp
1 1 /***************************************************************************
2 2 * GCTAPsfVector.hpp - CTA point spread function vector class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -29,11 +29,15 @@
29 29  
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32   -#include "GFits.hpp"
33   -#include "GRan.hpp"
  32 +#include <vector>
  33 +#include "GFilename.hpp"
34 34 #include "GNodeArray.hpp"
35 35 #include "GCTAPsf.hpp"
36 36  
  37 +/* __ Forward declarations _______________________________________________ */
  38 +class GRan;
  39 +class GFitsTable;
  40 +
37 41  
38 42 /***********************************************************************//**
39 43 * @class GCTAPsfVector
... ... @@ -48,7 +52,7 @@ class GCTAPsfVector : public GCTAPsf {
48 52 public:
49 53 // Constructors and destructors
50 54 GCTAPsfVector(void);
51   - GCTAPsfVector(const std::string& filename);
  55 + GCTAPsfVector(const GFilename& filename);
52 56 GCTAPsfVector(const GCTAPsfVector& psf);
53 57 virtual ~GCTAPsfVector(void);
54 58  
... ... @@ -66,8 +70,8 @@ public:
66 70 void clear(void);
67 71 GCTAPsfVector* clone(void) const;
68 72 std::string classname(void) const;
69   - void load(const std::string& filename);
70   - std::string filename(void) const;
  73 + void load(const GFilename& filename);
  74 + GFilename filename(void) const;
71 75 double mc(GRan& ran,
72 76 const double& logE,
73 77 const double& theta = 0.0,
... ... @@ -101,7 +105,7 @@ private:
101 105 void update(const double& logE) const;
102 106  
103 107 // Members
104   - std::string m_filename; //!< Name of Aeff response file
  108 + GFilename m_filename; //!< Name of Aeff response file
105 109 GNodeArray m_logE; //!< log(E) nodes for Aeff interpolation
106 110 std::vector<double> m_r68; //!< 68% containment radius of PSF in degrees
107 111 std::vector<double> m_sigma; //!< Sigma value of PSF in radians
... ... @@ -129,12 +133,14 @@ std::string GCTAPsfVector::classname(void) const
129 133 /***********************************************************************//**
130 134 * @brief Return filename
131 135 *
132   - * @return Returns filename from which point spread function was loaded
  136 + * @return Filename.
  137 + *
  138 + * Returns filename from which point spread function was loaded.
133 139 ***************************************************************************/
134 140 inline
135   -std::string GCTAPsfVector::filename(void) const
  141 +GFilename GCTAPsfVector::filename(void) const
136 142 {
137   - return m_filename;
  143 + return (m_filename);
138 144 }
139 145  
140 146 #endif /* GCTAPSFVECTOR_HPP */
... ...
inst/cta/include/GCTAResponseIrf.hpp
1 1 /***************************************************************************
2 2 * GCTAResponseIrf.hpp - CTA instrument response function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,9 +39,8 @@
39 39 #include "GCTAEdisp.hpp"
40 40 #include "GCTABackground.hpp"
41 41  
42   -/* __ Type definitions ___________________________________________________ */
43   -
44 42 /* __ Forward declarations _______________________________________________ */
  43 +class GFilename;
45 44 class GSkyDir;
46 45 class GPhoton;
47 46 class GEbounds;
... ... @@ -103,10 +102,10 @@ public:
103 102 void caldb(const GCaldb& caldb);
104 103 const GCaldb& caldb(void) const;
105 104 void load(const std::string& rspname);
106   - void load_aeff(const std::string& filename);
107   - void load_psf(const std::string& filename);
108   - void load_edisp(const std::string& filename);
109   - void load_background(const std::string& filename);
  105 + void load_aeff(const GFilename& filename);
  106 + void load_psf(const GFilename& filename);
  107 + void load_edisp(const GFilename& filename);
  108 + void load_background(const GFilename& filename);
110 109 void offset_sigma(const double& sigma);
111 110 double offset_sigma(void) const;
112 111 const GCTAAeff* aeff(void) const;
... ...
inst/cta/pyext/GCTAAeff.i
1 1 /***************************************************************************
2 2 * GCTAAeff.i - CTA effective area base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAAeff.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -55,8 +54,8 @@ public:
55 54 virtual void clear(void) = 0;
56 55 virtual GCTAAeff* clone(void) const = 0;
57 56 virtual std::string classname(void) const = 0;
58   - virtual void load(const std::string& filename) = 0;
59   - virtual std::string filename(void) const = 0;
  57 + virtual void load(const GFilename& filename) = 0;
  58 + virtual GFilename filename(void) const = 0;
60 59 virtual double max(const double& logE,
61 60 const double& zenith,
62 61 const double& azimuth,
... ...
inst/cta/pyext/GCTAAeff2D.i
1 1 /***************************************************************************
2 2 * GCTAAeff2D.i - CTA 2D effective area class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAAeff2D.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -40,7 +39,7 @@ class GCTAAeff2D : public GCTAAeff {
40 39 public:
41 40 // Constructors and destructors
42 41 GCTAAeff2D(void);
43   - explicit GCTAAeff2D(const std::string& filename);
  42 + explicit GCTAAeff2D(const GFilename& filename);
44 43 GCTAAeff2D(const GCTAAeff2D& cta);
45 44 virtual ~GCTAAeff2D(void);
46 45  
... ... @@ -56,8 +55,8 @@ public:
56 55 void clear(void);
57 56 GCTAAeff2D* clone(void) const;
58 57 std::string classname(void) const;
59   - void load(const std::string& filename);
60   - std::string filename(void) const;
  58 + void load(const GFilename& filename);
  59 + GFilename filename(void) const;
61 60 double max(const double& logE,
62 61 const double& zenith,
63 62 const double& azimuth,
... ... @@ -68,8 +67,8 @@ public:
68 67 void table(const GCTAResponseTable& table);
69 68 void read(const GFitsTable& table);
70 69 void write(GFitsBinTable& table) const;
71   - void save(const std::string& filename,
72   - const bool& clobber = false) const;
  70 + void save(const GFilename& filename,
  71 + const bool& clobber = false) const;
73 72 };
74 73  
75 74  
... ...
inst/cta/pyext/GCTAAeffArf.i
1 1 /***************************************************************************
2 2 * GCTAAeffArf.i - CTA ARF effective area class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAAeffArf.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -40,7 +39,7 @@ class GCTAAeffArf : public GCTAAeff {
40 39 public:
41 40 // Constructors and destructors
42 41 GCTAAeffArf(void);
43   - explicit GCTAAeffArf(const std::string& filename);
  42 + explicit GCTAAeffArf(const GFilename& filename);
44 43 GCTAAeffArf(const GCTAAeffArf& cta);
45 44 virtual ~GCTAAeffArf(void);
46 45  
... ... @@ -56,8 +55,8 @@ public:
56 55 void clear(void);
57 56 GCTAAeffArf* clone(void) const;
58 57 std::string classname(void) const;
59   - void load(const std::string& filename);
60   - std::string filename(void) const;
  58 + void load(const GFilename& filename);
  59 + GFilename filename(void) const;
61 60 double max(const double& logE,
62 61 const double& zenith,
63 62 const double& azimuth,
... ...
inst/cta/pyext/GCTAAeffPerfTable.i
1 1 /***************************************************************************
2 2 * GCTAAeffPerfTable.i - CTA performance table effective area class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAAeffPerfTable.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -40,7 +39,7 @@ class GCTAAeffPerfTable : public GCTAAeff {
40 39 public:
41 40 // Constructors and destructors
42 41 GCTAAeffPerfTable(void);
43   - explicit GCTAAeffPerfTable(const std::string& filename);
  42 + explicit GCTAAeffPerfTable(const GFilename& filename);
44 43 GCTAAeffPerfTable(const GCTAAeffPerfTable& cta);
45 44 virtual ~GCTAAeffPerfTable(void);
46 45  
... ... @@ -56,8 +55,8 @@ public:
56 55 void clear(void);
57 56 GCTAAeffPerfTable* clone(void) const;
58 57 std::string classname(void) const;
59   - void load(const std::string& filename);
60   - std::string filename(void) const;
  58 + void load(const GFilename& filename);
  59 + GFilename filename(void) const;
61 60 double max(const double& logE,
62 61 const double& zenith,
63 62 const double& azimuth,
... ...
inst/cta/pyext/GCTABackground.i
1 1 /***************************************************************************
2 2 * GCTABackground.i - CTA background model base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -51,8 +51,8 @@ public:
51 51 virtual void clear(void) = 0;
52 52 virtual GCTABackground* clone(void) const = 0;
53 53 virtual std::string classname(void) const = 0;
54   - virtual void load(const std::string& filename) = 0;
55   - virtual std::string filename(void) const = 0;
  54 + virtual void load(const GFilename& filename) = 0;
  55 + virtual GFilename filename(void) const = 0;
56 56 virtual GCTAInstDir mc(const GEnergy& energy,
57 57 const GTime& time,
58 58 GRan& ran) const = 0;
... ...
inst/cta/pyext/GCTABackground3D.i
1 1 /***************************************************************************
2 2 * GCTABackground3D.i - CTA 3D background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ class GCTABackground3D : public GCTABackground {
39 39 public:
40 40 // Constructors and destructors
41 41 GCTABackground3D(void);
42   - explicit GCTABackground3D(const std::string& filename);
  42 + explicit GCTABackground3D(const GFilename& filename);
43 43 GCTABackground3D(const GCTABackground3D& bgd);
44 44 virtual ~GCTABackground3D(void);
45 45  
... ... @@ -52,8 +52,8 @@ public:
52 52 void clear(void);
53 53 GCTABackground3D* clone(void) const;
54 54 std::string classname(void) const;
55   - void load(const std::string& filename);
56   - std::string filename(void) const;
  55 + void load(const GFilename& filename);
  56 + GFilename filename(void) const;
57 57 GCTAInstDir mc(const GEnergy& energy,
58 58 const GTime& time,
59 59 GRan& ran) const;
... ... @@ -65,8 +65,8 @@ public:
65 65 void table(const GCTAResponseTable& table);
66 66 void read(const GFitsTable& table);
67 67 void write(GFitsBinTable& table) const;
68   - void save(const std::string& filename,
69   - const bool& clobber = false) const;
  68 + void save(const GFilename& filename,
  69 + const bool& clobber = false) const;
70 70 };
71 71  
72 72  
... ...
inst/cta/pyext/GCTABackgroundPerfTable.i
1 1 /***************************************************************************
2 2 * GCTABackgroundPerfTable.i - CTA performance table background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ class GCTABackgroundPerfTable : public GCTABackground {
39 39 public:
40 40 // Constructors and destructors
41 41 GCTABackgroundPerfTable(void);
42   - explicit GCTABackgroundPerfTable(const std::string& filename);
  42 + explicit GCTABackgroundPerfTable(const GFilename& filename);
43 43 GCTABackgroundPerfTable(const GCTABackgroundPerfTable& bgd);
44 44 virtual ~GCTABackgroundPerfTable(void);
45 45  
... ... @@ -52,8 +52,8 @@ public:
52 52 void clear(void);
53 53 GCTABackgroundPerfTable* clone(void) const;
54 54 std::string classname(void) const;
55   - void load(const std::string& filename);
56   - std::string filename(void) const;
  55 + void load(const GFilename& filename);
  56 + GFilename filename(void) const;
57 57 GCTAInstDir mc(const GEnergy& energy,
58 58 const GTime& time,
59 59 GRan& ran) const;
... ...
inst/cta/pyext/GCTACubeBackground.i
1 1 /***************************************************************************
2 2 * GCTACubeBackground.i - CTA cube background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2015 by Michael Mayer *
  4 + * copyright (C) 2015-2016 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ class GCTACubeBackground : public GBase {
39 39 public:
40 40 // Constructors and destructors
41 41 GCTACubeBackground(void);
42   - explicit GCTACubeBackground(const std::string& filename);
  42 + explicit GCTACubeBackground(const GFilename& filename);
43 43 explicit GCTACubeBackground(const GCTAEventCube& cube);
44 44 GCTACubeBackground(const GCTACubeBackground& bgd);
45 45 virtual ~GCTACubeBackground(void);
... ... @@ -56,13 +56,13 @@ public:
56 56 double integral(const double& logE) const;
57 57 void read(const GFits& fits);
58 58 void write(GFits& file) const;
59   - void load(const std::string& filename);
60   - void save(const std::string& filename,
61   - const bool& clobber = false) const;
  59 + void load(const GFilename& filename);
  60 + void save(const GFilename& filename,
  61 + const bool& clobber = false) const;
62 62 const GSkyMap& cube(void) const;
63 63 const GEbounds& ebounds(void) const;
64 64 const GNodeArray& elogmeans(void) const;
65   - const std::string& filename(void) const;
  65 + const GFilename& filename(void) const;
66 66 };
67 67  
68 68  
... ...
inst/cta/pyext/GCTACubeExposure.i
1 1 /***************************************************************************
2 2 * GCTACubeExposure.i - CTA cube analysis exposure class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -44,7 +44,7 @@ public:
44 44 // Constructors and destructors
45 45 GCTACubeExposure(void);
46 46 GCTACubeExposure(const GCTACubeExposure& cube);
47   - explicit GCTACubeExposure(const std::string& filename);
  47 + explicit GCTACubeExposure(const GFilename& filename);
48 48 explicit GCTACubeExposure(const GCTAEventCube& cube);
49 49 GCTACubeExposure(const std::string& wcs,
50 50 const std::string& coords,
... ... @@ -61,23 +61,24 @@ public:
61 61 double operator()(const GSkyDir& dir, const GEnergy& energy) const;
62 62  
63 63 // Methods
64   - void clear(void);
65   - GCTACubeExposure* clone(void) const;
66   - std::string classname(void) const;
67   - void set(const GCTAObservation& obs);
68   - void fill(const GObservations& obs, GLog* log = NULL);
69   - const GSkyMap& cube(void) const;
70   - const GEbounds& ebounds(void) const;
71   - const GGti& gti(void) const;
72   - const GNodeArray& elogmeans(void) const;
73   - const double& livetime(void) const;
74   - const double& ontime(void) const;
75   - double deadc(void) const;
76   - void read(const GFits& fits);
77   - void write(GFits& file) const;
78   - void load(const std::string& filename);
79   - void save(const std::string& filename,
80   - const bool& clobber = false) const;
  64 + void clear(void);
  65 + GCTACubeExposure* clone(void) const;
  66 + std::string classname(void) const;
  67 + void set(const GCTAObservation& obs);
  68 + void fill(const GObservations& obs, GLog* log = NULL);
  69 + const GSkyMap& cube(void) const;
  70 + const GEbounds& ebounds(void) const;
  71 + const GGti& gti(void) const;
  72 + const GNodeArray& elogmeans(void) const;
  73 + const double& livetime(void) const;
  74 + const double& ontime(void) const;
  75 + double deadc(void) const;
  76 + void read(const GFits& fits);
  77 + void write(GFits& file) const;
  78 + void load(const GFilename& filename);
  79 + void save(const GFilename& filename,
  80 + const bool& clobber = false) const;
  81 + const GFilename& filename(void) const;
81 82 };
82 83  
83 84 /***********************************************************************//**
... ...
inst/cta/pyext/GCTACubePsf.i
1 1 /***************************************************************************
2 2 * GCTACubePsf.i - CTA cube analysis point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -27,7 +27,6 @@
27 27 %{
28 28 /* __ Includes ___________________________________________________________ */
29 29 #include "GCTACubePsf.hpp"
30   -#include "GTools.hpp"
31 30 %}
32 31  
33 32  
... ... @@ -48,7 +47,7 @@ public:
48 47 // Constructors and destructors
49 48 GCTACubePsf(void);
50 49 GCTACubePsf(const GCTACubePsf& cube);
51   - explicit GCTACubePsf(const std::string& filename);
  50 + explicit GCTACubePsf(const GFilename& filename);
52 51 GCTACubePsf(const GCTAEventCube& cube,
53 52 const double& dmax, const int& ndbins);
54 53 GCTACubePsf(const std::string& wcs,
... ... @@ -83,9 +82,10 @@ public:
83 82 int offset(const int& idelta, const int& iebin) const;
84 83 void read(const GFits& fits);
85 84 void write(GFits& file) const;
86   - void load(const std::string& filename);
87   - void save(const std::string& filename, const bool& clobber = false) const;
88   - const std::string& filename(void) const;
  85 + void load(const GFilename& filename);
  86 + void save(const GFilename& filename,
  87 + const bool& clobber = false) const;
  88 + const GFilename& filename(void) const;
89 89 };
90 90  
91 91  
... ...
inst/cta/pyext/GCTAEdisp.i
1 1 /***************************************************************************
2 2 * GCTAEdisp.i - Abstract CTA energy dispersion base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -54,8 +54,8 @@ public:
54 54 virtual void clear(void) = 0;
55 55 virtual GCTAEdisp* clone(void) const = 0;
56 56 virtual std::string classname(void) const = 0;
57   - virtual void load(const std::string& filename) = 0;
58   - virtual std::string filename(void) const = 0;
  57 + virtual void load(const GFilename& filename) = 0;
  58 + virtual GFilename filename(void) const = 0;
59 59 virtual GEnergy mc(GRan& ran,
60 60 const double& logE,
61 61 const double& theta = 0.0,
... ...
inst/cta/pyext/GCTAEdisp2D.i
1 1 /***************************************************************************
2 2 * GCTAEdisp2D.i - CTA 2D energy dispersion class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2015 by Florent Forest *
  4 + * copyright (C) 2015-2016 by Florent Forest *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ class GCTAEdisp2D : public GCTAEdisp {
39 39 public:
40 40 // Constructors and destructors
41 41 GCTAEdisp2D(void);
42   - explicit GCTAEdisp2D(const std::string& filename);
  42 + explicit GCTAEdisp2D(const GFilename& filename);
43 43 GCTAEdisp2D(const GCTAEdisp2D& edisp);
44 44 virtual ~GCTAEdisp2D(void);
45 45  
... ... @@ -55,8 +55,8 @@ public:
55 55 void clear(void);
56 56 GCTAEdisp2D* clone(void) const;
57 57 std::string classname(void) const;
58   - void load(const std::string& filename);
59   - std::string filename(void) const;
  58 + void load(const GFilename& filename);
  59 + GFilename filename(void) const;
60 60 GEnergy mc(GRan& ran,
61 61 const double& logE,
62 62 const double& theta = 0.0,
... ... @@ -79,8 +79,8 @@ public:
79 79 void table(const GCTAResponseTable& table);
80 80 void read(const GFitsTable& table);
81 81 void write(GFitsBinTable& table) const;
82   - void save(const std::string& filename,
83   - const bool& clobber = false) const;
  82 + void save(const GFilename& filename,
  83 + const bool& clobber = false) const;
84 84 };
85 85  
86 86  
... ...
inst/cta/pyext/GCTAEdispPerfTable.i
1 1 /***************************************************************************
2 2 * GCTAEdispPerfTable.i - CTA performance table energy dispersion class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Christoph Deil & Ellis Owen *
  4 + * copyright (C) 2014-2016 by Christoph Deil & Ellis Owen *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ class GCTAEdispPerfTable : public GCTAEdisp {
39 39 public:
40 40 // Constructors and destructors
41 41 GCTAEdispPerfTable(void);
42   - explicit GCTAEdispPerfTable(const std::string& filename);
  42 + explicit GCTAEdispPerfTable(const GFilename& filename);
43 43 GCTAEdispPerfTable(const GCTAEdispPerfTable& psf);
44 44 virtual ~GCTAEdispPerfTable(void);
45 45  
... ... @@ -55,8 +55,8 @@ public:
55 55 void clear(void);
56 56 GCTAEdispPerfTable* clone(void) const;
57 57 std::string classname(void) const;
58   - void load(const std::string& filename);
59   - std::string filename(void) const;
  58 + void load(const GFilename& filename);
  59 + GFilename filename(void) const;
60 60 GEnergy mc(GRan& ran,
61 61 const double& logE,
62 62 const double& theta = 0.0,
... ...
inst/cta/pyext/GCTAEdispRmf.i
1 1 /***************************************************************************
2 2 * GCTAEdispRmf.i - CTA RMF energy dispersion class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Christoph Deil & Ellis Owen *
  4 + * copyright (C) 2014-2016 by Christoph Deil & Ellis Owen *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ class GCTAEdispRmf : public GCTAEdisp {
39 39 public:
40 40 // Constructors and destructors
41 41 GCTAEdispRmf(void);
42   - explicit GCTAEdispRmf(const std::string& filename);
  42 + explicit GCTAEdispRmf(const GFilename& filename);
43 43 GCTAEdispRmf(const GCTAEdispRmf& psf);
44 44 virtual ~GCTAEdispRmf(void);
45 45  
... ... @@ -55,8 +55,8 @@ public:
55 55 void clear(void);
56 56 GCTAEdispRmf* clone(void) const;
57 57 std::string classname(void) const;
58   - void load(const std::string& filename);
59   - std::string filename(void) const;
  58 + void load(const GFilename& filename);
  59 + GFilename filename(void) const;
60 60 GEnergy mc(GRan& ran,
61 61 const double& logE,
62 62 const double& theta = 0.0,
... ...
inst/cta/pyext/GCTAObservation.i
... ... @@ -39,10 +39,10 @@ public:
39 39 // Constructors and destructors
40 40 GCTAObservation(void);
41 41 explicit GCTAObservation(const std::string& instrument);
42   - GCTAObservation(const std::string& cntcube,
43   - const std::string& expcube,
44   - const std::string& psfcube,
45   - const std::string& bkgcube);
  42 + GCTAObservation(const GFilename& cntcube,
  43 + const GFilename& expcube,
  44 + const GFilename& psfcube,
  45 + const GFilename& bkgcube);
46 46 GCTAObservation(const GCTAObservation& obs);
47 47 virtual ~GCTAObservation(void);
48 48  
... ... @@ -66,15 +66,15 @@ public:
66 66 void write(GFits& fits,
67 67 const std::string& evtname = "EVENTS",
68 68 const std::string& gtiname = "GTI") const;
69   - void load(const std::string& filename);
70   - void load(const std::string& cntcube,
71   - const std::string& expcube,
72   - const std::string& psfcube,
73   - const std::string& bkgcube);
74   - void save(const std::string& filename,
75   - const bool& clobber = false) const;
  69 + void load(const GFilename& filename);
  70 + void load(const GFilename& cntcube,
  71 + const GFilename& expcube,
  72 + const GFilename& psfcube,
  73 + const GFilename& bkgcube);
  74 + void save(const GFilename& filename,
  75 + const bool& clobber = false) const;
76 76 void response(const std::string& rspname,
77   - const GCaldb& caldb);
  77 + const GCaldb& caldb);
78 78 void response(const GCTACubeExposure& expcube,
79 79 const GCTACubePsf& psfcube,
80 80 const GCTACubeBackground& bkgcube);
... ... @@ -94,8 +94,8 @@ public:
94 94 void ontime(const double& ontime);
95 95 void livetime(const double& livetime);
96 96 void deadc(const double& deadc);
97   - void eventfile(const std::string& filename);
98   - const std::string& eventfile(void) const;
  97 + void eventfile(const GFilename& filename);
  98 + const GFilename& eventfile(void) const;
99 99 std::string eventtype(void) const;
100 100 void dispose_events(void);
101 101 const double& lo_user_thres(void) const;
... ...
inst/cta/pyext/GCTAOnOffObservations.i
... ... @@ -39,7 +39,7 @@ public:
39 39 // Constructors and destructors
40 40 GCTAOnOffObservations(void);
41 41 GCTAOnOffObservations(const GCTAOnOffObservations& obs);
42   - explicit GCTAOnOffObservations(const std::string& filename);
  42 + explicit GCTAOnOffObservations(const GFilename& filename);
43 43 virtual ~GCTAOnOffObservations(void);
44 44  
45 45 // Methods
... ... @@ -57,12 +57,12 @@ public:
57 57 void extend(const GCTAOnOffObservations& obs);
58 58 bool contains(const std::string& instrument,
59 59 const std::string& id) const;
60   - void load(const std::string& filename);
61   - void save(const std::string& filename) const;
  60 + void load(const GFilename& filename);
  61 + void save(const GFilename& filename) const;
62 62 void read(const GXml& xml);
63 63 void write(GXml& xml) const;
64 64 void models(const GModels& models);
65   - void models(const std::string& filename);
  65 + void models(const GFilename& filename);
66 66 const GModels& models(void) const;
67 67 };
68 68  
... ...
inst/cta/pyext/GCTAPointing.i
1 1 /***************************************************************************
2 2 * GCTAPointing.i - CTA pointing class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Jurgen Knodlseder *
  4 + * copyright (C) 2010-2016 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -25,6 +25,7 @@
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
  28 +#include "GHorizDir.hpp"
28 29 #include "GCTAPointing.hpp"
29 30 %}
30 31  
... ... @@ -40,7 +41,7 @@ public:
40 41 GCTAPointing(void);
41 42 explicit GCTAPointing(const GSkyDir& dir);
42 43 explicit GCTAPointing(const GXmlElement& xml);
43   - explicit GCTAPointing(const std::string& filename);
  44 + explicit GCTAPointing(const GFilename& filename);
44 45 GCTAPointing(const GCTAPointing& pnt);
45 46 virtual ~GCTAPointing(void);
46 47  
... ... @@ -58,7 +59,7 @@ public:
58 59 void zenith(const double& zenith);
59 60 void azimuth(const double& azimuth);
60 61 GHorizDir dir_horiz(const GTime& time) const;
61   - void load(const std::string& filename);
  62 + void load(const GFilename& filename);
62 63 void read(const GFitsTable& table);
63 64 void read(const GXmlElement& xml);
64 65 void write(GXmlElement& xml) const;
... ...
inst/cta/pyext/GCTAPsf.i
1 1 /***************************************************************************
2 2 * GCTAPsf.i - CTA point spread function base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAPsf.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -56,8 +55,8 @@ public:
56 55 virtual void clear(void) = 0;
57 56 virtual GCTAPsf* clone(void) const = 0;
58 57 virtual std::string classname(void) const = 0;
59   - virtual void load(const std::string& filename) = 0;
60   - virtual std::string filename(void) const = 0;
  58 + virtual void load(const GFilename& filename) = 0;
  59 + virtual GFilename filename(void) const = 0;
61 60 virtual double mc(GRan& ran,
62 61 const double& logE,
63 62 const double& theta = 0.0,
... ...
inst/cta/pyext/GCTAPsf2D.i
1 1 /***************************************************************************
2 2 * GCTAPsf2D.i - CTA 2D point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAPsf2D.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -40,7 +39,7 @@ class GCTAPsf2D : public GCTAPsf {
40 39 public:
41 40 // Constructors and destructors
42 41 GCTAPsf2D(void);
43   - explicit GCTAPsf2D(const std::string& filename);
  42 + explicit GCTAPsf2D(const GFilename& filename);
44 43 GCTAPsf2D(const GCTAPsf2D& psf);
45 44 virtual ~GCTAPsf2D(void);
46 45  
... ... @@ -57,8 +56,8 @@ public:
57 56 void clear(void);
58 57 GCTAPsf2D* clone(void) const;
59 58 std::string classname(void) const;
60   - void load(const std::string& filename);
61   - std::string filename(void) const;
  59 + void load(const GFilename& filename);
  60 + GFilename filename(void) const;
62 61 double mc(GRan& ran,
63 62 const double& logE,
64 63 const double& theta = 0.0,
... ... @@ -84,8 +83,8 @@ public:
84 83 void table(const GCTAResponseTable& table);
85 84 void read(const GFitsTable& table);
86 85 void write(GFitsBinTable& table) const;
87   - void save(const std::string& filename,
88   - const bool& clobber = false) const;
  86 + void save(const GFilename& filename,
  87 + const bool& clobber = false) const;
89 88  
90 89 };
91 90  
... ...
inst/cta/pyext/GCTAPsfKing.i
1 1 /***************************************************************************
2 2 * GCTAPsfKing.i - King profile CTA point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2013-2015 by Michael Mayer *
  4 + * copyright (C) 2013-2016 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,7 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAPsfKing.hpp"
29   -#include "GTools.hpp"
  29 +//#include "GTools.hpp"
30 30 %}
31 31  
32 32  
... ... @@ -42,7 +42,7 @@ class GCTAPsfKing : public GCTAPsf {
42 42 public:
43 43 // Constructors and destructors
44 44 GCTAPsfKing(void);
45   - explicit GCTAPsfKing(const std::string& filename);
  45 + explicit GCTAPsfKing(const GFilename& filename);
46 46 GCTAPsfKing(const GCTAPsfKing& psf);
47 47 virtual ~GCTAPsfKing(void);
48 48  
... ... @@ -59,8 +59,8 @@ public:
59 59 void clear(void);
60 60 GCTAPsfKing* clone(void) const;
61 61 std::string classname(void) const;
62   - void load(const std::string& filename);
63   - std::string filename(void) const;
  62 + void load(const GFilename& filename);
  63 + GFilename filename(void) const;
64 64 double mc(GRan& ran,
65 65 const double& logE,
66 66 const double& theta = 0.0,
... ... @@ -82,12 +82,12 @@ public:
82 82 const double& azimuth = 0.0,
83 83 const bool& etrue = true) const;
84 84 // Methods
85   - const GCTAResponseTable& table(void) const;
86   - void table(const GCTAResponseTable& table);
87   - void read(const GFitsTable& table);
88   - void write(GFitsBinTable& table) const;
89   - void save(const std::string& filename,
90   - const bool& clobber = false) const;
  85 + const GCTAResponseTable& table(void) const;
  86 + void table(const GCTAResponseTable& table);
  87 + void read(const GFitsTable& table);
  88 + void write(GFitsBinTable& table) const;
  89 + void save(const GFilename& filename,
  90 + const bool& clobber = false) const;
91 91 };
92 92  
93 93  
... ...
inst/cta/pyext/GCTAPsfPerfTable.i
1 1 /***************************************************************************
2 2 * GCTAPsfPerfTable.i - CTA performance table PSF class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAPsfPerfTable.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -40,7 +39,7 @@ class GCTAPsfPerfTable : public GCTAPsf {
40 39 public:
41 40 // Constructors and destructors
42 41 GCTAPsfPerfTable(void);
43   - GCTAPsfPerfTable(const std::string& filename);
  42 + GCTAPsfPerfTable(const GFilename& filename);
44 43 GCTAPsfPerfTable(const GCTAPsfPerfTable& psf);
45 44 virtual ~GCTAPsfPerfTable(void);
46 45  
... ... @@ -57,8 +56,8 @@ public:
57 56 void clear(void);
58 57 GCTAPsfPerfTable* clone(void) const;
59 58 std::string classname(void) const;
60   - void load(const std::string& filename);
61   - std::string filename(void) const;
  59 + void load(const GFilename& filename);
  60 + GFilename filename(void) const;
62 61 double mc(GRan& ran,
63 62 const double& logE,
64 63 const double& theta = 0.0,
... ...
inst/cta/pyext/GCTAPsfVector.i
1 1 /***************************************************************************
2 2 * GCTAPsfVector.i - CTA point spread function vector class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GCTAPsfVector.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -43,7 +42,7 @@ class GCTAPsfVector : public GCTAPsf {
43 42 public:
44 43 // Constructors and destructors
45 44 GCTAPsfVector(void);
46   - GCTAPsfVector(const std::string& filename);
  45 + GCTAPsfVector(const GFilename& filename);
47 46 GCTAPsfVector(const GCTAPsfVector& psf);
48 47 virtual ~GCTAPsfVector(void);
49 48  
... ... @@ -60,8 +59,8 @@ public:
60 59 void clear(void);
61 60 GCTAPsfVector* clone(void) const;
62 61 std::string classname(void) const;
63   - void load(const std::string& filename);
64   - std::string filename(void) const;
  62 + void load(const GFilename& filename);
  63 + GFilename filename(void) const;
65 64 double mc(GRan& ran,
66 65 const double& logE,
67 66 const double& theta = 0.0,
... ...
inst/cta/pyext/GCTAResponseIrf.i
1 1 /***************************************************************************
2 2 * GCTAResponseIrf.i - CTA instrument response function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -129,10 +129,10 @@ public:
129 129 void caldb(const GCaldb& caldb);
130 130 const GCaldb& caldb(void) const;
131 131 void load(const std::string& rspname);
132   - void load_aeff(const std::string& filename);
133   - void load_psf(const std::string& filename);
134   - void load_edisp(const std::string& filename);
135   - void load_background(const std::string& filename);
  132 + void load_aeff(const GFilename& filename);
  133 + void load_psf(const GFilename& filename);
  134 + void load_edisp(const GFilename& filename);
  135 + void load_background(const GFilename& filename);
136 136 void offset_sigma(const double& sigma);
137 137 double offset_sigma(void) const;
138 138 const GCTAAeff* aeff(void) const;
... ...
inst/cta/src/GCTAAeff2D.cpp
... ... @@ -76,7 +76,7 @@ GCTAAeff2D::GCTAAeff2D(void) : GCTAAeff()
76 76 *
77 77 * Constructs effective area from a FITS file.
78 78 ***************************************************************************/
79   -GCTAAeff2D::GCTAAeff2D(const std::string& filename) : GCTAAeff()
  79 +GCTAAeff2D::GCTAAeff2D(const GFilename& filename) : GCTAAeff()
80 80 {
81 81 // Initialise class members
82 82 init_members();
... ... @@ -352,19 +352,13 @@ void GCTAAeff2D::write(GFitsBinTable&amp; table) const
352 352 * If no extension name is provided, the effective area will be loaded from
353 353 * the "EFFECTIVE AREA" extension.
354 354 ***************************************************************************/
355   -void GCTAAeff2D::load(const std::string& filename)
  355 +void GCTAAeff2D::load(const GFilename& filename)
356 356 {
357   - // Create file name
358   - GFilename fname(filename);
359   -
360   - // Allocate FITS file
361   - GFits file;
362   -
363 357 // Open FITS file
364   - file.open(fname);
  358 + GFits file(filename);
365 359  
366 360 // Get effective area table
367   - const GFitsTable& table = *file.table(fname.extname("EFFECTIVE AREA"));
  361 + const GFitsTable& table = *file.table(filename.extname("EFFECTIVE AREA"));
368 362  
369 363 // Read effective area from table
370 364 read(table);
... ... @@ -386,27 +380,43 @@ void GCTAAeff2D::load(const std::string&amp; filename)
386 380 * @param[in] filename FITS file name.
387 381 * @param[in] clobber Overwrite existing file? (default: false)
388 382 *
389   - * Save the effectiva area into a FITS file.
  383 + * Saves effectiva area into a FITS file. If a file with the given
  384 + * @p filename does not yet exist it will be created, otherwise the method
  385 + * opens the existing file. The method will create a (or replace an existing)
  386 + * effectiva area extension. The extension name can be specified as part
  387 + * of the @p filename, or if no extension name is given, is assumed to be
  388 + * "EFFECTIVE AREA".
390 389 *
391   - * If no extension name is provided, the effective area will be saved into
392   - * the "EFFECTIVE AREA" extension.
  390 + * An existing file will only be modified if the @p clobber flag is set to
  391 + * true.
393 392 ***************************************************************************/
394   -void GCTAAeff2D::save(const std::string& filename, const bool& clobber) const
  393 +void GCTAAeff2D::save(const GFilename& filename, const bool& clobber) const
395 394 {
396   - // Create file name
397   - GFilename fname(filename);
  395 + // Get extension name
  396 + std::string extname = filename.extname("EFFECTIVE AREA");
  397 +
  398 + // Open or create FITS file
  399 + GFits fits(filename, true);
  400 +
  401 + // Remove extension if it exists already
  402 + if (fits.contains(extname)) {
  403 + fits.remove(extname);
  404 + }
398 405  
399 406 // Create binary table
400 407 GFitsBinTable table;
401   - table.extname(fname.extname("EFFECTIVE AREA"));
402 408  
403   - // Write the Effective area table
  409 + // Write the background table
404 410 write(table);
405 411  
406   - // Create FITS file, append table, and write into the file
407   - GFits fits;
  412 + // Set binary table extension name
  413 + table.extname(extname);
  414 +
  415 + // Append table to FITS file
408 416 fits.append(table);
409   - fits.saveto(fname, clobber);
  417 +
  418 + // Save to file
  419 + fits.save(clobber);
410 420  
411 421 // Return
412 422 return;
... ...
inst/cta/src/GCTAAeffArf.cpp
... ... @@ -77,7 +77,7 @@ GCTAAeffArf::GCTAAeffArf(void) : GCTAAeff()
77 77 *
78 78 * Constructs effective area from an ARF FITS file.
79 79 ***************************************************************************/
80   -GCTAAeffArf::GCTAAeffArf(const std::string& filename) : GCTAAeff()
  80 +GCTAAeffArf::GCTAAeffArf(const GFilename& filename) : GCTAAeff()
81 81 {
82 82 // Initialise class members
83 83 init_members();
... ... @@ -247,19 +247,13 @@ GCTAAeffArf* GCTAAeffArf::clone(void) const
247 247 * If no extension name is provided, the effective area will be loaded from
248 248 * the "SPECRESP" extension.
249 249 ***************************************************************************/
250   -void GCTAAeffArf::load(const std::string& filename)
  250 +void GCTAAeffArf::load(const GFilename& filename)
251 251 {
252   - // Create file name
253   - GFilename fname(filename);
254   -
255   - // Allocate FITS file
256   - GFits file;
257   -
258 252 // Open FITS file
259   - file.open(fname);
  253 + GFits file(filename);
260 254  
261 255 // Get ARF table
262   - const GFitsTable& table = *file.table(fname.extname("SPECRESP"));
  256 + const GFitsTable& table = *file.table(filename.extname("SPECRESP"));
263 257  
264 258 // Read ARF from table
265 259 read(table);
... ...
inst/cta/src/GCTAAeffPerfTable.cpp
1 1 /***************************************************************************
2 2 * GCTAAeffPerfTable.hpp - CTA performance table effective area class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -74,7 +74,7 @@ GCTAAeffPerfTable::GCTAAeffPerfTable(void) : GCTAAeff()
74 74 * Construct instance by loading the effective area information from an
75 75 * ASCII performance table.
76 76 ***************************************************************************/
77   -GCTAAeffPerfTable::GCTAAeffPerfTable(const std::string& filename) : GCTAAeff()
  77 +GCTAAeffPerfTable::GCTAAeffPerfTable(const GFilename& filename) : GCTAAeff()
78 78 {
79 79 // Initialise class members
80 80 init_members();
... ... @@ -245,7 +245,7 @@ GCTAAeffPerfTable* GCTAAeffPerfTable::clone(void) const
245 245 * This method loads the effective area information from an ASCII
246 246 * performance table.
247 247 ***************************************************************************/
248   -void GCTAAeffPerfTable::load(const std::string& filename)
  248 +void GCTAAeffPerfTable::load(const GFilename& filename)
249 249 {
250 250 // Clear arrays
251 251 m_logE.clear();
... ... @@ -255,13 +255,10 @@ void GCTAAeffPerfTable::load(const std::string&amp; filename)
255 255 const int n = 1000;
256 256 char line[n];
257 257  
258   - // Expand environment variables
259   - std::string fname = gammalib::expand_env(filename);
260   -
261 258 // Open performance table readonly
262   - FILE* fptr = std::fopen(fname.c_str(), "r");
  259 + FILE* fptr = std::fopen(filename.url().c_str(), "r");
263 260 if (fptr == NULL) {
264   - throw GCTAException::file_open_error(G_LOAD, fname);
  261 + throw GCTAException::file_open_error(G_LOAD, filename.url());
265 262 }
266 263  
267 264 // Read lines
... ...
inst/cta/src/GCTABackground3D.cpp
... ... @@ -81,7 +81,7 @@ GCTABackground3D::GCTABackground3D(void) : GCTABackground()
81 81 *
82 82 * Constructs background from a FITS file.
83 83 ***************************************************************************/
84   -GCTABackground3D::GCTABackground3D(const std::string& filename) :
  84 +GCTABackground3D::GCTABackground3D(const GFilename& filename) :
85 85 GCTABackground()
86 86 {
87 87 // Initialise class members
... ... @@ -404,25 +404,19 @@ void GCTABackground3D::write(GFitsBinTable&amp; table) const
404 404 * If no extension name is provided, the background will be loaded from the
405 405 * "BACKGROUND" extension.
406 406 ***************************************************************************/
407   -void GCTABackground3D::load(const std::string& filename)
  407 +void GCTABackground3D::load(const GFilename& filename)
408 408 {
409   - // Create file name
410   - GFilename fname(filename);
411   -
412   - // Allocate FITS file
413   - GFits file;
414   -
415 409 // Open FITS file
416   - file.open(fname);
  410 + GFits fits(filename);
417 411  
418 412 // Get background table
419   - const GFitsTable& table = *file.table(fname.extname("BACKGROUND"));
  413 + const GFitsTable& table = *fits.table(filename.extname("BACKGROUND"));
420 414  
421 415 // Read effective area from table
422 416 read(table);
423 417  
424 418 // Close FITS file
425   - file.close();
  419 + fits.close();
426 420  
427 421 // Store filename
428 422 m_filename = filename;
... ... @@ -435,30 +429,46 @@ void GCTABackground3D::load(const std::string&amp; filename)
435 429 /***********************************************************************//**
436 430 * @brief Save background into FITS file
437 431 *
438   - * @param[in] filename background table FITS file name.
  432 + * @param[in] filename Background table FITS file name.
439 433 * @param[in] clobber Overwrite existing file? (default: false)
440 434 *
441   - * Save the background into a FITS file.
  435 + * Saves background into a FITS file. If a file with the given @p filename
  436 + * does not yet exist it will be created, otherwise the method opens the
  437 + * existing file. The method will create a (or replace an existing)
  438 + * background extension. The extension name can be specified as part
  439 + * of the @p filename, or if no extension name is given, is assumed to be
  440 + * "BACKGROUND".
442 441 *
443   - * If no extension name is provided, the background will be saved into the
444   - * "BACKGROUND" extension.
  442 + * An existing file will only be modified if the @p clobber flag is set to
  443 + * true.
445 444 ***************************************************************************/
446   -void GCTABackground3D::save(const std::string& filename, const bool& clobber) const
  445 +void GCTABackground3D::save(const GFilename& filename, const bool& clobber) const
447 446 {
448   - // Create file name
449   - GFilename fname(filename);
  447 + // Get extension name
  448 + std::string extname = filename.extname("BACKGROUND");
  449 +
  450 + // Open or create FITS file
  451 + GFits fits(filename, true);
  452 +
  453 + // Remove extension if it exists already
  454 + if (fits.contains(extname)) {
  455 + fits.remove(extname);
  456 + }
450 457  
451 458 // Create binary table
452 459 GFitsBinTable table;
453   - table.extname(fname.extname("BACKGROUND"));
454 460  
455 461 // Write the background table
456 462 write(table);
457 463  
458   - // Create FITS file, append table, and write into the file
459   - GFits fits;
  464 + // Set binary table extension name
  465 + table.extname(extname);
  466 +
  467 + // Append table to FITS file
460 468 fits.append(table);
461   - fits.saveto(fname, clobber);
  469 +
  470 + // Save to file
  471 + fits.save(clobber);
462 472  
463 473 // Return
464 474 return;
... ...
inst/cta/src/GCTABackgroundPerfTable.cpp
1 1 /***************************************************************************
2 2 * GCTABackgroundPerfTable.cpp - CTA performance table background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -35,7 +35,7 @@
35 35 #include "GCTABackgroundPerfTable.hpp"
36 36  
37 37 /* __ Method name definitions ____________________________________________ */
38   -#define G_LOAD "GCTABackgroundPerfTable::load(std::string&)"
  38 +#define G_LOAD "GCTABackgroundPerfTable::load(GFilename&)"
39 39 #define G_MC "GCTABackgroundPerfTable::mc(GEnergy&, GTime&, GRan&)"
40 40  
41 41 /* __ Macros _____________________________________________________________ */
... ... @@ -76,7 +76,7 @@ GCTABackgroundPerfTable::GCTABackgroundPerfTable(void) : GCTABackground()
76 76 * Construct instance by loading the background information from a
77 77 * performance table.
78 78 ***************************************************************************/
79   -GCTABackgroundPerfTable::GCTABackgroundPerfTable(const std::string& filename) :
  79 +GCTABackgroundPerfTable::GCTABackgroundPerfTable(const GFilename& filename) :
80 80 GCTABackground()
81 81 {
82 82 // Initialise class members
... ... @@ -244,7 +244,7 @@ GCTABackgroundPerfTable* GCTABackgroundPerfTable::clone(void) const
244 244 *
245 245 * Loads the background information from a performance table.
246 246 ***************************************************************************/
247   -void GCTABackgroundPerfTable::load(const std::string& filename)
  247 +void GCTABackgroundPerfTable::load(const GFilename& filename)
248 248 {
249 249 // Clear arrays
250 250 m_logE.clear();
... ... @@ -254,13 +254,10 @@ void GCTABackgroundPerfTable::load(const std::string&amp; filename)
254 254 const int n = 1000;
255 255 char line[n];
256 256  
257   - // Expand environment variables
258   - std::string fname = gammalib::expand_env(filename);
259   -
260 257 // Open performance table readonly
261   - FILE* fptr = std::fopen(fname.c_str(), "r");
  258 + FILE* fptr = std::fopen(filename.url().c_str(), "r");
262 259 if (fptr == NULL) {
263   - throw GException::file_open_error(G_LOAD, fname);
  260 + throw GException::file_open_error(G_LOAD, filename.url());
264 261 }
265 262  
266 263 // Read lines
... ...
inst/cta/src/GCTACubeBackground.cpp
1 1 /***************************************************************************
2 2 * GCTACubeBackground.cpp - CTA cube background class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2015 by Michael Mayer *
  4 + * copyright (C) 2015-2016 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -86,7 +86,7 @@ GCTACubeBackground::GCTACubeBackground(void)
86 86 *
87 87 * Construct instance by loading the background information from a FITS file.
88 88 ***************************************************************************/
89   -GCTACubeBackground::GCTACubeBackground(const std::string& filename)
  89 +GCTACubeBackground::GCTACubeBackground(const GFilename& filename)
90 90 {
91 91 // Initialise class members
92 92 init_members();
... ... @@ -500,7 +500,7 @@ void GCTACubeBackground::write(GFits&amp; fits) const
500 500 *
501 501 * Loads the background cube from a FITS file.
502 502 ***************************************************************************/
503   -void GCTACubeBackground::load(const std::string& filename)
  503 +void GCTACubeBackground::load(const GFilename& filename)
504 504 {
505 505 // Open FITS file
506 506 GFits fits(filename);
... ... @@ -528,10 +528,10 @@ void GCTACubeBackground::load(const std::string&amp; filename)
528 528 *
529 529 * Save the background cube into a FITS file.
530 530 ***************************************************************************/
531   -void GCTACubeBackground::save(const std::string& filename,
532   - const bool& clobber) const
  531 +void GCTACubeBackground::save(const GFilename& filename,
  532 + const bool& clobber) const
533 533 {
534   - // Create empty FITS file
  534 + // Open or create FITS file
535 535 GFits fits;
536 536  
537 537 // Write background cube
... ...
inst/cta/src/GCTACubeExposure.cpp
... ... @@ -28,13 +28,15 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
  31 +#include "GTools.hpp"
  32 +#include "GMath.hpp"
  33 +#include "GLog.hpp"
  34 +#include "GObservations.hpp"
31 35 #include "GCTACubeExposure.hpp"
32 36 #include "GCTAObservation.hpp"
33 37 #include "GCTAResponseIrf.hpp"
  38 +#include "GCTAEventCube.hpp"
34 39 #include "GCTAEventList.hpp"
35   -#include "GMath.hpp"
36   -#include "GTools.hpp"
37   -#include "GLog.hpp"
38 40  
39 41 /* __ Method name definitions ____________________________________________ */
40 42 #define G_SET "GCTACubeExposure::set(GCTAObservation&)"
... ... @@ -95,7 +97,7 @@ GCTACubeExposure::GCTACubeExposure(const GCTACubeExposure&amp; cube)
95 97 * Construct exposure cube by loading the information from an exposure cube
96 98 * file.
97 99 ***************************************************************************/
98   -GCTACubeExposure::GCTACubeExposure(const std::string& filename)
  100 +GCTACubeExposure::GCTACubeExposure(const GFilename& filename)
99 101 {
100 102 // Initialise class members
101 103 init_members();
... ... @@ -580,7 +582,7 @@ void GCTACubeExposure::write(GFits&amp; fits) const
580 582 *
581 583 * Loads the exposure cube from a FITS file into the object.
582 584 ***************************************************************************/
583   -void GCTACubeExposure::load(const std::string& filename)
  585 +void GCTACubeExposure::load(const GFilename& filename)
584 586 {
585 587 // Open FITS file
586 588 GFits fits(filename);
... ... @@ -603,15 +605,13 @@ void GCTACubeExposure::load(const std::string&amp; filename)
603 605 * @brief Save exposure cube into FITS file
604 606 *
605 607 * @param[in] filename Exposure cube FITS file name.
606   - * @param[in] clobber Overwrite existing file? (true=yes)
  608 + * @param[in] clobber Overwrite existing file? (default: false)
607 609 *
608 610 * Save the exposure cube into a FITS file.
609   - *
610   - * @todo Implement method
611 611 ***************************************************************************/
612   -void GCTACubeExposure::save(const std::string& filename, const bool& clobber) const
  612 +void GCTACubeExposure::save(const GFilename& filename, const bool& clobber) const
613 613 {
614   - // Create empty FITS file
  614 + // Create FITS file
615 615 GFits fits;
616 616  
617 617 // Write exposure cube
... ...
inst/cta/src/GCTACubePsf.cpp
1 1 /***************************************************************************
2 2 * GCTACubePsf.cpp - CTA cube analysis point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -28,13 +28,15 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
  31 +#include "GTools.hpp"
  32 +#include "GMath.hpp"
  33 +#include "GLog.hpp"
  34 +#include "GObservations.hpp"
31 35 #include "GCTACubePsf.hpp"
32 36 #include "GCTAObservation.hpp"
33 37 #include "GCTAResponseIrf.hpp"
34 38 #include "GCTAEventList.hpp"
35   -#include "GMath.hpp"
36   -#include "GTools.hpp"
37   -#include "GLog.hpp"
  39 +#include "GCTAEventCube.hpp"
38 40  
39 41 /* __ Method name definitions ____________________________________________ */
40 42 #define G_SET "GCTACubePsf::set(GCTAObservation&)"
... ... @@ -96,7 +98,7 @@ GCTACubePsf::GCTACubePsf(const GCTACubePsf&amp; cube)
96 98 *
97 99 * Construct PSF cube by loading the information from a PSF cube file.
98 100 ***************************************************************************/
99   -GCTACubePsf::GCTACubePsf(const std::string& filename)
  101 +GCTACubePsf::GCTACubePsf(const GFilename& filename)
100 102 {
101 103 // Initialise class members
102 104 init_members();
... ... @@ -685,7 +687,7 @@ void GCTACubePsf::write(GFits&amp; fits) const
685 687 *
686 688 * Loads the PSF cube from a FITS file into the object.
687 689 ***************************************************************************/
688   -void GCTACubePsf::load(const std::string& filename)
  690 +void GCTACubePsf::load(const GFilename& filename)
689 691 {
690 692 // Open FITS file
691 693 GFits fits(filename);
... ... @@ -708,13 +710,13 @@ void GCTACubePsf::load(const std::string&amp; filename)
708 710 * @brief Save PSF cube into FITS file
709 711 *
710 712 * @param[in] filename PSF cube FITS file name.
711   - * @param[in] clobber Overwrite existing file? (true=yes)
  713 + * @param[in] clobber Overwrite existing file? (default: false)
712 714 *
713 715 * Save the PSF cube into a FITS file.
714 716 ***************************************************************************/
715   -void GCTACubePsf::save(const std::string& filename, const bool& clobber) const
  717 +void GCTACubePsf::save(const GFilename& filename, const bool& clobber) const
716 718 {
717   - // Create empty FITS file
  719 + // Create FITS file
718 720 GFits fits;
719 721  
720 722 // Write PSF cube
... ...
inst/cta/src/GCTAEdisp2D.cpp
... ... @@ -32,8 +32,10 @@
32 32 #include <vector>
33 33 #include "GTools.hpp"
34 34 #include "GMath.hpp"
  35 +#include "GException.hpp"
35 36 #include "GIntegral.hpp"
36 37 #include "GFilename.hpp"
  38 +#include "GRan.hpp"
37 39 #include "GFits.hpp"
38 40 #include "GFitsTable.hpp"
39 41 #include "GFitsBinTable.hpp"
... ... @@ -79,7 +81,7 @@ GCTAEdisp2D::GCTAEdisp2D(void) : GCTAEdisp()
79 81 *
80 82 * Constructs energy dispersion from a FITS file.
81 83 ***************************************************************************/
82   -GCTAEdisp2D::GCTAEdisp2D(const std::string& filename) : GCTAEdisp()
  84 +GCTAEdisp2D::GCTAEdisp2D(const GFilename& filename) : GCTAEdisp()
83 85 {
84 86  
85 87 // Initialise class members
... ... @@ -416,19 +418,13 @@ void GCTAEdisp2D::write(GFitsBinTable&amp; table) const
416 418 * If no extension name is provided, the energy dispersion will be loaded
417 419 * from the "ENERGY DISPERSION" extension.
418 420 ***************************************************************************/
419   -void GCTAEdisp2D::load(const std::string& filename)
  421 +void GCTAEdisp2D::load(const GFilename& filename)
420 422 {
421   - // Create file name
422   - GFilename fname(filename);
423   -
424   - // Allocate FITS file
425   - GFits file;
426   -
427 423 // Open FITS file
428   - file.open(fname);
  424 + GFits file(filename);
429 425  
430 426 // Get energy dispersion table
431   - const GFitsTable& table = *file.table(fname.extname("ENERGY DISPERSION"));
  427 + const GFitsTable& table = *file.table(filename.extname("ENERGY DISPERSION"));
432 428  
433 429 // Read energy dispersion from table
434 430 read(table);
... ... @@ -450,27 +446,43 @@ void GCTAEdisp2D::load(const std::string&amp; filename)
450 446 * @param[in] filename FITS file name.
451 447 * @param[in] clobber Overwrite existing file? (default: false)
452 448 *
453   - * Save the energy dispersion table into FITS file.
  449 + * Saves energy dispersion into a FITS file. If a file with the given
  450 + * @p filename does not yet exist it will be created, otherwise the method
  451 + * opens the existing file. The method will create a (or replace an existing)
  452 + * energy dispersion extension. The extension name can be specified as part
  453 + * of the @p filename, or if no extension name is given, is assumed to be
  454 + * "ENERGY DISPERSION".
454 455 *
455   - * If no extension name is provided, the energy dispersion will be saved into
456   - * the "ENERGY DISPERSION" extension.
  456 + * An existing file will only be modified if the @p clobber flag is set to
  457 + * true.
457 458 ***************************************************************************/
458   -void GCTAEdisp2D::save(const std::string& filename, const bool& clobber) const
  459 +void GCTAEdisp2D::save(const GFilename& filename, const bool& clobber) const
459 460 {
460   - // Create file name
461   - GFilename fname(filename);
  461 + // Get extension name
  462 + std::string extname = filename.extname("ENERGY DISPERSION");
  463 +
  464 + // Open or create FITS file
  465 + GFits fits(filename, true);
  466 +
  467 + // Remove extension if it exists already
  468 + if (fits.contains(extname)) {
  469 + fits.remove(extname);
  470 + }
462 471  
463 472 // Create binary table
464 473 GFitsBinTable table;
465   - table.extname(fname.extname("ENERGY DISPERSION"));
466 474  
467   - // Write the energy dispersion table
  475 + // Write the background table
468 476 write(table);
469 477  
470   - // Create FITS file, append table, and write into the file
471   - GFits fits;
  478 + // Set binary table extension name
  479 + table.extname(extname);
  480 +
  481 + // Append table to FITS file
472 482 fits.append(table);
473   - fits.saveto(fname, clobber);
  483 +
  484 + // Save to file
  485 + fits.save(clobber);
474 486  
475 487 // Return
476 488 return;
... ...
inst/cta/src/GCTAEdispPerfTable.cpp
... ... @@ -32,11 +32,12 @@
32 32 #include <cmath>
33 33 #include "GTools.hpp"
34 34 #include "GMath.hpp"
  35 +#include "GRan.hpp"
35 36 #include "GCTAEdispPerfTable.hpp"
36 37 #include "GCTAException.hpp"
37 38  
38 39 /* __ Method name definitions ____________________________________________ */
39   -#define G_LOAD "GCTAEdispPerfTable::load(std::string&)"
  40 +#define G_LOAD "GCTAEdispPerfTable::load(GFilename&)"
40 41  
41 42 /* __ Macros _____________________________________________________________ */
42 43  
... ... @@ -74,7 +75,7 @@ GCTAEdispPerfTable::GCTAEdispPerfTable(void) : GCTAEdisp()
74 75 * Construct instance by loading the energy dispersion information from
75 76 * an ASCII performance table.
76 77 ***************************************************************************/
77   -GCTAEdispPerfTable::GCTAEdispPerfTable(const std::string& filename) :
  78 +GCTAEdispPerfTable::GCTAEdispPerfTable(const GFilename& filename) :
78 79 GCTAEdisp()
79 80 {
80 81 // Initialise class members
... ... @@ -247,7 +248,7 @@ GCTAEdispPerfTable* GCTAEdispPerfTable::clone(void) const
247 248 * this internally to a sigma value by multiplying the stored values by
248 249 * 1/ln(10).
249 250 ***************************************************************************/
250   -void GCTAEdispPerfTable::load(const std::string& filename)
  251 +void GCTAEdispPerfTable::load(const GFilename& filename)
251 252 {
252 253  
253 254 // Clear arrays
... ... @@ -258,13 +259,10 @@ void GCTAEdispPerfTable::load(const std::string&amp; filename)
258 259 const int n = 1000;
259 260 char line[n];
260 261  
261   - // Expand environment variables
262   - std::string fname = gammalib::expand_env(filename);
263   -
264 262 // Open performance table readonly
265   - FILE* fptr = std::fopen(fname.c_str(), "r");
  263 + FILE* fptr = std::fopen(filename.url().c_str(), "r");
266 264 if (fptr == NULL) {
267   - throw GCTAException::file_open_error(G_LOAD, fname);
  265 + throw GCTAException::file_open_error(G_LOAD, filename.url());
268 266 }
269 267  
270 268 // Read lines
... ... @@ -290,15 +288,10 @@ void GCTAEdispPerfTable::load(const std::string&amp; filename)
290 288  
291 289 // Push elements in node array and vector
292 290 m_logE.append(gammalib::todouble(elements[0]));
  291 +
293 292 // The energy resolution is stored as RMS(ln(Eest/Etrue))
294 293 m_sigma.push_back(gammalib::todouble(elements[4]) * gammalib::inv_ln10);
295 294  
296   - // The energy resolution is stored as RMS(Eest/Etrue)
297   - //m_sigma.push_back(std::log10(gammalib::todouble(elements[4])));
298   -
299   - // The energy resolution is stored as RMS(log10(Eest/Etrue))
300   - //m_sigma.push_back(gammalib::todouble(elements[4]));
301   -
302 295 } // endwhile: looped over lines
303 296  
304 297 // Close file
... ...
inst/cta/src/GCTAEdispRmf.cpp
1 1 /***************************************************************************
2 2 * GCTAEdispRmf.cpp - CTA RMF energy dispersion class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Christoph Deil & Ellis Owen *
  4 + * copyright (C) 2014-2016 by Christoph Deil & Ellis Owen *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -31,12 +31,18 @@
31 31 #include <cmath>
32 32 #include "GTools.hpp"
33 33 #include "GMath.hpp"
  34 +#include "GFilename.hpp"
  35 +#include "GRan.hpp"
34 36 #include "GIntegral.hpp"
  37 +#include "GFunction.hpp"
35 38 #include "GEnergy.hpp"
  39 +#include "GRmf.hpp"
  40 +#include "GNodeArray.hpp"
  41 +#include "GMatrixSparse.hpp"
36 42 #include "GCTAEdispRmf.hpp"
37 43  
38 44 /* __ Method name definitions ____________________________________________ */
39   -#define G_LOAD "GCTAEdispRmf::load(std::string&)"
  45 +#define G_LOAD "GCTAEdispRmf::load(GFilename&)"
40 46  
41 47 /* __ Macros _____________________________________________________________ */
42 48  
... ... @@ -73,7 +79,7 @@ GCTAEdispRmf::GCTAEdispRmf(void) : GCTAEdisp()
73 79 *
74 80 * Construct instance by loading the Redistribution Matrix File.
75 81 ***************************************************************************/
76   -GCTAEdispRmf::GCTAEdispRmf(const std::string& filename) : GCTAEdisp()
  82 +GCTAEdispRmf::GCTAEdispRmf(const GFilename& filename) : GCTAEdisp()
77 83 {
78 84 // Initialise class members
79 85 init_members();
... ... @@ -232,7 +238,7 @@ GCTAEdispRmf* GCTAEdispRmf::clone(void) const
232 238 *
233 239 * This method loads the energy dispersion information from an RMF file.
234 240 ***************************************************************************/
235   -void GCTAEdispRmf::load(const std::string& filename)
  241 +void GCTAEdispRmf::load(const GFilename& filename)
236 242 {
237 243 // Load RMF file
238 244 m_rmf.load(filename);
... ...
inst/cta/src/GCTAEventList.cpp
... ... @@ -642,8 +642,8 @@ void GCTAEventList::fetch(void) const
642 642 if (!m_filename.is_empty()) {
643 643  
644 644 // Throw an exception if the file does not exist
645   - if (!gammalib::file_exists_gzip(m_filename.url())) {
646   - std::string msg = "File \""+m_filename.url()+"\" not "
  645 + if (!gammalib::file_exists_gzip(m_filename)) {
  646 + std::string msg = "File \""+m_filename+"\" not "
647 647 "found. Cannot fetch events. Maybe the "
648 648 "file has been deleted in the meantime.";
649 649 GException::file_error(G_FETCH, msg);
... ... @@ -683,7 +683,7 @@ void GCTAEventList::fetch(void) const
683 683 // Throw an exception if an exception has occured
684 684 if (has_exception) {
685 685 std::string msg = "Unable to load events from file \""+
686   - m_filename.url()+"\".";
  686 + m_filename+"\".";
687 687 throw GException::file_error(G_FETCH, msg);
688 688 }
689 689  
... ... @@ -763,9 +763,7 @@ std::string GCTAEventList::print(const GChatter&amp; chatter) const
763 763 gammalib::str(size()));
764 764 if (m_events.empty()) {
765 765 if (!m_filename.is_empty()) {
766   - result.append(" (disposed in \"");
767   - result.append(m_filename.url());
768   - result.append("\")");
  766 + result.append(" (disposed in \""+m_filename+"\")");
769 767 }
770 768 else {
771 769 result.append(" (disposed without possibility to recover)");
... ...
inst/cta/src/GCTAObservation.cpp
... ... @@ -62,8 +62,8 @@ const GObservationRegistry g_obs_veritas_registry(&amp;g_obs_veritas_seed);
62 62 #define G_EBOUNDS "GCTAObservation::ebounds()"
63 63 #define G_READ "GCTAObservation::read(GXmlElement&)"
64 64 #define G_WRITE "GCTAObservation::write(GXmlElement&)"
65   -#define G_LOAD "GCTAObservation::load(std::string&, std::string&, "\
66   - "std::string&, std::string&)"
  65 +#define G_LOAD "GCTAObservation::load(GFilename&, GFilename&, "\
  66 + "GFilename&, GFilename&)"
67 67  
68 68 /* __ Macros _____________________________________________________________ */
69 69  
... ... @@ -128,10 +128,10 @@ GCTAObservation::GCTAObservation(const std::string&amp; instrument) : GObservation()
128 128 * Constructs a CTA observation from a counts cube, an exposure cube, a Psf
129 129 * cube and a background cube.
130 130 ***************************************************************************/
131   -GCTAObservation::GCTAObservation(const std::string& cntcube,
132   - const std::string& expcube,
133   - const std::string& psfcube,
134   - const std::string& bkgcube) : GObservation()
  131 +GCTAObservation::GCTAObservation(const GFilename& cntcube,
  132 + const GFilename& expcube,
  133 + const GFilename& psfcube,
  134 + const GFilename& bkgcube) : GObservation()
135 135 {
136 136 // Initialise members
137 137 init_members();
... ... @@ -837,11 +837,11 @@ void GCTAObservation::write(GXmlElement&amp; xml) const
837 837  
838 838 // If there is an event filename then write the event information to the
839 839 // XML file ...
840   - if (!m_eventfile.empty()) {
  840 + if (!m_eventfile.is_empty()) {
841 841  
842 842 // Write event file name
843 843 GXmlElement* par = gammalib::xml_need_par(G_WRITE, xml, evttype);
844   - par->attribute("file", m_eventfile);
  844 + par->attribute("file", m_eventfile.url());
845 845  
846 846 }
847 847  
... ... @@ -1010,7 +1010,7 @@ void GCTAObservation::write(GFits&amp; fits, const std::string&amp; evtname,
1010 1010 *
1011 1011 * Loads either an event list or a counts cube from a FITS file.
1012 1012 ***************************************************************************/
1013   -void GCTAObservation::load(const std::string& filename)
  1013 +void GCTAObservation::load(const GFilename& filename)
1014 1014 {
1015 1015 // Store event filename
1016 1016 m_eventfile = filename;
... ... @@ -1040,17 +1040,17 @@ void GCTAObservation::load(const std::string&amp; filename)
1040 1040 * Loads a counts map, an exposure cube, a Psf cube and a background cube
1041 1041 * for stacked cube analysis.
1042 1042 ***************************************************************************/
1043   -void GCTAObservation::load(const std::string& cntcube,
1044   - const std::string& expcube,
1045   - const std::string& psfcube,
1046   - const std::string& bkgcube) {
  1043 +void GCTAObservation::load(const GFilename& cntcube,
  1044 + const GFilename& expcube,
  1045 + const GFilename& psfcube,
  1046 + const GFilename& bkgcube) {
1047 1047  
1048 1048 // Load counts cube FITS file
1049 1049 load(cntcube);
1050 1050  
1051 1051 // Check whether we have an event cube
1052 1052 if (dynamic_cast<const GCTAEventCube*>(events()) == NULL) {
1053   - std::string msg = "Specified file \""+cntcube+"\" is not a CTA "
  1053 + std::string msg = "Specified file \""+cntcube.url()+"\" is not a CTA "
1054 1054 "counts cube. Please provide a counts cube.";
1055 1055 throw GException::invalid_argument(G_LOAD, msg);
1056 1056 }
... ... @@ -1096,11 +1096,8 @@ void GCTAObservation::load(const std::string&amp; cntcube,
1096 1096 * energy boundaries and the Good Time Intervals. The extension names of
1097 1097 * these binary tables are "EBOUNDS" and "GTI", and cannot be modified.
1098 1098 ***************************************************************************/
1099   -void GCTAObservation::save(const std::string& filename, const bool& clobber) const
  1099 +void GCTAObservation::save(const GFilename& filename, const bool& clobber) const
1100 1100 {
1101   - // Initialise filename
1102   - GFilename fname(filename);
1103   -
1104 1101 // Set default events and Good Time Intervals extension name and extract
1105 1102 // a possible overwrite from the extension name argument of the filename.
1106 1103 // The specific format that is implemented is [events;gti], where the
... ... @@ -1108,8 +1105,8 @@ void GCTAObservation::save(const std::string&amp; filename, const bool&amp; clobber) con
1108 1105 // after the semi-colon is the Good Time Intervals extension name.
1109 1106 std::string evtname = "EVENTS";
1110 1107 std::string gtiname = "GTI";
1111   - if (fname.has_extname()) {
1112   - std::vector<std::string> extnames = gammalib::split(fname.extname(), ";");
  1108 + if (filename.has_extname()) {
  1109 + std::vector<std::string> extnames = gammalib::split(filename.extname(), ";");
1113 1110 if (extnames.size() > 0) {
1114 1111 evtname = gammalib::strip_whitespace(extnames[0]);
1115 1112 }
... ... @@ -1118,14 +1115,22 @@ void GCTAObservation::save(const std::string&amp; filename, const bool&amp; clobber) con
1118 1115 }
1119 1116 }
1120 1117  
1121   - // Create FITS file
1122   - GFits fits;
  1118 + // Open or create FITS file
  1119 + GFits fits(filename, true);
  1120 +
  1121 + // Remove HDUs if they exist already
  1122 + if (fits.contains(evtname)) {
  1123 + fits.remove(evtname);
  1124 + }
  1125 + if (fits.contains(gtiname)) {
  1126 + fits.remove(gtiname);
  1127 + }
1123 1128  
1124 1129 // Write data into FITS file
1125 1130 write(fits, evtname, gtiname);
1126 1131  
1127 1132 // Save FITS file
1128   - fits.saveto(fname.url(), clobber);
  1133 + fits.save(clobber);
1129 1134  
1130 1135 // Return
1131 1136 return;
... ... @@ -1219,7 +1224,7 @@ std::string GCTAObservation::print(const GChatter&amp; chatter) const
1219 1224 result.append("\n"+gammalib::parformat("Name")+name());
1220 1225 result.append("\n"+gammalib::parformat("Identifier")+id());
1221 1226 result.append("\n"+gammalib::parformat("Instrument")+instrument());
1222   - result.append("\n"+gammalib::parformat("Event file")+eventfile());
  1227 + result.append("\n"+gammalib::parformat("Event file")+eventfile().url());
1223 1228 result.append("\n"+gammalib::parformat("Event type")+eventtype());
1224 1229 result.append("\n"+gammalib::parformat("Statistics")+statistics());
1225 1230 result.append("\n"+gammalib::parformat("Ontime"));
... ...
inst/cta/src/GCTAOnOffObservations.cpp
... ... @@ -29,6 +29,7 @@
29 29 #include <config.h>
30 30 #endif
31 31 #include "GTools.hpp"
  32 +#include "GFilename.hpp"
32 33 #include "GException.hpp"
33 34 #include "GCTAOnOffObservations.hpp"
34 35  
... ... @@ -94,7 +95,7 @@ GCTAOnOffObservations::GCTAOnOffObservations(const GCTAOnOffObservations&amp; obs)
94 95 * from a XML file. Please refer to the read() method for more information
95 96 * about the structure of the XML file.
96 97 ***************************************************************************/
97   -GCTAOnOffObservations::GCTAOnOffObservations(const std::string& filename)
  98 +GCTAOnOffObservations::GCTAOnOffObservations(const GFilename& filename)
98 99 {
99 100 // Initialise members
100 101 init_members();
... ... @@ -492,13 +493,13 @@ bool GCTAOnOffObservations::contains(const std::string&amp; instrument,
492 493 * Loads observation from a XML file into the container. Please refer to the
493 494 * read() method for more information about the structure of the XML file.
494 495 ***************************************************************************/
495   -void GCTAOnOffObservations::load(const std::string& filename)
  496 +void GCTAOnOffObservations::load(const GFilename& filename)
496 497 {
497 498 // Clear any existing observations
498 499 clear();
499 500  
500 501 // Load XML document
501   - GXml xml(filename);
  502 + GXml xml(filename.url());
502 503  
503 504 // Read observations from XML document
504 505 read(xml);
... ... @@ -516,7 +517,7 @@ void GCTAOnOffObservations::load(const std::string&amp; filename)
516 517 * Saves observations into a XML file. Please refer to the read() method for
517 518 * more information about the structure of the XML file.
518 519 ***************************************************************************/
519   -void GCTAOnOffObservations::save(const std::string& filename) const
  520 +void GCTAOnOffObservations::save(const GFilename& filename) const
520 521 {
521 522 // Declare empty XML document
522 523 GXml xml;
... ... @@ -683,7 +684,7 @@ void GCTAOnOffObservations::write(GXml&amp; xml) const
683 684 * method for more information about the expected structure of the XML
684 685 * file.
685 686 ***************************************************************************/
686   -void GCTAOnOffObservations::models(const std::string& filename)
  687 +void GCTAOnOffObservations::models(const GFilename& filename)
687 688 {
688 689 // Load models
689 690 m_models.load(filename);
... ...
inst/cta/src/GCTAPointing.cpp
... ... @@ -30,9 +30,16 @@
30 30 #endif
31 31 #include "GTools.hpp"
32 32 #include "GFilename.hpp"
33   -#include "GCTAPointing.hpp"
34   -#include "GFits.hpp"
  33 +#include "GMatrix.hpp"
  34 +#include "GNodeArray.hpp"
35 35 #include "GHorizDir.hpp"
  36 +#include "GSkyDir.hpp"
  37 +#include "GTime.hpp"
  38 +#include "GTimeReference.hpp"
  39 +#include "GFits.hpp"
  40 +#include "GFitsTable.hpp"
  41 +#include "GCTAPointing.hpp"
  42 +#include "GCTAInstDir.hpp"
36 43  
37 44 /* __ Method name definitions ____________________________________________ */
38 45 #define G_DIR_HORIZ "GCTAPointing::dir_horiz(GTime&)"
... ... @@ -114,7 +121,7 @@ GCTAPointing::GCTAPointing(const GXmlElement&amp; xml)
114 121 *
115 122 * Construct CTA pointing from a pointing table FITS file.
116 123 ***************************************************************************/
117   -GCTAPointing::GCTAPointing(const std::string& filename)
  124 +GCTAPointing::GCTAPointing(const GFilename& filename)
118 125 {
119 126 // Initialise members
120 127 init_members();
... ... @@ -408,19 +415,13 @@ GHorizDir GCTAPointing::dir_horiz(const GTime&amp; time) const
408 415 * If no extension name is provided, the pointing is are loaded from the
409 416 * "POINTING" extension.
410 417 ************************************************************************/
411   -void GCTAPointing::load(const std::string& filename)
  418 +void GCTAPointing::load(const GFilename& filename)
412 419 {
413   - // Create file name
414   - GFilename fname(filename);
415   -
416   - // Allocate FITS file
417   - GFits file;
418   -
419 420 // Open FITS file
420   - file.open(fname);
  421 + GFits file(filename);
421 422  
422 423 // Get pointing table
423   - const GFitsTable& table = *file.table(fname.extname("POINTING"));
  424 + const GFitsTable& table = *file.table(filename.extname("POINTING"));
424 425  
425 426 // Read pointing from table
426 427 read(table);
... ...
inst/cta/src/GCTAPsf2D.cpp
... ... @@ -30,9 +30,10 @@
30 30 #endif
31 31 #include <cmath>
32 32 #include "GTools.hpp"
33   -#include "GException.hpp"
34 33 #include "GMath.hpp"
  34 +#include "GException.hpp"
35 35 #include "GFilename.hpp"
  36 +#include "GRan.hpp"
36 37 #include "GFits.hpp"
37 38 #include "GFitsBinTable.hpp"
38 39 #include "GCTAPsf2D.hpp"
... ... @@ -80,7 +81,7 @@ GCTAPsf2D::GCTAPsf2D(void) : GCTAPsf()
80 81 *
81 82 * Constructs point spread function from a FITS file.
82 83 ***************************************************************************/
83   -GCTAPsf2D::GCTAPsf2D(const std::string& filename) : GCTAPsf()
  84 +GCTAPsf2D::GCTAPsf2D(const GFilename& filename) : GCTAPsf()
84 85 {
85 86 // Initialise class members
86 87 init_members();
... ... @@ -386,25 +387,19 @@ void GCTAPsf2D::write(GFitsBinTable&amp; table) const
386 387 * If no extension name is provided, the point spread function will be loaded
387 388 * from the "POINT SPREAD FUNCTION" extension.
388 389 ***************************************************************************/
389   -void GCTAPsf2D::load(const std::string& filename)
  390 +void GCTAPsf2D::load(const GFilename& filename)
390 391 {
391   - // Create file name
392   - GFilename fname(filename);
393   -
394   - // Allocate FITS file
395   - GFits file;
396   -
397 392 // Open FITS file
398   - file.open(fname);
  393 + GFits fits(filename);
399 394  
400 395 // Get PSFa table
401   - const GFitsTable& table = *file.table(fname.extname("POINT SPREAD FUNCTION"));
  396 + const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION"));
402 397  
403 398 // Read PSF from table
404 399 read(table);
405 400  
406 401 // Close FITS file
407   - file.close();
  402 + fits.close();
408 403  
409 404 // Store filename
410 405 m_filename = filename;
... ... @@ -425,22 +420,33 @@ void GCTAPsf2D::load(const std::string&amp; filename)
425 420 * If no extension name is provided, the point spread function will be saved
426 421 * into the "POINT SPREAD FUNCTION" extension.
427 422 ***************************************************************************/
428   -void GCTAPsf2D::save(const std::string& filename, const bool& clobber) const
  423 +void GCTAPsf2D::save(const GFilename& filename, const bool& clobber) const
429 424 {
430   - // Create file name
431   - GFilename fname(filename);
  425 + // Get extension name
  426 + std::string extname = filename.extname("POINT SPREAD FUNCTION");
  427 +
  428 + // Open or create FITS file
  429 + GFits fits(filename, true);
  430 +
  431 + // Remove extension if it exists already
  432 + if (fits.contains(extname)) {
  433 + fits.remove(extname);
  434 + }
432 435  
433 436 // Create binary table
434 437 GFitsBinTable table;
435   - table.extname(fname.extname("POINT SPREAD FUNCTION"));
436 438  
437   - // Write the PSF table
  439 + // Write the background table
438 440 write(table);
439 441  
440   - // Create FITS file, append table, and write into the file
441   - GFits fits;
  442 + // Set binary table extension name
  443 + table.extname(extname);
  444 +
  445 + // Append table to FITS file
442 446 fits.append(table);
443   - fits.saveto(fname, clobber);
  447 +
  448 + // Save to file
  449 + fits.save(clobber);
444 450  
445 451 // Return
446 452 return;
... ...
inst/cta/src/GCTAPsfKing.cpp
... ... @@ -30,10 +30,12 @@
30 30 #endif
31 31 #include <cmath>
32 32 #include "GTools.hpp"
33   -#include "GException.hpp"
34 33 #include "GMath.hpp"
  34 +#include "GException.hpp"
  35 +#include "GRan.hpp"
35 36 #include "GFilename.hpp"
36 37 #include "GFits.hpp"
  38 +#include "GFitsTable.hpp"
37 39 #include "GFitsBinTable.hpp"
38 40 #include "GCTAPsfKing.hpp"
39 41 #include "GCTAException.hpp"
... ... @@ -85,7 +87,7 @@ GCTAPsfKing::GCTAPsfKing(void) : GCTAPsf()
85 87 *
86 88 * Constructs point spread function from a FITS file.
87 89 ***************************************************************************/
88   -GCTAPsfKing::GCTAPsfKing(const std::string& filename) : GCTAPsf()
  90 +GCTAPsfKing::GCTAPsfKing(const GFilename& filename) : GCTAPsf()
89 91 {
90 92 // Initialise class members
91 93 init_members();
... ... @@ -379,25 +381,19 @@ void GCTAPsfKing::write(GFitsBinTable&amp; table) const
379 381 * If no extension name is provided, the point spread function will be loaded
380 382 * from the "POINT SPREAD FUNCTION" extension.
381 383 ***************************************************************************/
382   -void GCTAPsfKing::load(const std::string& filename)
  384 +void GCTAPsfKing::load(const GFilename& filename)
383 385 {
384   - // Create file name
385   - GFilename fname(filename);
386   -
387   - // Allocate FITS file
388   - GFits file;
389   -
390 386 // Open FITS file
391   - file.open(fname);
  387 + GFits fits(filename);
392 388  
393 389 // Get PSFa table
394   - const GFitsTable& table = *file.table(fname.extname("POINT SPREAD FUNCTION"));
  390 + const GFitsTable& table = *fits.table(filename.extname("POINT SPREAD FUNCTION"));
395 391  
396 392 // Read PSF from table
397 393 read(table);
398 394  
399 395 // Close FITS file
400   - file.close();
  396 + fits.close();
401 397  
402 398 // Store filename
403 399 m_filename = filename;
... ... @@ -412,27 +408,43 @@ void GCTAPsfKing::load(const std::string&amp; filename)
412 408 * @param[in] filename FITS file name.
413 409 * @param[in] clobber Overwrite existing file? (default: false)
414 410 *
415   - * Save the point spread function into a FITS file.
  411 + * 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 + * 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 + * part of the @p filename, or if no extension name is given, is assumed to
  416 + * be "POINT SPREAD FUNCTION".
416 417 *
417   - * If no extension name is provided, the point spread function will be saved
418   - * into the "POINT SPREAD FUNCTION" extension.
  418 + * An existing file will only be modified if the @p clobber flag is set to
  419 + * true.
419 420 ***************************************************************************/
420   -void GCTAPsfKing::save(const std::string& filename, const bool& clobber) const
  421 +void GCTAPsfKing::save(const GFilename& filename, const bool& clobber) const
421 422 {
422   - // Create file name
423   - GFilename fname(filename);
  423 + // Get extension name
  424 + std::string extname = filename.extname("POINT SPREAD FUNCTION");
  425 +
  426 + // Open or create FITS file
  427 + GFits fits(filename, true);
  428 +
  429 + // Remove extension if it exists already
  430 + if (fits.contains(extname)) {
  431 + fits.remove(extname);
  432 + }
424 433  
425 434 // Create binary table
426 435 GFitsBinTable table;
427   - table.extname(fname.extname("POINT SPREAD FUNCTION"));
428 436  
429   - // Write the PSF table
  437 + // Write the background table
430 438 write(table);
431 439  
432   - // Create FITS file, append table, and write into the file
433   - GFits fits;
  440 + // Set binary table extension name
  441 + table.extname(extname);
  442 +
  443 + // Append table to FITS file
434 444 fits.append(table);
435   - fits.saveto(fname, clobber);
  445 +
  446 + // Save to file
  447 + fits.save(clobber);
436 448  
437 449 // Return
438 450 return;
... ...
inst/cta/src/GCTAPsfPerfTable.cpp
1 1 /***************************************************************************
2 2 * GCTAPsfPerfTable.cpp - CTA performance table PSF class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -32,11 +32,12 @@
32 32 #include <cmath>
33 33 #include "GTools.hpp"
34 34 #include "GMath.hpp"
  35 +#include "GRan.hpp"
35 36 #include "GCTAPsfPerfTable.hpp"
36 37 #include "GCTAException.hpp"
37 38  
38 39 /* __ Method name definitions ____________________________________________ */
39   -#define G_LOAD "GCTAPsfPerfTable::load(std::string&)"
  40 +#define G_LOAD "GCTAPsfPerfTable::load(GFilename&)"
40 41 #define G_CONTAINMENT_RADIUS "GCTAPsfPerfTable::containment_radius(double&,"\
41 42 " double&, double&, double&, double&, double&, bool&)"
42 43  
... ... @@ -77,7 +78,7 @@ GCTAPsfPerfTable::GCTAPsfPerfTable(void) : GCTAPsf()
77 78 * Construct instance by loading the point spread function information from
78 79 * an ASCII performance table.
79 80 ***************************************************************************/
80   -GCTAPsfPerfTable::GCTAPsfPerfTable(const std::string& filename) : GCTAPsf()
  81 +GCTAPsfPerfTable::GCTAPsfPerfTable(const GFilename& filename) : GCTAPsf()
81 82 {
82 83 // Initialise class members
83 84 init_members();
... ... @@ -257,7 +258,7 @@ GCTAPsfPerfTable* GCTAPsfPerfTable::clone(void) const
257 258 * This method loads the point spread function information from an ASCII
258 259 * performance table.
259 260 ***************************************************************************/
260   -void GCTAPsfPerfTable::load(const std::string& filename)
  261 +void GCTAPsfPerfTable::load(const GFilename& filename)
261 262 {
262 263 // Set conversion factor from 68% containment radius to 1 sigma
263 264 const double conv = 0.6624305 * gammalib::deg2rad;
... ... @@ -272,13 +273,10 @@ void GCTAPsfPerfTable::load(const std::string&amp; filename)
272 273 const int n = 1000;
273 274 char line[n];
274 275  
275   - // Expand environment variables
276   - std::string fname = gammalib::expand_env(filename);
277   -
278 276 // Open performance table readonly
279   - FILE* fptr = std::fopen(fname.c_str(), "r");
  277 + FILE* fptr = std::fopen(filename.url().c_str(), "r");
280 278 if (fptr == NULL) {
281   - throw GCTAException::file_open_error(G_LOAD, fname);
  279 + throw GCTAException::file_open_error(G_LOAD, filename);
282 280 }
283 281  
284 282 // Read lines
... ...
inst/cta/src/GCTAPsfVector.cpp
... ... @@ -31,7 +31,9 @@
31 31 #include <cmath>
32 32 #include "GTools.hpp"
33 33 #include "GMath.hpp"
  34 +#include "GRan.hpp"
34 35 #include "GFilename.hpp"
  36 +#include "GFits.hpp"
35 37 #include "GFitsTable.hpp"
36 38 #include "GFitsTableCol.hpp"
37 39 #include "GCTAPsfVector.hpp"
... ... @@ -77,7 +79,7 @@ GCTAPsfVector::GCTAPsfVector(void) : GCTAPsf()
77 79 *
78 80 * Constructs point spread function vector from a FITS file.
79 81 ***************************************************************************/
80   -GCTAPsfVector::GCTAPsfVector(const std::string& filename) : GCTAPsf()
  82 +GCTAPsfVector::GCTAPsfVector(const GFilename& filename) : GCTAPsf()
81 83 {
82 84 // Initialise class members
83 85 init_members();
... ... @@ -256,25 +258,19 @@ GCTAPsfVector* GCTAPsfVector::clone(void) const
256 258 * If no extension name is provided, the point spread function will be loaded
257 259 * from the "PSF" extension.
258 260 ***************************************************************************/
259   -void GCTAPsfVector::load(const std::string& filename)
  261 +void GCTAPsfVector::load(const GFilename& filename)
260 262 {
261   - // Create file name
262   - GFilename fname(filename);
263   -
264   - // Allocate FITS file
265   - GFits file;
266   -
267 263 // Open FITS file
268   - file.open(fname);
  264 + GFits fits(filename);
269 265  
270 266 // Get PSFa table
271   - const GFitsTable& table = *file.table(fname.extname("PSF"));
  267 + const GFitsTable& table = *fits.table(filename.extname("PSF"));
272 268  
273 269 // Read PSF from table
274 270 read(table);
275 271  
276 272 // Close FITS file
277   - file.close();
  273 + fits.close();
278 274  
279 275 // Store filename
280 276 m_filename = filename;
... ...
inst/cta/src/GCTAResponseIrf.cpp
... ... @@ -53,15 +53,15 @@
53 53 #include "GCTARoi.hpp"
54 54 #include "GCTAException.hpp"
55 55 #include "GCTASupport.hpp"
  56 +#include "GCTAAeff.hpp"
56 57 #include "GCTAAeff2D.hpp"
57 58 #include "GCTAAeffArf.hpp"
58 59 #include "GCTAAeffPerfTable.hpp"
  60 +#include "GCTAPsf.hpp"
59 61 #include "GCTAPsf2D.hpp"
60 62 #include "GCTAPsfVector.hpp"
61 63 #include "GCTAPsfPerfTable.hpp"
62 64 #include "GCTAPsfKing.hpp"
63   -#include "GCTAAeff.hpp"
64   -#include "GCTAPsf.hpp"
65 65 #include "GCTAEdisp.hpp"
66 66 #include "GCTAEdisp2D.hpp"
67 67 #include "GCTAEdispRmf.hpp"
... ... @@ -76,10 +76,10 @@
76 76 #define G_MC "GCTAResponseIrf::mc(double&, GPhoton&, GObservation&, GRan&)"
77 77 #define G_READ "GCTAResponseIrf::read(GXmlElement&)"
78 78 #define G_WRITE "GCTAResponseIrf::write(GXmlElement&)"
79   -#define G_LOAD_AEFF "GCTAResponseIrf::load_aeff(std::string&)"
80   -#define G_LOAD_PSF "GCTAResponseIrf::load_psf(std::string&)"
81   -#define G_LOAD_EDISP "GCTAResponseIrf::load_edisp(std::string&)"
82   -#define G_LOAD_BACKGROUND "GCTAResponseIrf::load_background(std::string&)"
  79 +#define G_LOAD_AEFF "GCTAResponseIrf::load_aeff(GFilename&)"
  80 +#define G_LOAD_PSF "GCTAResponseIrf::load_psf(GFilename&)"
  81 +#define G_LOAD_EDISP "GCTAResponseIrf::load_edisp(GFilename&)"
  82 +#define G_LOAD_BACKGROUND "GCTAResponseIrf::load_background(GFilename&)"
83 83 #define G_NIRF "GCTAResponseIrf::nirf(GPhoton&, GEnergy&, GTime&,"\
84 84 " GObservation&)"
85 85 #define G_IRF_RADIAL "GCTAResponseIrf::irf_radial(GEvent&, GSource&,"\
... ... @@ -1088,17 +1088,14 @@ void GCTAResponseIrf::load(const std::string&amp; rspname)
1088 1088 * If the file is not a FITS file, it will be interpreted as a
1089 1089 * GCTAAeffPerfTable performance table.
1090 1090 ***************************************************************************/
1091   -void GCTAResponseIrf::load_aeff(const std::string& filename)
  1091 +void GCTAResponseIrf::load_aeff(const GFilename& filename)
1092 1092 {
1093 1093 // Free any existing effective area instance
1094 1094 if (m_aeff != NULL) delete m_aeff;
1095 1095 m_aeff = NULL;
1096 1096  
1097   - // Initialise filename
1098   - GFilename fname(filename);
1099   -
1100 1097 // Check for existence of file
1101   - if (!gammalib::file_exists_gzip(fname.url())) {
  1098 + if (!gammalib::file_exists_gzip(filename)) {
1102 1099 std::string msg = "File \""+filename+"\" not found. Please specify "
1103 1100 "a valid effective area response file.";
1104 1101 throw GException::file_error(G_LOAD_AEFF, msg);
... ... @@ -1108,20 +1105,20 @@ void GCTAResponseIrf::load_aeff(const std::string&amp; filename)
1108 1105 if (gammalib::is_fits(filename)) {
1109 1106  
1110 1107 // Open FITS file
1111   - GFits file(fname);
  1108 + GFits fits(filename);
1112 1109  
1113 1110 // Get the extension name. If an extension name has been specified
1114 1111 // then use this name, otherwise use either the "EFFECTIVE AREA"
1115 1112 // or the "SPECRESP" extension.
1116 1113 std::string extname = "";
1117   - if (fname.has_extname()) {
1118   - extname = fname.extname();
  1114 + if (filename.has_extname()) {
  1115 + extname = filename.extname();
1119 1116 }
1120 1117 else {
1121   - if (file.contains("EFFECTIVE AREA")) {
  1118 + if (fits.contains("EFFECTIVE AREA")) {
1122 1119 extname = "EFFECTIVE AREA";
1123 1120 }
1124   - else if (file.contains("SPECRESP")) {
  1121 + else if (fits.contains("SPECRESP")) {
1125 1122 extname = "SPECRESP";
1126 1123 }
1127 1124 }
... ... @@ -1130,7 +1127,7 @@ void GCTAResponseIrf::load_aeff(const std::string&amp; filename)
1130 1127 if (!extname.empty()) {
1131 1128  
1132 1129 // Get FITS table
1133   - const GFitsTable& table = *file.table(extname);
  1130 + const GFitsTable& table = *fits.table(extname);
1134 1131  
1135 1132 // Read save energy thresholds if available
1136 1133 if (table.has_card("LO_THRES")) {
... ... @@ -1144,7 +1141,7 @@ void GCTAResponseIrf::load_aeff(const std::string&amp; filename)
1144 1141 if (table.contains("SPECRESP")) {
1145 1142  
1146 1143 // Close file
1147   - file.close();
  1144 + fits.close();
1148 1145  
1149 1146 // Allocate Aeff from file
1150 1147 m_aeff = new GCTAAeffArf(filename);
... ... @@ -1154,7 +1151,7 @@ void GCTAResponseIrf::load_aeff(const std::string&amp; filename)
1154 1151 else {
1155 1152  
1156 1153 // Close file
1157   - file.close();
  1154 + fits.close();
1158 1155  
1159 1156 // Allocate Aeff from file
1160 1157 m_aeff = new GCTAAeff2D(filename);
... ... @@ -1209,17 +1206,14 @@ void GCTAResponseIrf::load_aeff(const std::string&amp; filename)
1209 1206 * If the file is not a FITS file, it will be interpreted as a
1210 1207 * GCTAPsfPerfTable performance table.
1211 1208 ***************************************************************************/
1212   -void GCTAResponseIrf::load_psf(const std::string& filename)
  1209 +void GCTAResponseIrf::load_psf(const GFilename& filename)
1213 1210 {
1214 1211 // Free any existing point spread function instance
1215 1212 if (m_psf != NULL) delete m_psf;
1216 1213 m_psf = NULL;
1217 1214  
1218   - // Initialise filename
1219   - GFilename fname(filename);
1220   -
1221 1215 // Check for existence of file
1222   - if (!gammalib::file_exists_gzip(fname.url())) {
  1216 + if (!gammalib::file_exists_gzip(filename)) {
1223 1217 std::string msg = "File \""+filename+"\" not found. Please specify "
1224 1218 "a valid point spread function response file.";
1225 1219 throw GException::file_error(G_LOAD_PSF, msg);
... ... @@ -1229,20 +1223,20 @@ void GCTAResponseIrf::load_psf(const std::string&amp; filename)
1229 1223 if (gammalib::is_fits(filename)) {
1230 1224  
1231 1225 // Open FITS file
1232   - GFits file(fname);
  1226 + GFits fits(filename);
1233 1227  
1234 1228 // Get the extension name. If an extension name has been specified
1235 1229 // then use this name, otherwise use either the
1236 1230 // "POINT SPREAD FUNCTION" or the "PSF" extension.
1237 1231 std::string extname = "";
1238   - if (fname.has_extname()) {
1239   - extname = fname.extname();
  1232 + if (filename.has_extname()) {
  1233 + extname = filename.extname();
1240 1234 }
1241 1235 else {
1242   - if (file.contains("POINT SPREAD FUNCTION")) {
  1236 + if (fits.contains("POINT SPREAD FUNCTION")) {
1243 1237 extname = "POINT SPREAD FUNCTION";
1244 1238 }
1245   - else if (file.contains("PSF")) {
  1239 + else if (fits.contains("PSF")) {
1246 1240 extname = "PSF";
1247 1241 }
1248 1242 }
... ... @@ -1251,13 +1245,13 @@ void GCTAResponseIrf::load_psf(const std::string&amp; filename)
1251 1245 if (!extname.empty()) {
1252 1246  
1253 1247 // Get FITS table
1254   - const GFitsTable& table = *file.table(extname);
  1248 + const GFitsTable& table = *fits.table(extname);
1255 1249  
1256 1250 // Check for King profile specific table columns
1257 1251 if (table.contains("GAMMA") && table.contains("SIGMA")) {
1258 1252  
1259 1253 // Close FITS file
1260   - file.close();
  1254 + fits.close();
1261 1255  
1262 1256 // Allocate King profile PSF
1263 1257 m_psf = new GCTAPsfKing(filename);
... ... @@ -1271,7 +1265,7 @@ void GCTAResponseIrf::load_psf(const std::string&amp; filename)
1271 1265 table.contains("AMPL_3") && table.contains("SIGMA_3")) {
1272 1266  
1273 1267 // Close FITS file
1274   - file.close();
  1268 + fits.close();
1275 1269  
1276 1270 // Allocate Gaussian profile PSF
1277 1271 m_psf = new GCTAPsf2D(filename);
... ... @@ -1282,7 +1276,7 @@ void GCTAResponseIrf::load_psf(const std::string&amp; filename)
1282 1276 else {
1283 1277  
1284 1278 // Close FITS file
1285   - file.close();
  1279 + fits.close();
1286 1280  
1287 1281 // Allocate vector PSF
1288 1282 m_psf = new GCTAPsfVector(filename);
... ... @@ -1335,17 +1329,14 @@ void GCTAResponseIrf::load_psf(const std::string&amp; filename)
1335 1329 * If the file is not a FITS file, it will be interpreted as a
1336 1330 * GCTAEdispPerfTable performance table.
1337 1331 ***************************************************************************/
1338   -void GCTAResponseIrf::load_edisp(const std::string& filename)
  1332 +void GCTAResponseIrf::load_edisp(const GFilename& filename)
1339 1333 {
1340 1334 // Free any existing energy dispersion instance
1341 1335 if (m_edisp != NULL) delete m_edisp;
1342 1336 m_edisp = NULL;
1343 1337  
1344   - // Initialise filename
1345   - GFilename fname(filename);
1346   -
1347 1338 // Check for existence of file
1348   - if (!gammalib::file_exists_gzip(fname.url())) {
  1339 + if (!gammalib::file_exists_gzip(filename)) {
1349 1340 std::string msg = "File \""+filename+"\" not found. Please specify "
1350 1341 "a valid energy dispersion response file.";
1351 1342 throw GException::file_error(G_LOAD_EDISP, msg);
... ... @@ -1355,20 +1346,20 @@ void GCTAResponseIrf::load_edisp(const std::string&amp; filename)
1355 1346 if (gammalib::is_fits(filename)) {
1356 1347  
1357 1348 // Open FITS file
1358   - GFits file(fname);
  1349 + GFits fits(filename);
1359 1350  
1360 1351 // Get the extension name. If an extension name has been specified
1361 1352 // then use this name, otherwise use either the "EFFECTIVE AREA"
1362 1353 // or the "SPECRESP" extension.
1363 1354 std::string extname = "";
1364   - if (fname.has_extname()) {
1365   - extname = fname.extname();
  1355 + if (filename.has_extname()) {
  1356 + extname = filename.extname();
1366 1357 }
1367 1358 else {
1368   - if (file.contains("ENERGY DISPERSION")) {
  1359 + if (fits.contains("ENERGY DISPERSION")) {
1369 1360 extname = "ENERGY DISPERSION";
1370 1361 }
1371   - else if (file.contains("MATRIX")) {
  1362 + else if (fits.contains("MATRIX")) {
1372 1363 extname = "MATRIX";
1373 1364 }
1374 1365 }
... ... @@ -1377,13 +1368,13 @@ void GCTAResponseIrf::load_edisp(const std::string&amp; filename)
1377 1368 if (!extname.empty()) {
1378 1369  
1379 1370 // Get FITS table
1380   - const GFitsTable& table = *file.table(extname);
  1371 + const GFitsTable& table = *fits.table(extname);
1381 1372  
1382 1373 // Check for 2D migration matrix
1383 1374 if (table.contains("MIGRA_LO") && table.contains("MIGRA_HI")) {
1384 1375  
1385 1376 // Close FITS file
1386   - file.close();
  1377 + fits.close();
1387 1378  
1388 1379 // Allocate 2D migration matrix
1389 1380 m_edisp = new GCTAEdisp2D(filename);
... ... @@ -1394,7 +1385,7 @@ void GCTAResponseIrf::load_edisp(const std::string&amp; filename)
1394 1385 else {
1395 1386  
1396 1387 // Close FITS file
1397   - file.close();
  1388 + fits.close();
1398 1389  
1399 1390 // Allocate Gaussian profile PSF
1400 1391 m_edisp = new GCTAEdispRmf(filename);
... ... @@ -1443,17 +1434,14 @@ void GCTAResponseIrf::load_edisp(const std::string&amp; filename)
1443 1434 * If the file is not a FITS file it will be interpreted as a
1444 1435 * GCTABackgroundPerfTable performance table.
1445 1436 ***************************************************************************/
1446   -void GCTAResponseIrf::load_background(const std::string& filename)
  1437 +void GCTAResponseIrf::load_background(const GFilename& filename)
1447 1438 {
1448 1439 // Free any existing background model instance
1449 1440 if (m_background != NULL) delete m_background;
1450 1441 m_background = NULL;
1451 1442  
1452   - // Initialise filename
1453   - GFilename fname(filename);
1454   -
1455 1443 // Check for existence of file
1456   - if (!gammalib::file_exists_gzip(fname.url())) {
  1444 + if (!gammalib::file_exists_gzip(filename)) {
1457 1445 std::string msg = "File \""+filename+"\" not found. Please specify "
1458 1446 "a valid background response file.";
1459 1447 throw GException::file_error(G_LOAD_BACKGROUND, msg);
... ...
inst/lat/include/GLATAeff.hpp
1 1 /***************************************************************************
2 2 * GLATAeff.hpp - Fermi/LAT effective area *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -33,11 +33,12 @@
33 33 #include "GBase.hpp"
34 34 #include "GLATResponseTable.hpp"
35 35 #include "GLATEfficiency.hpp"
36   -#include "GFits.hpp"
37   -#include "GFitsTable.hpp"
38   -#include "GSkyDir.hpp"
39   -#include "GEnergy.hpp"
40   -#include "GTime.hpp"
  36 +
  37 +/* __ Forward declarations _______________________________________________ */
  38 +class GFilename;
  39 +class GEnergy;
  40 +class GFits;
  41 +class GFitsTable;
41 42  
42 43  
43 44 /***********************************************************************//**
... ... @@ -54,7 +55,7 @@ class GLATAeff : public GBase {
54 55 public:
55 56 // Constructors and destructors
56 57 GLATAeff(void);
57   - explicit GLATAeff(const std::string& filename);
  58 + explicit GLATAeff(const GFilename& filename);
58 59 GLATAeff(const GLATAeff& aeff);
59 60 virtual ~GLATAeff(void);
60 61  
... ... @@ -68,9 +69,9 @@ public:
68 69 void clear(void);
69 70 GLATAeff* clone(void) const;
70 71 std::string classname(void) const;
71   - void load(const std::string& filename);
72   - void save(const std::string& filename,
73   - const bool &clobber = false);
  72 + void load(const GFilename& filename);
  73 + void save(const GFilename& filename,
  74 + const bool& clobber = false);
74 75 void read(const GFits& file);
75 76 void write(GFits& file) const;
76 77 int size(void) const;
... ...
inst/lat/include/GLATEdisp.hpp
1 1 /***************************************************************************
2 2 * GLATEdisp.hpp - Fermi LAT energy dispersion *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -32,8 +32,11 @@
32 32 #include <vector>
33 33 #include "GBase.hpp"
34 34 #include "GLATResponseTable.hpp"
35   -#include "GFits.hpp"
36   -#include "GFitsTable.hpp"
  35 +
  36 +/* __ Forward declarations _______________________________________________ */
  37 +class GFilename;
  38 +class GFits;
  39 +class GFitsTable;
37 40  
38 41  
39 42 /***********************************************************************//**
... ... @@ -48,7 +51,7 @@ class GLATEdisp : public GBase {
48 51 public:
49 52 // Constructors and destructors
50 53 GLATEdisp(void);
51   - explicit GLATEdisp(const std::string& filename);
  54 + explicit GLATEdisp(const GFilename& filename);
52 55 GLATEdisp(const GLATEdisp& edisp);
53 56 virtual ~GLATEdisp(void);
54 57  
... ... @@ -62,9 +65,9 @@ public:
62 65 void clear(void);
63 66 GLATEdisp* clone(void) const;
64 67 std::string classname(void) const;
65   - void load(const std::string& filename);
66   - void save(const std::string& filename,
67   - const bool& clobber = false);
  68 + void load(const GFilename& filename);
  69 + void save(const GFilename& filename,
  70 + const bool& clobber = false);
68 71 void read(const GFits& file);
69 72 void write(GFits& file) const;
70 73 int size(void) const;
... ...
inst/lat/include/GLATLtCube.hpp
1 1 /***************************************************************************
2 2 * GLATLtCube.hpp - Fermi/LAT livetime cube class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -30,12 +30,15 @@
30 30 /* __ Includes ___________________________________________________________ */
31 31 #include <string>
32 32 #include "GBase.hpp"
33   -#include "GLATLtCubeMap.hpp"
34   -#include "GLATAeff.hpp"
35   -#include "GLATPsf.hpp"
36 33 #include "GGti.hpp"
37   -#include "GSkyDir.hpp"
38   -#include "GEnergy.hpp"
  34 +#include "GLATLtCubeMap.hpp"
  35 +
  36 +/* __ Forward declarations _______________________________________________ */
  37 +class GFilename;
  38 +class GSkyDir;
  39 +class GEnergy;
  40 +class GLATAeff;
  41 +class GLATPsf;
39 42  
40 43  
41 44 /***********************************************************************//**
... ... @@ -51,7 +54,7 @@ class GLATLtCube : public GBase {
51 54 public:
52 55 // Constructors and destructors
53 56 GLATLtCube(void);
54   - explicit GLATLtCube(const std::string& filename);
  57 + explicit GLATLtCube(const GFilename& filename);
55 58 GLATLtCube(const GLATLtCube& cube);
56 59 virtual ~GLATLtCube(void);
57 60  
... ... @@ -71,9 +74,9 @@ public:
71 74 void clear(void);
72 75 GLATLtCube* clone(void) const;
73 76 std::string classname(void) const;
74   - void load(const std::string& filename);
75   - void save(const std::string& filename,
76   - const bool& clobber=false) const;
  77 + void load(const GFilename& filename);
  78 + void save(const GFilename& filename,
  79 + const bool& clobber = false) const;
77 80 std::string print(const GChatter& chatter = NORMAL) const;
78 81  
79 82 private:
... ...
inst/lat/include/GLATPsf.hpp
1 1 /***************************************************************************
2 2 * GLATPsf.hpp - Fermi LAT point spread function *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -31,12 +31,10 @@
31 31 #include <string>
32 32 #include "GBase.hpp"
33 33 #include "GLATPsfBase.hpp"
34   -#include "GLATInstDir.hpp"
35   -#include "GFits.hpp"
36   -#include "GFitsTable.hpp"
37   -#include "GSkyDir.hpp"
38   -#include "GEnergy.hpp"
39   -#include "GTime.hpp"
  34 +
  35 +/* __ Forward declarations _______________________________________________ */
  36 +class GFilename;
  37 +class GFits;
40 38  
41 39  
42 40 /***********************************************************************//**
... ... @@ -58,7 +56,7 @@ class GLATPsf : public GBase {
58 56 public:
59 57 // Constructors and destructors
60 58 GLATPsf(void);
61   - explicit GLATPsf(const std::string& filename);
  59 + explicit GLATPsf(const GFilename& filename);
62 60 GLATPsf(const GLATPsf& psf);
63 61 virtual ~GLATPsf(void);
64 62  
... ... @@ -71,9 +69,9 @@ public:
71 69 void clear(void);
72 70 GLATPsf* clone(void) const;
73 71 std::string classname(void) const;
74   - void load(const std::string& filename);
75   - void save(const std::string& filename,
76   - const bool& clobber = false);
  72 + void load(const GFilename& filename);
  73 + void save(const GFilename& filename,
  74 + const bool& clobber = false);
77 75 void read(const GFits& file);
78 76 void write(GFits& file) const;
79 77 int size(void) const;
... ...
inst/lat/pyext/GLATAeff.i
... ... @@ -39,7 +39,7 @@ class GLATAeff : public GBase {
39 39 public:
40 40 // Constructors and destructors
41 41 GLATAeff(void);
42   - explicit GLATAeff(const std::string& filename);
  42 + explicit GLATAeff(const GFilename& filename);
43 43 GLATAeff(const GLATAeff& aeff);
44 44 virtual ~GLATAeff(void);
45 45  
... ... @@ -52,9 +52,9 @@ public:
52 52 void clear(void);
53 53 GLATAeff* clone(void) const;
54 54 std::string classname(void) const;
55   - void load(const std::string filename);
56   - void save(const std::string filename,
57   - const bool& clobber = false);
  55 + void load(const GFilename& filename);
  56 + void save(const GFilename& filename,
  57 + const bool& clobber = false);
58 58 void read(const GFits& file);
59 59 void write(GFits& file) const;
60 60 int size(void) const;
... ...
inst/lat/pyext/GLATEdisp.i
1 1 /***************************************************************************
2 2 * GLATEdisp.i - Fermi/LAT energy dispersion class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -21,7 +21,7 @@
21 21 /**
22 22 * @file GLATEdisp.i
23 23 * @brief Fermi/LAT energy dispersion class definition
24   - * @author J. Knoedlseder
  24 + * @author Juergen Knoedlseder
25 25 */
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
... ... @@ -39,7 +39,7 @@ class GLATEdisp : public GBase {
39 39 public:
40 40 // Constructors and destructors
41 41 GLATEdisp(void);
42   - explicit GLATEdisp(const std::string filename);
  42 + explicit GLATEdisp(const GFilename& filename);
43 43 GLATEdisp(const GLATEdisp& edisp);
44 44 virtual ~GLATEdisp(void);
45 45  
... ... @@ -50,9 +50,9 @@ public:
50 50 void clear(void);
51 51 GLATEdisp* clone(void) const;
52 52 std::string classname(void) const;
53   - void load(const std::string filename);
54   - void save(const std::string filename,
55   - const bool& clobber = false);
  53 + void load(const GFilename& filename);
  54 + void save(const GFilename& filename,
  55 + const bool& clobber = false);
56 56 void read(const GFits& file);
57 57 void write(GFits& file) const;
58 58 int size(void) const;
... ...
inst/lat/pyext/GLATLtCube.i
... ... @@ -26,7 +26,6 @@
26 26 %{
27 27 /* Put headers and other declarations here that are needed for compilation */
28 28 #include "GLATLtCube.hpp"
29   -#include "GTools.hpp"
30 29 %}
31 30  
32 31  
... ... @@ -40,7 +39,7 @@ class GLATLtCube : public GBase {
40 39 public:
41 40 // Constructors and destructors
42 41 GLATLtCube(void);
43   - explicit GLATLtCube(const std::string& filename);
  42 + explicit GLATLtCube(const GFilename& filename);
44 43 GLATLtCube(const GLATLtCube& cube);
45 44 virtual ~GLATLtCube(void);
46 45  
... ... @@ -59,8 +58,9 @@ public:
59 58 void clear(void);
60 59 GLATLtCube* clone(void) const;
61 60 std::string classname(void) const;
62   - void load(const std::string& filename);
63   - void save(const std::string& filename, bool clobber=false) const;
  61 + void load(const GFilename& filename);
  62 + void save(const GFilename& filename,
  63 + const bool& clobber = false) const;
64 64 };
65 65  
66 66  
... ...
inst/lat/pyext/GLATPsf.i
1 1 /***************************************************************************
2 2 * GLATPsf.i - Fermi/LAT point spread function class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -39,7 +39,7 @@ class GLATPsf : public GBase {
39 39 public:
40 40 // Constructors and destructors
41 41 GLATPsf(void);
42   - explicit GLATPsf(const std::string& filename);
  42 + explicit GLATPsf(const GFilename& filename);
43 43 GLATPsf(const GLATPsf& psf);
44 44 virtual ~GLATPsf(void);
45 45  
... ... @@ -51,9 +51,9 @@ public:
51 51 void clear(void);
52 52 GLATPsf* clone(void) const;
53 53 std::string classname(void) const;
54   - void load(const std::string& filename);
55   - void save(const std::string& filename,
56   - const bool& clobber = false);
  54 + void load(const GFilename& filename);
  55 + void save(const GFilename& filename,
  56 + const bool& clobber = false);
57 57 void read(const GFits& file);
58 58 void write(GFits& file) const;
59 59 int size(void) const;
... ...
inst/lat/src/GLATAeff.cpp
1 1 /***************************************************************************
2 2 * GLATAeff.cpp - Fermi-LAT effective area *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2008-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -28,13 +28,17 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
31   -#include "GLATAeff.hpp"
32   -#include "GLATException.hpp"
33 31 #include "GTools.hpp"
  32 +#include "GException.hpp"
  33 +#include "GFilename.hpp"
  34 +#include "GEnergy.hpp"
  35 +#include "GFits.hpp"
  36 +#include "GFitsTable.hpp"
34 37 #include "GFitsBinTable.hpp"
35 38 #include "GFitsTableCol.hpp"
36 39 #include "GFitsTableFloatCol.hpp"
37   -#include "GException.hpp"
  40 +#include "GLATAeff.hpp"
  41 +#include "GLATException.hpp"
38 42  
39 43 /* __ Method name definitions ____________________________________________ */
40 44 #define G_READ_AEFF "GLATAeff::read_aeff(GFitsTable&)"
... ... @@ -76,7 +80,7 @@ GLATAeff::GLATAeff(void)
76 80 * effective area information and the efficiency factor parameters are loaded
77 81 * when available.
78 82 ***************************************************************************/
79   -GLATAeff::GLATAeff(const std::string& filename)
  83 +GLATAeff::GLATAeff(const GFilename& filename)
80 84 {
81 85 // Initialise class members
82 86 init_members();
... ... @@ -255,7 +259,7 @@ GLATAeff* GLATAeff::clone(void) const
255 259 * efficiency factors, from the FITS response file. See the GLATAeff::read
256 260 * method for details.
257 261 ***************************************************************************/
258   -void GLATAeff::load(const std::string& filename)
  262 +void GLATAeff::load(const GFilename& filename)
259 263 {
260 264 // Open FITS file
261 265 GFits fits(filename);
... ... @@ -272,22 +276,22 @@ void GLATAeff::load(const std::string&amp; filename)
272 276 * @brief Save effective area into FITS file
273 277 *
274 278 * @param[in] filename FITS file.
275   - * @param[in] clobber Overwrite existing file?.
  279 + * @param[in] clobber Overwrite existing file? (default: false)
276 280 *
277 281 * This method saves the effective area information, and if available, the
278 282 * efficiency factors, into the FITS response file. See the GLATAeff::write
279 283 * method for details.
280 284 ***************************************************************************/
281   -void GLATAeff::save(const std::string& filename, const bool& clobber)
  285 +void GLATAeff::save(const GFilename& filename, const bool& clobber)
282 286 {
283   - // Open FITS file
284   - GFits fits(filename, true);
  287 + // Create FITS file
  288 + GFits fits;
285 289  
286 290 // Write effective area into file
287 291 write(fits);
288 292  
289 293 // Close FITS file
290   - fits.save(clobber);
  294 + fits.saveto(filename, clobber);
291 295  
292 296 // Return
293 297 return;
... ...
inst/lat/src/GLATEdisp.cpp
1 1 /***************************************************************************
2 2 * GLATEdisp.cpp - Fermi-LAT energy dispersion *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2008-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -28,14 +28,17 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
31   -#include "GLATEdisp.hpp"
32   -#include "GLATException.hpp"
33 31 #include "GTools.hpp"
  32 +#include "GFilename.hpp"
  33 +#include "GFits.hpp"
  34 +#include "GFitsTable.hpp"
34 35 #include "GFitsBinTable.hpp"
35 36 #include "GFitsTableFloatCol.hpp"
  37 +#include "GLATEdisp.hpp"
  38 +#include "GLATException.hpp"
36 39  
37 40 /* __ Method name definitions ____________________________________________ */
38   -#define G_READ "GLATEdisp::read(const GFits& file)"
  41 +#define G_READ "GLATEdisp::read(GFits&)"
39 42 #define G_READ_EDISP "GLATEdisp::read_edisp(GFitsTable&)"
40 43  
41 44 /* __ Macros _____________________________________________________________ */
... ... @@ -74,7 +77,7 @@ GLATEdisp::GLATEdisp(void)
74 77 * Construct instance by loading the energy dispersion information from FITS
75 78 * file.
76 79 ***************************************************************************/
77   -GLATEdisp::GLATEdisp(const std::string& filename)
  80 +GLATEdisp::GLATEdisp(const GFilename& filename)
78 81 {
79 82 // Initialise class members
80 83 init_members();
... ... @@ -191,7 +194,7 @@ GLATEdisp* GLATEdisp::clone(void) const
191 194 *
192 195 * @param[in] filename FITS file.
193 196 ***************************************************************************/
194   -void GLATEdisp::load(const std::string& filename)
  197 +void GLATEdisp::load(const GFilename& filename)
195 198 {
196 199 // Open FITS file
197 200 GFits fits(filename);
... ... @@ -208,18 +211,18 @@ void GLATEdisp::load(const std::string&amp; filename)
208 211 * @brief Save energy dispersion into FITS file
209 212 *
210 213 * @param[in] filename FITS file.
211   - * @param[in] clobber Overwrite existing file?.
  214 + * @param[in] clobber Overwrite existing file? (default: false)
212 215 ***************************************************************************/
213   -void GLATEdisp::save(const std::string& filename, const bool& clobber)
  216 +void GLATEdisp::save(const GFilename& filename, const bool& clobber)
214 217 {
215   - // Open FITS file
216   - GFits fits(filename, true);
  218 + // Create FITS file
  219 + GFits fits;
217 220  
218 221 // Write energy dispersion into file
219 222 write(fits);
220 223  
221 224 // Close FITS file
222   - fits.save(clobber);
  225 + fits.saveto(filename, clobber);
223 226  
224 227 // Return
225 228 return;
... ...
inst/lat/src/GLATLtCube.cpp
1 1 /***************************************************************************
2 2 * GLATLtCube.cpp - Fermi/LAT livetime cube class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -28,8 +28,13 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
31   -#include "GLATLtCube.hpp"
32 31 #include "GTools.hpp"
  32 +#include "GFilename.hpp"
  33 +#include "GSkyDir.hpp"
  34 +#include "GEnergy.hpp"
  35 +#include "GLATAeff.hpp"
  36 +#include "GLATPsf.hpp"
  37 +#include "GLATLtCube.hpp"
33 38  
34 39 /* __ Method name definitions ____________________________________________ */
35 40  
... ... @@ -66,7 +71,7 @@ GLATLtCube::GLATLtCube(void)
66 71 *
67 72 * @param[in] filename Livetime cube filename.
68 73 ***************************************************************************/
69   -GLATLtCube::GLATLtCube(const std::string& filename)
  74 +GLATLtCube::GLATLtCube(const GFilename& filename)
70 75 {
71 76 // Initialise class members
72 77 init_members();
... ... @@ -385,7 +390,7 @@ GLATLtCube* GLATLtCube::clone(void) const
385 390 * critical since they are not really needed. We just need them once
386 391 * we want to implement also saving.
387 392 ***************************************************************************/
388   -void GLATLtCube::load(const std::string& filename)
  393 +void GLATLtCube::load(const GFilename& filename)
389 394 {
390 395 // Clear object
391 396 clear();
... ... @@ -422,11 +427,11 @@ void GLATLtCube::load(const std::string&amp; filename)
422 427 * @brief Save livetime cube into FITS file
423 428 *
424 429 * @param[in] filename FITS file name.
425   - * @param[in] clobber Overwrite existing file?
  430 + * @param[in] clobber Overwrite existing file? (default: false)
426 431 *
427 432 * @todo Not yet implemented.
428 433 ***************************************************************************/
429   -void GLATLtCube::save(const std::string& filename, const bool& clobber) const
  434 +void GLATLtCube::save(const GFilename& filename, const bool& clobber) const
430 435 {
431 436 // Return
432 437 return;
... ...
inst/lat/src/GLATPsf.cpp
1 1 /***************************************************************************
2 2 * GLATPsf.cpp - Fermi-LAT point spread function *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2013 by Juergen Knoedlseder *
  4 + * copyright (C) 2008-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -28,13 +28,15 @@
28 28 #ifdef HAVE_CONFIG_H
29 29 #include <config.h>
30 30 #endif
  31 +#include "GTools.hpp"
  32 +#include "GFilename.hpp"
  33 +#include "GFits.hpp"
  34 +#include "GFitsBinTable.hpp"
  35 +#include "GFitsTableFloatCol.hpp"
31 36 #include "GLATPsf.hpp"
32 37 #include "GLATPsfV1.hpp"
33 38 #include "GLATPsfV3.hpp"
34 39 #include "GLATException.hpp"
35   -#include "GTools.hpp"
36   -#include "GFitsBinTable.hpp"
37   -#include "GFitsTableFloatCol.hpp"
38 40  
39 41 /* __ Method name definitions ____________________________________________ */
40 42 #define G_READ "GLATPsf::read(GFits&)"
... ... @@ -75,7 +77,7 @@ GLATPsf::GLATPsf(void)
75 77 *
76 78 * Construct instance by loading the point spread function from FITS file.
77 79 ***************************************************************************/
78   -GLATPsf::GLATPsf(const std::string& filename)
  80 +GLATPsf::GLATPsf(const GFilename& filename)
79 81 {
80 82 // Initialise class members
81 83 init_members();
... ... @@ -220,7 +222,7 @@ GLATPsf* GLATPsf::clone(void) const
220 222 *
221 223 * Loads Fermi/LAT point spread function from FITS file.
222 224 ***************************************************************************/
223   -void GLATPsf::load(const std::string& filename)
  225 +void GLATPsf::load(const GFilename& filename)
224 226 {
225 227 // Open FITS file
226 228 GFits fits(filename);
... ... @@ -237,20 +239,20 @@ void GLATPsf::load(const std::string&amp; filename)
237 239 * @brief Save point spread function into FITS file
238 240 *
239 241 * @param[in] filename FITS file.
240   - * @param[in] clobber Overwrite existing file?
  242 + * @param[in] clobber Overwrite existing file? (default: false)
241 243 *
242 244 * Saves Fermi/LAT point spread function into FITS file.
243 245 ***************************************************************************/
244   -void GLATPsf::save(const std::string& filename, const bool& clobber)
  246 +void GLATPsf::save(const GFilename& filename, const bool& clobber)
245 247 {
246   - // Open FITS file
247   - GFits fits(filename, true);
  248 + // Create FITS file
  249 + GFits fits;
248 250  
249 251 // Write point spread function into file
250 252 write(fits);
251 253  
252 254 // Close FITS file
253   - fits.save(clobber);
  255 + fits.saveto(filename, clobber);
254 256  
255 257 // Return
256 258 return;
... ...
inst/mwl/include/GMWLObservation.hpp
1 1 /***************************************************************************
2 2 * GMWLObservation.hpp - Multi-wavelength observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -28,11 +28,13 @@
28 28 #define GMWLOBSERVATION_HPP
29 29  
30 30 /* __ Includes ___________________________________________________________ */
  31 +#include "GFilename.hpp"
31 32 #include "GObservation.hpp"
32   -#include "GTime.hpp"
33   -#include "GModel.hpp"
34 33 #include "GMWLResponse.hpp"
35 34  
  35 +/* __ Forward declarations _______________________________________________ */
  36 +class GTime;
  37 +
36 38  
37 39 /***********************************************************************//**
38 40 * @class GMWLObservation
... ... @@ -48,7 +50,7 @@ class GMWLObservation : public GObservation {
48 50 public:
49 51 // Constructors and destructors
50 52 GMWLObservation(void);
51   - explicit GMWLObservation(const std::string& filename);
  53 + explicit GMWLObservation(const GFilename& filename);
52 54 GMWLObservation(const GMWLObservation& obs);
53 55 virtual ~GMWLObservation(void);
54 56  
... ... @@ -70,13 +72,9 @@ public:
70 72 virtual std::string print(const GChatter& chatter = NORMAL) const;
71 73  
72 74 // Other methods
73   - void load(const std::string& filename);
74   - const std::string& filename(void) const;
75   - const std::string& extno(void) const;
76   - const std::string& extname(void) const;
77   - void filename(const std::string& filename);
78   - void extno(const std::string& extno);
79   - void extname(const std::string& extname);
  75 + void load(const GFilename& filename);
  76 + const GFilename& filename(void) const;
  77 + void filename(const GFilename& filename);
80 78  
81 79 protected:
82 80 // Protected methods
... ... @@ -86,9 +84,7 @@ protected:
86 84  
87 85 // Protected members
88 86 std::string m_instrument; //!< Instrument name
89   - std::string m_filename; //!< Filename
90   - std::string m_extno; //!< Extension number
91   - std::string m_extname; //!< Extension name
  87 + GFilename m_filename; //!< Filename
92 88 GMWLResponse m_response; //!< Response function
93 89 };
94 90  
... ... @@ -171,33 +167,9 @@ double GMWLObservation::deadc(const GTime&amp; time) const
171 167 * @return Filename.
172 168 ***************************************************************************/
173 169 inline
174   -const std::string& GMWLObservation::filename(void) const
175   -{
176   - return m_filename;
177   -}
178   -
179   -
180   -/***********************************************************************//**
181   - * @brief Return extension number
182   - *
183   - * @return Extension number.
184   - ***************************************************************************/
185   -inline
186   -const std::string& GMWLObservation::extno(void) const
  170 +const GFilename& GMWLObservation::filename(void) const
187 171 {
188   - return m_extno;
189   -}
190   -
191   -
192   -/***********************************************************************//**
193   - * @brief Return extension name
194   - *
195   - * @return Extension name.
196   - ***************************************************************************/
197   -inline
198   -const std::string& GMWLObservation::extname(void) const
199   -{
200   - return m_extname;
  172 + return (m_filename);
201 173 }
202 174  
203 175  
... ... @@ -207,36 +179,10 @@ const std::string&amp; GMWLObservation::extname(void) const
207 179 * @param[in] filename Filename.
208 180 ***************************************************************************/
209 181 inline
210   -void GMWLObservation::filename(const std::string& filename)
  182 +void GMWLObservation::filename(const GFilename& filename)
211 183 {
212 184 m_filename = filename;
213 185 return;
214 186 }
215 187  
216   -
217   -/***********************************************************************//**
218   - * @brief Set extension number
219   - *
220   - * @param[in] extno Extension number.
221   - ***************************************************************************/
222   -inline
223   -void GMWLObservation::extno(const std::string& extno)
224   -{
225   - m_extno = extno;
226   - return;
227   -}
228   -
229   -
230   -/***********************************************************************//**
231   - * @brief Set extension name
232   - *
233   - * @param[in] extname Extension name..
234   - ***************************************************************************/
235   -inline
236   -void GMWLObservation::extname(const std::string& extname)
237   -{
238   - m_extname = extname;
239   - return;
240   -}
241   -
242 188 #endif /* GMWLOBSERVATION_HPP */
... ...
inst/mwl/pyext/GMWLObservation.i
1 1 /***************************************************************************
2 2 * GMWLObservation.i - Multi-wavelength observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -43,7 +43,7 @@ class GMWLObservation : public GObservation {
43 43 public:
44 44 // Constructors and destructors
45 45 GMWLObservation(void);
46   - explicit GMWLObservation(const std::string& filename);
  46 + explicit GMWLObservation(const GFilename& filename);
47 47 GMWLObservation(const GMWLObservation& obs);
48 48 virtual ~GMWLObservation(void);
49 49  
... ... @@ -61,13 +61,9 @@ public:
61 61 virtual void write(GXmlElement& xml) const;
62 62  
63 63 // Other methods
64   - void load(const std::string& filename);
65   - const std::string& filename(void) const;
66   - const std::string& extno(void) const;
67   - const std::string& extname(void) const;
68   - void filename(const std::string& filename);
69   - void extno(const std::string& extno);
70   - void extname(const std::string& extname);
  64 + void load(const GFilename& filename);
  65 + const GFilename& filename(void) const;
  66 + void filename(const GFilename& filename);
71 67 };
72 68  
73 69  
... ...
inst/mwl/src/GMWLObservation.cpp
... ... @@ -80,7 +80,7 @@ GMWLObservation::GMWLObservation(void) : GObservation()
80 80 *
81 81 * Creates instance from file.
82 82 ***************************************************************************/
83   -GMWLObservation::GMWLObservation(const std::string& filename) : GObservation()
  83 +GMWLObservation::GMWLObservation(const GFilename& filename) : GObservation()
84 84 {
85 85 // Initialise members
86 86 init_members();
... ... @@ -242,7 +242,7 @@ void GMWLObservation::response(const GResponse&amp; rsp)
242 242 *
243 243 * <observation name="..." id="..." instrument="MWL">
244 244 * <parameter name="Instrument" value="..."/>
245   - * <parameter name="Data" file="..." [extno="..."] [extname="..."]/>
  245 + * <parameter name="Data" file="..."/>
246 246 * </observation>
247 247 *
248 248 * The extno and extname attributes of the data parameter are optional, and
... ... @@ -285,23 +285,10 @@ void GMWLObservation::read(const GXmlElement&amp; xml)
285 285 else if (par->attribute("name") == "Data") {
286 286  
287 287 // Read filename
288   - std::string filename = par->attribute("file");
289   -
290   - // Read (optional) extension number and name
291   - std::string extno = par->attribute("extno");
292   - std::string extname = par->attribute("extname");
293   -
294   - // Load file (this also stores the filename, extno and
295   - // extname)
296   - if (!gammalib::strip_whitespace(extno).empty()) {
297   - load(filename+"["+extno+"]");
298   - }
299   - else if (!gammalib::strip_whitespace(extname).empty()) {
300   - load(filename+"["+extname+"]");
301   - }
302   - else {
303   - load(filename);
304   - }
  288 + GFilename filename = par->attribute("file");
  289 +
  290 + // Load file
  291 + load(filename);
305 292  
306 293 // Increment parameter counter
307 294 npar[1]++;
... ... @@ -335,7 +322,7 @@ void GMWLObservation::read(const GXmlElement&amp; xml)
335 322 *
336 323 * <observation name="..." id="..." instrument="MWL">
337 324 * <parameter name="Instrument" value="..."/>
338   - * <parameter name="Data" file="..." [extno="..."] [extname="..."]/>
  325 + * <parameter name="Data" file="..."/>
339 326 * </observation>
340 327 ***************************************************************************/
341 328 void GMWLObservation::write(GXmlElement& xml) const
... ... @@ -369,12 +356,6 @@ void GMWLObservation::write(GXmlElement&amp; xml) const
369 356 else if (par->attribute("name") == "Data") {
370 357 npar[1]++;
371 358 par->attribute("file", m_filename);
372   - if (gammalib::strip_whitespace(m_extno).length() > 0) {
373   - par->attribute("extno", m_extno);
374   - }
375   - if (gammalib::strip_whitespace(m_extname).length() > 0) {
376   - par->attribute("extname", m_extname);
377   - }
378 359 }
379 360  
380 361 } // endfor: looped over all parameters
... ... @@ -394,37 +375,22 @@ void GMWLObservation::write(GXmlElement&amp; xml) const
394 375 *
395 376 * @param[in] filename File name.
396 377 ***************************************************************************/
397   -void GMWLObservation::load(const std::string& filename)
  378 +void GMWLObservation::load(const GFilename& filename)
398 379 {
399 380 // Clear observation
400 381 clear();
401 382  
402   - // Create file name
403   - GFilename fname(filename);
404   -
405 383 // Allocate spectrum
406 384 GMWLSpectrum* spec = new GMWLSpectrum;
407 385 m_events = spec;
408 386  
409 387 // Load spectrum
410   - if (fname.has_extno()) {
411   - spec->load(filename);
412   - m_extno = gammalib::str(fname.extno());
413   - id(filename+"["+m_extno+"]");
414   - }
415   - else if (fname.has_extname()) {
416   - spec->load(filename);
417   - m_extname = fname.extname();
418   - id(filename+"["+m_extname+"]");
419   - }
420   - else {
421   - spec->load(filename);
422   - id(filename);
423   - }
  388 + spec->load(filename);
424 389  
425 390 // Set attributes
426 391 name("Multi-wavelength observation");
427   - m_filename = fname.url();
  392 + id(filename);
  393 + m_filename = filename;
428 394 m_instrument = spec->instrument();
429 395  
430 396 // Return
... ... @@ -487,8 +453,6 @@ void GMWLObservation::init_members(void)
487 453 // Initialise members
488 454 m_instrument = "MWL";
489 455 m_filename.clear();
490   - m_extno.clear();
491   - m_extname.clear();
492 456 m_response.clear();
493 457  
494 458 // Overwrite base class statistics
... ... @@ -509,8 +473,6 @@ void GMWLObservation::copy_members(const GMWLObservation&amp; obs)
509 473 // Copy members
510 474 m_instrument = obs.m_instrument;
511 475 m_filename = obs.m_filename;
512   - m_extno = obs.m_extno;
513   - m_extname = obs.m_extname;
514 476 m_response = obs.m_response;
515 477  
516 478 // Return
... ...
inst/mwl/test/data/obs_mwl.xml
1 1 <observation_list title="observation library">
2 2 <observation name="Crab" id="00001" instrument="MWL">
3 3 <parameter name="Instrument" value="COMPTEL"/>
4   - <parameter name="Data" file="$(PACKAGE_SOURCE)/inst/mwl/test/data/crab_mwl.fits" extname="COMPTEL"/>
  4 + <parameter name="Data" file="$(PACKAGE_SOURCE)/inst/mwl/test/data/crab_mwl.fits[COMPTEL]"/>
5 5 </observation>
6 6 <observation name="Crab" id="00002" instrument="MWL">
7 7 <parameter name="Instrument" value="LAT"/>
8   - <parameter name="Data" file="$(PACKAGE_SOURCE)/inst/mwl/test/data/crab_mwl.fits" extname="LAT"/>
  8 + <parameter name="Data" file="$(PACKAGE_SOURCE)/inst/mwl/test/data/crab_mwl.fits[LAT]"/>
9 9 </observation>
10 10 <observation name="Crab" id="00003" instrument="MWL">
11 11 <parameter name="Instrument" value="HESS"/>
12   - <parameter name="Data" file="$(PACKAGE_SOURCE)/inst/mwl/test/data/crab_mwl.fits" extname="HESS"/>
  12 + <parameter name="Data" file="$(PACKAGE_SOURCE)/inst/mwl/test/data/crab_mwl.fits[HESS]"/>
13 13 </observation>
14 14 </observation_list>
... ...