GammaLib 2.1.0.dev
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-2024 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#include "GVector.hpp"
34#include "GCOMDri.hpp"
35#include "GSkyMap.hpp"
36
37/* __ Type definitions ___________________________________________________ */
38
39/* __ Forward declaration ________________________________________________ */
40class GVector;
41class GMatrix;
42class GModelSky;
43class GEvent;
44class GPhoton;
45class GSource;
46class GEnergy;
47class GTime;
48class GObservation;
49class GFitsImage;
50class GFitsImageFloat;
51class GFilename;
52
53
54/***********************************************************************//**
55 * @class GCOMResponse
56 *
57 * @brief Interface for the COMPTEL instrument response function
58 ***************************************************************************/
59class GCOMResponse : public GResponse {
60
61 // Friend classes
62 friend class GCOMDri;
63
64public:
65 // Constructors and destructors
66 GCOMResponse(void);
67 GCOMResponse(const GCOMResponse& rsp);
68 GCOMResponse(const GCaldb& caldb, const std::string& rspname);
69 virtual ~GCOMResponse(void);
70
71 // Operators
72 virtual GCOMResponse& operator=(const GCOMResponse & rsp);
73
74 // Implement pure virtual base class methods
75 virtual void clear(void);
76 virtual GCOMResponse* clone(void) const;
77 virtual std::string classname(void) const;
78 virtual bool use_edisp(void) const;
79 virtual bool use_tdisp(void) const;
80 virtual double irf(const GEvent& event,
81 const GPhoton& photon,
82 const GObservation& obs) const;
83 virtual double nroi(const GModelSky& model,
84 const GEnergy& obsEng,
85 const GTime& obsTime,
86 const GObservation& obs) const;
87 virtual GEbounds ebounds(const GEnergy& obsEnergy) const;
88 virtual std::string print(const GChatter& chatter = NORMAL) const;
89
90 // Other Methods
91 void caldb(const GCaldb& caldb);
92 const GCaldb& caldb(void) const;
93 const std::string& rspname(void) const;
94 void load(const std::string& rspname);
95 void read(const GFitsImage& hdu);
96 void write(GFitsImageFloat& image) const;
97 void load_cache(const GFilename& filename);
98 void save_cache(const GFilename& filename) const;
99 void backproject(const GObservation& obs,
100 const GEvents* events,
101 GSkyMap* map) const;
102
103private:
104 // Private methods
105 void init_members(void);
106 void copy_members(const GCOMResponse& rsp);
107 void free_members(void);
108 void compute_faq(void);
109
110 // Overloaded virtual base class methods
111 virtual GVector irf_ptsrc(const GModelSky& model,
112 const GObservation& obs,
113 GMatrix* gradients = NULL) const;
114 virtual GVector irf_radial(const GModelSky& model,
115 const GObservation& obs,
116 GMatrix* gradients = NULL) const;
117 virtual GVector irf_elliptical(const GModelSky& model,
118 const GObservation& obs,
119 GMatrix* gradients = NULL) const;
120 virtual GVector irf_diffuse(const GModelSky& model,
121 const GObservation& obs,
122 GMatrix* gradients = NULL) const;
123
124 // Private data members
125 GCaldb m_caldb; //!< Calibration database
126 std::string m_rspname; //!< Response name
127 std::vector<double> m_iaq; //!< IAQ array
128 GSkyMap m_faq; //!< FAQ array
129 std::vector<bool> m_faq_zero; //!< Array of zero FAQ bins
130 std::vector<GVector> m_faq_native; //!< Array of native FAQ vectors
131 GVector m_faq_solidangle; //!< Array of FAQ solid angles
132 int m_phigeo_bins; //!< Number of Phigeo bins
133 int m_phibar_bins; //!< Number of Phibar bins
134 int m_faq_bins; //!< Number of FAQ bins
135 double m_phigeo_ref_value; //!< Phigeo reference value (deg)
136 double m_phigeo_ref_pixel; //!< Phigeo reference pixel (starting from 1)
137 double m_phigeo_bin_size; //!< Phigeo binsize (deg)
138 double m_phigeo_min; //!< Phigeo value of first bin (deg)
139 double m_phibar_ref_value; //!< Phigeo reference value (deg)
140 double m_phibar_ref_pixel; //!< Phigeo reference pixel (starting from 1)
141 double m_phibar_bin_size; //!< Phigeo binsize (deg)
142 double m_phibar_min; //!< Phigeo value of first bin (deg)
143};
144
145
146/***********************************************************************//**
147 * @brief Return class name
148 *
149 * @return String containing the class name ("GCOMResponse").
150 ***************************************************************************/
151inline
152std::string GCOMResponse::classname(void) const
153{
154 return ("GCOMResponse");
155}
156
157
158/***********************************************************************//**
159 * @brief Signal if energy dispersion will be used
160 *
161 * @return False.
162 ***************************************************************************/
163inline
165{
166 return false;
167}
168
169
170/***********************************************************************//**
171 * @brief Signal if time dispersion will be used
172 *
173 * @return False.
174 ***************************************************************************/
175inline
177{
178 return false;
179}
180
181
182/***********************************************************************//**
183 * @brief Return calibration database
184 *
185 * @return Calibration database.
186 ***************************************************************************/
187inline
188const GCaldb& GCOMResponse::caldb(void) const
189{
190 return m_caldb;
191}
192
193
194/***********************************************************************//**
195 * @brief Set calibration database
196 *
197 * @param[in] caldb Calibration database.
198 *
199 * Sets the calibration database for the COMPTEL response.
200 ***************************************************************************/
201inline
202void GCOMResponse::caldb(const GCaldb& caldb)
203{
204 m_caldb = caldb;
205 return;
206}
207
208
209/***********************************************************************//**
210 * @brief Return response name
211 *
212 * @return Response name.
213 ***************************************************************************/
214inline
215const std::string& GCOMResponse::rspname(void) const
216{
217 // Return response name
218 return m_rspname;
219}
220
221#endif /* GCOMRESPONSE_HPP */
COMPTEL Data Space class definition.
Calibration database class interface definition.
Abstract response base class definition.
Sky map class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Vector class interface definition.
COMPTEL Data Space class.
Definition GCOMDri.hpp:62
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.
void save_cache(const GFilename &filename) const
Save response cache.
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.
std::vector< GVector > m_faq_native
Array of native FAQ vectors.
double m_phibar_min
Phigeo value of first bin (deg)
void write(GFitsImageFloat &image) const
Write COMPTEL response into FITS image.
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.
GVector m_faq_solidangle
Array of FAQ solid angles.
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)
void backproject(const GObservation &obs, const GEvents *events, GSkyMap *map) const
Backproject events using instrument response function to sky map.
virtual ~GCOMResponse(void)
Destructor.
GSkyMap m_faq
FAQ array.
void compute_faq(void)
Compute FAQ.
void load_cache(const GFilename &filename)
Load response cache.
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.
int m_faq_bins
Number of FAQ bins.
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.
std::vector< bool > m_faq_zero
Array of zero FAQ bins.
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
Abstract event container class.
Definition GEvents.hpp:66
Filename class.
Definition GFilename.hpp:62
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 map class.
Definition GSkyMap.hpp:89
Class that handles gamma-ray sources.
Definition GSource.hpp:53
Time class.
Definition GTime.hpp:55
Vector class.
Definition GVector.hpp:46