GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAEventBin.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAEventBin.hpp - CTA event bin class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2017 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 GCTAEventBin.hpp
23  * @brief CTA event bin class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAEVENTBIN_HPP
28 #define GCTAEVENTBIN_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GEventBin.hpp"
33 #include "GEnergy.hpp"
34 #include "GTime.hpp"
35 #include "GCTAInstDir.hpp"
36 
37 
38 /***********************************************************************//**
39  * @class GCTAEventBin
40  *
41  * @brief GCTAEventBin class interface definition
42  *
43  * This class implements a CTA event bin. The event bin is a collection of
44  * pointers that points to the relevant information in memory. The class
45  * itself does not allocate any memory, it just is a vector to collect
46  * all relevant event information in a single place. This avoids duplication
47  * of information.
48  *
49  * Setting up the pointers is done by the corresponding event bin container
50  * class (GCTAEventCube).
51  ***************************************************************************/
52 class GCTAEventBin : public GEventBin {
53 
54  // Friend classes
55  friend class GCTAEventCube;
56 
57 public:
58  // Constructors and destructors
59  GCTAEventBin(void);
60  GCTAEventBin(const GCTAEventBin& bin);
61  virtual ~GCTAEventBin(void);
62 
63  // Operators
64  virtual GCTAEventBin& operator=(const GCTAEventBin& bin);
65 
66  // Implemented pure virtual base class methods
67  virtual void clear(void);
68  virtual GCTAEventBin* clone(void) const;
69  virtual std::string classname(void) const;
70  virtual double size(void) const;
71  virtual const GCTAInstDir& dir(void) const;
72  virtual const GEnergy& energy(void) const;
73  virtual const GTime& time(void) const;
74  virtual double counts(void) const;
75  virtual double error(void) const;
76  virtual void counts(const double& counts);
77  virtual std::string print(const GChatter& chatter = NORMAL) const;
78 
79  // Other methods
80  const int& ipix(void) const;
81  const int& ieng(void) const;
82  const double& solidangle(void) const;
83  const GEnergy& ewidth(void) const;
84  const double& ontime(void) const;
85  const double& weight(void) const;
86  void dir(const GCTAInstDir& dir);
87  void energy(const GEnergy& energy);
88  void time(const GTime& time);
89  void ipix(const int& ipix);
90  void ieng(const int& ieng);
91  void solidangle(const double& solidangle);
92  void ewidth(const GEnergy& ewidth);
93  void ontime(const double& ontime);
94  void weight(const double& weight);
95 
96 protected:
97  // Protected methods
98  void init_members(void);
99  void copy_members(const GCTAEventBin& bin);
100  void free_members(void);
101 
102  // Protected members
103  bool m_alloc; //!< Signals proper memory allocation
104  int m_ipix; //!< Index in spatial map
105  int m_ieng; //!< Index of energy layer
106  GCTAInstDir* m_dir; //!< Pointer to bin direction
107  GTime* m_time; //!< Pointer to bin time
108  GEnergy* m_energy; //!< Pointer to bin energy
109  GEnergy* m_ewidth; //!< Pointer to energy width of bin
110  double* m_counts; //!< Pointer to number of counts
111  double* m_solidangle; //!< Pointer to solid angle of pixel (sr)
112  double* m_ontime; //!< Pointer to ontime of bin (seconds)
113  double* m_weight; //!< Pointer to weight of bin
114 };
115 
116 
117 /***********************************************************************//**
118  * @brief Return class name
119  *
120  * @return String containing the class name ("GCTAEventBin").
121  ***************************************************************************/
122 inline
123 std::string GCTAEventBin::classname(void) const
124 {
125  return ("GCTAEventBin");
126 }
127 
128 
129 /***********************************************************************//**
130  * @brief Return the spatial pixel index
131  *
132  * @return Spatial pixel index.
133  *
134  * Returns the spatial index of the event bin in the event cube. If the event
135  * is not part of an event cube, -1 is returned.
136  ***************************************************************************/
137 inline
138 const int& GCTAEventBin::ipix(void) const
139 {
140  return (m_ipix);
141 }
142 
143 
144 /***********************************************************************//**
145  * @brief Set the spatial pixel index
146  *
147  * @param[in] ipix Spatial pixel index.
148  *
149  * Sets the spatial index of the event bin in the event cube.
150  ***************************************************************************/
151 inline
152 void GCTAEventBin::ipix(const int& ipix)
153 {
154  m_ipix = ipix;
155  return;
156 }
157 
158 
159 /***********************************************************************//**
160  * @brief Return the energy layer index
161  *
162  * @return Energy layer index.
163  *
164  * Returns the energy layer of the event bin in the event cube. If the event
165  * is not part of an event cube, -1 is returned.
166  ***************************************************************************/
167 inline
168 const int& GCTAEventBin::ieng(void) const
169 {
170  return (m_ieng);
171 }
172 
173 
174 /***********************************************************************//**
175  * @brief Set the energy layer index
176  *
177  * @param[in] ieng Energy layer index.
178  *
179  * Sets the energy layer of the event bin in the event cube.
180  ***************************************************************************/
181 inline
182 void GCTAEventBin::ieng(const int& ieng)
183 {
184  m_ieng = ieng;
185  return;
186 }
187 
188 #endif /* GCTAEVENTBIN_HPP */
const int & ieng(void) const
Return the energy layer index.
double * m_ontime
Pointer to ontime of bin (seconds)
virtual ~GCTAEventBin(void)
Destructor.
double * m_counts
Pointer to number of counts.
Energy value class definition.
virtual const GCTAInstDir & dir(void) const
Return instrument direction of event bin.
const double & weight(void) const
Return weight of event bin.
GCTAEventBin class interface definition.
Abstract interface for the event bin class.
Definition: GEventBin.hpp:64
int m_ipix
Index in spatial map.
Abstract event bin base class definition.
GCTAEventBin(void)
Void constructor.
Time class.
Definition: GTime.hpp:54
virtual const GEnergy & energy(void) const
Return energy of event bin.
int m_ieng
Index of energy layer.
GCTAInstDir * m_dir
Pointer to bin direction.
virtual double size(void) const
Return size of event bin.
virtual GCTAEventBin * clone(void) const
Clone event bin.
GTime * m_time
Pointer to bin time.
CTA event bin container class.
const GEnergy & ewidth(void) const
Return energy width of event bin.
const double & ontime(void) const
Return ontime of event bin.
virtual const GTime & time(void) const
Return time of event bin.
CTA instrument direction class interface definition.
GChatter
Definition: GTypemaps.hpp:33
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
bool m_alloc
Signals proper memory allocation.
virtual void clear(void)
Clear eventbin.
double * m_weight
Pointer to weight of bin.
virtual GCTAEventBin & operator=(const GCTAEventBin &bin)
Assignment operator.
virtual std::string classname(void) const
Return class name.
double * m_solidangle
Pointer to solid angle of pixel (sr)
GEnergy * m_ewidth
Pointer to energy width of bin.
CTA instrument direction class.
Definition: GCTAInstDir.hpp:59
GEnergy * m_energy
Pointer to bin energy.
const double & solidangle(void) const
Return solid angle of event bin.
void copy_members(const GCTAEventBin &bin)
Copy class members.
const int & ipix(void) const
Return the spatial pixel index.
virtual double counts(void) const
Return number of counts in event bin.
Time class interface definition.
virtual double error(void) const
Return error in number of counts.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event information.