GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEventBin.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GEventBin.hpp - Abstract event bin base class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2009-2014 by Jurgen Knodlseder *
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 GEventBin.hpp
23  * @brief Abstract event bin base class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GEVENTBIN_HPP
28 #define GEVENTBIN_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GEvent.hpp"
33 #include "GInstDir.hpp"
34 #include "GEnergy.hpp"
35 #include "GTime.hpp"
36 
37 
38 /***********************************************************************//**
39  * @class GEventBin
40  *
41  * @brief Abstract interface for the event bin class.
42  *
43  * An event bin is a collection of event atoms with similar properties.
44  * Event bins are used for binned analysis.
45  *
46  * Each event has 3 attributes: energy, instrument direction and time.
47  * These attributes can be accessed and changed through the energy(),
48  * dir(), and time() methods.
49  *
50  * The counts() and error() methods return the number of events within an
51  * event bin and the uncertainty in this number, which by default is
52  * given by the square root of the number of events (this is the default
53  * implementation provided by this class).
54  *
55  * The size() method returns the size of an event bin, which is the
56  * quantity that has to be multiplied by the probability for an event to
57  * occur to predict the number of events in a bin). The size is the solid
58  * angle of the event bin times the energy width times the ontime interval
59  * covered by the events.
60  *
61  * The GEventBin class does not hold any data members. Data members are
62  * stored in the derived classes.
63  ***************************************************************************/
64 class GEventBin : public GEvent {
65 
66  // Friend classes
67  friend class GEvents;
68 
69 public:
70  // Constructors and destructors
71  GEventBin(void);
72  GEventBin(const GEventBin& bin);
73  virtual ~GEventBin(void);
74 
75  // Operators
76  virtual GEventBin& operator=(const GEventBin& bin);
77 
78  // Pure virtual methods
79  virtual void clear(void) = 0;
80  virtual GEvent* clone(void) const = 0;
81  virtual std::string classname(void) const = 0;
82  virtual double size(void) const = 0;
83  virtual const GInstDir& dir(void) const = 0;
84  virtual const GEnergy& energy(void) const = 0;
85  virtual const GTime& time(void) const = 0;
86  virtual double counts(void) const = 0;
87  virtual double error(void) const = 0;
88  virtual void counts(const double& counts) = 0;
89  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
90 
91  // Other methods
92  bool is_atom(void) const;
93  bool is_bin(void) const;
94 
95 protected:
96  // Protected methods
97  void init_members(void);
98  void copy_members(const GEventBin& bin);
99  void free_members(void);
100 };
101 
102 
103 /***********************************************************************//**
104  * @brief Signal if event is an atom
105  *
106  * @return False.
107  ***************************************************************************/
108 inline
109 bool GEventBin::is_atom(void) const
110 {
111  return (false);
112 }
113 
114 
115 /***********************************************************************//**
116  * @brief Signal if event is a bin
117  *
118  * @return True.
119  ***************************************************************************/
120 inline
121 bool GEventBin::is_bin(void) const
122 {
123  return (true);
124 }
125 
126 #endif /* GEVENTBIN_HPP */
virtual double error(void) const =0
Return error in number of counts.
Definition: GEventBin.cpp:141
Abstract instrument direction base class definition.
virtual double size(void) const =0
Energy value class definition.
Abstract interface for the event bin class.
Definition: GEventBin.hpp:64
Abstract interface for the event classes.
Definition: GEvent.hpp:71
virtual double counts(void) const =0
virtual GEvent * clone(void) const =0
Clones object.
Time class.
Definition: GTime.hpp:54
virtual ~GEventBin(void)
Destructor.
Definition: GEventBin.cpp:83
virtual const GEnergy & energy(void) const =0
GEventBin(void)
Void constructor.
Definition: GEventBin.cpp:52
Abstract instrument direction base class.
Definition: GInstDir.hpp:47
Abstract event base class definition.
virtual std::string classname(void) const =0
Return class name.
GChatter
Definition: GTypemaps.hpp:33
bool is_bin(void) const
Signal if event is a bin.
Definition: GEventBin.hpp:121
bool is_atom(void) const
Signal if event is an atom.
Definition: GEventBin.hpp:109
void free_members(void)
Delete class members.
Definition: GEventBin.cpp:182
virtual const GTime & time(void) const =0
Abstract event container class.
Definition: GEvents.hpp:66
virtual GEventBin & operator=(const GEventBin &bin)
Assignment operator.
Definition: GEventBin.cpp:105
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
virtual const GInstDir & dir(void) const =0
void init_members(void)
Initialise class members.
Definition: GEventBin.cpp:160
Time class interface definition.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
void copy_members(const GEventBin &bin)
Copy class members.
Definition: GEventBin.cpp:172
virtual void clear(void)=0
Clear object.