GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMEventList.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMEventList.hpp - COMPTEL event list class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 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 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 _______________________________________________ */
38 class GRoi;
39 class GFits;
40 class GFilename;
41 class GFitsTable;
42 
43 /* __ Constants __________________________________________________________ */
44 
45 
46 /***********************************************************************//**
47  * @class GCOMEventList
48  *
49  * @brief COMPTEL event list class
50  ***************************************************************************/
51 class GCOMEventList : public GEventList {
52 
53 public:
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 
85 protected:
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 
94  // Protected members
95  GCOMRoi m_roi; //!< Region of interest
96  std::vector<GCOMEventAtom> m_events; //!< Events
97 };
98 
99 
100 /***********************************************************************//**
101  * @brief Return class name
102  *
103  * @return String containing the class name ("GCOMEventList").
104  ***************************************************************************/
105 inline
106 std::string GCOMEventList::classname(void) const
107 {
108  return ("GCOMEventList");
109 }
110 
111 
112 /***********************************************************************//**
113  * @brief Return number of events in list
114  *
115  * @return Number of events in list.
116  ***************************************************************************/
117 inline
118 int GCOMEventList::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  ***************************************************************************/
129 inline
130 int GCOMEventList::number(void) const
131 {
132  return (int)m_events.size();
133 }
134 
135 
136 /***********************************************************************//**
137  * @brief Return Region of Interest
138  *
139  * @return Region of Interest.
140  ***************************************************************************/
141 inline
142 const GCOMRoi& GCOMEventList::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  ***************************************************************************/
155 inline
157 {
158  m_events.reserve(number);
159  return;
160 }
161 
162 
163 /***********************************************************************//**
164  * @brief Set energies
165  *
166  * Sets energies.
167  ***************************************************************************/
168 inline
170 {
171  return;
172 }
173 
174 
175 /***********************************************************************//**
176  * @brief Set times
177  *
178  * Sets times.
179  ***************************************************************************/
180 inline
182 {
183  return;
184 }
185 
186 #endif /* GLATEVENTLIST_HPP */
void free_members(void)
Delete class members.
std::string number(const std::string &noun, const int &number)
Convert singular noun into number noun.
Definition: GTools.cpp:1046
virtual void set_times(void)
Set times.
virtual const GCOMRoi & roi(void) const
Return Region of Interest.
Abstract event atom container class.
Definition: GEventList.hpp:49
COMPTEL event atom class definition.
virtual void set_energies(void)
Set energies.
void read_events(const GFitsTable &table)
Read COMPTEL events from FITS table.
FITS file class.
Definition: GFits.hpp:63
COMPTEL region of interest class definition.
virtual GCOMEventList & operator=(const GCOMEventList &list)
Assignment operator.
Abstract event atom container class interface definition.
GCOMRoi m_roi
Region of interest.
virtual GCOMEventList * clone(void) const
Clone event list.
virtual void load(const GFilename &filename)
Load COMPTEL events from FITS file.
virtual int size(void) const
Return number of events in list.
virtual std::string classname(void) const
Return class name.
void reserve(const int &number)
Reserves space for events.
Filename class.
Definition: GFilename.hpp:62
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COMPTEL events.
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
GChatter
Definition: GTypemaps.hpp:33
void append(const GCOMEventAtom &event)
Append event to event list.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL event list information.
void copy_members(const GCOMEventList &list)
Copy class members.
COMPTEL region of interest class.
Definition: GCOMRoi.hpp:44
virtual void write(GFits &file) const
Write COMPTEL event list into FITS file.
virtual GCOMEventAtom * operator[](const int &index)
COMPTEL event atom access operator.
virtual void clear(void)
Clear COMPTEL event list.
std::vector< GCOMEventAtom > m_events
Events.
GCOMEventList(void)
Void constructor.
virtual int number(void) const
Return number of events in list.
COMPTEL event list class.
virtual void read(const GFits &file)
Read COMPTEL events from FITS file.
Interface for the region of interest classes.
Definition: GRoi.hpp:48
void init_members(void)
Initialise class members.
virtual ~GCOMEventList(void)
Destructor.
COMPTEL event atom class.