GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATEventBin.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATEventBin.hpp - Fermi/LAT event bin class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2009-2014 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 GLATEventBin.hpp
23  * @brief Fermi/LAT event bin class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GLATEVENTBIN_HPP
28 #define GLATEVENTBIN_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include "GEventBin.hpp"
32 #include "GEnergy.hpp"
33 #include "GTime.hpp"
34 #include "GLATInstDir.hpp"
35 
36 /* __ Forward declarations _______________________________________________ */
37 class GLATEventCube;
38 
39 
40 /***********************************************************************//**
41  * @class GLATEventBin
42  *
43  * @brief Fermi/LAT event bin class
44  *
45  * This class implement a counts map bin for the Fermi/LAT telescope.
46  *
47  * @todo Implement stand alone version of event bin.
48  ***************************************************************************/
49 class GLATEventBin : public GEventBin {
50 
51  // Friend classes
52  friend class GLATEventCube;
53 
54 public:
55  // Constructors and destructors
56  GLATEventBin(void);
57  GLATEventBin(const GLATEventBin& bin);
58  virtual ~GLATEventBin(void);
59 
60  // Operators
61  virtual GLATEventBin& operator=(const GLATEventBin& bin);
62 
63  // Implemented pure virtual base class methods
64  virtual void clear(void);
65  virtual GLATEventBin* clone(void) const;
66  virtual std::string classname(void) const;
67  virtual double size(void) const;
68  virtual const GLATInstDir& dir(void) const;
69  virtual const GEnergy& energy(void) const;
70  virtual const GTime& time(void) const;
71  virtual double counts(void) const;
72  virtual double error(void) const;
73  virtual void counts(const double& counts);
74  virtual std::string print(const GChatter& chatter = NORMAL) const;
75 
76  // Other methods
77  const double& solidangle(void) const;
78  const GEnergy& ewidth(void) const;
79  const double& ontime(void) const;
80  const int& index(void) const;
81  const int& ipix(void) const;
82  const int& ieng(void) const;
83  const GLATEventCube* cube(void) const;
84 
85 protected:
86  // Protected methods
87  void init_members(void);
88  void copy_members(const GLATEventBin& bin);
89  void free_members(void);
90 
91  // Protected members
92  GLATEventCube* m_cube; //!< Event cube back pointer
93  int m_index; //!< Actual skymap index
94  int m_ipix; //!< Actual spatial index
95  int m_ieng; //!< Actual energy index
96  GEnergy* m_energy; //!< Pointer to bin energy
97  GLATInstDir* m_dir; //!< Pointer to bin direction
98  GTime* m_time; //!< Pointer to bin time
99  double* m_counts; //!< Pointer to number of counts
100  double* m_solidangle; //!< Pointer to solid angle of pixel (sr)
101  GEnergy* m_ewidth; //!< Pointer to energy width of bin
102  double* m_ontime; //!< Pointer to ontime of bin (seconds)
103 };
104 
105 
106 /***********************************************************************//**
107  * @brief Return class name
108  *
109  * @return String containing the class name ("GLATEventBin").
110  ***************************************************************************/
111 inline
112 std::string GLATEventBin::classname(void) const
113 {
114  return ("GLATEventBin");
115 }
116 
117 
118 /***********************************************************************//**
119  * @brief Return event bin index in cube
120  *
121  * @return Event bin index in cube.
122  *
123  * Returns the index of the event in the counts map cube. If the event bin
124  * is not part of a cube, -1 is returned.
125  ***************************************************************************/
126 inline
127 const int& GLATEventBin::index(void) const
128 {
129  return m_index;
130 }
131 
132 
133 /***********************************************************************//**
134  * @brief Return event bin map pixel index in cube
135  *
136  * @return Event bin map pixel index in cube.
137  *
138  * Returns the spatial index of the event in the counts map cube. The spatial
139  * index relates to the reconstructed photon arrival direction. If the event
140  * bin is not part of a cube, -1 is returned.
141  ***************************************************************************/
142 inline
143 const int& GLATEventBin::ipix(void) const
144 {
145  return m_ipix;
146 }
147 
148 
149 /***********************************************************************//**
150  * @brief Return event bin energy index in cube
151  *
152  * @return Event bin energy index in cube.
153  *
154  * Returns the energy index of the event in the counts map cube. The energy
155  * index relates to the 3rd dimension of the counts map cube. If the event
156  * bin is not part of a cube, -1 is returned.
157  ***************************************************************************/
158 inline
159 const int& GLATEventBin::ieng(void) const
160 {
161  return m_ieng;
162 }
163 
164 
165 /***********************************************************************//**
166  * @brief Return pointer to related map cube
167  *
168  * @return Pointer to related map cube.
169  *
170  * Returns a pointer to the map cube in which the event bin is embedded. If
171  * the event bin is not part of a cube, NULL is returned.
172  ***************************************************************************/
173 inline
175 {
176  return m_cube;
177 }
178 
179 #endif /* GLATEVENTBIN_HPP */
const int & index(void) const
Return event bin index in cube.
Energy value class definition.
int m_index
Actual skymap index.
Fermi/LAT instrument direction class.
Definition: GLATInstDir.hpp:44
Abstract interface for the event bin class.
Definition: GEventBin.hpp:64
Abstract event bin base class definition.
virtual std::string classname(void) const
Return class name.
Time class.
Definition: GTime.hpp:54
GLATInstDir * m_dir
Pointer to bin direction.
GEnergy * m_ewidth
Pointer to energy width of bin.
virtual double error(void) const
Return error in number of counts.
GEnergy * m_energy
Pointer to bin energy.
virtual GLATEventBin * clone(void) const
Clone event bin.
int m_ipix
Actual spatial index.
const int & ieng(void) const
Return event bin energy index in cube.
const double & solidangle(void) const
Return solid angle of event bin.
Fermi/LAT event bin class.
int m_ieng
Actual energy index.
void free_members(void)
Delete class members.
virtual const GEnergy & energy(void) const
Return energy of event bin.
virtual ~GLATEventBin(void)
Destructor.
double * m_solidangle
Pointer to solid angle of pixel (sr)
virtual double size(void) const
Return size of event bin.
const GEnergy & ewidth(void) const
Return energy width of event bin.
const int & ipix(void) const
Return event bin map pixel index in cube.
virtual const GTime & time(void) const
Return time of event bin.
virtual GLATEventBin & operator=(const GLATEventBin &bin)
Assignment operator.
GLATEventBin(void)
Void constructor.
void init_members(void)
Initialise class members.
GChatter
Definition: GTypemaps.hpp:33
Fermi/LAT event cube class.
virtual const GLATInstDir & dir(void) const
Return instrument direction of event bin.
const double & ontime(void) const
Return ontime of event bin.
virtual void clear(void)
Clear event bin.
double * m_ontime
Pointer to ontime of bin (seconds)
double * m_counts
Pointer to number of counts.
void copy_members(const GLATEventBin &bin)
Copy class members.
virtual double counts(void) const
Return number of counts in event bin.
Fermi/LAT instrument direction class definition.
const GLATEventCube * cube(void) const
Return pointer to related map cube.
GLATEventCube * m_cube
Event cube back pointer.
GTime * m_time
Pointer to bin time.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event information.
Time class interface definition.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48