GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMEventBin.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMEventBin.hpp - COMPTEL event bin class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2012-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 GCOMEventBin.hpp
23  * @brief COMPTEL event bin class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCOMEVENTBIN_HPP
28 #define GCOMEVENTBIN_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include "GEventBin.hpp"
32 #include "GEnergy.hpp"
33 #include "GTime.hpp"
34 #include "GCOMInstDir.hpp"
35 
36 
37 /***********************************************************************//**
38  * @class GCOMEventBin
39  *
40  * @brief COMPTEL event bin class
41  *
42  * This class defines an event bin of the COMPTEL data space. The class holds
43  * pointers to the bin attributes, and allocates memory so that all bin
44  * attributes have an associated memory space. With this technique, the class
45  * can be used to hold information that is external to GCOMEventBin. The
46  * GCOMEventCube class will use this property to directly manipulate the
47  * pointers of the bin.
48  ***************************************************************************/
49 class GCOMEventBin : public GEventBin {
50 
51  // Friend classes
52  friend class GCOMEventCube;
53 
54 public:
55  // Constructors and destructors
56  GCOMEventBin(void);
57  GCOMEventBin(const GCOMEventBin& bin);
58  virtual ~GCOMEventBin(void);
59 
60  // Operators
61  virtual GCOMEventBin& operator=(const GCOMEventBin& bin);
62 
63  // Implemented pure virtual base class methods
64  virtual void clear(void);
65  virtual GCOMEventBin* clone(void) const;
66  virtual std::string classname(void) const;
67  virtual double size(void) const;
68  virtual const GCOMInstDir& 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 int& index(void) const;
78  const double& solidangle(void) const;
79  const GEnergy& ewidth(void) const;
80  const double& ontime(void) const;
81  void index(const int& index);
82  void dir(const GCOMInstDir& dir);
83  void energy(const GEnergy& energy);
84  void time(const GTime& time);
85  void solidangle(const double& solidangle);
86  void ewidth(const GEnergy& ewidth);
87  void ontime(const double& ontime);
88 
89 protected:
90  // Protected methods
91  void init_members(void);
92  void copy_members(const GCOMEventBin& bin);
93  void free_members(void);
94 
95  // Protected members
96  bool m_alloc; //!< Signals proper memory allocation
97  int m_index; //!< Dataspace index
98  GCOMInstDir* m_dir; //!< Pointer to bin direction
99  GTime* m_time; //!< Pointer to bin time
100  GEnergy* m_energy; //!< Pointer to bin energy
101  GEnergy* m_ewidth; //!< Pointer to energy width of bin
102  double* m_counts; //!< Pointer to number of counts
103  double* m_solidangle; //!< Pointer to solid angle of pixel (sr)
104  double* m_ontime; //!< Pointer to ontime of bin (seconds)
105 };
106 
107 
108 /***********************************************************************//**
109  * @brief Return class name
110  *
111  * @return String containing the class name ("GCOMEventBin").
112  ***************************************************************************/
113 inline
114 std::string GCOMEventBin::classname(void) const
115 {
116  return ("GCOMEventBin");
117 }
118 
119 
120 /***********************************************************************//**
121  * @brief Return bin index
122  *
123  * @return Bin index.
124  *
125  * Returns the index of the event bin if the bin is part of an event cube. If
126  * the event is not part of an event cube, -1 is returned.
127  ***************************************************************************/
128 inline
129 const int& GCOMEventBin::index(void) const
130 {
131  return (m_index);
132 }
133 
134 
135 /***********************************************************************//**
136  * @brief Set bin index
137  *
138  * @param[in] index Bin index.
139  *
140  * Set the index of the event bin if the bin is part of an event cube. If
141  * the event is not part of an event cube the index should be set to -1.
142  ***************************************************************************/
143 inline
144 void GCOMEventBin::index(const int& index)
145 {
146  m_index = index;
147  return;
148 }
149 
150 #endif /* GCOMEVENTBIN_HPP */
const double & ontime(void) const
Return ontime of event bin.
const int & index(void) const
Return bin index.
Energy value class definition.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event information.
int m_index
Dataspace index.
GCOMInstDir * m_dir
Pointer to bin direction.
Abstract interface for the event bin class.
Definition: GEventBin.hpp:64
Abstract event bin base class definition.
virtual double error(void) const
Return error in number of counts.
GTime * m_time
Pointer to bin time.
void copy_members(const GCOMEventBin &bin)
Copy class members.
Time class.
Definition: GTime.hpp:55
virtual const GTime & time(void) const
Return time of event bin.
COMPTEL event bin class.
void free_members(void)
Delete class members.
virtual void clear(void)
Clear instance.
virtual GCOMEventBin * clone(void) const
Clone instance.
double * m_ontime
Pointer to ontime of bin (seconds)
virtual ~GCOMEventBin(void)
Destructor.
const GEnergy & ewidth(void) const
Return energy width of event bin.
bool m_alloc
Signals proper memory allocation.
virtual std::string classname(void) const
Return class name.
GEnergy * m_ewidth
Pointer to energy width of bin.
const double & solidangle(void) const
Return solid angle of event bin.
virtual GCOMEventBin & operator=(const GCOMEventBin &bin)
Assignment operator.
GChatter
Definition: GTypemaps.hpp:33
COMPTEL event bin container class.
virtual double counts(void) const
Return number of counts in event bin.
void init_members(void)
Initialise class members.
virtual const GCOMInstDir & dir(void) const
Return instrument direction of event bin.
GEnergy * m_energy
Pointer to bin energy.
double * m_counts
Pointer to number of counts.
GCOMEventBin(void)
Void constructor.
COMPTEL instrument direction class definition.
virtual double size(void) const
Return size of event bin.
Time class interface definition.
Interface for the COMPTEL instrument direction class.
Definition: GCOMInstDir.hpp:45
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
double * m_solidangle
Pointer to solid angle of pixel (sr)
virtual const GEnergy & energy(void) const
Return energy of event bin.