GammaLib 2.0.0
Loading...
Searching...
No Matches
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 _______________________________________________ */
36class GFits;
37class GFitsTable;
38class GSkyDir;
39class GLATAeff;
40class GLATPsf;
41
42/* __ Constants __________________________________________________________ */
43namespace gammalib {
44 const std::string extname_lat_ltcubemap = "EXPOSURE";
45}
46
47/* __ Typedefs ___________________________________________________________ */
48typedef double (*_ltcube_ctheta)(const double& costheta);
49typedef 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 ***************************************************************************/
60class GLATLtCubeMap : public GBase {
61
62public:
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
94private:
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 ***************************************************************************/
114inline
115std::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 ***************************************************************************/
126inline
127const 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 ***************************************************************************/
138inline
139const 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 ***************************************************************************/
150inline
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 ***************************************************************************/
162inline
163const double& GLATLtCubeMap::costhetamin(void) const
164{
165 return m_min_ctheta;
166}
167
168#endif /* GLATLTCUBEMAP_HPP */
Definition of interface for all GammaLib classes.
double(* _ltcube_ctheta_phi)(const double &costheta, const double &phi)
double(* _ltcube_ctheta)(const double &costheta)
Sky map 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
Abstract interface for FITS table.
FITS file class.
Definition GFits.hpp:63
Interface for the Fermi/LAT effective area.
Definition GLATAeff.hpp:59
Fermi LAT livetime cube map class.
int m_num_ctheta
Number of bins in cos theta.
void free_members(void)
Delete class members.
GLATLtCubeMap & operator=(const GLATLtCubeMap &cube)
Assignment operator.
void write(GFits &fits, const std::string &extname=gammalib::extname_lat_ltcubemap) const
Write livetime cube map into FITS file.
const double & costhetamin(void) const
Return minimum of cosine theta.
virtual ~GLATLtCubeMap(void)
Destructor.
void copy_members(const GLATLtCubeMap &cube)
Copy class members.
double m_min_ctheta
Minimum cos theta value.
GSkyMap m_map
Lifetime cube map.
double costheta(const int &index) const
Return cos theta value for an index.
GLATLtCubeMap(void)
Void constructor.
const int & ncostheta(void) const
Return number of cosine theta bins.
void clear(void)
Clear livetime cube map.
bool m_sqrt_bin
Square root binning?
double operator()(const GSkyDir &dir, _ltcube_ctheta fct) const
Sum function multiplied by livetime over zenith angle.
std::string costhetabin(void) const
Return cos theta binning scheme.
const int & nphi(void) const
Return number of phi bins.
GLATLtCubeMap * clone(void) const
Clone livetime cube map.
std::string print(const GChatter &chatter=NORMAL) const
Print livetime cube map information.
double phi(const int &index) const
Return phi value (in radians) for an index.
std::string classname(void) const
Return class name.
int m_num_phi
Number of bins in phi.
void init_members(void)
Initialise class members.
void read(const GFitsTable &table)
Load livetime cube from FITS file.
bool has_phi(void) const
Signal if livetime cube map has phi dependence.
Interface for the Fermi LAT point spread function.
Definition GLATPsf.hpp:54
Sky direction class.
Definition GSkyDir.hpp:62
Sky map class.
Definition GSkyMap.hpp:89
const std::string extname_lat_ltcubemap