GammaLib 2.0.0
Loading...
Searching...
No Matches
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 _______________________________________________ */
40class GSource;
41class GEvent;
42class GPhoton;
43class GObservation;
44class GEnergy;
45class GTime;
46class GModelSky;
47class GLATEventAtom;
48class GLATEventBin;
49
50
51/***********************************************************************//**
52 * @class GLATResponse
53 *
54 * @brief Fermi/LAT Response class
55 ***************************************************************************/
56class GLATResponse : public GResponse {
57
58public:
59 // Constructors and destructors
60 GLATResponse(void);
61 GLATResponse(const GLATResponse& rsp);
62 virtual ~GLATResponse(void);
63
64 // Operators
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
107private:
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 ***************************************************************************/
136inline
137std::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 ***************************************************************************/
148inline
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 ***************************************************************************/
160inline
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 ***************************************************************************/
174inline
175int 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 ***************************************************************************/
186inline
187const 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 ***************************************************************************/
198inline
199const 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 ***************************************************************************/
210inline
211void GLATResponse::force_mean(const bool& value)
212{
213 m_force_mean = value;
214 return;
215}
216
217#endif /* GLATRESPONSE_HPP */
Fermi LAT effective area class definition.
Fermi LAT energy dispersion class definition.
Fermi/LAT mean PSF class definition.
Fermi LAT point spread function class definition.
Abstract response base class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
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
Interface for the Fermi/LAT effective area.
Definition GLATAeff.hpp:59
Interface for the Fermi LAT energy dispersion.
Definition GLATEdisp.hpp:55
Fermi/LAT event atom class.
Fermi/LAT event bin class.
Interface for the Fermi LAT point spread function.
Definition GLATPsf.hpp:54
Fermi/LAT Response class.
virtual bool use_edisp(void) const
Signal if response uses energy dispersion.
virtual GLATResponse * clone(void) const
Clone response.
double irf_spatial_bin(const GLATEventBin &event, const GSource &source, const GObservation &obs) const
Return value of model IRF for event bin.
void copy_members(const GLATResponse &rsp)
Copy class members.
virtual double irf(const GEvent &event, const GPhoton &photon, const GObservation &obs) const
Return value of point source IRF.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Fermi-LAT response information.
std::vector< GLATMeanPsf * > m_ptsrc
Mean PSFs for point sources.
std::string m_rspname
Name of the instrument response.
bool m_force_mean
Use mean PSF in any case.
virtual ~GLATResponse(void)
Destructor.
GLATEdisp * edisp(const int &index) const
Return pointer on energy dispersion.
virtual std::string classname(void) const
Return class name.
const std::string & rspname(void) const
Return response name.
virtual double irf_spatial(const GEvent &event, const GSource &source, const GObservation &obs) const
Return value of model instrument response function.
GLATResponse & operator=(const GLATResponse &rsp)
Assignment operator.
std::vector< GLATAeff * > m_aeff
Effective areas.
void init_members(void)
Initialise class members.
std::vector< GLATPsf * > m_psf
Point spread functions.
const bool & force_mean(void) const
Signal if mean PSF should be used for response computation.
void free_members(void)
Delete class members.
int size(void) const
Return number of event types.
GLATAeff * aeff(const int &index) const
Return pointer on effective area.
void save(const std::string &rspname) const
Save Fermi LAT response in calibration database.
virtual double irf_ptsrc(const GEvent &event, const GSource &source, const GObservation &obs) const
Return instrument response to point source.
virtual void clear(void)
Clear response.
double irf_spatial_atom(const GLATEventAtom &event, const GSource &source, const GObservation &obs) const
Return value of model IRF for event atom.
void load(const std::string &rspname)
Load Fermi LAT response from calibration database.
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 GEbounds ebounds(const GEnergy &obsEnergy) const
Return true energy boundaries for a specific observed energy.
std::vector< GLATEdisp * > m_edisp
Energy dispersions.
GLATResponse(void)
Void constructor.
GLATPsf * psf(const int &index) const
Return pointer on point spread function.
virtual double irf_diffuse(const GEvent &event, const GSource &source, const GObservation &obs) const
Return instrument response to diffuse source.
virtual bool use_tdisp(void) const
Signal if response uses time dispersion.
Sky model class.
Abstract observation base class.
Class that handles photons.
Definition GPhoton.hpp:47
Abstract instrument response base class.
Definition GResponse.hpp:77
Class that handles gamma-ray sources.
Definition GSource.hpp:53
Time class.
Definition GTime.hpp:55