GammaLib 2.0.0
Loading...
Searching...
No Matches
GLATMeanPsf.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATMeanPsf.hpp - Fermi/LAT mean PSF class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2010-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 GLATMeanPsf.hpp
23 * @brief Fermi/LAT mean PSF class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATMEANPSF_HPP
28#define GLATMEANPSF_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GBase.hpp"
34#include "GSkyDir.hpp"
35#include "GNodeArray.hpp"
36
37/* __ Forward declarations _______________________________________________ */
38class GLATObservation;
39
40
41/***********************************************************************//**
42 * @class GLATMeanPsf
43 *
44 * @brief Fermi/LAT mean PSF class
45 *
46 * The position-dependent mean PSF is the point spread function that has
47 * been averaged over the zenith and azimuth angles of an observation. The
48 * averaging is done using the livetime cube which holds the livetime as
49 * function and zenith and azimuth angles for an observation.
50 ***************************************************************************/
51class GLATMeanPsf : public GBase {
52
53public:
54 // Constructors and destructors
55 GLATMeanPsf(void);
56 GLATMeanPsf(const GSkyDir& dir, const GLATObservation& obs);
57 GLATMeanPsf(const GLATMeanPsf& cube);
58 virtual ~GLATMeanPsf(void);
59
60 // Operators
61 GLATMeanPsf& operator=(const GLATMeanPsf& cube);
62 double operator()(const double& offset, const double& logE);
63
64 // Methods
65 void clear(void);
66 GLATMeanPsf* clone(void) const;
67 std::string classname(void) const;
68 int size(void) const;
69 void set(const GSkyDir& dir, const GLATObservation& obs);
70 int noffsets(void) const;
71 int nenergies(void) const;
72 const double& offset(const int& inx) const;
73 const double& energy(const int& inx) const;
74 const GSkyDir& dir(void) const;
75 const std::string& name(void) const;
76 void name(const std::string& name);
77 const double& thetamax(void) const;
78 void thetamax(const double& value);
79 double psf(const double& offset, const double& logE);
80 double exposure(const double& logE);
81 std::string print(const GChatter& chatter = NORMAL) const;
82
83private:
84 // Methods
85 void init_members(void);
86 void copy_members(const GLATMeanPsf& psf);
87 void free_members(void);
88 void set_offsets(void);
89 void set_map_corrections(const GLATObservation& obs);
90 double integral(const double& radmax, const double& logE);
91
92 // Protected members
93 std::string m_name; //!< Source name for mean PSF
94 GSkyDir m_dir; //!< Source direction for mean PSF
95 std::vector<double> m_psf; //!< Mean PSF values
96 std::vector<double> m_exposure; //!< Mean exposure
97 std::vector<double> m_mapcorr; //!< Map corrections
98 GNodeArray m_offset; //!< Offsets of mean PSF
99 GNodeArray m_energy; //!< log10(energy) of mean PSF
100 double m_theta_max; //!< Maximum inclination angle (default 70 deg)
101
102 // Bi-linear interpolation data
103 double m_last_energy; //!< Last requested logE value
104 double m_last_offset; //!< Last requested offset value
105 int m_inx1_exp; //!< Exposure index 1
106 int m_inx2_exp; //!< Exposure index 2
107 int m_inx1; //!< Index 1
108 int m_inx2; //!< Index 2
109 int m_inx3; //!< Index 3
110 int m_inx4; //!< Index 4
111 double m_wgt1; //!< Weighting factor 1
112 double m_wgt2; //!< Weighting factor 2
113 double m_wgt3; //!< Weighting factor 3
114 double m_wgt4; //!< Weighting factor 4
115};
116
117
118/***********************************************************************//**
119 * @brief Return class name
120 *
121 * @return String containing the class name ("GLATMeanPsf").
122 ***************************************************************************/
123inline
124std::string GLATMeanPsf::classname(void) const
125{
126 return ("GLATMeanPsf");
127}
128
129
130/***********************************************************************//**
131 * @brief Return number of bins in mean PSF
132 *
133 * @return Number of bins in mean PSF
134 ***************************************************************************/
135inline
136int GLATMeanPsf::size(void) const
137{
138 // Compute size
139 int size = m_energy.size()*m_offset.size();
140
141 // Return size
142 return size;
143}
144
145
146/***********************************************************************//**
147 * @brief Return number of offset bins
148 *
149 * @return Number of offset bins.
150 ***************************************************************************/
151inline
153{
154 return m_offset.size();
155}
156
157
158/***********************************************************************//**
159 * @brief Return number of energy bins
160 *
161 * @return Number of energy bins.
162 ***************************************************************************/
163inline
165{
166 return m_energy.size();
167}
168
169
170/***********************************************************************//**
171 * @brief Return offset angle for given bin
172 *
173 * @param[in] inx Bin index [0,...,noffsets()-1]
174 * @return Offset angle.
175 ***************************************************************************/
176inline
177const double& GLATMeanPsf::offset(const int& inx) const
178{
179 return m_offset[inx];
180}
181
182
183/***********************************************************************//**
184 * @brief Return energy for given bin
185 *
186 * @param[in] inx Bin index [0,...,nenergies()-1]
187 * @return Energy.
188 ***************************************************************************/
189inline
190const double& GLATMeanPsf::energy(const int& inx) const
191{
192 return m_energy[inx];
193}
194
195
196/***********************************************************************//**
197 * @brief Return sky direction for mean PSF
198 *
199 * @return Sky direction.
200 ***************************************************************************/
201inline
202const GSkyDir& GLATMeanPsf::dir(void) const
203{
204 return m_dir;
205}
206
207
208/***********************************************************************//**
209 * @brief Return source name for mean PSF
210 *
211 * @return Source name.
212 ***************************************************************************/
213inline
214const std::string& GLATMeanPsf::name(void) const
215{
216 return m_name;
217}
218
219
220/***********************************************************************//**
221 * @brief Set source name for mean PSF
222 *
223 * @param[in] name Source name.
224 ***************************************************************************/
225inline
226void GLATMeanPsf::name(const std::string& name)
227{
228 m_name = name;
229 return;
230}
231
232
233/***********************************************************************//**
234 * @brief Return maximum theta angle
235 *
236 * @return Maximum theta angle.
237 ***************************************************************************/
238inline
239const double& GLATMeanPsf::thetamax(void) const
240{
241 return m_theta_max;
242}
243
244
245/***********************************************************************//**
246 * @brief Set maximum theta angle
247 *
248 * @param[in] value Maximum theta angle.
249 ***************************************************************************/
250inline
251void GLATMeanPsf::thetamax(const double& value)
252{
253 m_theta_max = value;
254 return;
255}
256
257#endif /* GLATMEANPSF_HPP */
Definition of interface for all GammaLib classes.
Node array class interface definition.
Sky direction class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Interface class for all GammaLib classes.
Definition GBase.hpp:52
Fermi/LAT mean PSF class.
const std::string & name(void) const
Return source name for mean PSF.
double m_wgt2
Weighting factor 2.
int m_inx4
Index 4.
std::string print(const GChatter &chatter=NORMAL) const
Print livetime cube information.
const GSkyDir & dir(void) const
Return sky direction for mean PSF.
void set(const GSkyDir &dir, const GLATObservation &obs)
Compute mean PSF and exposure.
void copy_members(const GLATMeanPsf &psf)
Copy class members.
std::vector< double > m_exposure
Mean exposure.
std::string m_name
Source name for mean PSF.
double m_wgt3
Weighting factor 3.
virtual ~GLATMeanPsf(void)
Destructor.
double exposure(const double &logE)
Return exposure value.
double m_last_offset
Last requested offset value.
const double & energy(const int &inx) const
Return energy for given bin.
double m_wgt1
Weighting factor 1.
double m_theta_max
Maximum inclination angle (default 70 deg)
void init_members(void)
Initialise class members.
GSkyDir m_dir
Source direction for mean PSF.
double psf(const double &offset, const double &logE)
Return mean PSF value.
double m_last_energy
Last requested logE value.
GNodeArray m_offset
Offsets of mean PSF.
int noffsets(void) const
Return number of offset bins.
GLATMeanPsf & operator=(const GLATMeanPsf &cube)
Assignment operator.
int size(void) const
Return number of bins in mean PSF.
std::vector< double > m_psf
Mean PSF values.
GLATMeanPsf * clone(void) const
Clone mean PSF.
double integral(const double &radmax, const double &logE)
Compute integral over PSF.
double m_wgt4
Weighting factor 4.
int m_inx1_exp
Exposure index 1.
void clear(void)
Clear mean PSF.
int m_inx3
Index 3.
const double & thetamax(void) const
Return maximum theta angle.
int m_inx1
Index 1.
int m_inx2_exp
Exposure index 2.
void free_members(void)
Delete class members.
GNodeArray m_energy
log10(energy) of mean PSF
void set_map_corrections(const GLATObservation &obs)
Compute map corrections.
std::string classname(void) const
Return class name.
int nenergies(void) const
Return number of energy bins.
void set_offsets(void)
Set array of offset values in degrees.
GLATMeanPsf(void)
Void constructor.
const double & offset(const int &inx) const
Return offset angle for given bin.
std::vector< double > m_mapcorr
Map corrections.
double operator()(const double &offset, const double &logE)
Return mean PSF*exposure value.
int m_inx2
Index 2.
Fermi/LAT observation class.
Node array class.
int size(void) const
Return number of nodes in node array.
Sky direction class.
Definition GSkyDir.hpp:62