GammaLib  1.7.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-2018 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 GModelSky;
38 class GEvent;
39 class GPhoton;
40 class GSource;
41 class GEnergy;
42 class GTime;
43 class GObservation;
44 class GFitsImage;
45 class GFitsImageFloat;
46 
47 
48 /***********************************************************************//**
49  * @class GCOMResponse
50  *
51  * @brief Interface for the COMPTEL instrument response function
52  ***************************************************************************/
53 class GCOMResponse : public GResponse {
54 
55  // Friend classes
56  friend class GCOMDri;
57 
58 public:
59  // Constructors and destructors
60  GCOMResponse(void);
61  GCOMResponse(const GCOMResponse& rsp);
62  GCOMResponse(const GCaldb& caldb, const std::string& rspname);
63  virtual ~GCOMResponse(void);
64 
65  // Operators
66  virtual GCOMResponse& operator=(const GCOMResponse & rsp);
67 
68  // Implement pure virtual base class methods
69  virtual void clear(void);
70  virtual GCOMResponse* clone(void) const;
71  virtual std::string classname(void) const;
72  virtual bool use_edisp(void) const;
73  virtual bool use_tdisp(void) const;
74  virtual double irf(const GEvent& event,
75  const GPhoton& photon,
76  const GObservation& obs) const;
77  virtual double irf(const GEvent& event,
78  const GSource& source,
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 
95 private:
96  // Private methods
97  void init_members(void);
98  void copy_members(const GCOMResponse& rsp);
99  void free_members(void);
100 
101  // Private data members
102  GCaldb m_caldb; //!< Calibration database
103  std::string m_rspname; //!< Response name
104  std::vector<double> m_iaq; //!< IAQ array
105  int m_phigeo_bins; //!< Number of Phigeo bins
106  int m_phibar_bins; //!< Number of Phibar bins
107  double m_phigeo_ref_value; //!< Phigeo reference value (deg)
108  double m_phigeo_ref_pixel; //!< Phigeo reference pixel (starting from 1)
109  double m_phigeo_bin_size; //!< Phigeo binsize (deg)
110  double m_phigeo_min; //!< Phigeo value of first bin (deg)
111  double m_phibar_ref_value; //!< Phigeo reference value (deg)
112  double m_phibar_ref_pixel; //!< Phigeo reference pixel (starting from 1)
113  double m_phibar_bin_size; //!< Phigeo binsize (deg)
114  double m_phibar_min; //!< Phigeo value of first bin (deg)
115 };
116 
117 
118 /***********************************************************************//**
119  * @brief Return class name
120  *
121  * @return String containing the class name ("GCOMResponse").
122  ***************************************************************************/
123 inline
124 std::string GCOMResponse::classname(void) const
125 {
126  return ("GCOMResponse");
127 }
128 
129 
130 /***********************************************************************//**
131  * @brief Signal if energy dispersion will be used
132  *
133  * @return False.
134  ***************************************************************************/
135 inline
136 bool GCOMResponse::use_edisp(void) const
137 {
138  return false;
139 }
140 
141 
142 /***********************************************************************//**
143  * @brief Signal if time dispersion will be used
144  *
145  * @return False.
146  ***************************************************************************/
147 inline
148 bool GCOMResponse::use_tdisp(void) const
149 {
150  return false;
151 }
152 
153 
154 /***********************************************************************//**
155  * @brief Return calibration database
156  *
157  * @return Calibration database.
158  ***************************************************************************/
159 inline
160 const GCaldb& GCOMResponse::caldb(void) const
161 {
162  return m_caldb;
163 }
164 
165 
166 /***********************************************************************//**
167  * @brief Set calibration database
168  *
169  * @param[in] caldb Calibration database.
170  *
171  * Sets the calibration database for the COMPTEL response.
172  ***************************************************************************/
173 inline
174 void GCOMResponse::caldb(const GCaldb& caldb)
175 {
176  m_caldb = caldb;
177  return;
178 }
179 
180 
181 /***********************************************************************//**
182  * @brief Return response name
183  *
184  * @return Response name.
185  ***************************************************************************/
186 inline
187 const std::string& GCOMResponse::rspname(void) const
188 {
189  // Return response name
190  return m_rspname;
191 }
192 
193 #endif /* GCOMRESPONSE_HPP */
virtual GCOMResponse * clone(void) const
Clone instance.
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.
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
Interface for the COMPTEL instrument response function.
double m_phigeo_ref_value
Phigeo reference value (deg)
Time class.
Definition: GTime.hpp:54
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.
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:120
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:60
void copy_members(const GCOMResponse &rsp)
Copy class members.
Abstract instrument response base class.
Definition: GResponse.hpp:67
Class that handles gamma-ray sources.
Definition: GSource.hpp:53
virtual ~GCOMResponse(void)
Destructor.
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.