GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAPsfVector.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAPsfVector.hpp - CTA point spread function vector 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 GCTAPsfVector.hpp
23  * @brief CTA point spread function vector class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAPSFVECTOR_HPP
28 #define GCTAPSFVECTOR_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include <vector>
33 #include "GFilename.hpp"
34 #include "GNodeArray.hpp"
35 #include "GCTAPsf.hpp"
36 
37 /* __ Forward declarations _______________________________________________ */
38 class GRan;
39 class GFitsTable;
40 
41 
42 /***********************************************************************//**
43  * @class GCTAPsfVector
44  *
45  * @brief CTA vector point spread function class
46  *
47  * This class implements the CTA point spread function response as function
48  * of energy as determined from a FITS table.
49  ***************************************************************************/
50 class GCTAPsfVector : public GCTAPsf {
51 
52 public:
53  // Constructors and destructors
54  GCTAPsfVector(void);
56  GCTAPsfVector(const GCTAPsfVector& psf);
57  virtual ~GCTAPsfVector(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  GCTAPsfVector* 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  // Other methods
98  void read(const GFitsTable& table);
99 
100 private:
101  // Methods
102  void init_members(void);
103  void copy_members(const GCTAPsfVector& psf);
104  void free_members(void);
105  void update(const double& logE) const;
106 
107  // Members
108  GFilename m_filename; //!< Name of Aeff response file
109  GNodeArray m_logE; //!< log(E) nodes for Aeff interpolation
110  std::vector<double> m_r68; //!< 68% containment radius of PSF in degrees
111  std::vector<double> m_sigma; //!< Sigma value of PSF in radians
112 
113  // Precomputation cache
114  mutable double m_par_logE; //!< Energy for which precomputation is done
115  mutable double m_par_scale; //!< Gaussian normalization
116  mutable double m_par_sigma; //!< Gaussian sigma (radians)
117  mutable double m_par_width; //!< Gaussian width parameter
118 };
119 
120 
121 /***********************************************************************//**
122  * @brief Return class name
123  *
124  * @return String containing the class name ("GCTAPsfVector").
125  ***************************************************************************/
126 inline
127 std::string GCTAPsfVector::classname(void) const
128 {
129  return ("GCTAPsfVector");
130 }
131 
132 
133 /***********************************************************************//**
134  * @brief Return filename
135  *
136  * @return Filename.
137  *
138  * Returns filename from which point spread function was loaded.
139  ***************************************************************************/
140 inline
142 {
143  return (m_filename);
144 }
145 
146 #endif /* GCTAPSFVECTOR_HPP */
double m_par_width
Gaussian width parameter.
Node array class.
Definition: GNodeArray.hpp:60
CTA vector point spread function class.
void load(const GFilename &filename)
Load point spread function from FITS file.
Abstract base class for the CTA point spread function.
Definition: GCTAPsf.hpp:47
std::vector< double > m_sigma
Sigma value of PSF in radians.
Random number generator class.
Definition: GRan.hpp:44
void free_members(void)
Delete class members.
void clear(void)
Clear instance.
double m_par_logE
Energy for which precomputation is done.
void copy_members(const GCTAPsfVector &psf)
Copy class members.
GNodeArray m_logE
log(E) nodes for Aeff interpolation
std::string classname(void) const
Return class name.
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function information.
virtual ~GCTAPsfVector(void)
Destructor.
Node array class interface definition.
void update(const double &logE) const
Update PSF parameter cache.
Filename class.
Definition: GFilename.hpp:62
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
GChatter
Definition: GTypemaps.hpp:33
CTA point spread function base class definition.
GFilename filename(void) const
Return filename.
GCTAPsfVector * clone(void) const
Clone instance.
GFilename m_filename
Name of Aeff response file.
GCTAPsfVector & operator=(const GCTAPsfVector &psf)
Assignment operator.
void init_members(void)
Initialise class members.
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)
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)
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.
void read(const GFitsTable &table)
Read point spread function vector from FITS table.
double m_par_sigma
Gaussian sigma (radians)
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)
std::vector< double > m_r68
68% containment radius of PSF in degrees
Filename class interface definition.
GCTAPsfVector(void)
Void constructor.