Loading [MathJax]/extensions/MathMenu.js
GammaLib 2.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GSPIEventCube.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GSPIEventCube.hpp - INTEGRAL/SPI event cube class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2020 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 GSPIEventCube.hpp
23 * @brief INTEGRAL/SPI event bin container class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GSPIEVENTCUBE_HPP
28#define GSPIEVENTCUBE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GEventCube.hpp"
34#include "GSPIEventBin.hpp"
35
36/* __ Forward declarations _______________________________________________ */
37class GFilename;
38class GEbounds;
39class GGti;
40class GFits;
41class GSkyDir;
42class GEnergy;
43class GTime;
44class GSPIInstDir;
45
46/* __ Constants __________________________________________________________ */
47
48
49/***********************************************************************//**
50 * @class GSPIEventCube
51 *
52 * @brief INTEGRAL/SPI event bin container class
53 *
54 * This class is a container class for INTEGRAL/SPI event bins.
55 ***************************************************************************/
56class GSPIEventCube : public GEventCube {
57
58public:
59 // Constructors and destructors
60 GSPIEventCube(void);
61 explicit GSPIEventCube(const GFilename& filename);
62 GSPIEventCube(const GSPIEventCube& cube);
63 virtual ~GSPIEventCube(void);
64
65 // Operators
66 virtual GSPIEventCube& operator=(const GSPIEventCube& cube);
67 virtual GSPIEventBin* operator[](const int& index);
68 virtual const GSPIEventBin* operator[](const int& index) const;
69
70 // Implemented pure virtual base class methods
71 virtual void clear(void);
72 virtual GSPIEventCube* clone(void) const;
73 virtual std::string classname(void) const;
74 virtual int size(void) const;
75 virtual int dim(void) const;
76 virtual int naxis(const int& axis) const;
77 virtual void load(const GFilename& filename);
78 virtual void save(const GFilename& filename,
79 const bool& clobber = false) const;
80 virtual void read(const GFits& file);
81 virtual void write(GFits& file) const;
82 virtual int number(void) const;
83 virtual std::string print(const GChatter& chatter = NORMAL) const;
84
85 // Other methods
86 double ontime(void) const;
87 double livetime(void) const;
88 double model_counts(const int& index) const;
89 int models(void) const;
90 const std::string& ptid(const int& ipt) const;
91 const GSPIInstDir& dir(const int& ipt, const int& idet) const;
92 const GSkyDir& spi_x(const int& ipt) const;
93 const GSkyDir& spi_z(const int& ipt) const;
94
95protected:
96 // Protected methods
97 void init_members(void);
98 void copy_members(const GSPIEventCube& cube);
99 void free_members(void);
100 void alloc_data(void);
101 void read_ebds(const GFitsTable* ebds);
102 void read_pnt(const GFitsTable* pnt, const GFitsTable* gti);
103 void read_gti(const GFitsTable* gti);
104 void read_dti(const GFitsTable* dti);
105 void read_dsp(const GFitsTable* dsp);
106 void read_models(const GFits& file);
107 virtual void set_energies(void);
108 virtual void set_times(void);
109 void init_bin(void);
110 void set_bin(const int& index);
111
112 // Protected members
113 GSPIEventBin m_bin; //!< Actual event bin
114 int m_num_pt; //!< Number of pointings
115 int m_num_det; //!< Number of detectors
116 int m_num_ebin; //!< Number of energy bins
117 int m_num_sky; //!< Number of sky models
118 int m_num_bgm; //!< Number of background models
119 int m_gti_size; //!< Size of GTI arrays
120 int m_dsp_size; //!< Size of DSP arrays
121 int m_model_size; //!< Size of model arrays
122 double* m_ontime; //!< Ontime array
123 double* m_livetime; //!< Livetime array
124 double* m_counts; //!< Counts array
125 double* m_stat_err; //!< Statistical error array
126 double* m_models; //!< Models array
127 double* m_size; //!< Event bin size array
128 GSPIInstDir* m_dir; //!< Event direction array
129 GTime* m_time; //!< Time array
130 GEnergy* m_energy; //!< Energy array
131 GEnergy* m_ewidth; //!< Energy bin width array
132 GSkyDir* m_spix; //!< SPI X axis array
133 GSkyDir* m_spiz; //!< SPI Z axis array
134 std::string* m_ptid; //!< Pointing identifiers
135 std::vector<std::string> m_modnames; //!< Model names
136};
137
138
139/***********************************************************************//**
140 * @brief Return class name
141 *
142 * @return String containing the class name ("GSPIEventCube").
143 ***************************************************************************/
144inline
145std::string GSPIEventCube::classname(void) const
146{
147 return ("GSPIEventCube");
148}
149
150
151/***********************************************************************//**
152 * @brief Return event cube size
153 *
154 * @return Number of bins in event cube.
155 *
156 * Returns number of bins in event cube.
157 ***************************************************************************/
158inline
159int GSPIEventCube::size(void) const
160{
161 return (m_dsp_size);
162}
163
164
165/***********************************************************************//**
166 * @brief Return event cube dimension
167 *
168 * @return Number of dimensions in event cube.
169 *
170 * Returns the dimension of the event cube which is always 3.
171 ***************************************************************************/
172inline
173int GSPIEventCube::dim(void) const
174{
175 return (3);
176}
177
178
179/***********************************************************************//**
180 * @brief Set energies
181 *
182 * Sets energies.
183 ***************************************************************************/
184inline
186{
187 return;
188}
189
190
191/***********************************************************************//**
192 * @brief Set times
193 *
194 * Sets times.
195 ***************************************************************************/
196inline
198{
199 return;
200}
201
202
203/***********************************************************************//**
204 * @brief Return number of models
205 *
206 * @return Number of models.
207 *
208 * Returns the number of models in the event cube.
209 ***************************************************************************/
210inline
212{
213 return (m_num_sky+m_num_bgm);
214}
215
216#endif /* GSPIEVENTCUBE_HPP */
Abstract event bin container class interface definition.
INTEGRAL/SPI event bin class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Energy boundaries container class.
Definition GEbounds.hpp:60
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Abstract event bin container class.
const GGti & gti(void) const
Return Good Time Intervals.
Definition GEvents.hpp:134
Filename class.
Definition GFilename.hpp:62
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Good Time Interval class.
Definition GGti.hpp:62
INTEGRAL/SPI event bin class.
INTEGRAL/SPI event bin container class.
void copy_members(const GSPIEventCube &cube)
Copy class members.
virtual void clear(void)
Clear INTEGRAL/SPI event cube.
void init_members(void)
Initialise class members.
void read_pnt(const GFitsTable *pnt, const GFitsTable *gti)
Read pointing information.
GSkyDir * m_spiz
SPI Z axis array.
GSkyDir * m_spix
SPI X axis array.
int m_model_size
Size of model arrays.
const GSPIInstDir & dir(const int &ipt, const int &idet) const
Return instrument direction.
const GSkyDir & spi_z(const int &ipt) const
Return SPI Z direction.
double * m_livetime
Livetime array.
int models(void) const
Return number of models.
GSPIEventBin m_bin
Actual event bin.
void read_models(const GFits &file)
Read models from INTEGRAL/SPI Observation Group.
GTime * m_time
Time array.
virtual ~GSPIEventCube(void)
Destructor.
void read_dti(const GFitsTable *dti)
Read data from INTEGRAL/SPI "SPI.-OBS.-DTI" extension.
virtual int dim(void) const
Return event cube dimension.
void read_dsp(const GFitsTable *dsp)
Read data from INTEGRAL/SPI "SPI.-OBS.-DSP" extension.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save INTEGRAL/SPI event cube into FITS file.
virtual int naxis(const int &axis) const
Return number of bins in axis.
void free_members(void)
Delete class members.
double livetime(void) const
Return total livetime.
virtual int size(void) const
Return event cube size.
void init_bin(void)
Initialise event bin.
GEnergy * m_energy
Energy array.
int m_num_pt
Number of pointings.
std::vector< std::string > m_modnames
Model names.
const std::string & ptid(const int &ipt) const
Return pointing identifier.
virtual void set_energies(void)
Set energies.
void set_bin(const int &index)
Set event bin.
virtual GSPIEventCube & operator=(const GSPIEventCube &cube)
Assignment operator.
double ontime(void) const
Return total ontime.
virtual void load(const GFilename &filename)
Load INTEGRAL/SPI event cube from Observation Group.
virtual void write(GFits &file) const
Write INTEGRAL/SPI event cube into FITS file.
double * m_size
Event bin size array.
GSPIInstDir * m_dir
Event direction array.
void read_gti(const GFitsTable *gti)
Read data from INTEGRAL/SPI "SPI.-OBS.-GTI" extension.
virtual std::string classname(void) const
Return class name.
void alloc_data(void)
Allocate data.
int m_gti_size
Size of GTI arrays.
int m_num_sky
Number of sky models.
int m_num_ebin
Number of energy bins.
virtual GSPIEventBin * operator[](const int &index)
Event bin access operator.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print INTEGRAL/SPI event cube information.
int m_num_det
Number of detectors.
int m_num_bgm
Number of background models.
double * m_counts
Counts array.
double * m_stat_err
Statistical error array.
double * m_ontime
Ontime array.
virtual void set_times(void)
Set times.
std::string * m_ptid
Pointing identifiers.
GSPIEventCube(void)
Void constructor.
virtual GSPIEventCube * clone(void) const
Clone event cube.
int m_dsp_size
Size of DSP arrays.
virtual void read(const GFits &file)
Read INTEGRAL/SPI event cube from Observation Group FITS file.
GEnergy * m_ewidth
Energy bin width array.
double * m_models
Models array.
double model_counts(const int &index) const
Return number of events in model.
const GSkyDir & spi_x(const int &ipt) const
Return SPI X direction (pointing direction)
void read_ebds(const GFitsTable *ebds)
Read data from INTEGRAL/SPI "SPI.-EBDS-SET" extension.
virtual int number(void) const
Return number of events in cube.
INTEGRAL/SPI instrument direction class.
Sky direction class.
Definition GSkyDir.hpp:62
Time class.
Definition GTime.hpp:55