GammaLib 2.0.0
Loading...
Searching...
No Matches
GLATPsfBase.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATPsfBase.hpp - Abstract Fermi/LAT point spread function base class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2012-2013 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 GLATPsfBase.hpp
23 * @brief Abstract Fermi/LAT point spread function base class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATPSFBASE_HPP
28#define GLATPSFBASE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GBase.hpp"
33#include "GLATResponseTable.hpp"
34#include "GFits.hpp"
35#include "GFitsTable.hpp"
36
37
38/***********************************************************************//**
39 * @class GLATPsfBase
40 *
41 * @brief Abstract Fermi/LAT point spread function base class
42 *
43 * This class defines the abstract interface for the Fermi/LAT point spread
44 * function (PSF). Classes that are derived from GLATPsfBase implement the
45 * version dependent LAT PSFs.
46 ***************************************************************************/
47class GLATPsfBase : public GBase {
48
49public:
50 // Constructors and destructors
51 GLATPsfBase(void);
53 virtual ~GLATPsfBase(void);
54
55 // Operators
57
58 // Pure virtual methods
59 virtual void clear(void) = 0;
60 virtual GLATPsfBase* clone(void) const = 0;
61 virtual std::string classname(void) const = 0;
62 virtual void read(const GFitsTable& table) = 0;
63 virtual void write(GFits& file) const = 0;
64 virtual double psf(const double& offset, const double& logE,
65 const double& ctheta) = 0;
66 virtual int version(void) const = 0;
67 virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
68
69 // Other methods
70 void read_scale(const GFitsTable& hdu);
71 void write_scale(GFits& file) const;
72 int size(void) const;
73 int nenergies(void) const;
74 int ncostheta(void) const;
75 const double& costhetamin(void) const;
76 void costhetamin(const double& ctheta);
77 bool has_phi(void) const;
78 const bool& front(void) const;
79 void front(const bool& front);
80 const double& scale_par1(void) const;
81 const double& scale_par2(void) const;
82 const double& scale_index(void) const;
83
84protected:
85 // Methods
86 void init_members(void);
87 void copy_members(const GLATPsfBase& psf);
88 void free_members(void);
89 double scale_factor(const double& energy) const;
90
91 // Protected members
92 bool m_front; //!< PSF is for front section?
93 GLATResponseTable m_rpsf_bins; //!< PSF energy and cos theta binning
94 double m_scale_par1; //!< PSF scaling parameter 1
95 double m_scale_par2; //!< PSF scaling parameter 2
96 double m_scale_index; //!< PSF scaling index
97 double m_min_ctheta; //!< Minimum valid cos(theta)
98};
99
100
101/***********************************************************************//**
102 * @brief Return number of bins in point spread function
103 *
104 * @return Number of bins in point spread function.
105 ***************************************************************************/
106inline
107int GLATPsfBase::size(void) const
108{
109 return nenergies()*ncostheta();
110}
111
112
113/***********************************************************************//**
114 * @brief Return number of energies in point spread function
115 *
116 * @return Number of energies in point spread function.
117 ***************************************************************************/
118inline
120{
121 return m_rpsf_bins.nenergies();
122}
123
124
125/***********************************************************************//**
126 * @brief Return number of cosine theta bins in point spread function
127 *
128 * @return Number of cosine theta bins in point spread function.
129 ***************************************************************************/
130inline
132{
133 return m_rpsf_bins.ncostheta();
134}
135
136
137/***********************************************************************//**
138 * @brief Return cosine theta minimum
139 *
140 * @return Cosine theta minimum.
141 ***************************************************************************/
142inline
143const double& GLATPsfBase::costhetamin(void) const
144{
145 return m_min_ctheta;
146}
147
148
149/***********************************************************************//**
150 * @brief Set minimum cos(theta) angle for point spread function
151 *
152 * @param[in] ctheta Cosine of maximum zenith angle.
153 ***************************************************************************/
154inline
155void GLATPsfBase::costhetamin(const double& ctheta)
156{
157 m_min_ctheta = ctheta;
158 return;
159}
160
161
162/***********************************************************************//**
163 * @brief Signal that point spread function has Phi dependence
164 *
165 * @return True if point spread function has Phi dependence.
166 ***************************************************************************/
167inline
168bool GLATPsfBase::has_phi(void) const
169{
170 return false;
171}
172
173
174/***********************************************************************//**
175 * @brief Signal that point spread function is for front section
176 *
177 * @return True if point spread function is for front section.
178 ***************************************************************************/
179inline
180const bool& GLATPsfBase::front(void) const
181{
182 return m_front;
183}
184
185
186/***********************************************************************//**
187 * @brief Set if point spread function is for front section
188 *
189 * @param[in] front True if point spread function is for front section.
190 ***************************************************************************/
191inline
192void GLATPsfBase::front(const bool& front)
193{
194 m_front = front;
195 return;
196}
197
198
199/***********************************************************************//**
200 * @brief Return first scaling parameter
201 *
202 * @return First scaling parameter.
203 ***************************************************************************/
204inline
205const double& GLATPsfBase::scale_par1(void) const
206{
207 return m_scale_par1;
208}
209
210
211/***********************************************************************//**
212 * @brief Return second scaling parameter
213 *
214 * @return Second scaling parameter.
215 ***************************************************************************/
216inline
217const double& GLATPsfBase::scale_par2(void) const
218{
219 return m_scale_par2;
220}
221
222
223/***********************************************************************//**
224 * @brief Return scaling index
225 *
226 * @return Scaling index.
227 ***************************************************************************/
228inline
229const double& GLATPsfBase::scale_index(void) const
230{
231 return m_scale_index;
232}
233
234#endif /* GLATPSFBASE_HPP */
Definition of interface for all GammaLib classes.
FITS table abstract base class interface definition.
FITS file class interface definition.
Fermi-LAT response table class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Interface class for all GammaLib classes.
Definition GBase.hpp:52
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Abstract Fermi/LAT point spread function base class.
virtual GLATPsfBase * clone(void) const =0
Clones object.
GLATPsfBase(void)
Void constructor.
virtual void read(const GFitsTable &table)=0
double m_scale_par2
PSF scaling parameter 2.
void write_scale(GFits &file) const
Write PSF scale factors.
const double & scale_par1(void) const
Return first scaling parameter.
GLATResponseTable m_rpsf_bins
PSF energy and cos theta binning.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
void free_members(void)
Delete class members.
virtual double psf(const double &offset, const double &logE, const double &ctheta)=0
bool m_front
PSF is for front section?
const double & scale_index(void) const
Return scaling index.
virtual void write(GFits &file) const =0
void init_members(void)
Initialise class members.
const bool & front(void) const
Signal that point spread function is for front section.
double m_scale_par1
PSF scaling parameter 1.
const double & scale_par2(void) const
Return second scaling parameter.
int nenergies(void) const
Return number of energies in point spread function.
const double & costhetamin(void) const
Return cosine theta minimum.
virtual int version(void) const =0
virtual ~GLATPsfBase(void)
Destructor.
virtual void clear(void)=0
Clear object.
virtual std::string classname(void) const =0
Return class name.
int size(void) const
Return number of bins in point spread function.
double m_scale_index
PSF scaling index.
void read_scale(const GFitsTable &hdu)
Read PSF scale factors from FITS table.
int ncostheta(void) const
Return number of cosine theta bins in point spread function.
GLATPsfBase & operator=(const GLATPsfBase &psf)
Assignment operator.
bool has_phi(void) const
Signal that point spread function has Phi dependence.
double m_min_ctheta
Minimum valid cos(theta)
void copy_members(const GLATPsfBase &psf)
Copy class members.
double scale_factor(const double &energy) const
Return scale factor for energy (in MeV)
Interface for the Fermi LAT Response table class.
const int & ncostheta(void) const
Return number of cosine theta bins in response table.
const int & nenergies(void) const
Return number of energies in response table.