GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  ***************************************************************************/
46 class GCTAEventAtom : public GEventAtom {
47 
48  // Friend classes
49  friend class GCTAEventList;
50 
51 public:
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 
83 protected:
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  ***************************************************************************/
105 inline
106 std::string GCTAEventAtom::classname(void) const
107 {
108  return ("GCTAEventAtom");
109 }
110 
111 
112 /***********************************************************************//**
113  * @brief Return instrument direction
114  *
115  * @return Instrument direction.
116  ***************************************************************************/
117 inline
118 const GCTAInstDir& GCTAEventAtom::dir(void) const
119 {
120  return (m_dir);
121 }
122 
123 
124 /***********************************************************************//**
125  * @brief Return energy
126  *
127  * @return Energy.
128  ***************************************************************************/
129 inline
130 const GEnergy& GCTAEventAtom::energy(void) const
131 {
132  return (m_energy);
133 }
134 
135 
136 /***********************************************************************//**
137  * @brief Return time
138  *
139  * @return Time.
140  ***************************************************************************/
141 inline
142 const 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  ***************************************************************************/
153 inline
155 {
156  m_dir = dir;
157  return;
158 }
159 
160 
161 /***********************************************************************//**
162  * @brief Set energy
163  *
164  * @param[in] energy Energy.
165  ***************************************************************************/
166 inline
167 void GCTAEventAtom::energy(const GEnergy& energy)
168 {
169  m_energy = energy;
170  return;
171 }
172 
173 
174 /***********************************************************************//**
175  * @brief Set time
176  *
177  * @param[in] time Time.
178  ***************************************************************************/
179 inline
180 void 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  ***************************************************************************/
194 inline
195 const 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  ***************************************************************************/
206 inline
207 const 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  ***************************************************************************/
218 inline
219 const 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  ***************************************************************************/
230 inline
231 const 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  ***************************************************************************/
242 inline
243 void 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  ***************************************************************************/
255 inline
256 void 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  ***************************************************************************/
268 inline
269 void 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  ***************************************************************************/
281 inline
282 void GCTAEventAtom::phase(const float& phase)
283 {
284  m_phase = phase;
285  return;
286 }
287 
288 #endif /* GCTAEVENTATOM_HPP */
virtual ~GCTAEventAtom(void)
Destructor.
GCTAInstDir m_dir
Event direction.
Energy value class definition.
const int & index(void) const
Return event index in list.
GEnergy m_energy
Event energy.
const int & mc_id(void) const
Return Monte Carlo identifier.
void free_members(void)
Delete class members.
CTA event list class.
const float & phase(void) const
Return event phase.
Time class.
Definition: GTime.hpp:55
void init_members(void)
Initialise class members.
GCTAEventAtom(void)
Void constructor.
float m_phase
Optional phase.
GCTAEventAtom * clone(void) const
Clone event atom.
const unsigned long & event_id(void) const
Return event identifier.
void clear(void)
Clear event atom.
std::string classname(void) const
Return class name.
const GTime & time(void) const
Return time.
CTA instrument direction class interface definition.
Abstract event atom base class definition.
GChatter
Definition: GTypemaps.hpp:33
GCTAEventAtom & operator=(const GCTAEventAtom &atom)
Assignment operator.
void copy_members(const GCTAEventAtom &atom)
Copy class members.
GTime m_time
Event time.
CTA event atom class.
int m_mc_id
Monte Carlo identifier.
CTA instrument direction class.
Definition: GCTAInstDir.hpp:63
int m_index
Index in list.
unsigned long m_event_id
Event identifier.
std::string print(const GChatter &chatter=NORMAL) const
Print event information.
Time class interface definition.
const GEnergy & energy(void) const
Return energy.
const GCTAInstDir & dir(void) const
Return instrument direction.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
Abstract interface for the event atom class.
Definition: GEventAtom.hpp:62