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