GammaLib 2.0.0
Loading...
Searching...
No Matches
GLATAeff.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATAeff.hpp - Fermi LAT effective area *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2010-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 GLATAeff.hpp
23 * @brief Fermi LAT effective area class definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATAEFF_HPP
28#define GLATAEFF_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GBase.hpp"
34#include "GLATResponseTable.hpp"
35#include "GLATEfficiency.hpp"
36
37/* __ Forward declarations _______________________________________________ */
38class GFilename;
39class GEnergy;
40class GFits;
41class GFitsTable;
42
43/* __ Constants __________________________________________________________ */
44namespace gammalib {
45 const std::string extname_lat_aeff = "EFFECTIVE AREA";
46 const std::string extname_lat_efficiency = "EFFICIENCY_PARAMS";
47}
48
49
50/***********************************************************************//**
51 * @class GLATAeff
52 *
53 * @brief Interface for the Fermi/LAT effective area
54 *
55 * This class handles the effective area information for Fermi/LAT. It also
56 * handles the IRF efficiency information that has been introduced for
57 * Pass 7 data analysis.
58 ***************************************************************************/
59class GLATAeff : public GBase {
60
61public:
62 // Constructors and destructors
63 GLATAeff(void);
64 GLATAeff(const GFilename& filename, const std::string& evtype);
65 GLATAeff(const GLATAeff& aeff);
66 virtual ~GLATAeff(void);
67
68 // Operators
69 GLATAeff& operator=(const GLATAeff& aeff);
70 double operator()(const double& logE, const double& ctheta);
71 double operator()(const double& logE, const double& ctheta,
72 const double& phi);
73
74 // Methods
75 void clear(void);
76 GLATAeff* clone(void) const;
77 std::string classname(void) const;
78 const std::string& evtype(void) const;
79 void load(const GFilename& filename,
80 const std::string& evtype);
81 void save(const GFilename& filename,
82 const bool& clobber = false);
83 void read(const GFits& file, const std::string& evtype);
84 void write(GFits& file) const;
85 int size(void) const;
86 int nenergies(void) const;
87 int ncostheta(void) const;
88 const double& costhetamin(void) const;
89 void costhetamin(const double& ctheta);
90 bool has_phi(void) const;
91 bool has_efficiency(void) const;
92 double efficiency_factor1(const GEnergy& srcEng) const;
93 double efficiency_factor2(const GEnergy& srcEng) const;
94 std::string print(const GChatter& chatter = NORMAL) const;
95
96private:
97 // Methods
98 void init_members(void);
99 void copy_members(const GLATAeff& aeff);
100 void free_members(void);
101 void read_aeff(const GFitsTable& hdu);
102 void read_efficiency(const GFitsTable& hdu);
103 void write_aeff(GFits& file) const;
104 void write_efficiency(GFits& file) const;
105
106 // Protected members
107 std::string m_evtype; //!< Event type
108 GLATResponseTable m_aeff_bins; //!< Aeff energy and cos theta binning
109 std::vector<double> m_aeff; //!< Aeff array
110 double m_min_ctheta; //!< Minimum valid cos(theta)
111 GLATEfficiency* m_eff_func1; //!< Efficiency functor 1
112 GLATEfficiency* m_eff_func2; //!< Efficiency functor 2
113};
114
115
116/***********************************************************************//**
117 * @brief Return class name
118 *
119 * @return String containing the class name ("GLATAeff").
120 ***************************************************************************/
121inline
122std::string GLATAeff::classname(void) const
123{
124 return ("GLATAeff");
125}
126
127
128/***********************************************************************//**
129 * @brief Return event type
130 *
131 * @return Event type.
132 ***************************************************************************/
133inline
134const std::string& GLATAeff::evtype(void) const
135{
136 return (m_evtype);
137}
138
139
140/***********************************************************************//**
141 * @brief Return number of bins in effective area response
142 *
143 * @return Number of bins in effective area response.
144 ***************************************************************************/
145inline
146int GLATAeff::size(void) const
147{
148 return nenergies()*ncostheta();
149}
150
151
152/***********************************************************************//**
153 * @brief Return number of energies in effective area response
154 *
155 * @return Number of energies in effective area response.
156 ***************************************************************************/
157inline
158int GLATAeff::nenergies(void) const
159{
160 return m_aeff_bins.nenergies();
161}
162
163
164/***********************************************************************//**
165 * @brief Return number of cosine theta bins in effective area response
166 *
167 * @return Number of cosine theta bins in effective area response.
168 ***************************************************************************/
169inline
170int GLATAeff::ncostheta(void) const
171{
172 return m_aeff_bins.ncostheta();
173}
174
175
176/***********************************************************************//**
177 * @brief Return cosine theta minimum
178 *
179 * @return Cosine theta minimum.
180 ***************************************************************************/
181inline
182const double& GLATAeff::costhetamin(void) const
183{
184 return m_min_ctheta;
185}
186
187
188/***********************************************************************//**
189 * @brief Set minimum cos(theta) angle for effective area access
190 *
191 * @param[in] ctheta Cosine of maximum zenith angle.
192 ***************************************************************************/
193inline
194void GLATAeff::costhetamin(const double& ctheta)
195{
196 m_min_ctheta = ctheta;
197 return;
198}
199
200
201/***********************************************************************//**
202 * @brief Signal that effective area has Phi dependence
203 *
204 * @return True if effective area has Phi dependence.
205 ***************************************************************************/
206inline
207bool GLATAeff::has_phi(void) const
208{
209 return false;
210}
211
212#endif /* GLATAEFF_HPP */
Definition of interface for all GammaLib classes.
Fermi/LAT IRF efficiency factor functor class definition.
Fermi-LAT response table class definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
Interface class for all GammaLib classes.
Definition GBase.hpp:52
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Filename class.
Definition GFilename.hpp:62
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Interface for the Fermi/LAT effective area.
Definition GLATAeff.hpp:59
virtual ~GLATAeff(void)
Destructor.
Definition GLATAeff.cpp:117
void read(const GFits &file, const std::string &evtype)
Read effective area from FITS file.
Definition GLATAeff.cpp:317
GLATAeff * clone(void) const
Clone effective area.
Definition GLATAeff.cpp:247
bool has_efficiency(void) const
Signals whether efficiency factors are present.
Definition GLATAeff.cpp:384
int ncostheta(void) const
Return number of cosine theta bins in effective area response.
Definition GLATAeff.hpp:170
double operator()(const double &logE, const double &ctheta)
Return effective area in units of cm2.
Definition GLATAeff.cpp:171
double m_min_ctheta
Minimum valid cos(theta)
Definition GLATAeff.hpp:110
void save(const GFilename &filename, const bool &clobber=false)
Save effective area into FITS file.
Definition GLATAeff.cpp:286
void write_efficiency(GFits &file) const
Write efficiency factors into FITS file.
Definition GLATAeff.cpp:742
GLATAeff & operator=(const GLATAeff &aeff)
Assignment operator.
Definition GLATAeff.cpp:139
std::string m_evtype
Event type.
Definition GLATAeff.hpp:107
bool has_phi(void) const
Signal that effective area has Phi dependence.
Definition GLATAeff.hpp:207
double efficiency_factor1(const GEnergy &srcEng) const
Returns efficiency factor 1.
Definition GLATAeff.cpp:403
GLATEfficiency * m_eff_func1
Efficiency functor 1.
Definition GLATAeff.hpp:111
void write_aeff(GFits &file) const
Write effective area into FITS file.
Definition GLATAeff.cpp:616
void write(GFits &file) const
Write effective area into FITS file.
Definition GLATAeff.cpp:360
std::string print(const GChatter &chatter=NORMAL) const
Print effective area information.
Definition GLATAeff.cpp:455
void clear(void)
Clear effective area.
Definition GLATAeff.cpp:229
int nenergies(void) const
Return number of energies in effective area response.
Definition GLATAeff.hpp:158
void load(const GFilename &filename, const std::string &evtype)
Load effective area from FITS file.
Definition GLATAeff.cpp:263
GLATEfficiency * m_eff_func2
Efficiency functor 2.
Definition GLATAeff.hpp:112
GLATResponseTable m_aeff_bins
Aeff energy and cos theta binning.
Definition GLATAeff.hpp:108
double efficiency_factor2(const GEnergy &srcEng) const
Returns efficiency factor 2.
Definition GLATAeff.cpp:432
GLATAeff(void)
Void constructor.
Definition GLATAeff.cpp:63
std::vector< double > m_aeff
Aeff array.
Definition GLATAeff.hpp:109
void read_aeff(const GFitsTable &hdu)
Read effective area from FITS table.
Definition GLATAeff.cpp:561
std::string classname(void) const
Return class name.
Definition GLATAeff.hpp:122
const std::string & evtype(void) const
Return event type.
Definition GLATAeff.hpp:134
const double & costhetamin(void) const
Return cosine theta minimum.
Definition GLATAeff.hpp:182
void read_efficiency(const GFitsTable &hdu)
Read efficiency factor parameters from FITS table.
Definition GLATAeff.cpp:672
void free_members(void)
Delete class members.
Definition GLATAeff.cpp:536
void init_members(void)
Initialise class members.
Definition GLATAeff.cpp:496
void copy_members(const GLATAeff &aeff)
Copy class members.
Definition GLATAeff.cpp:516
int size(void) const
Return number of bins in effective area response.
Definition GLATAeff.hpp:146
Interface for the Fermi/LAT efficiency factor functor.
Interface for the Fermi LAT Response table class.
const int & ncostheta(void) const
Return number of cosine theta bins in response table.
const int & nenergies(void) const
Return number of energies in response table.
const std::string extname_lat_efficiency
Definition GLATAeff.hpp:46
const std::string extname_lat_aeff
Definition GLATAeff.hpp:45