GammaLib 2.0.0
Loading...
Searching...
No Matches
GCTAEventAtom.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCTAEventAtom.hpp - CTA event atom class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2010-2018 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 GCTAEventAtom.hpp
23 * @brief CTA event atom class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCTAEVENTATOM_HPP
28#define GCTAEVENTATOM_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GEventAtom.hpp"
33#include "GEnergy.hpp"
34#include "GTime.hpp"
35#include "GCTAInstDir.hpp"
36
37
38/***********************************************************************//**
39 * @class GCTAEventAtom
40 *
41 * @brief CTA event atom class
42 *
43 * This class implements a CTA event atom. It collects all the relevant event
44 * information needed for CTA unbinned analysis.
45 ***************************************************************************/
46class GCTAEventAtom : public GEventAtom {
47
48 // Friend classes
49 friend class GCTAEventList;
50
51public:
52 // Constructors and destructors
53 GCTAEventAtom(void);
54 GCTAEventAtom(const GCTAInstDir& dir, const GEnergy& energy, const GTime& time);
55 GCTAEventAtom(const GCTAEventAtom& atom);
56 virtual ~GCTAEventAtom(void);
57
58 // Operators
60
61 // Implemented pure virtual base class methods
62 void clear(void);
63 GCTAEventAtom* clone(void) const;
64 std::string classname(void) const;
65 const GCTAInstDir& dir(void) const;
66 const GEnergy& energy(void) const;
67 const GTime& time(void) const;
68 void dir(const GCTAInstDir& dir);
69 void energy(const GEnergy& energy);
70 void time(const GTime& time);
71 std::string print(const GChatter& chatter = NORMAL) const;
72
73 // Other methods
74 const int& index(void) const;
75 const unsigned long& event_id(void) const;
76 const int& mc_id(void) const;
77 const float& phase(void) const;
78 void index(const int& index);
79 void event_id(const unsigned long& id);
80 void mc_id(const int& id);
81 void phase(const float& phase);
82
83protected:
84 // Protected methods
85 void init_members(void);
86 void copy_members(const GCTAEventAtom& atom);
87 void free_members(void);
88
89 // Protected members
90 int m_index; //!< Index in list
91 GCTAInstDir m_dir; //!< Event direction
92 GEnergy m_energy; //!< Event energy
93 GTime m_time; //!< Event time
94 unsigned long m_event_id; //!< Event identifier
95 int m_mc_id; //!< Monte Carlo identifier
96 float m_phase; //!< Optional phase
97};
98
99
100/***********************************************************************//**
101 * @brief Return class name
102 *
103 * @return String containing the class name ("GCTAEventAtom").
104 ***************************************************************************/
105inline
106std::string GCTAEventAtom::classname(void) const
107{
108 return ("GCTAEventAtom");
109}
110
111
112/***********************************************************************//**
113 * @brief Return instrument direction
114 *
115 * @return Instrument direction.
116 ***************************************************************************/
117inline
119{
120 return (m_dir);
121}
122
123
124/***********************************************************************//**
125 * @brief Return energy
126 *
127 * @return Energy.
128 ***************************************************************************/
129inline
131{
132 return (m_energy);
133}
134
135
136/***********************************************************************//**
137 * @brief Return time
138 *
139 * @return Time.
140 ***************************************************************************/
141inline
142const GTime& GCTAEventAtom::time(void) const
143{
144 return (m_time);
145}
146
147
148/***********************************************************************//**
149 * @brief Set instrument direction
150 *
151 * @param[in] dir Instrument direction.
152 ***************************************************************************/
153inline
155{
156 m_dir = dir;
157 return;
158}
159
160
161/***********************************************************************//**
162 * @brief Set energy
163 *
164 * @param[in] energy Energy.
165 ***************************************************************************/
166inline
168{
170 return;
171}
172
173
174/***********************************************************************//**
175 * @brief Set time
176 *
177 * @param[in] time Time.
178 ***************************************************************************/
179inline
180void GCTAEventAtom::time(const GTime& time)
181{
182 m_time = time;
183 return;
184}
185
186
187/***********************************************************************//**
188 * @brief Return event index in list
189 *
190 * @return Index.
191 *
192 * Returns the index of the event in case it is part of a list.
193 ***************************************************************************/
194inline
195const int& GCTAEventAtom::index(void) const
196{
197 return (m_index);
198}
199
200
201/***********************************************************************//**
202 * @brief Return event identifier
203 *
204 * @return Event identifier.
205 ***************************************************************************/
206inline
207const unsigned long& GCTAEventAtom::event_id(void) const
208{
209 return (m_event_id);
210}
211
212
213/***********************************************************************//**
214 * @brief Return Monte Carlo identifier
215 *
216 * @return Monte Carlo identifier.
217 ***************************************************************************/
218inline
219const int& GCTAEventAtom::mc_id(void) const
220{
221 return (m_mc_id);
222}
223
224
225/***********************************************************************//**
226 * @brief Return event phase
227 *
228 * @return Event phase.
229 ***************************************************************************/
230inline
231const float& GCTAEventAtom::phase(void) const
232{
233 return (m_phase);
234}
235
236
237/***********************************************************************//**
238 * @brief Set event index
239 *
240 * @param[in] index Event index.
241 ***************************************************************************/
242inline
243void GCTAEventAtom::index(const int& index)
244{
245 m_index = index;
246 return;
247}
248
249
250/***********************************************************************//**
251 * @brief Set event identifier
252 *
253 * @param[in] id Event identifier.
254 ***************************************************************************/
255inline
256void GCTAEventAtom::event_id(const unsigned long& id)
257{
258 m_event_id = id;
259 return;
260}
261
262
263/***********************************************************************//**
264 * @brief Set Monte Carlo identifier
265 *
266 * @param[in] id Monte Carlo identifier.
267 ***************************************************************************/
268inline
269void GCTAEventAtom::mc_id(const int& id)
270{
271 m_mc_id = id;
272 return;
273}
274
275
276/***********************************************************************//**
277 * @brief Set event phase
278 *
279 * @param[in] phase Event phase.
280 ***************************************************************************/
281inline
282void GCTAEventAtom::phase(const float& phase)
283{
284 m_phase = phase;
285 return;
286}
287
288#endif /* GCTAEVENTATOM_HPP */
CTA instrument direction class interface definition.
Energy value class definition.
Abstract event atom base class definition.
Time class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
CTA event atom class.
virtual ~GCTAEventAtom(void)
Destructor.
const int & mc_id(void) const
Return Monte Carlo identifier.
const float & phase(void) const
Return event phase.
const GEnergy & energy(void) const
Return energy.
int m_mc_id
Monte Carlo identifier.
std::string classname(void) const
Return class name.
GCTAInstDir m_dir
Event direction.
const int & index(void) const
Return event index in list.
float m_phase
Optional phase.
GEnergy m_energy
Event energy.
unsigned long m_event_id
Event identifier.
void copy_members(const GCTAEventAtom &atom)
Copy class members.
const unsigned long & event_id(void) const
Return event identifier.
const GCTAInstDir & dir(void) const
Return instrument direction.
int m_index
Index in list.
void clear(void)
Clear event atom.
GTime m_time
Event time.
void init_members(void)
Initialise class members.
std::string print(const GChatter &chatter=NORMAL) const
Print event information.
GCTAEventAtom * clone(void) const
Clone event atom.
const GTime & time(void) const
Return time.
GCTAEventAtom & operator=(const GCTAEventAtom &atom)
Assignment operator.
GCTAEventAtom(void)
Void constructor.
void free_members(void)
Delete class members.
CTA event list class.
CTA instrument direction class.
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Abstract interface for the event atom class.
Time class.
Definition GTime.hpp:55