GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATResponse.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATResponse.hpp - Fermi LAT Response class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2008-2020 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 GLATResponse.hpp
23  * @brief Fermi LAT Response class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GLATRESPONSE_HPP
28 #define GLATRESPONSE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <vector>
32 #include <string>
33 #include "GResponse.hpp"
34 #include "GLATAeff.hpp"
35 #include "GLATPsf.hpp"
36 #include "GLATEdisp.hpp"
37 #include "GLATMeanPsf.hpp"
38 
39 /* __ Forward declarations _______________________________________________ */
40 class GSource;
41 class GEvent;
42 class GPhoton;
43 class GObservation;
44 class GEnergy;
45 class GTime;
46 class GModelSky;
47 class GLATEventAtom;
48 class GLATEventBin;
49 
50 
51 /***********************************************************************//**
52  * @class GLATResponse
53  *
54  * @brief Fermi/LAT Response class
55  ***************************************************************************/
56 class GLATResponse : public GResponse {
57 
58 public:
59  // Constructors and destructors
60  GLATResponse(void);
61  GLATResponse(const GLATResponse& rsp);
62  virtual ~GLATResponse(void);
63 
64  // Operators
65  GLATResponse& operator=(const GLATResponse & rsp);
66 
67  // Implement pure virtual base class methods
68  virtual void clear(void);
69  virtual GLATResponse* clone(void) const;
70  virtual std::string classname(void) const;
71  virtual bool use_edisp(void) const;
72  virtual bool use_tdisp(void) const;
73  virtual double irf(const GEvent& event,
74  const GPhoton& photon,
75  const GObservation& obs) const;
76  virtual double nroi(const GModelSky& model,
77  const GEnergy& obsEng,
78  const GTime& obsTime,
79  const GObservation& obs) const;
80  virtual GEbounds ebounds(const GEnergy& obsEnergy) const;
81  virtual std::string print(const GChatter& chatter = NORMAL) const;
82 
83  // Overloaded virtual base class methods
84  virtual double irf_spatial(const GEvent& event,
85  const GSource& source,
86  const GObservation& obs) const;
87 
88  // Other Methods
89  int size(void) const;
90  const std::string& rspname(void) const;
91  void load(const std::string& rspname);
92  void save(const std::string& rspname) const;
93  const bool& force_mean(void) const;
94  void force_mean(const bool& value);
95  GLATAeff* aeff(const int& index) const;
96  GLATPsf* psf(const int& index) const;
97  GLATEdisp* edisp(const int& index) const;
98 
99  // Reponse methods
100  double irf_spatial_atom(const GLATEventAtom& event,
101  const GSource& source,
102  const GObservation& obs) const;
103  double irf_spatial_bin(const GLATEventBin& event,
104  const GSource& source,
105  const GObservation& obs) const;
106 
107 private:
108  // Private methods
109  void init_members(void);
110  void copy_members(const GLATResponse& rsp);
111  void free_members(void);
112 
113  // Overloaded virtual base class methods
114  virtual double irf_ptsrc(const GEvent& event,
115  const GSource& source,
116  const GObservation& obs) const;
117  virtual double irf_diffuse(const GEvent& event,
118  const GSource& source,
119  const GObservation& obs) const;
120 
121  // Private members
122  std::string m_rspname; //!< Name of the instrument response
123  bool m_force_mean; //!< Use mean PSF in any case
124  std::vector<GLATAeff*> m_aeff; //!< Effective areas
125  std::vector<GLATPsf*> m_psf; //!< Point spread functions
126  std::vector<GLATEdisp*> m_edisp; //!< Energy dispersions
127  std::vector<GLATMeanPsf*> m_ptsrc; //!< Mean PSFs for point sources
128 };
129 
130 
131 /***********************************************************************//**
132  * @brief Return class name
133  *
134  * @return String containing the class name ("GLATResponse").
135  ***************************************************************************/
136 inline
137 std::string GLATResponse::classname(void) const
138 {
139  return ("GLATResponse");
140 }
141 
142 
143 /***********************************************************************//**
144  * @brief Signal if response uses energy dispersion
145  *
146  * @return True if response uses energy dispersion.
147  ***************************************************************************/
148 inline
149 bool GLATResponse::use_edisp(void) const
150 {
151  return (false);
152 }
153 
154 
155 /***********************************************************************//**
156  * @brief Signal if response uses time dispersion
157  *
158  * @return True if response uses time dispersion.
159  ***************************************************************************/
160 inline
161 bool GLATResponse::use_tdisp(void) const
162 {
163  return (false);
164 }
165 
166 
167 /***********************************************************************//**
168  * @brief Return number of event types
169  *
170  * @return Number of event types.
171  *
172  * Returns the number of events types in this reponse.
173  ***************************************************************************/
174 inline
175 int GLATResponse::size(void) const
176 {
177  return (int)m_aeff.size();
178 }
179 
180 
181 /***********************************************************************//**
182  * @brief Return response name
183  *
184  * @return Response name.
185  ***************************************************************************/
186 inline
187 const std::string& GLATResponse::rspname(void) const
188 {
189  return (m_rspname);
190 }
191 
192 
193 /***********************************************************************//**
194  * @brief Signal if mean PSF should be used for response computation
195  *
196  * @return True if mean PSF should be used for response computation.
197  ***************************************************************************/
198 inline
199 const bool& GLATResponse::force_mean(void) const
200 {
201  return (m_force_mean);
202 }
203 
204 
205 /***********************************************************************//**
206  * @brief Set if mean PSF should be used for response computation
207  *
208  * @param[in] value True if mean PSF should be used for response computation.
209  ***************************************************************************/
210 inline
211 void GLATResponse::force_mean(const bool& value)
212 {
213  m_force_mean = value;
214  return;
215 }
216 
217 #endif /* GLATRESPONSE_HPP */
virtual ~GLATResponse(void)
Destructor.
std::string m_rspname
Name of the instrument response.
virtual GEbounds ebounds(const GEnergy &obsEnergy) const
Return true energy boundaries for a specific observed energy.
int size(void) const
Return number of event types.
const bool & force_mean(void) const
Signal if mean PSF should be used for response computation.
virtual std::string classname(void) const
Return class name.
virtual double irf_spatial(const GEvent &event, const GSource &source, const GObservation &obs) const
Return value of model instrument response function.
virtual bool use_edisp(void) const
Signal if response uses energy dispersion.
Interface for the Fermi LAT energy dispersion.
Definition: GLATEdisp.hpp:55
Abstract interface for the event classes.
Definition: GEvent.hpp:71
GLATPsf * psf(const int &index) const
Return pointer on point spread function.
Fermi/LAT Response class.
void load(const std::string &rspname)
Load Fermi LAT response from calibration database.
std::vector< GLATMeanPsf * > m_ptsrc
Mean PSFs for point sources.
double irf_spatial_bin(const GLATEventBin &event, const GSource &source, const GObservation &obs) const
Return value of model IRF for event bin.
GLATResponse & operator=(const GLATResponse &rsp)
Assignment operator.
Time class.
Definition: GTime.hpp:55
virtual double irf_diffuse(const GEvent &event, const GSource &source, const GObservation &obs) const
Return instrument response to diffuse source.
const std::string & rspname(void) const
Return response name.
bool m_force_mean
Use mean PSF in any case.
void init_members(void)
Initialise class members.
virtual void clear(void)
Clear response.
GLATEdisp * edisp(const int &index) const
Return pointer on energy dispersion.
Class that handles photons.
Definition: GPhoton.hpp:47
Fermi/LAT event bin class.
Interface for the Fermi LAT point spread function.
Definition: GLATPsf.hpp:54
Energy boundaries container class.
Definition: GEbounds.hpp:60
virtual double irf_ptsrc(const GEvent &event, const GSource &source, const GObservation &obs) const
Return instrument response to point source.
GLATResponse(void)
Void constructor.
GChatter
Definition: GTypemaps.hpp:33
void save(const std::string &rspname) const
Save Fermi LAT response in calibration database.
Interface for the Fermi/LAT effective area.
Definition: GLATAeff.hpp:59
virtual double irf(const GEvent &event, const GPhoton &photon, const GObservation &obs) const
Return value of point source IRF.
Fermi LAT energy dispersion class definition.
void free_members(void)
Delete class members.
Fermi LAT point spread function class definition.
Abstract observation base class.
virtual bool use_tdisp(void) const
Signal if response uses time dispersion.
GLATAeff * aeff(const int &index) const
Return pointer on effective area.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Fermi-LAT response information.
virtual GLATResponse * clone(void) const
Clone response.
Fermi/LAT mean PSF class definition.
std::vector< GLATAeff * > m_aeff
Effective areas.
Abstract response base class definition.
double irf_spatial_atom(const GLATEventAtom &event, const GSource &source, const GObservation &obs) const
Return value of model IRF for event atom.
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.
Sky model class.
Definition: GModelSky.hpp:122
Fermi LAT effective area class definition.
Abstract instrument response base class.
Definition: GResponse.hpp:77
Class that handles gamma-ray sources.
Definition: GSource.hpp:53
std::vector< GLATPsf * > m_psf
Point spread functions.
Fermi/LAT event atom class.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
std::vector< GLATEdisp * > m_edisp
Energy dispersions.
void copy_members(const GLATResponse &rsp)
Copy class members.