GammaLib 2.0.0
Loading...
Searching...
No Matches
GCTAPsf2D.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCTAPsf2D.hpp - CTA 2D point spread function class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2012-2017 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 GCTAPsf2D.hpp
23 * @brief CTA 2D point spread function class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCTAPSF2D_HPP
28#define GCTAPSF2D_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GFilename.hpp"
33#include "GCTAPsf.hpp"
34#include "GCTAResponseTable.hpp"
35
36/* __ Forward declarations _______________________________________________ */
37class GRan;
38class GFitsBinTable;
39
40/* __ Constants __________________________________________________________ */
41namespace gammalib {
42 const std::string extname_cta_psf2d = "POINT SPREAD FUNCTION";
43}
44
45
46/***********************************************************************//**
47 * @class GCTAPsf2D
48 *
49 * @brief CTA 2D point spread function class
50 *
51 * This class implements the CTA point spread function response as function
52 * of energy and offset angle.
53 ***************************************************************************/
54class GCTAPsf2D : public GCTAPsf {
55
56public:
57 // Constructors and destructors
58 GCTAPsf2D(void);
59 explicit GCTAPsf2D(const GFilename& filename);
60 GCTAPsf2D(const GCTAPsf2D& psf);
61 virtual ~GCTAPsf2D(void);
62
63 // Operators
64 GCTAPsf2D& operator=(const GCTAPsf2D& psf);
65 double operator()(const double& delta,
66 const double& logE,
67 const double& theta = 0.0,
68 const double& phi = 0.0,
69 const double& zenith = 0.0,
70 const double& azimuth = 0.0,
71 const bool& etrue = true) const;
72
73 // Implemented pure virtual methods
74 void clear(void);
75 GCTAPsf2D* clone(void) const;
76 std::string classname(void) const;
77 void load(const GFilename& filename);
78 GFilename filename(void) const;
79 double mc(GRan& ran,
80 const double& logE,
81 const double& theta = 0.0,
82 const double& phi = 0.0,
83 const double& zenith = 0.0,
84 const double& azimuth = 0.0,
85 const bool& etrue = true) const;
86 double delta_max(const double& logE,
87 const double& theta = 0.0,
88 const double& phi = 0.0,
89 const double& zenith = 0.0,
90 const double& azimuth = 0.0,
91 const bool& etrue = true) const;
92 double containment_radius(const double& fraction,
93 const double& logE,
94 const double& theta = 0.0,
95 const double& phi = 0.0,
96 const double& zenith = 0.0,
97 const double& azimuth = 0.0,
98 const bool& etrue = true) const;
99 std::string print(const GChatter& chatter = NORMAL) const;
100
101 // Methods
102 const GCTAResponseTable& table(void) const;
103 void table(const GCTAResponseTable& table);
104 void read(const GFitsTable& table);
105 void write(GFitsBinTable& table) const;
106 void save(const GFilename& filename,
107 const bool& clobber = false) const;
108
109
110private:
111 // Methods
112 void init_members(void);
113 void copy_members(const GCTAPsf2D& psf);
114 void free_members(void);
115 void update(const double& logE, const double& theta) const;
116
117 // Members
118 GFilename m_filename; //!< Name of Aeff response file
119 GCTAResponseTable m_psf; //!< PSF response table
120 int m_inx_energy; //!< Energy index
121 int m_inx_theta; //!< Theta index
122 int m_inx_sigma1; //!< 1st Gaussian sigma
123 int m_inx_ampl2; //!< 2nd Gaussian relative amplitude
124 int m_inx_sigma2; //!< 2nd Gaussian sigma
125 int m_inx_ampl3; //!< 3nd Gaussian relative amplitude
126 int m_inx_sigma3; //!< 3nd Gaussian sigma
127
128 // Precomputation cache
129 mutable double m_par_logE; //!< Cache energy
130 mutable double m_par_theta; //!< Cache offset angle
131 mutable double m_norm; //!< Global normalization
132 mutable double m_norm2; //!< Gaussian 2 normalization
133 mutable double m_norm3; //!< Gaussian 3 normalization
134 mutable double m_sigma1; //!< Gaussian 1 sigma
135 mutable double m_sigma2; //!< Gaussian 2 sigma
136 mutable double m_sigma3; //!< Gaussian 3 sigma
137 mutable double m_width1; //!< Gaussian 1 width
138 mutable double m_width2; //!< Gaussian 2 width
139 mutable double m_width3; //!< Gaussian 3 width
140};
141
142
143/***********************************************************************//**
144 * @brief Return class name
145 *
146 * @return String containing the class name ("GCTAPsf2D").
147 ***************************************************************************/
148inline
149std::string GCTAPsf2D::classname(void) const
150{
151 return ("GCTAPsf2D");
152}
153
154
155/***********************************************************************//**
156 * @brief Return filename
157 *
158 * @return Returns filename from which point spread function was loaded
159 ***************************************************************************/
160inline
162{
163 return m_filename;
164}
165
166/***********************************************************************//**
167 * @brief Return response table
168 *
169 * @return Response table.
170 ***************************************************************************/
171inline
173{
174 return m_psf;
175}
176
177/***********************************************************************//**
178 * @brief Assign response table
179 *
180 * @param[in] table Response table.
181 ***************************************************************************/
182inline
184{
185 m_psf = table;
186}
187
188
189#endif /* GCTAPSF2D_HPP */
CTA point spread function base class definition.
CTA response table class definition.
Filename class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
CTA 2D point spread function class.
Definition GCTAPsf2D.hpp:54
int m_inx_sigma2
2nd Gaussian sigma
GCTAPsf2D & operator=(const GCTAPsf2D &psf)
Assignment operator.
double m_sigma3
Gaussian 3 sigma.
int m_inx_sigma3
3nd Gaussian sigma
double m_sigma2
Gaussian 2 sigma.
double m_par_theta
Cache offset angle.
double m_norm3
Gaussian 3 normalization.
void init_members(void)
Initialise class members.
GCTAPsf2D * clone(void) const
Clone point spread functions.
const GCTAResponseTable & table(void) const
Return response table.
void copy_members(const GCTAPsf2D &psf)
Copy class members.
double m_sigma1
Gaussian 1 sigma.
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function information.
double m_norm2
Gaussian 2 normalization.
GCTAResponseTable m_psf
PSF response table.
double m_par_logE
Cache energy.
void free_members(void)
Delete class members.
double m_norm
Global normalization.
GFilename m_filename
Name of Aeff response file.
void save(const GFilename &filename, const bool &clobber=false) const
Save point spread function table into FITS file.
double m_width3
Gaussian 3 width.
int m_inx_theta
Theta index.
GFilename filename(void) const
Return filename.
void load(const GFilename &filename)
Load point spread function from FITS file.
double operator()(const double &delta, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Return point spread function (in units of sr^-1)
int m_inx_sigma1
1st Gaussian sigma
double m_width2
Gaussian 2 width.
void read(const GFitsTable &table)
Read point spread function from FITS table.
double containment_radius(const double &fraction, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Return the radius that contains a fraction of the events (radians)
double m_width1
Gaussian 1 width.
void update(const double &logE, const double &theta) const
Update PSF parameter cache.
std::string classname(void) const
Return class name.
GCTAPsf2D(void)
Void constructor.
Definition GCTAPsf2D.cpp:68
int m_inx_energy
Energy index.
int m_inx_ampl3
3nd Gaussian relative amplitude
virtual ~GCTAPsf2D(void)
Destructor.
void write(GFitsBinTable &table) const
Write point spread function into FITS binary table.
void clear(void)
Clear point spread function.
double delta_max(const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Return maximum size of PSF (radians)
int m_inx_ampl2
2nd Gaussian relative amplitude
double mc(GRan &ran, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
Simulate PSF offset (radians)
Abstract base class for the CTA point spread function.
Definition GCTAPsf.hpp:47
CTA response table class.
Filename class.
Definition GFilename.hpp:62
FITS binary table class.
Abstract interface for FITS table.
Random number generator class.
Definition GRan.hpp:44
const std::string extname_cta_psf2d
Definition GCTAPsf2D.hpp:42