GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 _______________________________________________ */
38 class 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  ***************************************************************************/
51 class GLATMeanPsf : public GBase {
52 
53 public:
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 
83 private:
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  ***************************************************************************/
123 inline
124 std::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  ***************************************************************************/
135 inline
136 int 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  ***************************************************************************/
151 inline
152 int GLATMeanPsf::noffsets(void) const
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  ***************************************************************************/
163 inline
164 int GLATMeanPsf::nenergies(void) const
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  ***************************************************************************/
176 inline
177 const 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  ***************************************************************************/
189 inline
190 const 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  ***************************************************************************/
201 inline
202 const 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  ***************************************************************************/
213 inline
214 const 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  ***************************************************************************/
225 inline
226 void 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  ***************************************************************************/
238 inline
239 const 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  ***************************************************************************/
250 inline
251 void GLATMeanPsf::thetamax(const double& value)
252 {
253  m_theta_max = value;
254  return;
255 }
256 
257 #endif /* GLATMEANPSF_HPP */
int m_inx3
Index 3.
Fermi/LAT observation class.
int size(void) const
Return number of nodes in node array.
Definition: GNodeArray.hpp:192
std::string m_name
Source name for mean PSF.
Definition: GLATMeanPsf.hpp:93
const GSkyDir & dir(void) const
Return sky direction for mean PSF.
Node array class.
Definition: GNodeArray.hpp:60
double m_theta_max
Maximum inclination angle (default 70 deg)
double operator()(const double &offset, const double &logE)
Return mean PSF*exposure value.
const std::string & name(void) const
Return source name for mean PSF.
double m_wgt4
Weighting factor 4.
void init_members(void)
Initialise class members.
Sky direction class interface definition.
const double & offset(const int &inx) const
Return offset angle for given bin.
int m_inx4
Index 4.
int m_inx2_exp
Exposure index 2.
GLATMeanPsf * clone(void) const
Clone mean PSF.
Definition of interface for all GammaLib classes.
void free_members(void)
Delete class members.
void set_offsets(void)
Set array of offset values in degrees.
int size(void) const
Return number of bins in mean PSF.
int m_inx2
Index 2.
GLATMeanPsf & operator=(const GLATMeanPsf &cube)
Assignment operator.
double exposure(const double &logE)
Return exposure value.
GLATMeanPsf(void)
Void constructor.
Definition: GLATMeanPsf.cpp:68
void clear(void)
Clear mean PSF.
Node array class interface definition.
std::string classname(void) const
Return class name.
double m_wgt1
Weighting factor 1.
GSkyDir m_dir
Source direction for mean PSF.
Definition: GLATMeanPsf.hpp:94
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
double m_last_energy
Last requested logE value.
GChatter
Definition: GTypemaps.hpp:33
std::vector< double > m_mapcorr
Map corrections.
Definition: GLATMeanPsf.hpp:97
double m_last_offset
Last requested offset value.
GNodeArray m_offset
Offsets of mean PSF.
Definition: GLATMeanPsf.hpp:98
void set(const GSkyDir &dir, const GLATObservation &obs)
Compute mean PSF and exposure.
double m_wgt3
Weighting factor 3.
std::vector< double > m_psf
Mean PSF values.
Definition: GLATMeanPsf.hpp:95
double psf(const double &offset, const double &logE)
Return mean PSF value.
double m_wgt2
Weighting factor 2.
void copy_members(const GLATMeanPsf &psf)
Copy class members.
double integral(const double &radmax, const double &logE)
Compute integral over PSF.
std::vector< double > m_exposure
Mean exposure.
Definition: GLATMeanPsf.hpp:96
int nenergies(void) const
Return number of energy bins.
const double & thetamax(void) const
Return maximum theta angle.
Fermi/LAT mean PSF class.
Definition: GLATMeanPsf.hpp:51
std::string print(const GChatter &chatter=NORMAL) const
Print livetime cube information.
int noffsets(void) const
Return number of offset bins.
GNodeArray m_energy
log10(energy) of mean PSF
Definition: GLATMeanPsf.hpp:99
int m_inx1_exp
Exposure index 1.
virtual ~GLATMeanPsf(void)
Destructor.
Sky direction class.
Definition: GSkyDir.hpp:62
const double & energy(const int &inx) const
Return energy for given bin.
void set_map_corrections(const GLATObservation &obs)
Compute map corrections.
int m_inx1
Index 1.