GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSEventList.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOSEventList.hpp - COSI event list class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2026 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 GCOSEventList.hpp
23 * @brief COSI event list class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCOSEVENTLIST_HPP
28#define GCOSEVENTLIST_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GEventList.hpp"
34#include "GCOSEventAtom.hpp"
35#include "GCOSRoi.hpp"
36
37/* __ Forward declarations _______________________________________________ */
38class GRoi;
39class GFits;
40class GFilename;
41
42/* __ Constants __________________________________________________________ */
43
44
45/***********************************************************************//**
46 * @class GCOSEventList
47 *
48 * @brief COSI event list class
49 ***************************************************************************/
50class GCOSEventList : public GEventList {
51
52public:
53 // Constructors and destructors
54 GCOSEventList(void);
55 explicit GCOSEventList(const GFilename& filename);
56 GCOSEventList(const GCOSEventList& list);
57 virtual ~GCOSEventList(void);
58
59 // Operators
60 virtual GCOSEventList& operator=(const GCOSEventList& list);
61 virtual GCOSEventAtom* operator[](const int& index);
62 virtual const GCOSEventAtom* operator[](const int& index) const;
63
64 // Implemented pure virtual base class methods
65 virtual void clear(void);
66 virtual GCOSEventList* clone(void) const;
67 virtual std::string classname(void) const;
68 virtual int size(void) const;
69 virtual void load(const GFilename& filename);
70 virtual void save(const GFilename& filename,
71 const bool& clobber = false) const;
72 virtual void read(const GFits& fits);
73 virtual void write(GFits& fits) const;
74 virtual double number(void) const;
75 virtual void roi(const GRoi& roi);
76 virtual const GCOSRoi& roi(void) const;
77 virtual std::string print(const GChatter& chatter = NORMAL) const;
78
79 // Other methods
80 void append(const GCOSEventAtom& event);
81 void extend(const GCOSEventList& list);
82 void reserve(const int& number);
83 void remove(const int& index, const int& number = 1);
84 void sort(void);
85
86protected:
87 // Protected methods
88 void init_members(void);
89 void copy_members(const GCOSEventList& list);
90 void free_members(void);
91 virtual void set_energies(void);
92 virtual void set_times(void);
93
94 // Protected members
95 GCOSRoi m_roi; //!< Region of interest
96 std::vector<GCOSEventAtom> m_events; //!< Events
97};
98
99
100/***********************************************************************//**
101 * @brief Return class name
102 *
103 * @return String containing the class name ("GCOSEventList").
104 ***************************************************************************/
105inline
106std::string GCOSEventList::classname(void) const
107{
108 return ("GCOSEventList");
109}
110
111
112/***********************************************************************//**
113 * @brief Return number of events in list
114 *
115 * @return Number of events in list.
116 ***************************************************************************/
117inline
118int GCOSEventList::size(void) const
119{
120 return (int)m_events.size();
121}
122
123
124/***********************************************************************//**
125 * @brief Return number of events in list
126 *
127 * @return Number of events in list.
128 ***************************************************************************/
129inline
130double GCOSEventList::number(void) const
131{
132 return (double)m_events.size();
133}
134
135
136/***********************************************************************//**
137 * @brief Return Region of Interest
138 *
139 * @return Region of Interest.
140 ***************************************************************************/
141inline
142const GCOSRoi& GCOSEventList::roi(void) const
143{
144 return m_roi;
145}
146
147
148/***********************************************************************//**
149 * @brief Reserves space for events
150 *
151 * @param[in] number Number of events.
152 *
153 * Reserves space for a @p number events in the event list.
154 ***************************************************************************/
155inline
156void GCOSEventList::reserve(const int& number)
157{
158 m_events.reserve(number);
159 return;
160}
161
162
163/***********************************************************************//**
164 * @brief Set energies
165 *
166 * Sets energies.
167 ***************************************************************************/
168inline
170{
171 return;
172}
173
174
175/***********************************************************************//**
176 * @brief Set times
177 *
178 * Sets times.
179 ***************************************************************************/
180inline
182{
183 return;
184}
185
186#endif /* GLATEVENTLIST_HPP */
COSI event atom class definition.
COSI region of interest class definition.
Abstract event atom container class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
COSI event atom class.
COSI event list class.
virtual void set_energies(void)
Set energies.
virtual GCOSEventList & operator=(const GCOSEventList &list)
Assignment operator.
void remove(const int &index, const int &number=1)
Remove events from event list.
virtual void read(const GFits &fits)
Read COSI events from FITS file.
virtual void load(const GFilename &filename)
Load COSI events from FITS file.
void reserve(const int &number)
Reserves space for events.
void extend(const GCOSEventList &list)
Extend event list with another event list.
virtual std::string classname(void) const
Return class name.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COSI events.
virtual const GCOSRoi & roi(void) const
Return Region of Interest.
virtual ~GCOSEventList(void)
Destructor.
GCOSRoi m_roi
Region of interest.
virtual void set_times(void)
Set times.
void copy_members(const GCOSEventList &list)
Copy class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COSI event list information.
void sort(void)
Sort events by increasing time.
void free_members(void)
Delete class members.
virtual int size(void) const
Return number of events in list.
virtual GCOSEventList * clone(void) const
Clone event list.
void append(const GCOSEventAtom &event)
Append event to event list.
virtual GCOSEventAtom * operator[](const int &index)
COSI event atom access operator.
void init_members(void)
Initialise class members.
std::vector< GCOSEventAtom > m_events
Events.
GCOSEventList(void)
Void constructor.
virtual void clear(void)
Clear COSI event list.
virtual void write(GFits &fits) const
Write COSI event list into FITS file.
virtual double number(void) const
Return number of events in list.
COSI region of interest class.
Definition GCOSRoi.hpp:50
Abstract event atom container class.
Filename class.
Definition GFilename.hpp:62
FITS file class.
Definition GFits.hpp:63
Interface for the region of interest classes.
Definition GRoi.hpp:48