GammaLib 2.0.0
Loading...
Searching...
No Matches
GLATEdisp.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GLATEdisp.hpp - Fermi LAT energy dispersion *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2010-2021 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 GLATEdisp.hpp
23 * @brief Fermi LAT energy dispersion class definition.
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GLATEDISP_HPP
28#define GLATEDISP_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include "GBase.hpp"
34#include "GLATResponseTable.hpp"
35
36/* __ Forward declarations _______________________________________________ */
37class GFilename;
38class GFits;
39class GFitsTable;
40
41/* __ Constants __________________________________________________________ */
42namespace gammalib {
43 const std::string extname_lat_edisp = "ENERGY DISPERSION";
44 const std::string extname_lat_edisp_scale = "EDISP_SCALING_PARAMS";
45}
46
47
48/***********************************************************************//**
49 * @class GLATEdisp
50 *
51 * @brief Interface for the Fermi LAT energy dispersion.
52 *
53 * @todo Implement support for older response functions?
54 ***************************************************************************/
55class GLATEdisp : public GBase {
56
57public:
58 // Constructors and destructors
59 GLATEdisp(void);
60 GLATEdisp(const GFilename& filename, const std::string& evtype);
61 GLATEdisp(const GLATEdisp& edisp);
62 virtual ~GLATEdisp(void);
63
64 // Operators
65 GLATEdisp& operator=(const GLATEdisp& edisp);
66 //double operator()(const double& logE, const double& ctheta);
67 //double operator()(const GSkyDir& srcDir, const GEnergy& srcEng,
68 // const GTime& srcTime, const GLATPointing& pnt);
69
70 // Methods
71 void clear(void);
72 GLATEdisp* clone(void) const;
73 std::string classname(void) const;
74 const std::string& evtype(void) const;
75 void load(const GFilename& filename,
76 const std::string& evtype);
77 void save(const GFilename& filename,
78 const bool& clobber = false);
79 void read(const GFits& file, const std::string& evtype);
80 void write(GFits& file) const;
81 int size(void) const;
82 int nenergies(void) const;
83 int ncostheta(void) const;
84 //double costhetamin(void) const { return m_min_ctheta; }
85 //void costhetamin(const double& ctheta);
86 bool has_phi(void) const;
87 std::string print(const GChatter& chatter = NORMAL) const;
88
89private:
90 // Methods
91 void init_members(void);
92 void copy_members(const GLATEdisp& edisp);
93 void free_members(void);
94 void read_edisp(const GFitsTable& table);
95 void write_edisp(GFits& file) const;
96
97 // Protected members
98 std::string m_evtype; //!< Event type
99 GLATResponseTable m_edisp_bins; //!< Energy dispersion energy and cos theta binning
100 std::vector<double> m_norm; //!< Energy dispersion normalization
101 std::vector<double> m_ls1; //!< Energy dispersion ...
102 std::vector<double> m_scale; //!< Energy dispersion scaling parameters
103};
104
105
106/***********************************************************************//**
107 * @brief Return class name
108 *
109 * @return String containing the class name ("GLATEdisp").
110 ***************************************************************************/
111inline
112std::string GLATEdisp::classname(void) const
113{
114 return ("GLATEdisp");
115}
116
117
118/***********************************************************************//**
119 * @brief Return event type
120 *
121 * @return Event type.
122 ***************************************************************************/
123inline
124const std::string& GLATEdisp::evtype(void) const
125{
126 return (m_evtype);
127}
128
129
130/***********************************************************************//**
131 * @brief Return number of bins in energy dispersion response
132 *
133 * @return Number of bins in energy dispersion response.
134 ***************************************************************************/
135inline
136int GLATEdisp::size(void) const
137{
138 return nenergies()*ncostheta();
139}
140
141
142/***********************************************************************//**
143 * @brief Return number of energies in energy dispersion response
144 *
145 * @return Number of energies in energy dispersion response.
146 ***************************************************************************/
147inline
148int GLATEdisp::nenergies(void) const
149{
150 return m_edisp_bins.nenergies();
151}
152
153
154/***********************************************************************//**
155 * @brief Return number of cosine theta bins in energy dispersion response
156 *
157 * @return Number of cosine theta bins in energy dispersion response.
158 ***************************************************************************/
159inline
160int GLATEdisp::ncostheta(void) const
161{
162 return m_edisp_bins.ncostheta();
163}
164
165
166/***********************************************************************//**
167 * @brief Signal that energy dispersion has Phi dependence
168 *
169 * @return True if energy dispersion has Phi dependence.
170 ***************************************************************************/
171inline
172bool GLATEdisp::has_phi(void) const
173{
174 return false;
175}
176
177#endif /* GLATEDISP_HPP */
Definition of interface for all GammaLib classes.
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
Filename class.
Definition GFilename.hpp:62
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Interface for the Fermi LAT energy dispersion.
Definition GLATEdisp.hpp:55
void copy_members(const GLATEdisp &edisp)
Copy class members.
std::vector< double > m_scale
Energy dispersion scaling parameters.
void load(const GFilename &filename, const std::string &evtype)
Load energy dispersion from FITS file.
void free_members(void)
Delete class members.
GLATEdisp * clone(void) const
Clone energy dispersion response.
std::string m_evtype
Event type.
Definition GLATEdisp.hpp:98
int ncostheta(void) const
Return number of cosine theta bins in energy dispersion response.
std::vector< double > m_ls1
Energy dispersion ...
std::string classname(void) const
Return class name.
void clear(void)
Clear energy dispersion response.
virtual ~GLATEdisp(void)
Destructor.
void write_edisp(GFits &file) const
Write energy dispersion into FITS file.
std::vector< double > m_norm
Energy dispersion normalization.
GLATResponseTable m_edisp_bins
Energy dispersion energy and cos theta binning.
Definition GLATEdisp.hpp:99
void read(const GFits &file, const std::string &evtype)
Read energy dispersion from FITS file.
GLATEdisp & operator=(const GLATEdisp &edisp)
Assignment operator.
void save(const GFilename &filename, const bool &clobber=false)
Save energy dispersion into FITS file.
void read_edisp(const GFitsTable &table)
Read energy dispersion from FITS table.
std::string print(const GChatter &chatter=NORMAL) const
Print energy dispersion information.
int size(void) const
Return number of bins in energy dispersion response.
void write(GFits &file) const
Write energy dispersion into FITS file.
bool has_phi(void) const
Signal that energy dispersion has Phi dependence.
int nenergies(void) const
Return number of energies in energy dispersion response.
GLATEdisp(void)
Void constructor.
Definition GLATEdisp.cpp:62
const std::string & evtype(void) const
Return event type.
void init_members(void)
Initialise class members.
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_edisp
Definition GLATEdisp.hpp:43
const std::string extname_lat_edisp_scale
Definition GLATEdisp.hpp:44