GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  ***************************************************************************/
45 class GMWLDatum : public GEventBin {
46 
47  // Friend classes
48  friend class GMWLSpectrum; //!< Needs access to load data
49 
50 public:
51  // Constructors and destructors
52  GMWLDatum(void);
53  GMWLDatum(const GEnergy& energy, const GEnergy& energy_err,
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 
83 protected:
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  ***************************************************************************/
105 inline
106 std::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  ***************************************************************************/
117 inline
118 double 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  ***************************************************************************/
129 inline
130 const 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  ***************************************************************************/
141 inline
142 const 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  ***************************************************************************/
153 inline
154 const 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  ***************************************************************************/
165 inline
166 double 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  ***************************************************************************/
177 inline
178 void 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  ***************************************************************************/
190 inline
191 const 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  ***************************************************************************/
202 inline
203 void 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  ***************************************************************************/
215 inline
216 const 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  ***************************************************************************/
227 inline
228 void GMWLDatum::flux_err(const double& error)
229 {
230  m_flux_err = error;
231  return;
232 }
233 
234 
235 /***********************************************************************//**
236  * @brief Set energy of spectral bin
237  *
238  * @param[in] energy Energy of spectral bin.
239  ***************************************************************************/
240 inline
241 void 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  ***************************************************************************/
253 inline
254 const GEnergy& GMWLDatum::energy_err(void) const
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  ***************************************************************************/
265 inline
266 void GMWLDatum::energy_err(const GEnergy& error)
267 {
268  m_eng_err = error;
269  return;
270 }
271 
272 #endif /* GMWLDATUM_HPP */
const double & flux_err(void) const
Return flux error of spectral bin.
Definition: GMWLDatum.hpp:216
double m_flux
Flux of spectral point (ph/cm2/s/MeV)
Definition: GMWLDatum.hpp:94
virtual GMWLDatum & operator=(const GMWLDatum &datum)
Assignment operator.
Definition: GMWLDatum.cpp:144
virtual const GMWLInstDir & dir(void) const
Return instrument direction (dummy method)
Definition: GMWLDatum.hpp:130
GMWLInstDir class definition.
Energy value class definition.
double m_flux_err
Uncertainty in flux (ph/cm2/s/MeV)
Definition: GMWLDatum.hpp:95
virtual std::string print(const GChatter &chatter=NORMAL) const
Print spectral point information.
Definition: GMWLDatum.cpp:230
Abstract interface for the event bin class.
Definition: GEventBin.hpp:64
Abstract event bin base class definition.
virtual GMWLDatum * clone(void) const
Clone instance.
Definition: GMWLDatum.cpp:199
const double & flux(void) const
Return flux of spectral bin.
Definition: GMWLDatum.hpp:191
Time class.
Definition: GTime.hpp:55
virtual void clear(void)
Clear instance.
Definition: GMWLDatum.cpp:179
Multi-wavelength spectrum class interface.
GEnergy m_eng_err
Uncertainty in energy.
Definition: GMWLDatum.hpp:93
virtual const GEnergy & energy(void) const
Return energy of spectral bin.
Definition: GMWLDatum.hpp:142
GEnergy m_eng
Energy of spectral point.
Definition: GMWLDatum.hpp:92
virtual double size(void) const
Return size of spectral bins.
Definition: GMWLDatum.hpp:118
virtual double counts(void) const
Return flux of spectral bin.
Definition: GMWLDatum.hpp:166
virtual std::string classname(void) const
Return class name.
Definition: GMWLDatum.hpp:106
GChatter
Definition: GTypemaps.hpp:33
Interface for the Multi-wavelength instrument direction class.
Definition: GMWLInstDir.hpp:48
virtual const GTime & time(void) const
Return time of spectral bin.
Definition: GMWLDatum.hpp:154
virtual ~GMWLDatum(void)
Destructor.
Definition: GMWLDatum.cpp:120
Multi-wavelength spectral point class.
Definition: GMWLDatum.hpp:45
void init_members(void)
Initialise class members.
Definition: GMWLDatum.cpp:264
void copy_members(const GMWLDatum &datum)
Copy class members.
Definition: GMWLDatum.cpp:284
GMWLInstDir m_dir
Instrument direction of spectral point (not used)
Definition: GMWLDatum.hpp:90
GMWLDatum(void)
Void constructor.
Definition: GMWLDatum.cpp:56
void free_members(void)
Delete class members.
Definition: GMWLDatum.cpp:305
const GEnergy & energy_err(void) const
Return energy error of spectral bin.
Definition: GMWLDatum.hpp:254
GTime m_time
Time of spectral point (not used)
Definition: GMWLDatum.hpp:91
Time class interface definition.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
virtual double error(void) const
Returns flux error.
Definition: GMWLDatum.cpp:214