GammaLib 2.1.0.dev
Loading...
Searching...
No Matches
GLATPsfV3.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATPsfV3.hpp - Fermi/LAT point spread function version 3 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 GLATPsfV3.hpp
23 * @brief Fermi/LAT point spread function version 3 class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATPSFV3_HPP
28#define GLATPSFV3_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 GLATPsfV3
41 *
42 * @brief Fermi/LAT point spread function version 3 class
43 *
44 * Version 3 of the Fermi/LAT PSF is the sum of two King model functions.
45 * In contrast to version 2, this class interpolates the distributions
46 * rather than the parameters.
47 *
48 * This class has been inspired by code from the Fermi/LAT ScienceTools.
49 * For comparison check the file irfs/latResponse/src/Psf3.h
50 ***************************************************************************/
51class GLATPsfV3 : public GLATPsfBase {
52
53public:
54 // Constructors and destructors
55 GLATPsfV3(void);
56 GLATPsfV3(const GLATPsfV3& psf);
57 virtual ~GLATPsfV3(void);
58
59 // Operators
61
62 // Methods
63 void clear(void);
64 GLATPsfV3* clone(void) const;
65 std::string classname(void) const;
66 void read(const GFitsTable& table);
67 void write(GFits& file) const;
68 double psf(const double& offset, const double& logE,
69 const double& ctheta);
70 int version(void) const;
71 std::string print(const GChatter& chatter = NORMAL) const;
72
73private:
74 // Methods
75 void init_members(void);
76 void copy_members(const GLATPsfV3& psf);
77 void free_members(void);
78 static double base_fct(const double& u, const double& gamma);
79 static double base_int(const double& u, const double& gamma);
80 double eval_psf(const double& offset, const double& energy,
81 const int& index);
82 double integrate_psf(const double& energy, const int& index);
83 void normalize_psf(void);
84
85 // Integrand class. This class is used to perform the radial
86 // integration of the PSF to assure the proper normalization.
87 // Note that score and stail need to be scaled by energy.
88 class base_integrand : public GFunction {
89 public:
90 base_integrand(double ncore, double ntail,
91 double score, double stail,
92 double gcore, double gtail) :
93 m_ncore(ncore), m_ntail(ntail),
94 m_score(score), m_stail(stail),
95 m_gcore(gcore), m_gtail(gtail) { }
96 double eval(const double& x) {
97 double rc = x / m_score;
98 double uc = 0.5 * rc * rc;
99 double rt = x / m_stail;
100 double ut = 0.5 * rt * rt;
101 double f = m_ncore * (base_fct(uc, m_gcore) +
102 m_ntail * base_fct(ut, m_gtail));
103 return (f*std::sin(x));
104 }
105 private:
106 double m_ncore;
107 double m_ntail;
108 double m_score;
109 double m_stail;
110 double m_gcore;
111 double m_gtail;
112 };
113
114 // Protected members
115 std::vector<double> m_ncore; //!< PSF ncore parameter
116 std::vector<double> m_ntail; //!< PSF ntail parameter
117 std::vector<double> m_score; //!< PSF score parameter
118 std::vector<double> m_stail; //!< PSF stail parameter
119 std::vector<double> m_gcore; //!< PSF gcore parameter
120 std::vector<double> m_gtail; //!< PSF gtail parameter
121};
122
123
124/***********************************************************************//**
125 * @brief Return class name
126 *
127 * @return String containing the class name ("GLATPsfV3").
128 ***************************************************************************/
129inline
130std::string GLATPsfV3::classname(void) const
131{
132 return ("GLATPsfV3");
133}
134
135
136/***********************************************************************//**
137 * @brief Return point spread function version number
138 *
139 * @return Point spread function version number (3).
140 ***************************************************************************/
141inline
142int GLATPsfV3::version(void) const
143{
144 return 3;
145}
146
147#endif /* GLATPSFV3_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.
base_integrand(double ncore, double ntail, double score, double stail, double gcore, double gtail)
Definition GLATPsfV3.hpp:90
double eval(const double &x)
Definition GLATPsfV3.hpp:96
Fermi/LAT point spread function version 3 class.
Definition GLATPsfV3.hpp:51
static double base_fct(const double &u, const double &gamma)
Return point spread base function value.
GLATPsfV3 & operator=(const GLATPsfV3 &psf)
Assignment operator.
double integrate_psf(const double &energy, const int &index)
Integrates PSF for a specific set of parameters.
std::vector< double > m_ntail
PSF ntail parameter.
std::vector< double > m_gcore
PSF gcore parameter.
double psf(const double &offset, const double &logE, const double &ctheta)
Return point spread function value.
std::vector< double > m_stail
PSF stail parameter.
GLATPsfV3 * clone(void) const
Clone point spread function.
std::vector< double > m_score
PSF score parameter.
void init_members(void)
Initialise class members.
void clear(void)
Clear point spread function.
double eval_psf(const double &offset, const double &energy, const int &index)
Evaluate PSF for a specific set of parameters.
std::string classname(void) const
Return class name.
std::vector< double > m_gtail
PSF gtail parameter.
int version(void) const
Return point spread function version number.
static double base_int(const double &u, const double &gamma)
Return approximation of point spread base function integral.
GLATPsfV3(void)
Void constructor.
Definition GLATPsfV3.cpp:61
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function.
std::vector< double > m_ncore
PSF ncore parameter.
void normalize_psf(void)
Normalize PSF for all parameters.
void copy_members(const GLATPsfV3 &psf)
Copy class members.
void write(GFits &file) const
Write point spread function into FITS file.
virtual ~GLATPsfV3(void)
Destructor.
Definition GLATPsfV3.cpp:92
void read(const GFitsTable &table)
Read point spread function from FITS table.
void free_members(void)
Delete class members.