GammaLib 2.0.0
Loading...
Searching...
No Matches
GLATPsfV1.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATPsfV1.hpp - Fermi/LAT point spread function version 1 class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2012-2014 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 GLATPsfV1.hpp
23 * @brief Fermi/LAT point spread function version 1 class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATPSFV1_HPP
28#define GLATPSFV1_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <vector>
32#include <cmath>
33#include "GLATPsfBase.hpp"
34#include "GFits.hpp"
35#include "GFitsTable.hpp"
36#include "GFunction.hpp"
37
38
39/***********************************************************************//**
40 * @class GLATPsfV1
41 *
42 * @brief Fermi/LAT point spread function version 1 class
43 *
44 * This class has been inspired by code from the Fermi/LAT ScienceTools.
45 * For comparison check the file irfs/latResponse/src/Psf.h
46 ***************************************************************************/
47class GLATPsfV1 : public GLATPsfBase {
48
49public:
50 // Constructors and destructors
51 GLATPsfV1(void);
52 GLATPsfV1(const GLATPsfV1& psf);
53 virtual ~GLATPsfV1(void);
54
55 // Operators
57
58 // Methods
59 void clear(void);
60 GLATPsfV1* clone(void) const;
61 std::string classname(void) const;
62 void read(const GFitsTable& table);
63 void write(GFits& file) const;
64 double psf(const double& offset, const double& logE,
65 const double& ctheta);
66 int version(void) const;
67 std::string print(const GChatter& chatter = NORMAL) const;
68
69private:
70 // Methods
71 void init_members(void);
72 void copy_members(const GLATPsfV1& psf);
73 void free_members(void);
74 static double base_fct(const double& u, const double& gamma);
75 static double base_int(const double& u, const double& gamma);
76
77 // Integrand class. This class is used to perform the radial
78 // integration of the PSF that assures the proper normalization
79 // of the PSF at low energies.
80 class base_integrand : public GFunction {
81 public:
82 base_integrand(double ncore, double ntail, double sigma,
83 double gcore, double gtail) :
84 m_ncore(ncore), m_ntail(ntail), m_sigma(sigma),
85 m_gcore(gcore), m_gtail(gtail) { }
86 double eval(const double& x) {
87 double r = x / m_sigma;
88 double u = 0.5 * r * r;
89 double f = m_ncore * base_fct(u, m_gcore) +
91 return (f*std::sin(x));
92 }
93 private:
94 double m_ncore;
95 double m_ntail;
96 double m_sigma;
97 double m_gcore;
98 double m_gtail;
99 };
100
101 // Protected members
102 std::vector<double> m_ncore; //!< PSF ncore parameter
103 std::vector<double> m_sigma; //!< PSF sigma parameter
104 std::vector<double> m_gcore; //!< PSF gcore parameter
105 std::vector<double> m_gtail; //!< PSF gtail parameter
106};
107
108
109/***********************************************************************//**
110 * @brief Return class name
111 *
112 * @return String containing the class name ("GLATPsfV1").
113 ***************************************************************************/
114inline
115std::string GLATPsfV1::classname(void) const
116{
117 return ("GLATPsfV1");
118}
119
120
121/***********************************************************************//**
122 * @brief Return point spread function version number
123 *
124 * @return Point spread function version number (1).
125 ***************************************************************************/
126inline
127int GLATPsfV1::version(void) const
128{
129 return 1;
130}
131
132#endif /* GLATPSFV1_HPP */
FITS table abstract base class interface definition.
FITS file class interface definition.
Single parameter function abstract base class definition.
Abstract Fermi/LAT point spread function base class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Single parameter function abstract base class.
Definition GFunction.hpp:44
Abstract Fermi/LAT point spread function base class.
double eval(const double &x)
Definition GLATPsfV1.hpp:86
base_integrand(double ncore, double ntail, double sigma, double gcore, double gtail)
Definition GLATPsfV1.hpp:82
Fermi/LAT point spread function version 1 class.
Definition GLATPsfV1.hpp:47
virtual ~GLATPsfV1(void)
Destructor.
Definition GLATPsfV1.cpp:91
void clear(void)
Clear point spread function.
void read(const GFitsTable &table)
Read point spread function from FITS table.
std::vector< double > m_gcore
PSF gcore parameter.
std::vector< double > m_sigma
PSF sigma parameter.
std::string classname(void) const
Return class name.
GLATPsfV1(void)
Void constructor.
Definition GLATPsfV1.cpp:60
void copy_members(const GLATPsfV1 &psf)
Copy class members.
void free_members(void)
Delete class members.
std::vector< double > m_ncore
PSF ncore parameter.
GLATPsfV1 * clone(void) const
Clone point spread function.
static double base_int(const double &u, const double &gamma)
Return approximation of point spread base function integral.
std::vector< double > m_gtail
PSF gtail parameter.
GLATPsfV1 & operator=(const GLATPsfV1 &psf)
Assignment operator.
double psf(const double &offset, const double &logE, const double &ctheta)
Return point spread function value.
int version(void) const
Return point spread function version number.
void write(GFits &file) const
Write point spread function into FITS file.
void init_members(void)
Initialise class members.
static double base_fct(const double &u, const double &gamma)
Return point spread base function value.
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function.