GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAPsfPerfTable.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAPsfPerfTable.hpp - CTA performance table PSF class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2012-2016 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 GCTAPsfPerfTable.hpp
23  * @brief CTA performance table point spread function class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAPSFPERFTABLE_HPP
28 #define GCTAPSFPERFTABLE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GFilename.hpp"
33 #include "GNodeArray.hpp"
34 #include "GCTAPsf.hpp"
35 
36 /* __ Forward declarations _______________________________________________ */
37 class GRan;
38 
39 
40 /***********************************************************************//**
41  * @class GCTAPsfPerfTable
42  *
43  * @brief CTA performance table point spread function class
44  *
45  * This class implements the CTA point spread function response as function
46  * of energy as determined from a performance table. The performance table is
47  * an ASCII file that specifies the CTA performance parameters in a simple
48  * way.
49  ***************************************************************************/
50 class GCTAPsfPerfTable : public GCTAPsf {
51 
52 public:
53  // Constructors and destructors
54  GCTAPsfPerfTable(void);
57  virtual ~GCTAPsfPerfTable(void);
58 
59  // Operators
61  double operator()(const double& delta,
62  const double& logE,
63  const double& theta = 0.0,
64  const double& phi = 0.0,
65  const double& zenith = 0.0,
66  const double& azimuth = 0.0,
67  const bool& etrue = true) const;
68 
69  // Implemented pure virtual methods
70  void clear(void);
71  GCTAPsfPerfTable* clone(void) const;
72  std::string classname(void) const;
73  void load(const GFilename& filename);
74  GFilename filename(void) const;
75  double mc(GRan& ran,
76  const double& logE,
77  const double& theta = 0.0,
78  const double& phi = 0.0,
79  const double& zenith = 0.0,
80  const double& azimuth = 0.0,
81  const bool& etrue = true) const;
82  double delta_max(const double& logE,
83  const double& theta = 0.0,
84  const double& phi = 0.0,
85  const double& zenith = 0.0,
86  const double& azimuth = 0.0,
87  const bool& etrue = true) const;
88  double containment_radius(const double& fraction,
89  const double& logE,
90  const double& theta = 0.0,
91  const double& phi = 0.0,
92  const double& zenith = 0.0,
93  const double& azimuth = 0.0,
94  const bool& etrue = true) const;
95  std::string print(const GChatter& chatter = NORMAL) const;
96 
97 private:
98  // Methods
99  void init_members(void);
100  void copy_members(const GCTAPsfPerfTable& psf);
101  void free_members(void);
102  void update(const double& logE) const;
103 
104  // Members
105  GFilename m_filename; //!< Name of Aeff response file
106  GNodeArray m_logE; //!< log(E) nodes for Aeff interpolation
107  std::vector<double> m_r68; //!< 68% containment radius of PSF in degrees
108  std::vector<double> m_r80; //!< 80% containment radius of PSF in degrees
109  std::vector<double> m_sigma; //!< Sigma value of PSF in radians
110 
111  // Precomputation cache
112  mutable double m_par_logE; //!< Energy for which precomputation is done
113  mutable double m_par_scale; //!< Gaussian normalization
114  mutable double m_par_sigma; //!< Gaussian sigma (radians)
115  mutable double m_par_width; //!< Gaussian width parameter
116 };
117 
118 
119 /***********************************************************************//**
120  * @brief Return class name
121  *
122  * @return String containing the class name ("GCTAPsfPerfTable").
123  ***************************************************************************/
124 inline
125 std::string GCTAPsfPerfTable::classname(void) const
126 {
127  return ("GCTAPsfPerfTable");
128 }
129 
130 
131 /***********************************************************************//**
132  * @brief Return filename
133  *
134  * @return Returns filename from which point spread function was loaded
135  ***************************************************************************/
136 inline
138 {
139  return m_filename;
140 }
141 
142 #endif /* GCTAPSFPERFTABLE_HPP */
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 update(const double &logE) const
Update PSF parameter cache.
Node array class.
Definition: GNodeArray.hpp:60
virtual ~GCTAPsfPerfTable(void)
Destructor.
std::string classname(void) const
Return class name.
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)
double m_par_scale
Gaussian normalization.
GCTAPsfPerfTable * clone(void) const
Clone instance.
Abstract base class for the CTA point spread function.
Definition: GCTAPsf.hpp:47
void load(const GFilename &filename)
Load point spread function from performance table.
Random number generator class.
Definition: GRan.hpp:44
GFilename m_filename
Name of Aeff response file.
double m_par_sigma
Gaussian sigma (radians)
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function information.
Node array class interface definition.
void free_members(void)
Delete class members.
Filename class.
Definition: GFilename.hpp:62
void clear(void)
Clear instance.
GNodeArray m_logE
log(E) nodes for Aeff interpolation
GChatter
Definition: GTypemaps.hpp:33
void copy_members(const GCTAPsfPerfTable &psf)
Copy class members.
std::vector< double > m_r80
80% containment radius of PSF in degrees
CTA point spread function base class definition.
std::vector< double > m_r68
68% containment radius of PSF in degrees
void init_members(void)
Initialise class members.
GFilename filename(void) const
Return filename.
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)
GCTAPsfPerfTable & operator=(const GCTAPsfPerfTable &psf)
Assignment operator.
CTA performance table point spread function class.
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)
std::vector< double > m_sigma
Sigma value of PSF in radians.
GCTAPsfPerfTable(void)
Void constructor.
double m_par_width
Gaussian width parameter.
Filename class interface definition.
double m_par_logE
Energy for which precomputation is done.