GammaLib 2.0.0
Loading...
Searching...
No Matches
GCOMResponse.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOMResponse.hpp - COMPTEL Response class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2012-2021 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 GCOMResponse.hpp
23 * @brief COMPTEL instrument response function class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCOMRESPONSE_HPP
28#define GCOMRESPONSE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include "GResponse.hpp"
32#include "GCaldb.hpp"
33
34/* __ Type definitions ___________________________________________________ */
35
36/* __ Forward declaration ________________________________________________ */
37class GVector;
38class GMatrix;
39class GModelSky;
40class GEvent;
41class GPhoton;
42class GSource;
43class GEnergy;
44class GTime;
45class GObservation;
46class GFitsImage;
47class GFitsImageFloat;
48
49
50/***********************************************************************//**
51 * @class GCOMResponse
52 *
53 * @brief Interface for the COMPTEL instrument response function
54 ***************************************************************************/
55class GCOMResponse : public GResponse {
56
57 // Friend classes
58 friend class GCOMDri;
59
60public:
61 // Constructors and destructors
62 GCOMResponse(void);
63 GCOMResponse(const GCOMResponse& rsp);
64 GCOMResponse(const GCaldb& caldb, const std::string& rspname);
65 virtual ~GCOMResponse(void);
66
67 // Operators
68 virtual GCOMResponse& operator=(const GCOMResponse & rsp);
69
70 // Implement pure virtual base class methods
71 virtual void clear(void);
72 virtual GCOMResponse* clone(void) const;
73 virtual std::string classname(void) const;
74 virtual bool use_edisp(void) const;
75 virtual bool use_tdisp(void) const;
76 virtual double irf(const GEvent& event,
77 const GPhoton& photon,
78 const GObservation& obs) const;
79 virtual double nroi(const GModelSky& model,
80 const GEnergy& obsEng,
81 const GTime& obsTime,
82 const GObservation& obs) const;
83 virtual GEbounds ebounds(const GEnergy& obsEnergy) const;
84 virtual std::string print(const GChatter& chatter = NORMAL) const;
85
86 // Other Methods
87 void caldb(const GCaldb& caldb);
88 const GCaldb& caldb(void) const;
89 const std::string& rspname(void) const;
90 void load(const std::string& rspname);
91 void read(const GFitsImage& hdu);
92 void write(GFitsImageFloat& image) const;
93
94private:
95 // Private methods
96 void init_members(void);
97 void copy_members(const GCOMResponse& rsp);
98 void free_members(void);
99
100 // Overloaded virtual base class methods
101 virtual GVector irf_ptsrc(const GModelSky& model,
102 const GObservation& obs,
103 GMatrix* gradients = NULL) const;
104 virtual GVector irf_radial(const GModelSky& model,
105 const GObservation& obs,
106 GMatrix* gradients = NULL) const;
107 virtual GVector irf_elliptical(const GModelSky& model,
108 const GObservation& obs,
109 GMatrix* gradients = NULL) const;
110 virtual GVector irf_diffuse(const GModelSky& model,
111 const GObservation& obs,
112 GMatrix* gradients = NULL) const;
113
114 // Support methods
116 const GObservation& obs,
117 const GSkyDir& model_dir,
118 const double& theta_max,
119 GMatrix* gradients = NULL) const;
120
121 // Private data members
122 GCaldb m_caldb; //!< Calibration database
123 std::string m_rspname; //!< Response name
124 std::vector<double> m_iaq; //!< IAQ array
125 int m_phigeo_bins; //!< Number of Phigeo bins
126 int m_phibar_bins; //!< Number of Phibar bins
127 double m_phigeo_ref_value; //!< Phigeo reference value (deg)
128 double m_phigeo_ref_pixel; //!< Phigeo reference pixel (starting from 1)
129 double m_phigeo_bin_size; //!< Phigeo binsize (deg)
130 double m_phigeo_min; //!< Phigeo value of first bin (deg)
131 double m_phibar_ref_value; //!< Phigeo reference value (deg)
132 double m_phibar_ref_pixel; //!< Phigeo reference pixel (starting from 1)
133 double m_phibar_bin_size; //!< Phigeo binsize (deg)
134 double m_phibar_min; //!< Phigeo value of first bin (deg)
135};
136
137
138/***********************************************************************//**
139 * @brief Return class name
140 *
141 * @return String containing the class name ("GCOMResponse").
142 ***************************************************************************/
143inline
144std::string GCOMResponse::classname(void) const
145{
146 return ("GCOMResponse");
147}
148
149
150/***********************************************************************//**
151 * @brief Signal if energy dispersion will be used
152 *
153 * @return False.
154 ***************************************************************************/
155inline
157{
158 return false;
159}
160
161
162/***********************************************************************//**
163 * @brief Signal if time dispersion will be used
164 *
165 * @return False.
166 ***************************************************************************/
167inline
169{
170 return false;
171}
172
173
174/***********************************************************************//**
175 * @brief Return calibration database
176 *
177 * @return Calibration database.
178 ***************************************************************************/
179inline
180const GCaldb& GCOMResponse::caldb(void) const
181{
182 return m_caldb;
183}
184
185
186/***********************************************************************//**
187 * @brief Set calibration database
188 *
189 * @param[in] caldb Calibration database.
190 *
191 * Sets the calibration database for the COMPTEL response.
192 ***************************************************************************/
193inline
194void GCOMResponse::caldb(const GCaldb& caldb)
195{
196 m_caldb = caldb;
197 return;
198}
199
200
201/***********************************************************************//**
202 * @brief Return response name
203 *
204 * @return Response name.
205 ***************************************************************************/
206inline
207const std::string& GCOMResponse::rspname(void) const
208{
209 // Return response name
210 return m_rspname;
211}
212
213#endif /* GCOMRESPONSE_HPP */
Calibration database class interface definition.
Abstract response base class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
COMPTEL Data Space class.
Definition GCOMDri.hpp:61
Interface for the COMPTEL instrument response function.
virtual double irf(const GEvent &event, const GPhoton &photon, const GObservation &obs) const
Return value of instrument response function.
void free_members(void)
Delete class members.
virtual bool use_edisp(void) const
Signal if energy dispersion will be used.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL response information.
virtual GVector irf_ptsrc(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to point source.
int m_phigeo_bins
Number of Phigeo bins.
double m_phibar_min
Phigeo value of first bin (deg)
void write(GFitsImageFloat &image) const
Write COMPTEL response into FITS image.
GVector irf_extended(const GModelSky &model, const GObservation &obs, const GSkyDir &model_dir, const double &theta_max, GMatrix *gradients=NULL) const
GCOMResponse(void)
Void constructor.
virtual GVector irf_radial(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to radial source.
int m_phibar_bins
Number of Phibar bins.
const std::string & rspname(void) const
Return response name.
double m_phibar_bin_size
Phigeo binsize (deg)
void copy_members(const GCOMResponse &rsp)
Copy class members.
std::vector< double > m_iaq
IAQ array.
double m_phigeo_min
Phigeo value of first bin (deg)
virtual ~GCOMResponse(void)
Destructor.
virtual GVector irf_elliptical(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to elliptical source.
const GCaldb & caldb(void) const
Return calibration database.
double m_phibar_ref_value
Phigeo reference value (deg)
void read(const GFitsImage &hdu)
Read COMPTEL response from FITS image.
double m_phigeo_ref_value
Phigeo reference value (deg)
std::string m_rspname
Response name.
virtual GEbounds ebounds(const GEnergy &obsEnergy) const
Return true energy boundaries for a specific observed energy.
GCaldb m_caldb
Calibration database.
void init_members(void)
Initialise class members.
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.
virtual void clear(void)
Clear instance.
double m_phigeo_ref_pixel
Phigeo reference pixel (starting from 1)
double m_phigeo_bin_size
Phigeo binsize (deg)
virtual GVector irf_diffuse(const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
Return instrument response to diffuse source.
virtual GCOMResponse * clone(void) const
Clone instance.
double m_phibar_ref_pixel
Phigeo reference pixel (starting from 1)
virtual GCOMResponse & operator=(const GCOMResponse &rsp)
Assignment operator.
virtual bool use_tdisp(void) const
Signal if time dispersion will be used.
virtual std::string classname(void) const
Return class name.
void load(const std::string &rspname)
Load COMPTEL response.
Calibration database class.
Definition GCaldb.hpp:66
Energy boundaries container class.
Definition GEbounds.hpp:60
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Abstract interface for the event classes.
Definition GEvent.hpp:71
Single precision FITS image class.
Abstract FITS image base class.
Generic matrix class definition.
Definition GMatrix.hpp:79
Sky model class.
Abstract observation base class.
Class that handles photons.
Definition GPhoton.hpp:47
Abstract instrument response base class.
Definition GResponse.hpp:77
Sky direction class.
Definition GSkyDir.hpp:62
Class that handles gamma-ray sources.
Definition GSource.hpp:53
Time class.
Definition GTime.hpp:55
Vector class.
Definition GVector.hpp:46