GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAAeff2D.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAAeff2D.hpp - CTA 2D effective area class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2012-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 GCTAAeff2D.hpp
23  * @brief CTA 2D effective area class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAAEFF2D_HPP
28 #define GCTAAEFF2D_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GFilename.hpp"
33 #include "GEbounds.hpp"
34 #include "GCTAAeff.hpp"
35 #include "GCTAResponseTable.hpp"
36 
37 /* __ Forward declarations _______________________________________________ */
38 class GFitsTable;
39 class GFitsBinTable;
40 
41 /* __ Constants __________________________________________________________ */
42 namespace gammalib {
43  const std::string extname_cta_aeff2d = "EFFECTIVE AREA";
44 }
45 
46 
47 /***********************************************************************//**
48  * @class GCTAAeff2D
49  *
50  * @brief CTA 2D effective area class
51  *
52  * This class implements the CTA effective area response as function of
53  * energy and offset angle.
54  ***************************************************************************/
55 class GCTAAeff2D : public GCTAAeff {
56 
57 public:
58  // Constructors and destructors
59  GCTAAeff2D(void);
60  explicit GCTAAeff2D(const GFilename& filename);
61  GCTAAeff2D(const GCTAAeff2D& cta);
62  virtual ~GCTAAeff2D(void);
63 
64  // Operators
65  GCTAAeff2D& operator=(const GCTAAeff2D& aeff);
66  double operator()(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  GCTAAeff2D* clone(void) const;
76  std::string classname(void) const;
77  void load(const GFilename& filename);
78  GFilename filename(void) const;
79  double max(const double& logE,
80  const double& zenith,
81  const double& azimuth,
82  const bool& etrue = true) const;
83  GEbounds ebounds(void) const;
84  std::string print(const GChatter& chatter = NORMAL) const;
85 
86  // Methods
87  const double& rad_max(void) const;
88  void rad_max(const double& rad_max);
89  const GCTAResponseTable& table(void) const;
90  void table(const GCTAResponseTable& table);
91  void read(const GFitsTable& table);
92  void write(GFitsBinTable& table) const;
93  void save(const GFilename& filename,
94  const bool& clobber = false) const;
95 
96 private:
97  // Methods
98  void init_members(void);
99  void copy_members(const GCTAAeff2D& aeff);
100  void free_members(void);
101  void set_indices(void);
102  void set_boundaries(void);
103 
104  // Members
105  GFilename m_filename; //!< Name of Aeff response file
106  GCTAResponseTable m_aeff; //!< Aeff response table
107  GEbounds m_ebounds; //!< Energy boundaries
108  int m_inx_energy; //!< Energy index
109  int m_inx_theta; //!< Theta index
110  int m_inx_aeff; //!< Effective area (true energy)
111  int m_inx_aeff_reco; //!< Effective area (reco. energy)
112  double m_logE_min; //!< Minimum logE (log10(E/TeV))
113  double m_logE_max; //!< Maximum logE (log10(E/TeV))
114  double m_theta_min; //!< Minimum theta (radians)
115  double m_theta_max; //!< Maximum theta (radians)
116  double m_lo_thres; //!< Lower energy threshold (TeV)
117  double m_hi_thres; //!< Upper energy threshold (TeV)
118  double m_rad_max; //!< Radius cut (degrees)
119 };
120 
121 
122 /***********************************************************************//**
123  * @brief Return class name
124  *
125  * @return String containing the class name ("GCTAAeff2D").
126  ***************************************************************************/
127 inline
128 std::string GCTAAeff2D::classname(void) const
129 {
130  return ("GCTAAeff2D");
131 }
132 
133 
134 /***********************************************************************//**
135  * @brief Return filename
136  *
137  * @return Filename from which effective area was loaded
138  ***************************************************************************/
139 inline
141 {
142  return m_filename;
143 }
144 
145 
146 /***********************************************************************//**
147  * @brief Return energy boundaries
148  *
149  * @return Energy boundaries of effective area
150  ***************************************************************************/
151 inline
153 {
154  return m_ebounds;
155 }
156 
157 
158 /***********************************************************************//**
159  * @brief Return radius cut value
160  *
161  * @return Radius cut value (degrees)
162  ***************************************************************************/
163 inline
164 const double& GCTAAeff2D::rad_max(void) const
165 {
166  return m_rad_max;
167 }
168 
169 
170 /***********************************************************************//**
171  * @brief Set radius cut value
172  *
173  * @param[in] rad_max Radius cut value (degrees)
174  ***************************************************************************/
175 inline
176 void GCTAAeff2D::rad_max(const double& rad_max)
177 {
178  m_rad_max = rad_max;
179  return;
180 }
181 
182 
183 /***********************************************************************//**
184  * @brief Return response table
185  *
186  * @return Response table.
187  *
188  * Returns the response table of the effective area. The effective area
189  * values are given in units of cm2.
190  ***************************************************************************/
191 inline
193 {
194  return m_aeff;
195 }
196 
197 #endif /* GCTAAEFF2D_HPP */
int m_inx_aeff
Effective area (true energy)
Definition: GCTAAeff2D.hpp:110
GCTAResponseTable m_aeff
Aeff response table.
Definition: GCTAAeff2D.hpp:106
double m_theta_max
Maximum theta (radians)
Definition: GCTAAeff2D.hpp:115
double m_hi_thres
Upper energy threshold (TeV)
Definition: GCTAAeff2D.hpp:117
double m_logE_max
Maximum logE (log10(E/TeV))
Definition: GCTAAeff2D.hpp:113
GCTAAeff2D & operator=(const GCTAAeff2D &aeff)
Assignment operator.
Definition: GCTAAeff2D.cpp:143
void copy_members(const GCTAAeff2D &aeff)
Copy class members.
Definition: GCTAAeff2D.cpp:663
GEbounds m_ebounds
Energy boundaries.
Definition: GCTAAeff2D.hpp:107
double m_logE_min
Minimum logE (log10(E/TeV))
Definition: GCTAAeff2D.hpp:112
void set_boundaries(void)
Set effective area boundaries.
Definition: GCTAAeff2D.cpp:724
GCTAAeff2D(void)
Void constructor.
Definition: GCTAAeff2D.cpp:64
double m_rad_max
Radius cut (degrees)
Definition: GCTAAeff2D.hpp:118
virtual ~GCTAAeff2D(void)
Destructor.
Definition: GCTAAeff2D.cpp:119
double m_theta_min
Minimum theta (radians)
Definition: GCTAAeff2D.hpp:114
void read(const GFitsTable &table)
Read effective area from FITS table.
Definition: GCTAAeff2D.cpp:288
CTA effective area base class definition.
const GCTAResponseTable & table(void) const
Return response table.
Definition: GCTAAeff2D.hpp:192
GFilename filename(void) const
Return filename.
Definition: GCTAAeff2D.hpp:140
CTA response table class definition.
GCTAAeff2D * clone(void) const
Clone effective area.
Definition: GCTAAeff2D.cpp:255
CTA 2D effective area class.
Definition: GCTAAeff2D.hpp:55
double m_lo_thres
Lower energy threshold (TeV)
Definition: GCTAAeff2D.hpp:116
Energy boundaries container class.
Definition: GEbounds.hpp:60
double max(const double &logE, const double &zenith, const double &azimuth, const bool &etrue=true) const
Return maximum effective area at a given energy in cm2.
Definition: GCTAAeff2D.cpp:477
std::string print(const GChatter &chatter=NORMAL) const
Print effective area information.
Definition: GCTAAeff2D.cpp:556
Filename class.
Definition: GFilename.hpp:62
GEbounds ebounds(void) const
Return energy boundaries.
Definition: GCTAAeff2D.hpp:152
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
void clear(void)
Clear effective area.
Definition: GCTAAeff2D.cpp:233
GChatter
Definition: GTypemaps.hpp:33
const std::string extname_cta_aeff2d
Definition: GCTAAeff2D.hpp:43
void set_indices(void)
Set table indices.
Definition: GCTAAeff2D.cpp:702
int m_inx_theta
Theta index.
Definition: GCTAAeff2D.hpp:109
const double & rad_max(void) const
Return radius cut value.
Definition: GCTAAeff2D.hpp:164
void write(GFitsBinTable &table) const
Write effective area into FITS binary table.
Definition: GCTAAeff2D.cpp:341
Abstract base class for the CTA effective area.
Definition: GCTAAeff.hpp:54
void init_members(void)
Initialise class members.
Definition: GCTAAeff2D.cpp:635
void save(const GFilename &filename, const bool &clobber=false) const
Save effective area into FITS file.
Definition: GCTAAeff2D.cpp:431
void free_members(void)
Delete class members.
Definition: GCTAAeff2D.cpp:689
int m_inx_energy
Energy index.
Definition: GCTAAeff2D.hpp:108
FITS binary table class.
void load(const GFilename &filename)
Load effective area from FITS file.
Definition: GCTAAeff2D.cpp:386
Energy boundaries class interface definition.
CTA response table class.
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.
Definition: GCTAAeff2D.cpp:189
std::string classname(void) const
Return class name.
Definition: GCTAAeff2D.hpp:128
int m_inx_aeff_reco
Effective area (reco. energy)
Definition: GCTAAeff2D.hpp:111
Filename class interface definition.
GFilename m_filename
Name of Aeff response file.
Definition: GCTAAeff2D.hpp:105