GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEvent.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GEvent.hpp - Abstract event base 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 GEvent.hpp
23  * @brief Abstract event base class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GEVENT_HPP
28 #define GEVENT_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GBase.hpp"
33 #include "GInstDir.hpp"
34 #include "GEnergy.hpp"
35 #include "GTime.hpp"
36 
37 
38 /***********************************************************************//**
39  * @class GEvent
40  *
41  * @brief Abstract interface for the event classes.
42  *
43  * This class provides an abstract interface to an event. An event can be
44  * either a physical event occurring in the instrument (called an event
45  * atom) or a collection of events with similar properties (called an
46  * event bin). While event atoms are used for unbinned analysis, event bins
47  * are used for binned analysis. The methods is_atom() and is_bin() inform
48  * whether an event is an atom or a bin.
49  *
50  * Each event has 3 attributes: energy, instrument direction and time.
51  * These attributes can be accessed and changed through the energy(),
52  * dir(), and time() methods.
53  *
54  * The counts() and error() methods return the number of counts and the
55  * error in this number for each event. For event atoms the number of
56  * counts is 1 and the error is 0. The event bins, the number of counts
57  * is the number of events within a bin, and error is the uncertainty in
58  * this number (typically the square root of the number, yet also other
59  * schemes may be implemented).
60  *
61  * The size() method returns the size of an event bin, which is the
62  * quantity that has to be multiplied by the probability for an event to
63  * occur to predict the number of events in a bin. For event atoms this
64  * quantity is by definition 1. For event bins, the size is the solid
65  * angle of the event bin times the energy width times the ontime interval
66  * covered by the events.
67  *
68  * The GEvent class does not hold any data members. Data members are stored
69  * in the derived classes.
70  ***************************************************************************/
71 class GEvent : public GBase {
72 
73 public:
74  // Constructors and destructors
75  GEvent(void);
76  GEvent(const GEvent& event);
77  virtual ~GEvent(void);
78 
79  // Operators
80  virtual GEvent& operator=(const GEvent& event);
81 
82  // Pure virtual methods
83  virtual void clear(void) = 0;
84  virtual GEvent* clone(void) const = 0;
85  virtual std::string classname(void) const = 0;
86  virtual double size(void) const = 0;
87  virtual const GInstDir& dir(void) const = 0;
88  virtual const GEnergy& energy(void) const = 0;
89  virtual const GTime& time(void) const = 0;
90  virtual double counts(void) const = 0;
91  virtual double error(void) const = 0;
92  virtual bool is_atom(void) const = 0;
93  virtual bool is_bin(void) const = 0;
94  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
95 
96 protected:
97  // Protected methods
98  void init_members(void);
99  void copy_members(const GEvent& event);
100  void free_members(void);
101 };
102 
103 #endif /* GEVENT_HPP */
Abstract instrument direction base class definition.
void copy_members(const GEvent &event)
Copy class members.
Definition: GEvent.cpp:153
virtual double counts(void) const =0
Energy value class definition.
virtual double error(void) const =0
Abstract interface for the event classes.
Definition: GEvent.hpp:71
Definition of interface for all GammaLib classes.
virtual double size(void) const =0
Time class.
Definition: GTime.hpp:54
virtual const GTime & time(void) const =0
virtual GEvent & operator=(const GEvent &event)
Assignment operator.
Definition: GEvent.cpp:105
Abstract instrument direction base class.
Definition: GInstDir.hpp:47
virtual ~GEvent(void)
Destructor.
Definition: GEvent.cpp:83
virtual bool is_bin(void) const =0
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
virtual const GEnergy & energy(void) const =0
virtual std::string classname(void) const =0
Return class name.
GChatter
Definition: GTypemaps.hpp:33
void init_members(void)
Initialise class members.
Definition: GEvent.cpp:141
virtual GEvent * clone(void) const =0
Clones object.
virtual bool is_atom(void) const =0
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
void free_members(void)
Delete class members.
Definition: GEvent.cpp:163
GEvent(void)
Void constructor.
Definition: GEvent.cpp:52
virtual void clear(void)=0
Clear object.
virtual const GInstDir & dir(void) const =0
Time class interface definition.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48