GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  ***************************************************************************/
47 class GLATPsfBase : public GBase {
48 
49 public:
50  // Constructors and destructors
51  GLATPsfBase(void);
52  GLATPsfBase(const GLATPsfBase& psf);
53  virtual ~GLATPsfBase(void);
54 
55  // Operators
56  GLATPsfBase& operator=(const GLATPsfBase& psf);
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 
84 protected:
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  ***************************************************************************/
106 inline
107 int 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  ***************************************************************************/
118 inline
119 int GLATPsfBase::nenergies(void) const
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  ***************************************************************************/
130 inline
131 int GLATPsfBase::ncostheta(void) const
132 {
133  return m_rpsf_bins.ncostheta();
134 }
135 
136 
137 /***********************************************************************//**
138  * @brief Return cosine theta minimum
139  *
140  * @return Cosine theta minimum.
141  ***************************************************************************/
142 inline
143 const 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  ***************************************************************************/
154 inline
155 void 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  ***************************************************************************/
167 inline
168 bool 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  ***************************************************************************/
179 inline
180 const 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  ***************************************************************************/
191 inline
192 void 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  ***************************************************************************/
204 inline
205 const 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  ***************************************************************************/
216 inline
217 const 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  ***************************************************************************/
228 inline
229 const double& GLATPsfBase::scale_index(void) const
230 {
231  return m_scale_index;
232 }
233 
234 #endif /* GLATPSFBASE_HPP */
virtual ~GLATPsfBase(void)
Destructor.
Definition: GLATPsfBase.cpp:89
void read_scale(const GFitsTable &hdu)
Read PSF scale factors from FITS table.
virtual GLATPsfBase * clone(void) const =0
Clones object.
virtual double psf(const double &offset, const double &logE, const double &ctheta)=0
const double & scale_index(void) const
Return scaling index.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
const double & costhetamin(void) const
Return cosine theta minimum.
virtual void write(GFits &file) const =0
bool has_phi(void) const
Signal that point spread function has Phi dependence.
Definition of interface for all GammaLib classes.
Fermi-LAT response table class definition.
void copy_members(const GLATPsfBase &psf)
Copy class members.
const double & scale_par1(void) const
Return first scaling parameter.
int ncostheta(void) const
Return number of cosine theta bins in point spread function.
FITS file class.
Definition: GFits.hpp:63
FITS file class interface definition.
virtual std::string classname(void) const =0
Return class name.
double m_scale_index
PSF scaling index.
Definition: GLATPsfBase.hpp:96
double scale_factor(const double &energy) const
Return scale factor for energy (in MeV)
void write_scale(GFits &file) const
Write PSF scale factors.
void free_members(void)
Delete class members.
Abstract Fermi/LAT point spread function base class.
Definition: GLATPsfBase.hpp:47
const int & nenergies(void) const
Return number of energies in response table.
bool m_front
PSF is for front section?
Definition: GLATPsfBase.hpp:92
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
Interface for the Fermi LAT Response table class.
const int & ncostheta(void) const
Return number of cosine theta bins in response table.
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
GChatter
Definition: GTypemaps.hpp:33
GLATPsfBase(void)
Void constructor.
Definition: GLATPsfBase.cpp:58
void init_members(void)
Initialise class members.
double m_min_ctheta
Minimum valid cos(theta)
Definition: GLATPsfBase.hpp:97
GLATPsfBase & operator=(const GLATPsfBase &psf)
Assignment operator.
virtual int version(void) const =0
virtual void read(const GFitsTable &table)=0
GLATResponseTable m_rpsf_bins
PSF energy and cos theta binning.
Definition: GLATPsfBase.hpp:93
int nenergies(void) const
Return number of energies in point spread function.
int size(void) const
Return number of bins in point spread function.
const double & scale_par2(void) const
Return second scaling parameter.
double m_scale_par1
PSF scaling parameter 1.
Definition: GLATPsfBase.hpp:94
const bool & front(void) const
Signal that point spread function is for front section.
double m_scale_par2
PSF scaling parameter 2.
Definition: GLATPsfBase.hpp:95
FITS table abstract base class interface definition.
virtual void clear(void)=0
Clear object.