GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAAeffPerfTable.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAAeffPerfTable.hpp - CTA performance table effective area 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 GCTAAeffPerfTable.hpp
23  * @brief CTA performance table effective area class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAAEFFPERFTABLE_HPP
28 #define GCTAAEFFPERFTABLE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GFits.hpp"
33 #include "GEbounds.hpp"
34 #include "GNodeArray.hpp"
35 #include "GCTAAeff.hpp"
36 
37 
38 /***********************************************************************//**
39  * @class GCTAAeffPerfTable
40  *
41  * @brief CTA performance table effective area class
42  *
43  * This class implements the CTA effective area response as function of
44  * energy as determined from a performance table. The performance table is
45  * an ASCII file that specifies the CTA performance parameters in a simple
46  * way.
47  ***************************************************************************/
48 class GCTAAeffPerfTable : public GCTAAeff {
49 
50 public:
51  // Constructors and destructors
52  GCTAAeffPerfTable(void);
53  explicit GCTAAeffPerfTable(const GFilename& filename);
55  virtual ~GCTAAeffPerfTable(void);
56 
57  // Operators
59  double operator()(const double& logE,
60  const double& theta = 0.0,
61  const double& phi = 0.0,
62  const double& zenith = 0.0,
63  const double& azimuth = 0.0,
64  const bool& etrue = true) const;
65 
66  // Implemented pure virtual methods
67  void clear(void);
68  GCTAAeffPerfTable* clone(void) const;
69  std::string classname(void) const;
70  void load(const GFilename& filename);
71  GFilename filename(void) const;
72  double max(const double& logE,
73  const double& zenith,
74  const double& azimuth,
75  const bool& etrue = true) const;
76  GEbounds ebounds(void) const;
77  std::string print(const GChatter& chatter = NORMAL) const;
78 
79  // Methods
80  int size(void) const;
81  void sigma(const double& sigma);
82  const double& sigma(void) const;
83 
84 private:
85  // Methods
86  void init_members(void);
87  void copy_members(const GCTAAeffPerfTable& aeff);
88  void free_members(void);
89  void set_boundaries(void);
90 
91  // Members
92  GFilename m_filename; //!< Name of Aeff response file
93  GNodeArray m_logE; //!< log(E) nodes for Aeff interpolation
94  std::vector<double> m_aeff; //!< Effective area in cm2
95  GEbounds m_ebounds; //!< Energy boundaries
96  double m_sigma; //!< Sigma for offset angle computation (0=none)
97  double m_logE_min; //!< Minimum logE (log10(E/TeV))
98  double m_logE_max; //!< Maximum logE (log10(E/TeV))
99 };
100 
101 
102 /***********************************************************************//**
103  * @brief Return class name
104  *
105  * @return String containing the class name ("GCTAAeffPerfTable").
106  ***************************************************************************/
107 inline
108 std::string GCTAAeffPerfTable::classname(void) const
109 {
110  return ("GCTAAeffPerfTable");
111 }
112 
113 
114 /***********************************************************************//**
115  * @brief Return filename
116  *
117  * @return Filename from which effective area was loaded.
118  ***************************************************************************/
119 inline
121 {
122  return m_filename;
123 }
124 
125 
126 /***********************************************************************//**
127  * @brief Return energy boundaries
128  *
129  * @return Energy boundaries of effective area
130  ***************************************************************************/
131 inline
133 {
134  return m_ebounds;
135 }
136 
137 
138 /***********************************************************************//**
139  * @brief Return number of node energies in response
140  *
141  * @return Number of node energies.
142  ***************************************************************************/
143 inline
144 int GCTAAeffPerfTable::size(void) const
145 {
146  return (m_logE.size());
147 }
148 
149 
150 /***********************************************************************//**
151  * @brief Set sigma for offset angle dependence
152  *
153  * @param[in] sigma Sigma for offset angle dependence.
154  *
155  * Sets the sigma parameter for the offset angle dependence of the effective
156  * area. If @p sigma is 0, no offset angle dependency will be assumed. By
157  * default, @p sigma = 3.
158  ***************************************************************************/
159 inline
160 void GCTAAeffPerfTable::sigma(const double& sigma)
161 {
162  m_sigma = sigma;
163  return;
164 }
165 
166 
167 /***********************************************************************//**
168  * @brief Return sigma for offset angle dependence
169  *
170  * @return Sigma for offset angle dependence.
171  ***************************************************************************/
172 inline
173 const double& GCTAAeffPerfTable::sigma(void) const
174 {
175  return (m_sigma);
176 }
177 
178 #endif /* GCTAAEFFPERFTABLE_HPP */
void load(const GFilename &filename)
Load effective area from performance table.
int size(void) const
Return number of nodes in node array.
Definition: GNodeArray.hpp:188
GEbounds ebounds(void) const
Return energy boundaries.
GCTAAeffPerfTable & operator=(const GCTAAeffPerfTable &aeff)
Assignment operator.
double operator()(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 effective area in units of cm2.
CTA performance table effective area class.
Node array class.
Definition: GNodeArray.hpp:60
GEbounds m_ebounds
Energy boundaries.
double m_logE_min
Minimum logE (log10(E/TeV))
void set_boundaries(void)
Set effective area boundaries.
void free_members(void)
Delete class members.
std::string print(const GChatter &chatter=NORMAL) const
Print effective area information.
GNodeArray m_logE
log(E) nodes for Aeff interpolation
double m_logE_max
Maximum logE (log10(E/TeV))
virtual ~GCTAAeffPerfTable(void)
Destructor.
GCTAAeffPerfTable * clone(void) const
Clone instance.
FITS file class interface definition.
void copy_members(const GCTAAeffPerfTable &aeff)
Copy class members.
double max(const double &logE, const double &zenith, const double &azimuth, const bool &etrue=true) const
Return maximum effective area at a given energy.
GFilename filename(void) const
Return filename.
std::string classname(void) const
Return class name.
double m_sigma
Sigma for offset angle computation (0=none)
CTA effective area base class definition.
Node array class interface definition.
Energy boundaries container class.
Definition: GEbounds.hpp:60
GFilename m_filename
Name of Aeff response file.
Filename class.
Definition: GFilename.hpp:62
void clear(void)
Clear instance.
const double & sigma(void) const
Return sigma for offset angle dependence.
void init_members(void)
Initialise class members.
GChatter
Definition: GTypemaps.hpp:33
GCTAAeffPerfTable(void)
Void constructor.
Abstract base class for the CTA effective area.
Definition: GCTAAeff.hpp:54
std::vector< double > m_aeff
Effective area in cm2.
Energy boundaries class interface definition.
int size(void) const
Return number of node energies in response.