GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATLtCubeMap.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATLtCubeMap.hpp - Fermi LAT livetime cube map class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-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 GLATLtCubeMap.hpp
23  * @brief Fermi LAT livetime cube map class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GLATLTCUBEMAP_HPP
28 #define GLATLTCUBEMAP_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GBase.hpp"
33 #include "GSkyMap.hpp"
34 
35 /* __ Forward declarations _______________________________________________ */
36 class GFits;
37 class GFitsTable;
38 class GSkyDir;
39 class GLATAeff;
40 class GLATPsf;
41 
42 /* __ Constants __________________________________________________________ */
43 namespace gammalib {
44  const std::string extname_lat_ltcubemap = "EXPOSURE";
45 }
46 
47 /* __ Typedefs ___________________________________________________________ */
48 typedef double (*_ltcube_ctheta)(const double& costheta);
49 typedef double (*_ltcube_ctheta_phi)(const double& costheta, const double& phi);
50 
51 
52 /***********************************************************************//**
53  * @class GLATLtCubeMap
54  *
55  * @brief Fermi LAT livetime cube map class
56  *
57  * A livetime cube map holds a set of HEALPix skymaps that are a function
58  * of the cosine of the zenith angle and (optionally) of the azimuth angle.
59  ***************************************************************************/
60 class GLATLtCubeMap : public GBase {
61 
62 public:
63  // Constructors and destructors
64  GLATLtCubeMap(void);
65  GLATLtCubeMap(const GLATLtCubeMap& map);
66  virtual ~GLATLtCubeMap(void);
67 
68  // Operators
70  double operator()(const GSkyDir& dir, _ltcube_ctheta fct) const;
71  double operator()(const GSkyDir& dir, _ltcube_ctheta_phi fct) const;
72  double operator()(const GSkyDir& dir, const GEnergy& energy,
73  const GLATAeff& aeff) const;
74  double operator()(const GSkyDir& dir, const GEnergy& energy,
75  const double& offset, const GLATPsf& psf,
76  const GLATAeff& aeff) const;
77 
78  // Methods
79  void clear(void);
80  GLATLtCubeMap* clone(void) const;
81  std::string classname(void) const;
82  void read(const GFitsTable& table);
83  void write(GFits& fits,
84  const std::string& extname = gammalib::extname_lat_ltcubemap) const;
85  const int& ncostheta(void) const;
86  const int& nphi(void) const;
87  bool has_phi(void) const;
88  double costheta(const int& index) const;
89  double phi(const int& index) const;
90  const double& costhetamin(void) const;
91  std::string costhetabin(void) const;
92  std::string print(const GChatter& chatter = NORMAL) const;
93 
94 private:
95  // Methods
96  void init_members(void);
97  void copy_members(const GLATLtCubeMap& cube);
98  void free_members(void);
99 
100  // Protected members
101  GSkyMap m_map; //!< Lifetime cube map
102  int m_num_ctheta; //!< Number of bins in cos theta
103  int m_num_phi; //!< Number of bins in phi
104  double m_min_ctheta; //!< Minimum cos theta value
105  bool m_sqrt_bin; //!< Square root binning?
106 };
107 
108 
109 /***********************************************************************//**
110  * @brief Return class name
111  *
112  * @return String containing the class name ("GLATLtCubeMap").
113  ***************************************************************************/
114 inline
115 std::string GLATLtCubeMap::classname(void) const
116 {
117  return ("GLATLtCubeMap");
118 }
119 
120 
121 /***********************************************************************//**
122  * @brief Return number of cosine theta bins
123  *
124  * @return Number of cosine theta bins.
125  ***************************************************************************/
126 inline
127 const int& GLATLtCubeMap::ncostheta(void) const
128 {
129  return m_num_ctheta;
130 }
131 
132 
133 /***********************************************************************//**
134  * @brief Return number of phi bins
135  *
136  * @return Number of phi bins.
137  ***************************************************************************/
138 inline
139 const int& GLATLtCubeMap::nphi(void) const
140 {
141  return m_num_phi;
142 }
143 
144 
145 /***********************************************************************//**
146  * @brief Signal if livetime cube map has phi dependence
147  *
148  * @return True if livetime cube map has phi dependence.
149  ***************************************************************************/
150 inline
151 bool GLATLtCubeMap::has_phi(void) const
152 {
153  return (m_num_phi != 0);
154 }
155 
156 
157 /***********************************************************************//**
158  * @brief Return minimum of cosine theta
159  *
160  * @return Minimum of cosine theta.
161  ***************************************************************************/
162 inline
163 const double& GLATLtCubeMap::costhetamin(void) const
164 {
165  return m_min_ctheta;
166 }
167 
168 #endif /* GLATLTCUBEMAP_HPP */
void free_members(void)
Delete class members.
GLATLtCubeMap * clone(void) const
Clone livetime cube map.
bool m_sqrt_bin
Square root binning?
Sky map class.
Definition: GSkyMap.hpp:89
double(* _ltcube_ctheta_phi)(const double &costheta, const double &phi)
std::string classname(void) const
Return class name.
GLATLtCubeMap & operator=(const GLATLtCubeMap &cube)
Assignment operator.
double m_min_ctheta
Minimum cos theta value.
Definition of interface for all GammaLib classes.
bool has_phi(void) const
Signal if livetime cube map has phi dependence.
FITS file class.
Definition: GFits.hpp:63
Sky map class definition.
int m_num_ctheta
Number of bins in cos theta.
const double & costhetamin(void) const
Return minimum of cosine theta.
Interface for the Fermi LAT point spread function.
Definition: GLATPsf.hpp:54
virtual ~GLATLtCubeMap(void)
Destructor.
void write(GFits &fits, const std::string &extname=gammalib::extname_lat_ltcubemap) const
Write livetime cube map into FITS file.
std::string costhetabin(void) const
Return cos theta binning scheme.
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
int m_num_phi
Number of bins in phi.
const int & nphi(void) const
Return number of phi bins.
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
GChatter
Definition: GTypemaps.hpp:33
Interface for the Fermi/LAT effective area.
Definition: GLATAeff.hpp:59
void copy_members(const GLATLtCubeMap &cube)
Copy class members.
void clear(void)
Clear livetime cube map.
double phi(const int &index) const
Return phi value (in radians) for an index.
GSkyMap m_map
Lifetime cube map.
double operator()(const GSkyDir &dir, _ltcube_ctheta fct) const
Sum function multiplied by livetime over zenith angle.
const int & ncostheta(void) const
Return number of cosine theta bins.
GLATLtCubeMap(void)
Void constructor.
double(* _ltcube_ctheta)(const double &costheta)
Sky direction class.
Definition: GSkyDir.hpp:62
void init_members(void)
Initialise class members.
void read(const GFitsTable &table)
Load livetime cube from FITS file.
Fermi LAT livetime cube map class.
double costheta(const int &index) const
Return cos theta value for an index.
const std::string extname_lat_ltcubemap
std::string print(const GChatter &chatter=NORMAL) const
Print livetime cube map information.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48