GammaLib 2.0.0
Loading...
Searching...
No Matches
GMWLDatum.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GMWLDatum.hpp - Multi-wavelength spectral point class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2010-2018 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 GMWLDatum.hpp
23 * @brief Multi-wavelength spectral point class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GMWLDATUM_HPP
28#define GMWLDATUM_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include "GEventBin.hpp"
32#include "GEnergy.hpp"
33#include "GTime.hpp"
34#include "GMWLInstDir.hpp"
35
36
37/***********************************************************************//**
38 * @class GMWLDatum
39 *
40 * @brief Multi-wavelength spectral point class
41 *
42 * This class defines a spectral data point for the multi-wavelength
43 * interface. It derives from the abstract GEventBin base class.
44 ***************************************************************************/
45class GMWLDatum : public GEventBin {
46
47 // Friend classes
48 friend class GMWLSpectrum; //!< Needs access to load data
49
50public:
51 // Constructors and destructors
52 GMWLDatum(void);
54 const double& flux, const double& flux_err);
55 GMWLDatum(const GMWLDatum& datum);
56 virtual ~GMWLDatum(void);
57
58 // Operators
59 virtual GMWLDatum& operator=(const GMWLDatum& datum);
60
61 // Implemented pure virtual base class methods
62 virtual void clear(void);
63 virtual GMWLDatum* clone(void) const;
64 virtual std::string classname(void) const;
65 virtual double size(void) const;
66 virtual const GMWLInstDir& dir(void) const;
67 virtual const GEnergy& energy(void) const;
68 virtual const GTime& time(void) const;
69 virtual double counts(void) const;
70 virtual double error(void) const;
71 virtual void counts(const double& flux);
72 virtual std::string print(const GChatter& chatter = NORMAL) const;
73
74 // Other methods
75 const double& flux(void) const;
76 const double& flux_err(void) const;
77 const GEnergy& energy_err(void) const;
78 void flux(const double& flux);
79 void flux_err(const double& error);
80 void energy(const GEnergy& energy);
81 void energy_err(const GEnergy& error);
82
83protected:
84 // Protected methods
85 void init_members(void);
86 void copy_members(const GMWLDatum& datum);
87 void free_members(void);
88
89 // Protected members
90 GMWLInstDir m_dir; //!< Instrument direction of spectral point (not used)
91 GTime m_time; //!< Time of spectral point (not used)
92 GEnergy m_eng; //!< Energy of spectral point
93 GEnergy m_eng_err; //!< Uncertainty in energy
94 double m_flux; //!< Flux of spectral point (ph/cm2/s/MeV)
95 double m_flux_err; //!< Uncertainty in flux (ph/cm2/s/MeV)
96
97};
98
99
100/***********************************************************************//**
101 * @brief Return class name
102 *
103 * @return String containing the class name ("GMWLDatum").
104 ***************************************************************************/
105inline
106std::string GMWLDatum::classname(void) const
107{
108 return ("GMWLDatum");
109}
110
111
112/***********************************************************************//**
113 * @brief Return size of spectral bins
114 *
115 * @return Size of spectrl bin (always 1).
116 ***************************************************************************/
117inline
118double GMWLDatum::size(void) const
119{
120 return 1.0;
121}
122
123
124/***********************************************************************//**
125 * @brief Return instrument direction (dummy method)
126 *
127 * @return Instrument direction.
128 ***************************************************************************/
129inline
130const GMWLInstDir& GMWLDatum::dir(void) const
131{
132 return m_dir;
133}
134
135
136/***********************************************************************//**
137 * @brief Return energy of spectral bin
138 *
139 * @return Energy of spectral bin.
140 ***************************************************************************/
141inline
142const GEnergy& GMWLDatum::energy(void) const
143{
144 return m_eng;
145}
146
147
148/***********************************************************************//**
149 * @brief Return time of spectral bin
150 *
151 * @return Time of spectral bin.
152 ***************************************************************************/
153inline
154const GTime& GMWLDatum::time(void) const
155{
156 return m_time;
157}
158
159
160/***********************************************************************//**
161 * @brief Return flux of spectral bin
162 *
163 * @return Flux of spectral bin.
164 ***************************************************************************/
165inline
166double GMWLDatum::counts(void) const
167{
168 return m_flux;
169}
170
171
172/***********************************************************************//**
173 * @brief Set flux of spectral bin
174 *
175 * @param[in] flux Flux of spectral bin.
176 ***************************************************************************/
177inline
178void GMWLDatum::counts(const double& flux)
179{
180 m_flux = flux;
181 return;
182}
183
184
185/***********************************************************************//**
186 * @brief Return flux of spectral bin
187 *
188 * @return Flux of spectral bin.
189 ***************************************************************************/
190inline
191const double& GMWLDatum::flux(void) const
192{
193 return m_flux;
194}
195
196
197/***********************************************************************//**
198 * @brief Set flux of spectral bin
199 *
200 * @param[in] flux Flux of spectral bin.
201 ***************************************************************************/
202inline
203void GMWLDatum::flux(const double& flux)
204{
205 m_flux = flux;
206 return;
207}
208
209
210/***********************************************************************//**
211 * @brief Return flux error of spectral bin
212 *
213 * @return Flux error of spectral bin.
214 ***************************************************************************/
215inline
216const double& GMWLDatum::flux_err(void) const
217{
218 return m_flux_err;
219}
220
221
222/***********************************************************************//**
223 * @brief Set flux error of spectral bin
224 *
225 * @param[in] error Flux error of spectral bin.
226 ***************************************************************************/
227inline
228void GMWLDatum::flux_err(const double& error)
229{
231 return;
232}
233
234
235/***********************************************************************//**
236 * @brief Set energy of spectral bin
237 *
238 * @param[in] energy Energy of spectral bin.
239 ***************************************************************************/
240inline
241void GMWLDatum::energy(const GEnergy& energy)
242{
243 m_eng = energy;
244 return;
245}
246
247
248/***********************************************************************//**
249 * @brief Return energy error of spectral bin
250 *
251 * @return Energy error of spectral bin.
252 ***************************************************************************/
253inline
255{
256 return m_eng_err;
257}
258
259
260/***********************************************************************//**
261 * @brief Set energy error of spectral bin
262 *
263 * @param[in] error Energy error of spectral bin.
264 ***************************************************************************/
265inline
267{
269 return;
270}
271
272#endif /* GMWLDATUM_HPP */
Energy value class definition.
Abstract event bin base class definition.
GMWLInstDir class definition.
Time class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Abstract interface for the event bin class.
Definition GEventBin.hpp:64
Multi-wavelength spectral point class.
Definition GMWLDatum.hpp:45
double m_flux_err
Uncertainty in flux (ph/cm2/s/MeV)
Definition GMWLDatum.hpp:95
virtual const GMWLInstDir & dir(void) const
Return instrument direction (dummy method)
GTime m_time
Time of spectral point (not used)
Definition GMWLDatum.hpp:91
GEnergy m_eng
Energy of spectral point.
Definition GMWLDatum.hpp:92
virtual std::string classname(void) const
Return class name.
virtual double error(void) const
Returns flux error.
const GEnergy & energy_err(void) const
Return energy error of spectral bin.
virtual double size(void) const
Return size of spectral bins.
virtual GMWLDatum & operator=(const GMWLDatum &datum)
Assignment operator.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print spectral point information.
double m_flux
Flux of spectral point (ph/cm2/s/MeV)
Definition GMWLDatum.hpp:94
virtual const GTime & time(void) const
Return time of spectral bin.
void free_members(void)
Delete class members.
virtual void clear(void)
Clear instance.
void init_members(void)
Initialise class members.
GMWLDatum(void)
Void constructor.
Definition GMWLDatum.cpp:56
GEnergy m_eng_err
Uncertainty in energy.
Definition GMWLDatum.hpp:93
virtual GMWLDatum * clone(void) const
Clone instance.
GMWLInstDir m_dir
Instrument direction of spectral point (not used)
Definition GMWLDatum.hpp:90
const double & flux(void) const
Return flux of spectral bin.
virtual const GEnergy & energy(void) const
Return energy of spectral bin.
const double & flux_err(void) const
Return flux error of spectral bin.
virtual double counts(void) const
Return flux of spectral bin.
void copy_members(const GMWLDatum &datum)
Copy class members.
virtual ~GMWLDatum(void)
Destructor.
Interface for the Multi-wavelength instrument direction class.
Multi-wavelength spectrum class interface.
Time class.
Definition GTime.hpp:55