GammaLib  1.7.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-2016 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  // Implemented pure virtual 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 irf(const GEvent& event,
77  const GSource& source,
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  int size(void) const;
88  const std::string& rspname(void) const;
89  void load(const std::string& rspname);
90  void save(const std::string& rspname) const;
91  const bool& force_mean(void) const;
92  void force_mean(const bool& value);
93  GLATAeff* aeff(const int& index) const;
94  GLATPsf* psf(const int& index) const;
95  GLATEdisp* edisp(const int& index) const;
96 
97  // Reponse methods
98  double irf(const GLATEventAtom& event,
99  const GSource& source,
100  const GObservation& obs) const;
101  double irf(const GLATEventBin& event,
102  const GSource& source,
103  const GObservation& obs) const;
104 
105 private:
106  // Private methods
107  void init_members(void);
108  void copy_members(const GLATResponse& rsp);
109  void free_members(void);
110 
111  // Private members
112  std::string m_rspname; //!< Name of the instrument response
113  bool m_force_mean; //!< Use mean PSF in any case
114  std::vector<GLATAeff*> m_aeff; //!< Effective areas
115  std::vector<GLATPsf*> m_psf; //!< Point spread functions
116  std::vector<GLATEdisp*> m_edisp; //!< Energy dispersions
117  std::vector<GLATMeanPsf*> m_ptsrc; //!< Mean PSFs for point sources
118 };
119 
120 
121 /***********************************************************************//**
122  * @brief Return class name
123  *
124  * @return String containing the class name ("GLATResponse").
125  ***************************************************************************/
126 inline
127 std::string GLATResponse::classname(void) const
128 {
129  return ("GLATResponse");
130 }
131 
132 
133 /***********************************************************************//**
134  * @brief Signal if response uses energy dispersion
135  *
136  * @return True if response uses energy dispersion.
137  ***************************************************************************/
138 inline
139 bool GLATResponse::use_edisp(void) const
140 {
141  return (false);
142 }
143 
144 
145 /***********************************************************************//**
146  * @brief Signal if response uses time dispersion
147  *
148  * @return True if response uses time dispersion.
149  ***************************************************************************/
150 inline
151 bool GLATResponse::use_tdisp(void) const
152 {
153  return (false);
154 }
155 
156 
157 /***********************************************************************//**
158  * @brief Return number of event types
159  *
160  * @return Number of event types.
161  *
162  * Returns the number of events types in this reponse.
163  ***************************************************************************/
164 inline
165 int GLATResponse::size(void) const
166 {
167  return (int)m_aeff.size();
168 }
169 
170 
171 /***********************************************************************//**
172  * @brief Return response name
173  *
174  * @return Response name.
175  ***************************************************************************/
176 inline
177 const std::string& GLATResponse::rspname(void) const
178 {
179  return (m_rspname);
180 }
181 
182 
183 /***********************************************************************//**
184  * @brief Signal if mean PSF should be used for response computation
185  *
186  * @return True if mean PSF should be used for response computation.
187  ***************************************************************************/
188 inline
189 const bool& GLATResponse::force_mean(void) const
190 {
191  return (m_force_mean);
192 }
193 
194 
195 /***********************************************************************//**
196  * @brief Set if mean PSF should be used for response computation
197  *
198  * @param[in] value True if mean PSF should be used for response computation.
199  ***************************************************************************/
200 inline
201 void GLATResponse::force_mean(const bool& value)
202 {
203  m_force_mean = value;
204  return;
205 }
206 
207 #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 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.
GLATResponse & operator=(const GLATResponse &rsp)
Assignment operator.
Time class.
Definition: GTime.hpp:54
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
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.
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:120
Fermi LAT effective area class definition.
Abstract instrument response base class.
Definition: GResponse.hpp:67
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.