GammaLib 2.1.0.dev
Loading...
Searching...
No Matches
GSPIObservation.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GSPIObservation.hpp - INTEGRAL/SPI observation class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2020-2024 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 GSPIObservation.hpp
23 * @brief INTEGRAL/SPI observation class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GSPIOBSERVATION_HPP
28#define GSPIOBSERVATION_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GFilename.hpp"
33#include "GObservation.hpp"
34#include "GSPIResponse.hpp"
35
36/* __ Forward declarations _______________________________________________ */
37class GTime;
38class GFits;
39class GResponse;
40class GXmlElement;
41
42/* __ Constants __________________________________________________________ */
43
44
45/***********************************************************************//**
46 * @class GSPIObservation
47 *
48 * @brief INTEGRAL/SPI observation class
49 *
50 * The INTEGRAL/SPI observation class defines an observation.
51 *
52 * @todo Complete the class description.
53 ***************************************************************************/
55
56public:
57 // Constructors and destructors
58 GSPIObservation(void);
59 explicit GSPIObservation(const GXmlElement& xml);
60 explicit GSPIObservation(const GFilename& filename);
62 virtual ~GSPIObservation(void);
63
64 // Operators
65 virtual GSPIObservation& operator=(const GSPIObservation& obs);
66
67 // Implement pure virtual methods
68 virtual void clear(void);
69 virtual GSPIObservation* clone(void) const;
70 virtual std::string classname(void) const;
71 virtual void response(const GResponse& rsp);
72 virtual const GSPIResponse* response(void) const;
73 virtual std::string instrument(void) const;
74 virtual double ontime(void) const;
75 virtual double livetime(void) const;
76 virtual double deadc(const GTime& time = GTime()) const;
77 virtual void read(const GXmlElement& xml);
78 virtual void write(GXmlElement& xml) const;
79 virtual std::string print(const GChatter& chatter = NORMAL) const;
80
81 // Overloaded virtual methods
82 virtual double grad_step_size(const GModelPar& par) const;
83
84 // Other methods
85 void read(const GFits& fits);
86 void load(const GFilename& filename);
87 void ontime(const double& ontime);
88 void livetime(const double& livetime);
89 void deadc(const double& deadc);
90
91protected:
92 // Protected methods
93 void init_members(void);
94 void copy_members(const GSPIObservation& obs);
95 void free_members(void);
96
97 // Protected members
98 std::string m_instrument; //!< Instrument name
99 GFilename m_filename; //!< OG FITS filename
100 GFilename m_rsp_grpname; //!< Response group FITS filename (optional)
101 GFilename m_rsp_filename; //!< Response FITS filename (optional)
102 GSPIResponse m_response; //!< Response functions
103 double m_ontime; //!< Ontime (sec)
104 double m_livetime; //!< Livetime (sec)
105 double m_deadc; //!< Deadtime correction
106};
107
108
109/***********************************************************************//**
110 * @brief Return class name
111 *
112 * @return String containing the class name ("GSPIObservation").
113 ***************************************************************************/
114inline
115std::string GSPIObservation::classname(void) const
116{
117 return ("GSPIObservation");
118}
119
120
121/***********************************************************************//**
122 * @brief Return pointer to response function
123 *
124 * @return Response function pointer.
125 ***************************************************************************/
126inline
128{
129 // Return response pointer
130 return &m_response;
131}
132
133
134/***********************************************************************//**
135 * @brief Return instrument
136 *
137 * @return Instrument name.
138 ***************************************************************************/
139inline
140std::string GSPIObservation::instrument(void) const
141{
142 // Return instrument
143 return (m_instrument);
144}
145
146
147/***********************************************************************//**
148 * @brief Return ontime
149 *
150 * @return Ontime (seconds).
151 ***************************************************************************/
152inline
153double GSPIObservation::ontime(void) const
154{
155 // Return ontime
156 return (m_ontime);
157}
158
159
160/***********************************************************************//**
161 * @brief Return livetime
162 *
163 * @return Livetime (seconds).
164 ***************************************************************************/
165inline
167{
168 // Return livetime
169 return (m_livetime);
170}
171
172
173/***********************************************************************//**
174 * @brief Return deadtime correction factor
175 *
176 * @param[in] time Time.
177 *
178 * @return Deadtime correction factor.
179 ***************************************************************************/
180inline
181double GSPIObservation::deadc(const GTime& time) const
182{
183 // Return livetime
184 return (m_deadc);
185}
186
187
188/***********************************************************************//**
189 * @brief Set ontime
190 *
191 * @param[in] ontime Ontime.
192 ***************************************************************************/
193inline
194void GSPIObservation::ontime(const double& ontime)
195{
197 return;
198}
199
200
201/***********************************************************************//**
202 * @brief Set livetime
203 *
204 * @param[in] livetime Livetime.
205 ***************************************************************************/
206inline
207void GSPIObservation::livetime(const double& livetime)
208{
210 return;
211}
212
213
214/***********************************************************************//**
215 * @brief Set deadtime correction factor
216 *
217 * @param[in] deadc Deadtime correction factor.
218 ***************************************************************************/
219inline
220void GSPIObservation::deadc(const double& deadc)
221{
222 m_deadc = deadc;
223 return;
224}
225
226#endif /* GSPIOBSERVATION_HPP */
Filename class interface definition.
Abstract observation base class interface definition.
INTEGRAL/SPI instrument response function class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Filename class.
Definition GFilename.hpp:62
FITS file class.
Definition GFits.hpp:63
Model parameter class.
Definition GModelPar.hpp:87
Abstract observation base class.
Abstract instrument response base class.
Definition GResponse.hpp:77
INTEGRAL/SPI observation class.
double m_deadc
Deadtime correction.
double m_ontime
Ontime (sec)
void load(const GFilename &filename)
Load Observation Group.
GSPIObservation(void)
Void constructor.
void copy_members(const GSPIObservation &obs)
Copy class members.
virtual std::string classname(void) const
Return class name.
virtual double ontime(void) const
Return ontime.
virtual void read(const GXmlElement &xml)
Read INTEGRAL/SPI observation from XML element.
virtual double deadc(const GTime &time=GTime()) const
Return deadtime correction factor.
virtual ~GSPIObservation(void)
Destructor.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print observation information.
void init_members(void)
Initialise class members.
virtual double livetime(void) const
Return livetime.
GFilename m_rsp_filename
Response FITS filename (optional)
virtual void write(GXmlElement &xml) const
Write INTEGRAL/SPI observation into XML element.
virtual GSPIObservation * clone(void) const
Clone INTEGRAL/SPI observation.
GSPIResponse m_response
Response functions.
virtual GSPIObservation & operator=(const GSPIObservation &obs)
Assignment operator.
GFilename m_rsp_grpname
Response group FITS filename (optional)
virtual const GSPIResponse * response(void) const
Return pointer to response function.
virtual void clear(void)
Clear INTEGRAL/SPI observation.
double m_livetime
Livetime (sec)
virtual double grad_step_size(const GModelPar &par) const
Return gradient step size for a given model parameter.
std::string m_instrument
Instrument name.
GFilename m_filename
OG FITS filename.
virtual std::string instrument(void) const
Return instrument.
void free_members(void)
Delete class members.
INTEGRAL/SPI instrument response function class.
Time class.
Definition GTime.hpp:55
XML element node class.