GammaLib 2.0.0
Loading...
Searching...
No Matches
GLATEventCube.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATEventCube.hpp - Fermi/LAT event cube class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2009-2016 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- *
6 * *
7 * This program is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file GLATEventCube.hpp
23 * @brief Fermi/LAT event cube class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATEVENTCUBE_HPP
28#define GLATEVENTCUBE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GEventCube.hpp"
34#include "GLATInstDir.hpp"
35#include "GLATEventBin.hpp"
36#include "GEnergy.hpp"
37#include "GTime.hpp"
38#include "GFits.hpp"
39#include "GFitsImage.hpp"
40#include "GFitsTable.hpp"
41#include "GSkyMap.hpp"
42#include "GNodeArray.hpp"
43
44/* __ Forward declarations _______________________________________________ */
45class GFilename;
46
47
48/***********************************************************************//**
49 * @class GLATEventCube
50 *
51 * @brief Fermi/LAT event cube class
52 ***************************************************************************/
53class GLATEventCube : public GEventCube {
54
55public:
56 // Constructors and destructors
57 GLATEventCube(void);
58 explicit GLATEventCube(const GFilename& filename);
59 GLATEventCube(const GLATEventCube& cube);
60 virtual ~GLATEventCube(void);
61
62 // Operators
63 virtual GLATEventCube& operator=(const GLATEventCube& cube);
64 virtual GLATEventBin* operator[](const int& index);
65 virtual const GLATEventBin* operator[](const int& index) const;
66
67 // Implemented pure virtual base class methods
68 virtual void clear(void);
69 virtual GLATEventCube* clone(void) const;
70 virtual std::string classname(void) const;
71 virtual int size(void) const;
72 virtual int dim(void) const;
73 virtual int naxis(const int& axis) const;
74 virtual void load(const GFilename& filename);
75 virtual void save(const GFilename& filename,
76 const bool& clobber = false) const;
77 virtual void read(const GFits& file);
78 virtual void write(GFits& file) const;
79 virtual int number(void) const;
80 virtual std::string print(const GChatter& chatter = NORMAL) const;
81
82 // Other methods
83 void time(const GTime& time);
84 void map(const GSkyMap& map);
85 void enodes(const GNodeArray& enodes);
86 void ontime(const double& ontime);
87 const GTime& time(void) const;
88 const GSkyMap& map(void) const;
89 const GNodeArray& enodes(void) const;
90 const double& ontime(void) const;
91 int nx(void) const;
92 int ny(void) const;
93 int npix(void) const;
94 int ebins(void) const;
95 int ndiffrsp(void) const;
96 std::string diffname(const int& index) const;
97 GSkyMap* diffrsp(const int& index) const;
98 double maxrad(const GSkyDir& dir) const;
99
100protected:
101 // Protected methods
102 void init_members(void);
103 void copy_members(const GLATEventCube& cube);
104 void free_members(void);
105 void read_cntmap(const GFitsImage& hdu);
106 void read_srcmap(const GFitsImage& hdu);
107 void read_ebds(const GFitsTable& hdu);
108 void read_gti(const GFitsTable& hdu);
109 void set_directions(void);
110 virtual void set_energies(void);
111 virtual void set_times(void);
112 void set_bin(const int& index);
113
114 // Protected data area
115 GLATEventBin m_bin; //!< Actual energy bin
116 GSkyMap m_map; //!< Counts map stored as sky map
117 GTime m_time; //!< Event cube mean time
118 double m_ontime; //!< Event cube ontime (sec)
119 std::vector<GLATInstDir> m_dirs; //!< Array of event directions
120 std::vector<double> m_solidangle; //!< Array of solid angles (sr)
121 std::vector<GEnergy> m_energies; //!< Array of log mean energies
122 std::vector<GEnergy> m_ewidth; //!< Array of energy bin widths
123 std::vector<GSkyMap*> m_srcmap; //!< Pointers to source maps
124 std::vector<std::string> m_srcmap_names; //!< Source map names
125 GNodeArray m_enodes; //!< Energy nodes
126};
127
128
129/***********************************************************************//**
130 * @brief Return class name
131 *
132 * @return String containing the class name ("GLATEventCube").
133 ***************************************************************************/
134inline
135std::string GLATEventCube::classname(void) const
136{
137 return ("GLATEventCube");
138}
139
140
141/***********************************************************************//**
142 * @brief Set event cube mean time
143 *
144 * @param[in] time Event cube mean time.
145 ***************************************************************************/
146inline
147void GLATEventCube::time(const GTime& time)
148{
149 m_time = time;
150 return;
151}
152
153
154/***********************************************************************//**
155 * @brief Set event cube energy nodes
156 *
157 * @param[in] enodes Energy nodes.
158 ***************************************************************************/
159inline
161{
163 return;
164}
165
166
167/***********************************************************************//**
168 * @brief Set event cube ontime
169 *
170 * @param[in] ontime Ontime.
171 ***************************************************************************/
172inline
173void GLATEventCube::ontime(const double& ontime)
174{
176 return;
177}
178
179
180/***********************************************************************//**
181 * @brief Return event cube mean time
182 *
183 * @return Event cube mean time.
184 ***************************************************************************/
185inline
186const GTime& GLATEventCube::time(void) const
187{
188 return m_time;
189}
190
191
192/***********************************************************************//**
193 * @brief Return event cube sky map
194 *
195 * @return Sky map.
196 ***************************************************************************/
197inline
198const GSkyMap& GLATEventCube::map(void) const
199{
200 return m_map;
201}
202
203
204/***********************************************************************//**
205 * @brief Return event cube energy nodes
206 *
207 * @return Energy nodes.
208 ***************************************************************************/
209inline
211{
212 return m_enodes;
213}
214
215
216/***********************************************************************//**
217 * @brief Return event cube ontime
218 *
219 * @return Ontime.
220 ***************************************************************************/
221inline
222const double& GLATEventCube::ontime(void) const
223{
224 return m_ontime;
225}
226
227
228/***********************************************************************//**
229 * @brief Return number of bins in X direction
230 *
231 * @return Number of bins in X direction.
232 ***************************************************************************/
233inline
234int GLATEventCube::nx(void) const
235{
236 return m_map.nx();
237}
238
239
240/***********************************************************************//**
241 * @brief Return number of bins in Y direction
242 *
243 * @return Number of bins in Y direction.
244 ***************************************************************************/
245inline
246int GLATEventCube::ny(void) const
247{
248 return m_map.ny();
249}
250
251
252/***********************************************************************//**
253 * @brief Return number of pixels in event cube sky map
254 *
255 * @return Number of pixels in event cube sky map.
256 ***************************************************************************/
257inline
258int GLATEventCube::npix(void) const
259{
260 return m_map.npix();
261}
262
263
264/***********************************************************************//**
265 * @brief Return number of energy bins in event cube
266 *
267 * @return Number of energy bins in event cube.
268 ***************************************************************************/
269inline
270int GLATEventCube::ebins(void) const
271{
272 return m_map.nmaps();
273}
274
275
276/***********************************************************************//**
277 * @brief Return number of diffuse model components
278 *
279 * @return Number of diffuse model components.
280 ***************************************************************************/
281inline
283{
284 return (int)m_srcmap.size();
285}
286
287#endif /* GLATEVENTCUBE_HPP */
Energy value class definition.
Abstract event bin container class interface definition.
Abstract FITS image base class definition.
FITS table abstract base class interface definition.
FITS file class interface definition.
Fermi/LAT event bin class interface definition.
Fermi/LAT instrument direction class definition.
Node array class interface definition.
Sky map class definition.
Time class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Abstract event bin container class.
Filename class.
Definition GFilename.hpp:62
Abstract FITS image base class.
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Fermi/LAT event bin class.
Fermi/LAT event cube class.
GLATEventBin m_bin
Actual energy bin.
virtual GLATEventCube * clone(void) const
Clone instance.
double maxrad(const GSkyDir &dir) const
Computes the maximum radius (in degrees) around a given source direction that fits spatially into the...
GLATEventCube(void)
Void constructor.
virtual std::string classname(void) const
Return class name.
virtual void clear(void)
Clear instance.
std::vector< GSkyMap * > m_srcmap
Pointers to source maps.
virtual ~GLATEventCube(void)
Destructor.
virtual void set_energies(void)
Set log mean energies and energy widths of event cube.
void copy_members(const GLATEventCube &cube)
Copy class members.
void set_directions(void)
Set sky directions and solid angles of events cube.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event cube information.
virtual int number(void) const
Return number of events in cube.
const GSkyMap & map(void) const
Return event cube sky map.
virtual int dim(void) const
Return dimension of event cube.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save LAT event cube into FITS file.
void read_gti(const GFitsTable &hdu)
Read GTIs from HDU.
virtual void load(const GFilename &filename)
Load LAT event cube from FITS file.
int npix(void) const
Return number of pixels in event cube sky map.
GTime m_time
Event cube mean time.
int ndiffrsp(void) const
Return number of diffuse model components.
virtual void set_times(void)
Set mean event time and ontime of event cube.
const double & ontime(void) const
Return event cube ontime.
virtual int size(void) const
Return number of bins in event cube.
virtual int naxis(const int &axis) const
Return number of bins in axis.
void free_members(void)
Delete class members.
std::vector< double > m_solidangle
Array of solid angles (sr)
std::vector< GEnergy > m_energies
Array of log mean energies.
int ny(void) const
Return number of bins in Y direction.
void read_cntmap(const GFitsImage &hdu)
Read Fermi/LAT counts map from HDU.
int nx(void) const
Return number of bins in X direction.
virtual void read(const GFits &file)
Read LAT event cube from FITS file.
void read_srcmap(const GFitsImage &hdu)
Read LAT source map from HDU.
virtual void write(GFits &file) const
Write LAT event cube into FITS file.
std::vector< GLATInstDir > m_dirs
Array of event directions.
GNodeArray m_enodes
Energy nodes.
void read_ebds(const GFitsTable &hdu)
Read energy boundaries from HDU.
GSkyMap * diffrsp(const int &index) const
Return diffuse response map.
int ebins(void) const
Return number of energy bins in event cube.
GSkyMap m_map
Counts map stored as sky map.
std::string diffname(const int &index) const
Return name of diffuse model.
double m_ontime
Event cube ontime (sec)
std::vector< std::string > m_srcmap_names
Source map names.
std::vector< GEnergy > m_ewidth
Array of energy bin widths.
const GNodeArray & enodes(void) const
Return event cube energy nodes.
virtual GLATEventBin * operator[](const int &index)
Event bin access operator.
void set_bin(const int &index)
Set event bin.
virtual GLATEventCube & operator=(const GLATEventCube &cube)
Assignment operator.
void init_members(void)
Initialise class members.
const GTime & time(void) const
Return event cube mean time.
Node array class.
Sky direction class.
Definition GSkyDir.hpp:62
Sky map class.
Definition GSkyMap.hpp:89
const int & nmaps(void) const
Returns number of maps.
Definition GSkyMap.hpp:389
const int & nx(void) const
Returns number of pixels in x coordinate.
Definition GSkyMap.hpp:361
const int & npix(void) const
Returns number of pixels.
Definition GSkyMap.hpp:345
const int & ny(void) const
Returns number of pixels in y coordinate.
Definition GSkyMap.hpp:377
Time class.
Definition GTime.hpp:55