GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GMWLResponse.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GMWLResponse.cpp - Multi-wavelength response class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2015 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 GMWLResponse.cpp
23  * @brief GMWLResponse class interface implementation.
24  * @author Juergen Knoedlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include "GTools.hpp"
32 #include "GException.hpp"
33 #include "GMWLResponse.hpp"
34 
35 /* __ Method name definitions ____________________________________________ */
36 #define G_NROI "GMWLResponse::nroi(GModelSky&, GEnergy&, GTime&, "\
37  "GObservation&)"
38 #define G_EBOUNDS "GMWLResponse::ebounds(GEnergy&)"
39 
40 /* __ Macros _____________________________________________________________ */
41 
42 /* __ Coding definitions _________________________________________________ */
43 
44 /* __ Debug definitions __________________________________________________ */
45 
46 
47 /*==========================================================================
48  = =
49  = Constructors/destructors =
50  = =
51  ==========================================================================*/
52 
53 /***********************************************************************//**
54  * @brief Void constructor
55  ***************************************************************************/
57 {
58  // Initialise class members
59  init_members();
60 
61  // Return
62  return;
63 }
64 
65 
66 /***********************************************************************//**
67  * @brief Copy constructor
68  *
69  * @param[in] rsp Response.
70  ***************************************************************************/
72 {
73  // Initialise class members
74  init_members();
75 
76  // Copy members
77  copy_members(rsp);
78 
79  // Return
80  return;
81 }
82 
83 
84 /***********************************************************************//**
85  * @brief Destructor
86  ***************************************************************************/
88 {
89  // Free members
90  free_members();
91 
92  // Return
93  return;
94 }
95 
96 
97 /*==========================================================================
98  = =
99  = Operators =
100  = =
101  ==========================================================================*/
102 
103 /***********************************************************************//**
104  * @brief Assignment operator
105  *
106  * @param[in] rsp Response.
107  ***************************************************************************/
109 {
110  // Execute only if object is not identical
111  if (this != &rsp) {
112 
113  // Copy base class members
114  this->GResponse::operator=(rsp);
115 
116  // Free members
117  free_members();
118 
119  // Initialise private members
120  init_members();
121 
122  // Copy members
123  copy_members(rsp);
124 
125  } // endif: object was not identical
126 
127  // Return this object
128  return *this;
129 }
130 
131 
132 /*==========================================================================
133  = =
134  = Public methods =
135  = =
136  ==========================================================================*/
137 
138 /***********************************************************************//**
139  * @brief Clear instance
140  ***************************************************************************/
142 {
143  // Free members
144  free_members();
145  this->GResponse::free_members();
146 
147  // Initialise private members
148  this->GResponse::init_members();
149  init_members();
150 
151  // Return
152  return;
153 }
154 
155 
156 /***********************************************************************//**
157  * @brief Clone instance
158  ***************************************************************************/
160 {
161  return new GMWLResponse(*this);
162 }
163 
164 
165 /***********************************************************************//**
166  * @brief Return integral of event probability for a given sky model over ROI
167  *
168  * @param[in] model Sky model.
169  * @param[in] obsEng Observed photon energy.
170  * @param[in] obsTime Observed photon arrival time.
171  * @param[in] obs Observation.
172  * @return 0.0
173  *
174  * @exception GException::feature_not_implemented
175  * Method is not implemented.
176  ***************************************************************************/
177 double GMWLResponse::nroi(const GModelSky& model,
178  const GEnergy& obsEng,
179  const GTime& obsTime,
180  const GObservation& obs) const
181 {
182  // Method is not implemented
183  std::string msg = "Spatial integration of sky model over the data space "
184  "is not implemented.";
186 
187  // Return Npred
188  return (0.0);
189 }
190 
191 
192 /***********************************************************************//**
193  * @brief Return true energy boundaries for a specific observed energy
194  *
195  * @param[in] obsEnergy Observed Energy.
196  * @return True energy boundaries for given observed energy.
197  *
198  * @exception GException::feature_not_implemented
199  * Method is not implemented.
200  ***************************************************************************/
201 GEbounds GMWLResponse::ebounds(const GEnergy& obsEnergy) const
202 {
203  // Initialise an empty boundary object
205 
206  // Throw an exception
207  std::string msg = "Energy dispersion not implemented.";
209 
210  // Return energy boundaries
211  return ebounds;
212 }
213 
214 
215 /***********************************************************************//**
216  * @brief Print response information
217  *
218  * @param[in] chatter Chattiness (defaults to NORMAL).
219  * @return String containing response information
220  ***************************************************************************/
221 std::string GMWLResponse::print(const GChatter& chatter) const
222 {
223  // Initialise result string
224  std::string result;
225 
226  // Continue only if chatter is not silent
227  if (chatter != SILENT) {
228 
229  // Append header
230  result.append("=== GMWLResponse ===");
231 
232  // Append information
233  //result.append(parformat("Calibration database")+m_caldb+"\n");
234  //result.append(parformat("Response functions")+m_rspname);
235 
236  } // endif: chatter was not silent
237 
238  // Return result
239  return result;
240 }
241 
242 
243 /*==========================================================================
244  = =
245  = Private methods =
246  = =
247  ==========================================================================*/
248 
249 /***********************************************************************//**
250  * @brief Initialise class members
251  ***************************************************************************/
253 {
254  // Return
255  return;
256 }
257 
258 
259 /***********************************************************************//**
260  * @brief Copy class members
261  *
262  * @param[in] rsp Response.
263  ***************************************************************************/
265 {
266  // Return
267  return;
268 }
269 
270 
271 /***********************************************************************//**
272  * @brief Delete class members
273  ***************************************************************************/
275 {
276  // Return
277  return;
278 }
279 
280 
281 /*==========================================================================
282  = =
283  = Friends =
284  = =
285  ==========================================================================*/
virtual GMWLResponse * clone(void) const
Clone instance.
Multi-wavelength response class.
virtual double nroi(const GModelSky &model, const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const
Return integral of event probability for a given sky model over ROI.
void copy_members(const GMWLResponse &pnt)
Copy class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print response information.
Time class.
Definition: GTime.hpp:54
Gammalib tools definition.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
Definition: GResponse.cpp:260
#define G_EBOUNDS
Multi-wavelength response class interface definition.
Energy boundaries container class.
Definition: GEbounds.hpp:60
virtual void clear(void)
Clear instance.
virtual GMWLResponse & operator=(const GMWLResponse &rsp)
Assignment operator.
GChatter
Definition: GTypemaps.hpp:33
Abstract observation base class.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
Definition: GResponse.cpp:282
virtual GResponse & operator=(const GResponse &rsp)
Assignment operator.
Definition: GResponse.cpp:125
virtual ~GMWLResponse(void)
Destructor.
virtual GEbounds ebounds(const GEnergy &obsEnergy) const
Return true energy boundaries for a specific observed energy.
#define G_NROI
Sky model class.
Definition: GModelSky.hpp:120
Exception handler interface definition.
GMWLResponse(void)
Void constructor.
Abstract instrument response base class.
Definition: GResponse.hpp:67
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48