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