GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSSpaceCraft.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOSSpaceCraft.hpp - COSI space craft 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 GCOSSpaceCraft.hpp
23 * @brief COSI space craft class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCOSSPACECRAFT_HPP
28#define GCOSSPACECRAFT_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GBase.hpp"
34#include "GGti.hpp"
35#include "GCOSPointing.hpp"
36
37/* __ Forward declaration ________________________________________________ */
38class GSkyDir;
39class GSkyMap;
40class GFits;
41class GFilename;
42
43/* __ Constants __________________________________________________________ */
44
45
46/***********************************************************************//**
47 * @class GCOSSpaceCraft
48 *
49 * @brief COSI space craft class
50 *
51 * The COSI space craft class provides spacecraft attitude and detector
52 * livetime information as function of time.
53 ***************************************************************************/
54class GCOSSpaceCraft : public GBase {
55
56public:
57 // Constructors and destructors
58 GCOSSpaceCraft(void);
59 explicit GCOSSpaceCraft(const GFilename& filename);
60 GCOSSpaceCraft(const GCOSSpaceCraft& spacecraft);
61 virtual ~GCOSSpaceCraft(void);
62
63 // Operators
64 GCOSSpaceCraft& operator=(const GCOSSpaceCraft& spacecraft);
65 GCOSPointing& operator[](const int& index);
66 const GCOSPointing& operator[](const int& index) const;
67
68 // Methods
69 void clear(void);
70 GCOSSpaceCraft* clone(void) const;
71 std::string classname(void) const;
72 bool is_empty(void) const;
73 int size(void) const;
74 const GGti& gti(void) const;
75 const std::vector<double>& livetimes(void) const;
76 const double& ontime(void) const;
77 const double& livetime(void) const;
78 double livetime(const GSkyDir& dir) const;
79 GSkyMap livetime(const GSkyMap& map) const;
80 const double& deadc(void) const;
81 void load(const GFilename& filename);
82 void save(const GFilename& filename,
83 const bool& clobber = false) const;
84 void read(const GFits& fits);
85 void write(GFits& fits) const;
86 std::string print(const GChatter& chatter = NORMAL) const;
87
88protected:
89 // Protected methods
90 void init_members(void);
91 void copy_members(const GCOSSpaceCraft& spacecraft);
92 void free_members(void);
93 void load_ori(const GFilename& filename);
94 void load_fits(const GFilename& filename);
95 void read_pointings(const GFits& fits);
96 void read_livetimes(const GFits& fits);
97 void write_pointings(GFits& fits) const;
98 void write_livetimes(GFits& fits) const;
99
100 // Protected members
101 GGti m_gti; //!< Good Time Intervals
102 std::vector<double> m_livetimes; //!< Livetimes for each Good Time Interval (sec)
103 std::vector<GCOSPointing> m_pointings; //!< Pointings
104 double m_ontime; //!< Ontime (sec)
105 double m_livetime; //!< Livetime (sec)
106 double m_deadc; //!< Deadtime correction
107};
108
109
110/***********************************************************************//**
111 * @brief Return class name
112 *
113 * @return String containing the class name ("GCOSSpaceCraft").
114 ***************************************************************************/
115inline
116std::string GCOSSpaceCraft::classname(void) const
117{
118 return ("GCOSSpaceCraft");
119}
120
121
122/***********************************************************************//**
123 * @brief Signals whether there are no pointing entries
124 *
125 * @return True if instance does not hold any pointing entries.
126 ***************************************************************************/
127inline
129{
130 return (m_pointings.empty());
131}
132
133
134/***********************************************************************//**
135 * @brief Return number of pointing entries
136 *
137 * @return Number of pointing entries.
138 ***************************************************************************/
139inline
140int GCOSSpaceCraft::size(void) const
141{
142 return (m_pointings.size());
143}
144
145
146/***********************************************************************//**
147 * @brief Return Good Time Intervals
148 *
149 * @return Good Time Intervals.
150 ***************************************************************************/
151inline
152const GGti& GCOSSpaceCraft::gti(void) const
153{
154 return (m_gti);
155}
156
157
158/***********************************************************************//**
159 * @brief Return vector of livetimes
160 *
161 * @return Vector of livetimes.
162 ***************************************************************************/
163inline
164const std::vector<double>& GCOSSpaceCraft::livetimes(void) const
165{
166 return (m_livetimes);
167}
168
169
170/***********************************************************************//**
171 * @brief Return ontime in seconds
172 *
173 * @return Ontime (sec).
174 ***************************************************************************/
175inline
176const double& GCOSSpaceCraft::ontime(void) const
177{
178 return (m_ontime);
179}
180
181
182/***********************************************************************//**
183 * @brief Return livetime in seconds
184 *
185 * @return Livetime (sec).
186 ***************************************************************************/
187inline
188const double& GCOSSpaceCraft::livetime(void) const
189{
190 return (m_livetime);
191}
192
193
194/***********************************************************************//**
195 * @brief Return deadtime correction factor
196 *
197 * @return Deadtime correction factor.
198 ***************************************************************************/
199inline
200const double& GCOSSpaceCraft::deadc(void) const
201{
202 return (m_deadc);
203}
204
205#endif /* GCOSSPACECRAFT_HPP */
Definition of interface for all GammaLib classes.
COSI pointing class definition.
Good time interval class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Interface class for all GammaLib classes.
Definition GBase.hpp:52
COSI pointing class.
COSI space craft class.
const GGti & gti(void) const
Return Good Time Intervals.
std::vector< double > m_livetimes
Livetimes for each Good Time Interval (sec)
void load_fits(const GFilename &filename)
Load COSI space craft file from FITS file.
double m_livetime
Livetime (sec)
void load_ori(const GFilename &filename)
Load COSI space craft file from ORI file.
int size(void) const
Return number of pointing entries.
void read_livetimes(const GFits &fits)
Read livetimes from FITS file.
void write_livetimes(GFits &fits) const
Write livetimes into FITS file.
GCOSSpaceCraft(void)
Void constructor.
GCOSSpaceCraft & operator=(const GCOSSpaceCraft &spacecraft)
Assignment operator.
double m_deadc
Deadtime correction.
GGti m_gti
Good Time Intervals.
double m_ontime
Ontime (sec)
void clear(void)
Clear space craft.
void free_members(void)
Delete class members.
std::string print(const GChatter &chatter=NORMAL) const
Print space craft information.
void copy_members(const GCOSSpaceCraft &spacecraft)
Copy class members.
const double & deadc(void) const
Return deadtime correction factor.
void read(const GFits &fits)
Read COSI space craft FITS file.
const double & ontime(void) const
Return ontime in seconds.
void load(const GFilename &filename)
Load COSI space craft file.
const std::vector< double > & livetimes(void) const
Return vector of livetimes.
void write(GFits &fits) const
Write COSI space craft into FITS file.
std::vector< GCOSPointing > m_pointings
Pointings.
void read_pointings(const GFits &fits)
Read pointings from FITS file.
bool is_empty(void) const
Signals whether there are no pointing entries.
void write_pointings(GFits &fits) const
Write pointings into FITS file.
std::string classname(void) const
Return class name.
virtual ~GCOSSpaceCraft(void)
Destructor.
void save(const GFilename &filename, const bool &clobber=false) const
Save COSI space craft FITS file.
GCOSSpaceCraft * clone(void) const
Clone space craft.
void init_members(void)
Initialise class members.
GCOSPointing & operator[](const int &index)
Return reference to COSI pointing.
const double & livetime(void) const
Return livetime in seconds.
Filename class.
Definition GFilename.hpp:62
FITS file class.
Definition GFits.hpp:63
Good Time Interval class.
Definition GGti.hpp:63
Sky direction class.
Definition GSkyDir.hpp:62
Sky map class.
Definition GSkyMap.hpp:89