GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 _______________________________________________ */
37 class GTime;
38 class GFits;
39 class GResponse;
40 class 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  ***************************************************************************/
54 class GSPIObservation : public GObservation {
55 
56 public:
57  // Constructors and destructors
58  GSPIObservation(void);
59  explicit GSPIObservation(const GXmlElement& xml);
60  explicit GSPIObservation(const GFilename& filename);
61  GSPIObservation(const GSPIObservation& obs);
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 
88 protected:
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  ***************************************************************************/
111 inline
112 std::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  ***************************************************************************/
123 inline
125 {
126  // Return response pointer
127  return &m_response;
128 }
129 
130 
131 /***********************************************************************//**
132  * @brief Return instrument
133  *
134  * @return Instrument name.
135  ***************************************************************************/
136 inline
137 std::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  ***************************************************************************/
149 inline
150 double 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  ***************************************************************************/
162 inline
163 double GSPIObservation::livetime(void) const
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  ***************************************************************************/
177 inline
178 double 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  ***************************************************************************/
190 inline
191 void GSPIObservation::ontime(const double& ontime)
192 {
193  m_ontime = ontime;
194  return;
195 }
196 
197 
198 /***********************************************************************//**
199  * @brief Set livetime
200  *
201  * @param[in] livetime Livetime.
202  ***************************************************************************/
203 inline
204 void 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  ***************************************************************************/
216 inline
217 void GSPIObservation::deadc(const double& deadc)
218 {
219  m_deadc = deadc;
220  return;
221 }
222 
223 #endif /* GSPIOBSERVATION_HPP */
virtual double ontime(void) const
Return ontime.
virtual std::string classname(void) const
Return class name.
virtual GSPIObservation * clone(void) const
Clone INTEGRAL/SPI observation.
virtual void clear(void)
Clear INTEGRAL/SPI observation.
virtual ~GSPIObservation(void)
Destructor.
GFilename m_filename
OG FITS filename.
double m_ontime
Ontime (sec)
XML element node class.
Definition: GXmlElement.hpp:48
virtual std::string print(const GChatter &chatter=NORMAL) const
Print observation information.
Time class.
Definition: GTime.hpp:55
GSPIObservation(void)
Void constructor.
FITS file class.
Definition: GFits.hpp:63
void free_members(void)
Delete class members.
virtual void write(GXmlElement &xml) const
Write INTEGRAL/SPI observation into XML element.
GFilename m_rsp_filename
Response FITS filename (optional)
double m_livetime
Livetime (sec)
Filename class.
Definition: GFilename.hpp:62
GSPIResponse m_response
Response functions.
void copy_members(const GSPIObservation &obs)
Copy class members.
virtual std::string instrument(void) const
Return instrument.
GChatter
Definition: GTypemaps.hpp:33
void init_members(void)
Initialise class members.
Abstract observation base class.
virtual const GSPIResponse * response(void) const
Return pointer to response function.
INTEGRAL/SPI instrument response function class definition.
Abstract observation base class interface definition.
void load(const GFilename &filename)
Load Observation Group.
virtual GSPIObservation & operator=(const GSPIObservation &obs)
Assignment operator.
INTEGRAL/SPI observation class.
double m_deadc
Deadtime correction.
virtual double deadc(const GTime &time=GTime()) const
Return deadtime correction factor.
GFilename m_rsp_grpname
Response group FITS filename (optional)
std::string m_instrument
Instrument name.
INTEGRAL/SPI instrument response function class.
virtual void read(const GXmlElement &xml)
Read INTEGRAL/SPI observation from XML element.
Abstract instrument response base class.
Definition: GResponse.hpp:77
virtual double livetime(void) const
Return livetime.
Filename class interface definition.