GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSEventCube.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOSEventCube.hpp - COSI event cube 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 GCOSEventCube.hpp
23 * @brief COSI event bin container class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCOSEVENTCUBE_HPP
28#define GCOSEVENTCUBE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GBounds.hpp"
34#include "GEventCube.hpp"
35#include "GCOSEventBin.hpp"
36#include "GCOSInstDir.hpp"
37#include "GSkyDir.hpp"
38#include "GSkyMap.hpp"
39#include "GEnergy.hpp"
40#include "GTime.hpp"
41
42/* __ Forward declarations _______________________________________________ */
43class GFilename;
44class GEbounds;
45class GGti;
46class GFits;
47class GCOSEventList;
48
49/* __ Constants __________________________________________________________ */
50
51
52/***********************************************************************//**
53 * @class GCOSEventCube
54 *
55 * @brief COSI event bin container class
56 *
57 * This class is a container class for COSI event bins.
58 ***************************************************************************/
59class GCOSEventCube : public GEventCube {
60
61public:
62 // Constructors and destructors
63 GCOSEventCube(void);
64 explicit GCOSEventCube(const GFilename& filename);
65 GCOSEventCube(const std::string& coords,
66 const int& nside,
67 const std::string& order,
68 const GBounds& phibounds,
69 const GEbounds& ebounds,
70 const GGti& gti);
72 virtual ~GCOSEventCube(void);
73
74 // Operators
76 virtual GCOSEventBin* operator[](const int& index);
77 virtual const GCOSEventBin* operator[](const int& index) const;
78
79 // Implemented pure virtual base class methods
80 virtual void clear(void);
81 virtual GCOSEventCube* clone(void) const;
82 virtual std::string classname(void) const;
83 virtual int size(void) const;
84 virtual int dim(void) const;
85 virtual int naxis(const int& axis) const;
86 virtual void load(const GFilename& filename);
87 virtual void save(const GFilename& filename,
88 const bool& clobber = false) const;
89 virtual void read(const GFits& fits);
90 virtual void write(GFits& fits) const;
91 virtual double number(void) const;
92 virtual std::string print(const GChatter& chatter = NORMAL) const;
93
94 // Other methods
95 void set(const std::string& coords,
96 const int& nside,
97 const std::string& order,
98 const GBounds& phibounds,
99 const GEbounds& ebounds,
100 const GGti& gti);
101 const GSkyMap& cube(void) const;
102 const GBounds& phibounds(void) const;
103 const GTime& time(void) const;
104 const double& ontime(void) const;
105 const double& solidangle(void) const;
106 void fill(const GCOSEventList& list);
107
108protected:
109 // Protected methods
110 void init_members(void);
111 void copy_members(const GCOSEventCube& cube);
112 void free_members(void);
113 void set_scatter_directions(void);
114 void set_scatter_angles(void);
115 virtual void set_energies(void);
116 virtual void set_times(void);
117 void init_bin(void);
118 void set_bin(const int& index);
119
120 // Protected members
121 GSkyMap m_cube; //!< Event cube
122 GBounds m_phibounds; //!< Phi layer boundaries
123 GCOSEventBin m_bin; //!< Current event bin
124 GCOSInstDir m_dir; //!< Current event direction
125 GTime m_time; //!< Event cube mean time
126 double m_ontime; //!< Event cube ontime (sec)
127 double m_solidangle; //!< Event bin solid angle (sr)
128 int m_npix; //!< Number of HealPix pixels
129 int m_nphi; //!< Number of Phi layers
130 std::vector<GSkyDir> m_dirs; //!< Cube pixel scatter directions
131 std::vector<double> m_phis; //!< Array of scatter angles
132 std::vector<double> m_phiwidths; //!< Array of scatter angles bin widths
133 std::vector<GEnergy> m_energies; //!< Cube energy bin mean energies
134 std::vector<GEnergy> m_ewidths; //!< Cube energy bin widths
135
136 // Event filling statistics
137 int m_num_events_checked; //!< Number of checked events
138 int m_num_events_used; //!< Number of used events
139 int m_num_outside_gti; //!< Number of events outside GTI
140 int m_num_outside_ebounds; //!< Number of events outside energy boundaries
141 int m_num_outside_phibounds; //!< Number of events outside scatter angle bounds.
142};
143
144
145/***********************************************************************//**
146 * @brief Return class name
147 *
148 * @return String containing the class name ("GCOSEventCube").
149 ***************************************************************************/
150inline
151std::string GCOSEventCube::classname(void) const
152{
153 return ("GCOSEventCube");
154}
155
156
157/***********************************************************************//**
158 * @brief Return event cube
159 *
160 * @return Event cube.
161 ***************************************************************************/
162inline
163const GSkyMap& GCOSEventCube::cube(void) const
164{
165 return (m_cube);
166}
167
168
169/***********************************************************************//**
170 * @brief Return Phi boundaries
171 *
172 * @return Phi boundaries.
173 ***************************************************************************/
174inline
176{
177 return (m_phibounds);
178}
179
180
181/***********************************************************************//**
182 * @brief Return event cube time
183 *
184 * @return Event cube time.
185 ***************************************************************************/
186inline
187const GTime& GCOSEventCube::time(void) const
188{
189 return (m_time);
190}
191
192
193/***********************************************************************//**
194 * @brief Return event cube ontime
195 *
196 * @return Event cube ontime.
197 ***************************************************************************/
198inline
199const double& GCOSEventCube::ontime(void) const
200{
201 return (m_ontime);
202}
203
204
205/***********************************************************************//**
206 * @brief Return event cube pixels solid angles
207 *
208 * @return Event cube pixels solid angles.
209 ***************************************************************************/
210inline
211const double& GCOSEventCube::solidangle(void) const
212{
213 return (m_solidangle);
214}
215
216#endif /* GCOSEVENTCUBE_HPP */
Boundaries class interface definition.
COSI event bin class definition.
COSI instrument direction class definition.
Energy value class definition.
Abstract event bin container class interface definition.
Sky direction class interface definition.
Sky map class definition.
Time class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Boundaries container class.
Definition GBounds.hpp:59
COSI event bin class.
COSI event bin container class.
void init_members(void)
Initialise class members.
std::vector< GEnergy > m_ewidths
Cube energy bin widths.
virtual int naxis(const int &axis) const
Return number of bins in axis.
virtual void clear(void)
Clear COSI event cube.
void free_members(void)
Delete class members.
virtual GCOSEventCube & operator=(const GCOSEventCube &cube)
Assignment operator.
GCOSEventBin m_bin
Current event bin.
virtual std::string classname(void) const
Return class name.
virtual int size(void) const
Return number of bins in event cube.
void set(const std::string &coords, const int &nside, const std::string &order, const GBounds &phibounds, const GEbounds &ebounds, const GGti &gti)
Set event cube.
virtual GCOSEventBin * operator[](const int &index)
Event bin access operator.
int m_num_outside_ebounds
Number of events outside energy boundaries.
std::vector< double > m_phiwidths
Array of scatter angles bin widths.
void init_bin(void)
Initialise event bin.
int m_num_outside_phibounds
Number of events outside scatter angle bounds.
virtual void read(const GFits &fits)
Read COSI event cube from FITS file.
void copy_members(const GCOSEventCube &cube)
Copy class members.
virtual ~GCOSEventCube(void)
Destructor.
virtual void set_energies(void)
Set log mean energies and energy widths of energy bins.
const GSkyMap & cube(void) const
Return event cube.
GBounds m_phibounds
Phi layer boundaries.
void set_scatter_angles(void)
Set Compton scatter angles of event cube.
int m_num_outside_gti
Number of events outside GTI.
GCOSEventCube(void)
Void constructor.
double m_ontime
Event cube ontime (sec)
virtual GCOSEventCube * clone(void) const
Clone event cube.
const GBounds & phibounds(void) const
Return Phi boundaries.
void set_scatter_directions(void)
Set scatter directions of all events cube pixels.
int m_num_events_checked
Number of checked events.
const double & solidangle(void) const
Return event cube pixels solid angles.
virtual double number(void) const
Return number of events in cube.
int m_npix
Number of HealPix pixels.
GCOSInstDir m_dir
Current event direction.
void fill(const GCOSEventList &list)
Fill event cube with events from event list.
const double & ontime(void) const
Return event cube ontime.
GTime m_time
Event cube mean time.
virtual void load(const GFilename &filename)
Load COSI event cube from FITS file.
GSkyMap m_cube
Event cube.
double m_solidangle
Event bin solid angle (sr)
const GTime & time(void) const
Return event cube time.
virtual int dim(void) const
Return dimension of event cube.
virtual void write(GFits &fits) const
Write COSI event cube into FITS file.
int m_num_events_used
Number of used events.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COSI event cube information.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COSI event cube into FITS file.
std::vector< GEnergy > m_energies
Cube energy bin mean energies.
virtual void set_times(void)
Set mean event time and ontime of event cube.
std::vector< GSkyDir > m_dirs
Cube pixel scatter directions.
std::vector< double > m_phis
Array of scatter angles.
void set_bin(const int &index)
Set event bin.
int m_nphi
Number of Phi layers.
COSI event list class.
COSI instrument direction class.
Energy boundaries container class.
Definition GEbounds.hpp:60
Abstract event bin container class.
const GGti & gti(void) const
Return Good Time Intervals.
Definition GEvents.hpp:134
const GEbounds & ebounds(void) const
Return energy boundaries.
Definition GEvents.hpp:122
Filename class.
Definition GFilename.hpp:62
FITS file class.
Definition GFits.hpp:63
Good Time Interval class.
Definition GGti.hpp:63
Sky map class.
Definition GSkyMap.hpp:89
Time class.
Definition GTime.hpp:55