GammaLib  2.0.0
 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-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 ________________________________________________ */
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 
49 
50 /***********************************************************************//**
51  * @class GCOMResponse
52  *
53  * @brief Interface for the COMPTEL instrument response function
54  ***************************************************************************/
55 class GCOMResponse : public GResponse {
56 
57  // Friend classes
58  friend class GCOMDri;
59 
60 public:
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 
94 private:
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
115  GVector irf_extended(const GModelSky& model,
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  ***************************************************************************/
143 inline
144 std::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  ***************************************************************************/
155 inline
156 bool GCOMResponse::use_edisp(void) const
157 {
158  return false;
159 }
160 
161 
162 /***********************************************************************//**
163  * @brief Signal if time dispersion will be used
164  *
165  * @return False.
166  ***************************************************************************/
167 inline
168 bool GCOMResponse::use_tdisp(void) const
169 {
170  return false;
171 }
172 
173 
174 /***********************************************************************//**
175  * @brief Return calibration database
176  *
177  * @return Calibration database.
178  ***************************************************************************/
179 inline
180 const 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  ***************************************************************************/
193 inline
194 void 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  ***************************************************************************/
206 inline
207 const std::string& GCOMResponse::rspname(void) const
208 {
209  // Return response name
210  return m_rspname;
211 }
212 
213 #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
virtual bool use_edisp(void) const
Signal if energy dispersion will be used.
void write(GFitsImageFloat &image) const
Write COMPTEL response into FITS image.
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
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:61
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.