GLATAeff.hpp
6.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/***************************************************************************
* GLATAeff.hpp - Fermi/LAT effective area *
* ----------------------------------------------------------------------- *
* copyright (C) 2010-2015 by Juergen Knoedlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
/**
* @file GLATAeff.hpp
* @brief Fermi/LAT effective area class definition
* @author Juergen Knoedlseder
*/
#ifndef GLATAEFF_HPP
#define GLATAEFF_HPP
/* __ Includes ___________________________________________________________ */
#include <string>
#include <vector>
#include "GBase.hpp"
#include "GLATResponseTable.hpp"
#include "GLATEfficiency.hpp"
#include "GFits.hpp"
#include "GFitsTable.hpp"
#include "GSkyDir.hpp"
#include "GEnergy.hpp"
#include "GTime.hpp"
/***********************************************************************//**
* @class GLATAeff
*
* @brief Interface for the Fermi/LAT effective area
*
* This class handles the effective area information for Fermi/LAT. It also
* handles the IRF efficiency information that has been introduced for
* Pass 7 data analysis.
***************************************************************************/
class GLATAeff : public GBase {
public:
// Constructors and destructors
GLATAeff(void);
GLATAeff(const std::string& filename, const std::string& evtype);
GLATAeff(const GLATAeff& aeff);
virtual ~GLATAeff(void);
// Operators
GLATAeff& operator=(const GLATAeff& aeff);
double operator()(const double& logE, const double& ctheta);
double operator()(const double& logE, const double& ctheta,
const double& phi);
// Methods
void clear(void);
GLATAeff* clone(void) const;
std::string classname(void) const;
void load(const std::string& filename,
const std::string& evtype);
void save(const std::string& filename,
const bool &clobber = false);
void read(const GFits& file);
void write(GFits& file) const;
int size(void) const;
int nenergies(void) const;
int ncostheta(void) const;
const double& costhetamin(void) const;
void costhetamin(const double& ctheta);
bool has_phi(void) const;
bool has_efficiency(void) const;
double efficiency_factor1(const GEnergy& srcEng) const;
double efficiency_factor2(const GEnergy& srcEng) const;
std::string print(const GChatter& chatter = NORMAL) const;
private:
// Methods
void init_members(void);
void copy_members(const GLATAeff& aeff);
void free_members(void);
void read_aeff(const GFitsTable& hdu);
void read_efficiency(const GFitsTable& hdu);
void write_aeff(GFits& file) const;
void write_efficiency(GFits& file) const;
// Protected members
std::string m_evtype; //!< Event type
GLATResponseTable m_aeff_bins; //!< Aeff energy and cos theta binning
std::vector<double> m_aeff; //!< Aeff array
double m_min_ctheta; //!< Minimum valid cos(theta)
GLATEfficiency* m_eff_func1; //!< Efficiency functor 1
GLATEfficiency* m_eff_func2; //!< Efficiency functor 2
};
/***********************************************************************//**
* @brief Return class name
*
* @return String containing the class name ("GLATAeff").
***************************************************************************/
inline
std::string GLATAeff::classname(void) const
{
return ("GLATAeff");
}
/***********************************************************************//**
* @brief Return number of bins in effective area response
*
* @return Number of bins in effective area response.
***************************************************************************/
inline
int GLATAeff::size(void) const
{
return nenergies()*ncostheta();
}
/***********************************************************************//**
* @brief Return number of energies in effective area response
*
* @return Number of energies in effective area response.
***************************************************************************/
inline
int GLATAeff::nenergies(void) const
{
return m_aeff_bins.nenergies();
}
/***********************************************************************//**
* @brief Return number of cosine theta bins in effective area response
*
* @return Number of cosine theta bins in effective area response.
***************************************************************************/
inline
int GLATAeff::ncostheta(void) const
{
return m_aeff_bins.ncostheta();
}
/***********************************************************************//**
* @brief Return cosine theta minimum
*
* @return Cosine theta minimum.
***************************************************************************/
inline
const double& GLATAeff::costhetamin(void) const
{
return m_min_ctheta;
}
/***********************************************************************//**
* @brief Set minimum cos(theta) angle for effective area access
*
* @param[in] ctheta Cosine of maximum zenith angle.
***************************************************************************/
inline
void GLATAeff::costhetamin(const double& ctheta)
{
m_min_ctheta = ctheta;
return;
}
/***********************************************************************//**
* @brief Signal that effective area has Phi dependence
*
* @return True if effective area has Phi dependence.
***************************************************************************/
inline
bool GLATAeff::has_phi(void) const
{
return false;
}
#endif /* GLATAEFF_HPP */