GammaLib 2.0.0
Loading...
Searching...
No Matches
GCTAPsfTable.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCTAPsfTable.hpp - CTA point spread function table class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2016-2018 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 GCTAPsfTable.hpp
23 * @brief CTA point spread function table class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCTAPSFTABLE_HPP
28#define GCTAPSFTABLE_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 GFitsTable;
39
40/* __ Constants __________________________________________________________ */
41namespace gammalib {
42 const std::string extname_cta_psftable = "PSF_2D_TABLE";
43}
44
45
46/***********************************************************************//**
47 * @class GCTAPsfTable
48 *
49 * @brief CTA point spread function table class
50 *
51 * This class implements the CTA point spread function response as function
52 * of energy as determined from a FITS table.
53 ***************************************************************************/
54class GCTAPsfTable : public GCTAPsf {
55
56public:
57 // Constructors and destructors
58 GCTAPsfTable(void);
59 explicit GCTAPsfTable(const GFilename& filename);
60 GCTAPsfTable(const GCTAPsfTable& psf);
61 virtual ~GCTAPsfTable(void);
62
63 // Operators
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 GCTAPsfTable* 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
109private:
110 // Methods
111 void init_members(void);
112 void copy_members(const GCTAPsfTable& psf);
113 void free_members(void);
114 void precompute(void);
115 int element(const int& ieng, const int& itheta, const int& idelta);
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_delta; //!< Delta index
123 int m_inx_rpsf; //!< PSF histogram
124 double m_delta_max; //!< Maximum delta angle (radians)
125 double m_psf_max; //!< Maximum PSF value
126};
127
128
129/***********************************************************************//**
130 * @brief Return class name
131 *
132 * @return String containing the class name ("GCTAPsfTable").
133 ***************************************************************************/
134inline
135std::string GCTAPsfTable::classname(void) const
136{
137 return ("GCTAPsfTable");
138}
139
140
141/***********************************************************************//**
142 * @brief Return filename
143 *
144 * @return Filename from which point spread function was loaded.
145 *
146 * Returns filename from which point spread function was loaded.
147 ***************************************************************************/
148inline
150{
151 return m_filename;
152}
153
154/***********************************************************************//**
155 * @brief Return response table
156 *
157 * @return Response table.
158 ***************************************************************************/
159inline
161{
162 return m_psf;
163}
164
165/***********************************************************************//**
166 * @brief Assign response table
167 *
168 * @param[in] table Response table.
169 ***************************************************************************/
170inline
172{
173 m_psf = table;
174}
175
176#endif /* GCTAPSFTABLE_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 point spread function table class.
std::string classname(void) const
Return class name.
GCTAPsfTable * clone(void) const
Clone point spread functions.
int m_inx_rpsf
PSF histogram.
int m_inx_theta
Theta index.
void clear(void)
Clear point spread function.
void write(GFitsBinTable &table) const
Write point spread function into FITS table.
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)
void precompute(void)
Performs precomputations for point spread function.
GCTAPsfTable & operator=(const GCTAPsfTable &psf)
Assignment operator.
GFilename m_filename
Name of Aeff response file.
GCTAResponseTable m_psf
PSF response table.
GFilename filename(void) const
Return filename.
void free_members(void)
Delete class members.
void copy_members(const GCTAPsfTable &psf)
Copy class members.
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function information.
int element(const int &ieng, const int &itheta, const int &idelta)
Return element index.
virtual ~GCTAPsfTable(void)
Destructor.
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)
void read(const GFitsTable &table)
Read point spread function from FITS table.
GCTAPsfTable(void)
Void constructor.
const GCTAResponseTable & table(void) const
Return response table.
int m_inx_energy
Energy index.
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)
void save(const GFilename &filename, const bool &clobber=false) const
Save point spread function table into FITS file.
double m_psf_max
Maximum PSF value.
void init_members(void)
Initialise class members.
int m_inx_delta
Delta index.
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)
void load(const GFilename &filename)
Load point spread function from FITS file.
double m_delta_max
Maximum delta angle (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_psftable