GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSObservation.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOSObservation.hpp - COSI observation 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 GCOSObservation.hpp
23 * @brief COSI observation class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCOSOBSERVATION_HPP
28#define GCOSOBSERVATION_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GFilename.hpp"
34#include "GObservation.hpp"
35#include "GCOSResponse.hpp"
36#include "GCOSSpaceCraft.hpp"
37#include "GCOSEventList.hpp"
38#include "GCOSEventCube.hpp"
39
40/* __ Forward declarations _______________________________________________ */
41class GTime;
42class GResponse;
43class GXmlElement;
44
45/* __ Constants __________________________________________________________ */
46
47
48/***********************************************************************//**
49 * @class GCOSObservation
50 *
51 * @brief COSI observation class
52 *
53 * The COSI observation class defines an observation.
54 *
55 * @todo Complete the class description.
56 ***************************************************************************/
58
59public:
60 // Constructors and destructors
61 GCOSObservation(void);
62 explicit GCOSObservation(const GXmlElement& xml);
63 GCOSObservation(const GFilename& eventname,
64 const GFilename& spacename,
65 const GFilename& rspname);
66 GCOSObservation(const std::vector<GFilename>& eventnames,
67 const GFilename& spacename,
68 const GFilename& rspname);
70 virtual ~GCOSObservation(void);
71
72 // Operators
73 virtual GCOSObservation& operator=(const GCOSObservation& obs);
74
75 // Implement pure virtual methods
76 virtual void clear(void);
77 virtual GCOSObservation* clone(void) const;
78 virtual std::string classname(void) const;
79 virtual void response(const GResponse& rsp);
80 virtual const GCOSResponse* response(void) const;
81 virtual std::string instrument(void) const;
82 virtual double ontime(void) const;
83 virtual double livetime(void) const;
84 virtual double deadc(const GTime& time = GTime()) const;
85 virtual void read(const GXmlElement& xml);
86 virtual void write(GXmlElement& xml) const;
87 virtual std::string print(const GChatter& chatter = NORMAL) const;
88
89 // Other methods
90 bool is_unbinned(void) const;
91 bool is_binned(void) const;
92 const GCOSSpaceCraft& spacecraft(void) const;
93 void ontime(const double& ontime);
94 void livetime(const double& livetime);
95 void deadc(const double& deadc);
96 void load(const GFilename& eventname,
97 const GFilename& spacename,
98 const GFilename& rspname);
99 void load(const std::vector<GFilename>& eventnames,
100 const GFilename& spacename,
101 const GFilename& rspname);
102
103protected:
104 // Protected methods
105 void init_members(void);
106 void copy_members(const GCOSObservation& obs);
107 void free_members(void);
108
109 // Protected members
110 std::string m_instrument; //!< Instrument name
111 GCOSResponse m_response; //!< Response functions
112 GCOSSpaceCraft m_spacecraft; //!< Space craft information
113 double m_ontime; //!< Ontime (sec)
114 double m_livetime; //!< Livetime (sec)
115 double m_deadc; //!< Deadtime correction
116
117 // Protected members for binned observation
118
119 // Protected members for unbinned observation
120 std::vector<GFilename> m_eventnames; //!< Event list filenames
121 GFilename m_spacename; //!< Space craft filename
122 GFilename m_rspname; //!< Response filename
123};
124
125
126/***********************************************************************//**
127 * @brief Return class name
128 *
129 * @return String containing the class name ("GCOSObservation").
130 ***************************************************************************/
131inline
132std::string GCOSObservation::classname(void) const
133{
134 return ("GCOSObservation");
135}
136
137
138/***********************************************************************//**
139 * @brief Return pointer to response function
140 *
141 * @return Response function pointer.
142 ***************************************************************************/
143inline
145{
146 // Return response pointer
147 return &m_response;
148}
149
150
151/***********************************************************************//**
152 * @brief Return instrument
153 *
154 * @return Instrument name.
155 ***************************************************************************/
156inline
157std::string GCOSObservation::instrument(void) const
158{
159 // Return instrument
160 return (m_instrument);
161}
162
163
164/***********************************************************************//**
165 * @brief Return ontime
166 *
167 * @return Ontime (seconds).
168 ***************************************************************************/
169inline
170double GCOSObservation::ontime(void) const
171{
172 // Return ontime
173 return (m_ontime);
174}
175
176
177/***********************************************************************//**
178 * @brief Return livetime
179 *
180 * @return Livetime (seconds).
181 ***************************************************************************/
182inline
184{
185 // Return livetime
186 return (m_livetime);
187}
188
189
190/***********************************************************************//**
191 * @brief Return deadtime correction factor
192 *
193 * @param[in] time Time.
194 *
195 * @return Deadtime correction factor.
196 ***************************************************************************/
197inline
198double GCOSObservation::deadc(const GTime& time) const
199{
200 // Return livetime
201 return (m_deadc);
202}
203
204
205/***********************************************************************//**
206 * @brief Check whether observation is unbinned
207 *
208 * @return True if observation is unbinned.
209 ***************************************************************************/
210inline
212{
213 return (dynamic_cast<const GCOSEventList*>(m_events) != NULL);
214}
215
216
217/***********************************************************************//**
218 * @brief Check whether observation is binned
219 *
220 * @return True if observation is binned.
221 ***************************************************************************/
222inline
224{
225 return (dynamic_cast<const GCOSEventCube*>(m_events) != NULL);
226}
227
228
229/***********************************************************************//**
230 * @brief Return space craft information
231 *
232 * @return Space craft information.
233 ***************************************************************************/
234inline
236{
237 return(m_spacecraft);
238}
239
240
241/***********************************************************************//**
242 * @brief Set ontime
243 *
244 * @param[in] ontime Ontime.
245 ***************************************************************************/
246inline
247void GCOSObservation::ontime(const double& ontime)
248{
250 return;
251}
252
253
254/***********************************************************************//**
255 * @brief Set livetime
256 *
257 * @param[in] livetime Livetime.
258 ***************************************************************************/
259inline
260void GCOSObservation::livetime(const double& livetime)
261{
263 return;
264}
265
266
267/***********************************************************************//**
268 * @brief Set deadtime correction factor
269 *
270 * @param[in] deadc Deadtime correction factor.
271 ***************************************************************************/
272inline
273void GCOSObservation::deadc(const double& deadc)
274{
275 m_deadc = deadc;
276 return;
277}
278
279#endif /* GCOSOBSERVATION_HPP */
COSI event bin container class definition.
COSI event list class definition.
COSI instrument response function class definition.
COSI space craft class definition.
Filename class interface definition.
Abstract observation base class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
COSI event bin container class.
COSI event list class.
COSI observation class.
GFilename m_rspname
Response filename.
virtual void write(GXmlElement &xml) const
Write COSI observation into XML element.
bool is_binned(void) const
Check whether observation is binned.
void copy_members(const GCOSObservation &obs)
Copy class members.
virtual double ontime(void) const
Return ontime.
void free_members(void)
Delete class members.
virtual ~GCOSObservation(void)
Destructor.
GCOSObservation(void)
Void constructor.
virtual double livetime(void) const
Return livetime.
bool is_unbinned(void) const
Check whether observation is unbinned.
void load(const GFilename &eventname, const GFilename &spacename, const GFilename &rspname)
Load data for an unbinned observation.
virtual double deadc(const GTime &time=GTime()) const
Return deadtime correction factor.
double m_ontime
Ontime (sec)
virtual const GCOSResponse * response(void) const
Return pointer to response function.
double m_deadc
Deadtime correction.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print observation information.
GFilename m_spacename
Space craft filename.
std::string m_instrument
Instrument name.
virtual std::string instrument(void) const
Return instrument.
virtual GCOSObservation * clone(void) const
Clone COSI observation.
virtual std::string classname(void) const
Return class name.
virtual GCOSObservation & operator=(const GCOSObservation &obs)
Assignment operator.
GCOSResponse m_response
Response functions.
const GCOSSpaceCraft & spacecraft(void) const
Return space craft information.
double m_livetime
Livetime (sec)
GCOSSpaceCraft m_spacecraft
Space craft information.
virtual void clear(void)
Clear COSI observation.
void init_members(void)
Initialise class members.
virtual void read(const GXmlElement &xml)
Read COSI observation from XML element.
std::vector< GFilename > m_eventnames
Event list filenames.
COSI instrument response function class.
COSI space craft class.
Filename class.
Definition GFilename.hpp:62
Abstract observation base class.
GEvents * m_events
Pointer to event container.
Abstract instrument response base class.
Definition GResponse.hpp:77
Time class.
Definition GTime.hpp:55
XML element node class.