GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATPsf.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATPsf.hpp - Fermi LAT point spread function *
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 GLATPsf.hpp
23  * @brief Fermi LAT point spread function class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GLATPSF_HPP
28 #define GLATPSF_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GBase.hpp"
33 #include "GLATPsfBase.hpp"
34 
35 /* __ Forward declarations _______________________________________________ */
36 class GFilename;
37 class GFits;
38 
39 
40 /***********************************************************************//**
41  * @class GLATPsf
42  *
43  * @brief Interface for the Fermi LAT point spread function
44  *
45  * This class provides the interface to the Fermi LAT point spread function
46  * (PSF). An instance of the class holds the PSF for a specific event type.
47  * The class handles different PSF versions by holding a pointer to the
48  * versioned PSF, which is defined by the abstract base class GLATPsfBase.
49  * On loading (or reading) of the PSF information from the FITS file, the
50  * appropriate versioned PSF will be allocated.
51  *
52  * @todo Implement Phi dependence
53  ***************************************************************************/
54 class GLATPsf : public GBase {
55 
56 public:
57  // Constructors and destructors
58  GLATPsf(void);
59  GLATPsf(const GFilename& filename, const std::string& evtype);
60  GLATPsf(const GLATPsf& psf);
61  virtual ~GLATPsf(void);
62 
63  // Operators
64  GLATPsf& operator= (const GLATPsf& psf);
65  double operator()(const double& offset, const double& logE,
66  const double& ctheta);
67 
68  // Methods
69  void clear(void);
70  GLATPsf* clone(void) const;
71  std::string classname(void) const;
72  const std::string& evtype(void) const;
73  void load(const GFilename& filename,
74  const std::string& evtype);
75  void save(const GFilename& filename,
76  const bool& clobber = false);
77  void read(const GFits& file, const std::string& evtype);
78  void write(GFits& file) const;
79  int size(void) const;
80  int nenergies(void) const;
81  int ncostheta(void) const;
82  double costhetamin(void) const;
83  void costhetamin(const double& ctheta);
84  bool has_phi(void) const;
85  int version(void) const;
86  std::string print(const GChatter& chatter = NORMAL) const;
87 
88 private:
89  // Methods
90  void init_members(void);
91  void copy_members(const GLATPsf& psf);
92  void free_members(void);
93 
94  // Members
95  std::string m_evtype; //!< Event type
96  GLATPsfBase* m_psf; //!< Pointer to versioned point spread function
97 };
98 
99 
100 /***********************************************************************//**
101  * @brief Return class name
102  *
103  * @return String containing the class name ("GLATPsf").
104  ***************************************************************************/
105 inline
106 std::string GLATPsf::classname(void) const
107 {
108  return ("GLATPsf");
109 }
110 
111 
112 /***********************************************************************//**
113  * @brief Return event type
114  *
115  * @return Event type.
116  *
117  * Returns the event type for this point spread function.
118  ***************************************************************************/
119 inline
120 const std::string& GLATPsf::evtype(void) const
121 {
122  return (m_evtype);
123 }
124 
125 
126 /***********************************************************************//**
127  * @brief Signals if PSF has phi dependence
128  *
129  * @todo Implement phi dependence
130  ***************************************************************************/
131 inline
132 bool GLATPsf::has_phi(void) const
133 {
134  // Return
135  return (false);
136 }
137 
138 #endif /* GLATPSF_HPP */
double operator()(const double &offset, const double &logE, const double &ctheta)
Return point spread function value.
Definition: GLATPsf.cpp:177
void clear(void)
Clear instance.
Definition: GLATPsf.cpp:199
GLATPsf * clone(void) const
Clone instance.
Definition: GLATPsf.cpp:217
void read(const GFits &file, const std::string &evtype)
Read point spread function from FITS file.
Definition: GLATPsf.cpp:284
Definition of interface for all GammaLib classes.
void save(const GFilename &filename, const bool &clobber=false)
Save point spread function into FITS file.
Definition: GLATPsf.cpp:252
void copy_members(const GLATPsf &psf)
Copy class members.
Definition: GLATPsf.cpp:563
FITS file class.
Definition: GFits.hpp:63
const std::string & evtype(void) const
Return event type.
Definition: GLATPsf.hpp:120
int nenergies(void) const
Returns number of energy bins in PSF.
Definition: GLATPsf.cpp:409
Interface for the Fermi LAT point spread function.
Definition: GLATPsf.hpp:54
Abstract Fermi/LAT point spread function base class.
Definition: GLATPsfBase.hpp:47
bool has_phi(void) const
Signals if PSF has phi dependence.
Definition: GLATPsf.hpp:132
Filename class.
Definition: GFilename.hpp:62
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
int version(void) const
Returns PSF version.
Definition: GLATPsf.cpp:485
double costhetamin(void) const
Returns minimum cos(theta) angle.
Definition: GLATPsf.cpp:445
virtual ~GLATPsf(void)
Destructor.
Definition: GLATPsf.cpp:121
int size(void) const
Returns size of PSF.
Definition: GLATPsf.cpp:394
GChatter
Definition: GTypemaps.hpp:33
void write(GFits &file) const
Write point spread function into FITS file.
Definition: GLATPsf.cpp:367
GLATPsfBase * m_psf
Pointer to versioned point spread function.
Definition: GLATPsf.hpp:96
std::string m_evtype
Event type.
Definition: GLATPsf.hpp:95
GLATPsf(void)
Void constructor.
Definition: GLATPsf.cpp:65
Abstract Fermi/LAT point spread function base class definition.
void load(const GFilename &filename, const std::string &evtype)
Load point spread function from FITS file.
Definition: GLATPsf.cpp:231
int ncostheta(void) const
Returns number of cos(theta) bins in PSF.
Definition: GLATPsf.cpp:427
void init_members(void)
Initialise class members.
Definition: GLATPsf.cpp:547
std::string classname(void) const
Return class name.
Definition: GLATPsf.hpp:106
GLATPsf & operator=(const GLATPsf &psf)
Assignment operator.
Definition: GLATPsf.cpp:143
std::string print(const GChatter &chatter=NORMAL) const
Print point spread function information.
Definition: GLATPsf.cpp:501
void free_members(void)
Delete class members.
Definition: GLATPsf.cpp:584