GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSEventAtom.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOSEventAtom.hpp - COSI event atom 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 GCOSEventAtom.hpp
23 * @brief COSI event atom class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCOSEVENTATOM_HPP
28#define GCOSEVENTATOM_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <iostream>
32#include "GEventAtom.hpp"
33#include "GEnergy.hpp"
34#include "GTime.hpp"
35#include "GCOSInstDir.hpp"
36
37/* __ Forward declarations _______________________________________________ */
38
39/* __ Constants __________________________________________________________ */
40
41
42/***********************************************************************//**
43 * @class GCOSEventAtom
44 *
45 * @brief COSI event atom class
46 ***************************************************************************/
47class GCOSEventAtom : public GEventAtom {
48
49 // Operator friends
50 friend bool operator<(const GCOSEventAtom& a, const GCOSEventAtom& b);
51
52public:
53 // Constructors and destructors
54 GCOSEventAtom(void);
55 GCOSEventAtom(const GCOSEventAtom& atom);
56 GCOSEventAtom(const GCOSInstDir& dir, const GEnergy& energy, const GTime& time);
57 virtual ~GCOSEventAtom(void);
58
59 // Operators
61
62 // Implemented pure virtual base class methods
63 void clear(void);
64 GCOSEventAtom* clone(void) const;
65 std::string classname(void) const;
66 const GCOSInstDir& dir(void) const;
67 const GEnergy& energy(void) const;
68 const GTime& time(void) const;
69 std::string print(const GChatter& chatter = NORMAL) const;
70
71 // Other methods
72 void dir(const GCOSInstDir& dir);
73 void energy(const GEnergy& energy);
74 void time(const GTime& time);
75
76protected:
77 // Protected methods
78 void init_members(void);
79 void copy_members(const GCOSEventAtom& atom);
80 void free_members(void);
81
82 // Protected members
83 GCOSInstDir m_dir; //!< Event direction
84 GEnergy m_energy; //!< Event energy
85 GTime m_time; //!< Event time
86};
87
88
89/***********************************************************************//**
90 * @brief Return class name
91 *
92 * @return String containing the class name ("GCOSEventAtom").
93 ***************************************************************************/
94inline
95std::string GCOSEventAtom::classname(void) const
96{
97 return ("GCOSEventAtom");
98}
99
100
101/***********************************************************************//**
102 * @brief Return event instrument direction
103 *
104 * @return Event instrument direction.
105 *
106 * Returns the instrument direction of the event. The instrument direction
107 * is the event location in the three-dimensional COSI data space, spanned
108 * by the scattering angles Chi and Psi and the Compton scatter angle Phi.
109 ***************************************************************************/
110inline
112{
113 return (m_dir);
114}
115
116
117/***********************************************************************//**
118 * @brief Set event instrument direction
119 *
120 * @param[in] dir Event instrument direction.
121 *
122 * Sets the event instrument direction.
123 ***************************************************************************/
124inline
126{
127 m_dir = dir;
128 return;
129}
130
131
132/***********************************************************************//**
133 * @brief Return event energy
134 *
135 * @return Event energy.
136 *
137 * Returns the measured energy of the photon on the sky.
138 ***************************************************************************/
139inline
141{
142 return (m_energy);
143}
144
145
146/***********************************************************************//**
147 * @brief Set event energy
148 *
149 * @param[in] energy Event energy.
150 *
151 * Sets the event energy.
152 ***************************************************************************/
153inline
155{
157 return;
158}
159
160
161/***********************************************************************//**
162 * @brief Return event time
163 *
164 * @return Event time.
165 *
166 * Returns the event triggering time.
167 ***************************************************************************/
168inline
169const GTime& GCOSEventAtom::time(void) const
170{
171 return (m_time);
172}
173
174
175/***********************************************************************//**
176 * @brief Set event time
177 *
178 * @param[in] time Event time.
179 *
180 * Sets the event time.
181 ***************************************************************************/
182inline
183void GCOSEventAtom::time(const GTime& time)
184{
185 m_time = time;
186 return;
187}
188
189
190/***********************************************************************//**
191 * @brief Check if time of one event atom is smaller than time of another
192 * event atom
193 *
194 * @param[in] a First event atom.
195 * @param[in] b Second event atom.
196 * @return True if time of @p a is smaller than time of @p b.
197 ***************************************************************************/
198inline
199bool operator<(const GCOSEventAtom& a, const GCOSEventAtom& b)
200{
201 return (a.time() < b.time());
202}
203
204#endif /* GCOSEVENTATOM_HPP */
bool operator<(const GCOSEventAtom &a, const GCOSEventAtom &b)
Check if time of one event atom is smaller than time of another event atom.
COSI instrument direction class 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
COSI event atom class.
void free_members(void)
Delete class members.
void copy_members(const GCOSEventAtom &atom)
Copy class members.
GCOSEventAtom & operator=(const GCOSEventAtom &atom)
Assignment operator.
GCOSInstDir m_dir
Event direction.
void init_members(void)
Initialise class members.
const GEnergy & energy(void) const
Return event energy.
friend bool operator<(const GCOSEventAtom &a, const GCOSEventAtom &b)
Check if time of one event atom is smaller than time of another event atom.
GCOSEventAtom(void)
Void constructor.
void clear(void)
Clear event atom.
const GTime & time(void) const
Return event time.
std::string classname(void) const
Return class name.
GTime m_time
Event time.
const GCOSInstDir & dir(void) const
Return event instrument direction.
GEnergy m_energy
Event energy.
virtual ~GCOSEventAtom(void)
Destructor.
GCOSEventAtom * clone(void) const
Clone event atom.
std::string print(const GChatter &chatter=NORMAL) const
Print event information.
COSI 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