GammaLib 2.0.0
Loading...
Searching...
No Matches
GLATEventList.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATEventList.hpp - Fermi/LAT event list class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2009-2017 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 GLATEventList.hpp
23 * @brief Fermi/LAT event list class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATEVENTLIST_HPP
28#define GLATEVENTLIST_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GEventList.hpp"
34#include "GLATEventAtom.hpp"
35#include "GLATRoi.hpp"
36#include "GFits.hpp"
37#include "GFitsHDU.hpp"
38#include "GFitsTable.hpp"
39
40/* __ Forward declarations _______________________________________________ */
41class GFilename;
42
43/* __ Constants __________________________________________________________ */
44namespace gammalib {
45 const std::string extname_lat_events = "EVENTS";
46}
47
48
49/***********************************************************************//**
50 * @class GLATEventList
51 *
52 * @brief Fermi/LAT event list class
53 ***************************************************************************/
54class GLATEventList : public GEventList {
55
56public:
57 // Constructors and destructors
58 GLATEventList(void);
59 explicit GLATEventList(const GFilename& filename);
60 GLATEventList(const GLATEventList& list);
61 virtual ~GLATEventList(void);
62
63 // Operators
64 virtual GLATEventList& operator=(const GLATEventList& list);
65 virtual GLATEventAtom* operator[](const int& index);
66 virtual const GLATEventAtom* operator[](const int& index) const;
67
68 // Implemented pure virtual base class methods
69 virtual void clear(void);
70 virtual GLATEventList* clone(void) const;
71 virtual std::string classname(void) const;
72 virtual int size(void) const;
73 virtual void load(const GFilename& filename);
74 virtual void save(const GFilename& filename,
75 const bool& clobber = false) const;
76 virtual void read(const GFits& file);
77 virtual void write(GFits& file) const;
78 virtual int number(void) const;
79 virtual void roi(const GRoi& roi);
80 virtual const GLATRoi& roi(void) const;
81 virtual std::string print(const GChatter& chatter = NORMAL) const;
82
83 // Other methods
84 void append(const GLATEventAtom& event);
85 void reserve(const int& number);
86 void remove(const int& index, const int& number = 1);
87
88protected:
89 // Protected methods
90 void init_members(void);
91 void copy_members(const GLATEventList& list);
92 void free_members(void);
93 virtual void set_energies(void) { return; }
94 virtual void set_times(void) { return; }
95 void read_events(const GFitsTable& hdu);
96 void read_ds_keys(const GFitsHDU& hdu);
97
98 // Protected members
99 GLATRoi m_roi; //!< Region of interest
100 std::vector<GLATEventAtom> m_events; //!< Events
101 std::vector<std::string> m_difrsp_label; //!< Diffuse response model labels
102 std::vector<std::string> m_ds_type; //!< Data selection types
103 std::vector<std::string> m_ds_unit; //!< Data selection units
104 std::vector<std::string> m_ds_value; //!< Data selection values
105 std::vector<std::string> m_ds_reference; //!< Data selection references
106};
107
108
109/***********************************************************************//**
110 * @brief Return class name
111 *
112 * @return String containing the class name ("GLATEventList").
113 ***************************************************************************/
114inline
115std::string GLATEventList::classname(void) const
116{
117 return ("GLATEventList");
118}
119
120
121/***********************************************************************//**
122 * @brief Return number of events in list
123 *
124 * @return Number of events in list.
125 ***************************************************************************/
126inline
127int GLATEventList::size(void) const
128{
129 return (int)m_events.size();
130}
131
132
133/***********************************************************************//**
134 * @brief Return number of events in list
135 *
136 * @return Number of events in list.
137 ***************************************************************************/
138inline
140{
141 return (int)m_events.size();
142}
143
144
145/***********************************************************************//**
146 * @brief Return Region of Interest
147 *
148 * @return Region of Interest.
149 ***************************************************************************/
150inline
151const GLATRoi& GLATEventList::roi(void) const
152{
153 return m_roi;
154}
155
156
157/***********************************************************************//**
158 * @brief Reserves space for events
159 *
160 * @param[in] number Number of events.
161 *
162 * Reserves space for number events in the event list.
163 ***************************************************************************/
164inline
165void GLATEventList::reserve(const int& number)
166{
167 m_events.reserve(number);
168 return;
169}
170
171#endif /* GLATEVENTLIST_HPP */
Abstract event atom container class interface definition.
Abstract FITS extension base class definition.
FITS table abstract base class interface definition.
FITS file class interface definition.
Fermi/LAT event atom class definition.
Fermi/LAT region of interest class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Abstract event atom container class.
Filename class.
Definition GFilename.hpp:62
Abstract FITS extension base class.
Definition GFitsHDU.hpp:51
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Fermi/LAT event atom class.
Fermi/LAT event list class.
std::vector< std::string > m_ds_type
Data selection types.
std::vector< GLATEventAtom > m_events
Events.
void read_ds_keys(const GFitsHDU &hdu)
Read data selection keywords from FITS HDU.
void remove(const int &index, const int &number=1)
Remove events from event list.
std::vector< std::string > m_ds_reference
Data selection references.
GLATEventList(void)
Void constructor.
virtual void clear(void)
Clear event list.
void append(const GLATEventAtom &event)
Append event to event list.
virtual void write(GFits &file) const
Write LAT event list into FITS file.
std::vector< std::string > m_difrsp_label
Diffuse response model labels.
virtual GLATEventList * clone(void) const
Clone event list.
virtual int size(void) const
Return number of events in list.
virtual const GLATRoi & roi(void) const
Return Region of Interest.
virtual void load(const GFilename &filename)
Load LAT events from FITS file.
void copy_members(const GLATEventList &list)
Copy class members.
std::vector< std::string > m_ds_value
Data selection values.
virtual ~GLATEventList(void)
Destructor.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save LAT events.
virtual int number(void) const
Return number of events in list.
void reserve(const int &number)
Reserves space for events.
virtual void read(const GFits &file)
Read LAT events from FITS file.
virtual std::string classname(void) const
Return class name.
virtual void set_energies(void)
void free_members(void)
Delete class members.
std::vector< std::string > m_ds_unit
Data selection units.
void read_events(const GFitsTable &hdu)
Read LAT events from FITS table.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event list information.
virtual void set_times(void)
void init_members(void)
Initialise class members.
GLATRoi m_roi
Region of interest.
virtual GLATEventAtom * operator[](const int &index)
Event atom access operator.
virtual GLATEventList & operator=(const GLATEventList &list)
Assignment operator.
Fermi/LAT region of interest class.
Definition GLATRoi.hpp:45
Interface for the region of interest classes.
Definition GRoi.hpp:48
const std::string extname_lat_events