GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 _______________________________________________ */
37 class GFilename;
38 class GFits;
39 class GFitsTable;
40 
41 /* __ Constants __________________________________________________________ */
42 namespace 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  ***************************************************************************/
55 class GLATEdisp : public GBase {
56 
57 public:
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 
89 private:
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  ***************************************************************************/
111 inline
112 std::string GLATEdisp::classname(void) const
113 {
114  return ("GLATEdisp");
115 }
116 
117 
118 /***********************************************************************//**
119  * @brief Return event type
120  *
121  * @return Event type.
122  ***************************************************************************/
123 inline
124 const 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  ***************************************************************************/
135 inline
136 int 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  ***************************************************************************/
147 inline
148 int 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  ***************************************************************************/
159 inline
160 int 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  ***************************************************************************/
171 inline
172 bool GLATEdisp::has_phi(void) const
173 {
174  return false;
175 }
176 
177 #endif /* GLATEDISP_HPP */
void read(const GFits &file, const std::string &evtype)
Read energy dispersion from FITS file.
Definition: GLATEdisp.cpp:242
bool has_phi(void) const
Signal that energy dispersion has Phi dependence.
Definition: GLATEdisp.hpp:172
std::vector< double > m_scale
Energy dispersion scaling parameters.
Definition: GLATEdisp.hpp:102
void save(const GFilename &filename, const bool &clobber=false)
Save energy dispersion into FITS file.
Definition: GLATEdisp.cpp:218
GLATEdisp & operator=(const GLATEdisp &edisp)
Assignment operator.
Definition: GLATEdisp.cpp:137
Interface for the Fermi LAT energy dispersion.
Definition: GLATEdisp.hpp:55
Definition of interface for all GammaLib classes.
Fermi-LAT response table class definition.
int size(void) const
Return number of bins in energy dispersion response.
Definition: GLATEdisp.hpp:136
FITS file class.
Definition: GFits.hpp:63
void write_edisp(GFits &file) const
Write energy dispersion into FITS file.
Definition: GLATEdisp.cpp:440
std::vector< double > m_ls1
Energy dispersion ...
Definition: GLATEdisp.hpp:101
void write(GFits &file) const
Write energy dispersion into FITS file.
Definition: GLATEdisp.cpp:279
GLATResponseTable m_edisp_bins
Energy dispersion energy and cos theta binning.
Definition: GLATEdisp.hpp:99
std::string classname(void) const
Return class name.
Definition: GLATEdisp.hpp:112
const int & nenergies(void) const
Return number of energies in response table.
Filename class.
Definition: GFilename.hpp:62
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
void read_edisp(const GFitsTable &table)
Read energy dispersion from FITS table.
Definition: GLATEdisp.cpp:381
Interface for the Fermi LAT Response table class.
int ncostheta(void) const
Return number of cosine theta bins in energy dispersion response.
Definition: GLATEdisp.hpp:160
const int & ncostheta(void) const
Return number of cosine theta bins in response table.
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
int nenergies(void) const
Return number of energies in energy dispersion response.
Definition: GLATEdisp.hpp:148
GChatter
Definition: GTypemaps.hpp:33
void free_members(void)
Delete class members.
Definition: GLATEdisp.cpp:364
GLATEdisp(void)
Void constructor.
Definition: GLATEdisp.cpp:62
GLATEdisp * clone(void) const
Clone energy dispersion response.
Definition: GLATEdisp.cpp:187
void clear(void)
Clear energy dispersion response.
Definition: GLATEdisp.cpp:169
std::string print(const GChatter &chatter=NORMAL) const
Print energy dispersion information.
Definition: GLATEdisp.cpp:295
virtual ~GLATEdisp(void)
Destructor.
Definition: GLATEdisp.cpp:115
const std::string extname_lat_edisp
Definition: GLATEdisp.hpp:43
std::vector< double > m_norm
Energy dispersion normalization.
Definition: GLATEdisp.hpp:100
void copy_members(const GLATEdisp &edisp)
Copy class members.
Definition: GLATEdisp.cpp:347
const std::string & evtype(void) const
Return event type.
Definition: GLATEdisp.hpp:124
void load(const GFilename &filename, const std::string &evtype)
Load energy dispersion from FITS file.
Definition: GLATEdisp.cpp:199
const std::string extname_lat_edisp_scale
Definition: GLATEdisp.hpp:44
void init_members(void)
Initialise class members.
Definition: GLATEdisp.cpp:328
std::string m_evtype
Event type.
Definition: GLATEdisp.hpp:98