GammaLib 2.0.0
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 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 // Other methods
82 void read(const GFits& fits);
83 void load(const GFilename& filename);
84 void ontime(const double& ontime);
85 void livetime(const double& livetime);
86 void deadc(const double& deadc);
87
88protected:
89 // Protected methods
90 void init_members(void);
91 void copy_members(const GSPIObservation& obs);
92 void free_members(void);
93
94 // Protected members
95 std::string m_instrument; //!< Instrument name
96 GFilename m_filename; //!< OG FITS filename
97 GFilename m_rsp_grpname; //!< Response group FITS filename (optional)
98 GFilename m_rsp_filename; //!< Response FITS filename (optional)
99 GSPIResponse m_response; //!< Response functions
100 double m_ontime; //!< Ontime (sec)
101 double m_livetime; //!< Livetime (sec)
102 double m_deadc; //!< Deadtime correction
103};
104
105
106/***********************************************************************//**
107 * @brief Return class name
108 *
109 * @return String containing the class name ("GSPIObservation").
110 ***************************************************************************/
111inline
112std::string GSPIObservation::classname(void) const
113{
114 return ("GSPIObservation");
115}
116
117
118/***********************************************************************//**
119 * @brief Return pointer to response function
120 *
121 * @return Response function pointer.
122 ***************************************************************************/
123inline
125{
126 // Return response pointer
127 return &m_response;
128}
129
130
131/***********************************************************************//**
132 * @brief Return instrument
133 *
134 * @return Instrument name.
135 ***************************************************************************/
136inline
137std::string GSPIObservation::instrument(void) const
138{
139 // Return instrument
140 return (m_instrument);
141}
142
143
144/***********************************************************************//**
145 * @brief Return ontime
146 *
147 * @return Ontime (seconds).
148 ***************************************************************************/
149inline
150double GSPIObservation::ontime(void) const
151{
152 // Return ontime
153 return (m_ontime);
154}
155
156
157/***********************************************************************//**
158 * @brief Return livetime
159 *
160 * @return Livetime (seconds).
161 ***************************************************************************/
162inline
164{
165 // Return livetime
166 return (m_livetime);
167}
168
169
170/***********************************************************************//**
171 * @brief Return deadtime correction factor
172 *
173 * @param[in] time Time.
174 *
175 * @return Deadtime correction factor.
176 ***************************************************************************/
177inline
178double GSPIObservation::deadc(const GTime& time) const
179{
180 // Return livetime
181 return (m_deadc);
182}
183
184
185/***********************************************************************//**
186 * @brief Set ontime
187 *
188 * @param[in] ontime Ontime.
189 ***************************************************************************/
190inline
191void GSPIObservation::ontime(const double& ontime)
192{
194 return;
195}
196
197
198/***********************************************************************//**
199 * @brief Set livetime
200 *
201 * @param[in] livetime Livetime.
202 ***************************************************************************/
203inline
204void GSPIObservation::livetime(const double& livetime)
205{
207 return;
208}
209
210
211/***********************************************************************//**
212 * @brief Set deadtime correction factor
213 *
214 * @param[in] deadc Deadtime correction factor.
215 ***************************************************************************/
216inline
217void GSPIObservation::deadc(const double& deadc)
218{
219 m_deadc = deadc;
220 return;
221}
222
223#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
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)
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.