GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMEventCube.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMEventCube.hpp - COMPTEL event bin container class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2012-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 GCOMEventCube.hpp
23  * @brief COMPTEL event bin container class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCOMEVENTCUBE_HPP
28 #define GCOMEVENTCUBE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include <vector>
33 #include "GEnergy.hpp"
34 #include "GTime.hpp"
35 #include "GSkyDir.hpp"
36 #include "GEventCube.hpp"
37 #include "GCOMEventBin.hpp"
38 #include "GCOMInstDir.hpp"
39 #include "GCOMDri.hpp"
40 
41 /* __ Forward declarations _______________________________________________ */
42 class GFilename;
43 class GEbounds;
44 class GGti;
45 
46 
47 /***********************************************************************//**
48  * @class GCOMEventCube
49  *
50  * @brief COMPTEL event bin container class
51  *
52  * This class is a container class for COMPTEL event bins.
53  ***************************************************************************/
54 class GCOMEventCube : public GEventCube {
55 
56 public:
57  // Constructors and destructors
58  GCOMEventCube(void);
59  explicit GCOMEventCube(const GFilename& filename);
60  explicit GCOMEventCube(const GCOMDri& dre);
61  GCOMEventCube(const GCOMEventCube& cube);
62  virtual ~GCOMEventCube(void);
63 
64  // Operators
65  virtual GCOMEventCube& operator=(const GCOMEventCube& cube);
66  virtual GCOMEventBin* operator[](const int& index);
67  virtual const GCOMEventBin* operator[](const int& index) const;
68 
69  // Implemented pure virtual base class methods
70  virtual void clear(void);
71  virtual GCOMEventCube* clone(void) const;
72  virtual std::string classname(void) const;
73  virtual int size(void) const;
74  virtual int dim(void) const;
75  virtual int naxis(const int& axis) const;
76  virtual void load(const GFilename& filename);
77  virtual void save(const GFilename& filename,
78  const bool& clobber = false) const;
79  virtual void read(const GFits& file);
80  virtual void write(GFits& file) const;
81  virtual int number(void) const;
82  virtual std::string print(const GChatter& chatter = NORMAL) const;
83 
84  // Other methods
85  const GCOMDri& dre(void) const;
86 
87 protected:
88  // Protected methods
89  void init_members(void);
90  void copy_members(const GCOMEventCube& cube);
91  void free_members(void);
92  void init_cube(void);
93  void set_scatter_directions(void);
94  void set_scatter_angles(void);
95  virtual void set_energies(void);
96  virtual void set_times(void);
97  void init_bin(void);
98  void set_bin(const int& index);
99 
100  // Protected members
101  GCOMEventBin m_bin; //!< Actual event bin
102  GCOMInstDir m_dir; //!< Actual event direction
103  GCOMDri m_dri; //!< DRI cube
104  GTime m_time; //!< Event cube mean time
105  double m_ontime; //!< Event cube ontime (sec)
106  GEnergy m_energy; //!< Event cube mean energy
107  GEnergy m_ewidth; //!< Event cube energy bin width
108  int m_npix; //!< Number of DRI pixels
109  std::vector<GSkyDir> m_dirs; //!< Array of event scatter directions
110  std::vector<double> m_solidangle; //!< Array of solid angles (sr)
111  std::vector<double> m_phibar; //!< Array of event scatter angles
112 };
113 
114 
115 /***********************************************************************//**
116  * @brief Return class name
117  *
118  * @return String containing the class name ("GCOMEventCube").
119  ***************************************************************************/
120 inline
121 std::string GCOMEventCube::classname(void) const
122 {
123  return ("GCOMEventCube");
124 }
125 
126 
127 /***********************************************************************//**
128  * @brief Return number of bins in event cube
129  *
130  * @return Number of bins in event cube.
131  ***************************************************************************/
132 inline
133 int GCOMEventCube::size(void) const
134 {
135  return (m_dri.size());
136 }
137 
138 
139 /***********************************************************************//**
140  * @brief Return reference to DRE data
141  *
142  * @return Reference to DRE data.
143  ***************************************************************************/
144 inline
145 const GCOMDri& GCOMEventCube::dre(void) const
146 {
147  return (m_dri);
148 }
149 
150 #endif /* GCOMEVENTCUBE_HPP */
void set_scatter_directions(void)
Set sky directions and solid angles of events cube.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event cube information.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COMPTEL event cube into FITS file.
virtual GCOMEventCube * clone(void) const
Clone instance.
Energy value class definition.
virtual void set_times(void)
Set mean event time and ontime of event cube.
std::vector< GSkyDir > m_dirs
Array of event scatter directions.
Sky direction class interface definition.
int size(void) const
Return number of bins.
Definition: GCOMDri.hpp:230
COMPTEL Data Space class definition.
GCOMDri m_dri
DRI cube.
virtual int size(void) const
Return number of bins in event cube.
Abstract event bin container class interface definition.
void init_bin(void)
Initialise event bin.
Time class.
Definition: GTime.hpp:55
FITS file class.
Definition: GFits.hpp:63
virtual void read(const GFits &file)
Read COMPTEL event cube from FITS file.
COMPTEL event bin class.
virtual void load(const GFilename &filename)
Load COMPTEL event cube from FITS file.
GCOMInstDir m_dir
Actual event direction.
void init_members(void)
Initialise class members.
COMPTEL event bin class interface definition.
virtual int dim(void) const
Return dimension of event cube.
Energy boundaries container class.
Definition: GEbounds.hpp:60
void set_scatter_angles(void)
Set Compton scatter angles of event cube.
GCOMEventCube(void)
Void constructor.
Filename class.
Definition: GFilename.hpp:62
void free_members(void)
Delete class members.
std::vector< double > m_phibar
Array of event scatter angles.
void init_cube(void)
Initialise event cube.
virtual void clear(void)
Clear instance.
GChatter
Definition: GTypemaps.hpp:33
Good Time Interval class.
Definition: GGti.hpp:62
GCOMEventBin m_bin
Actual event bin.
double m_ontime
Event cube ontime (sec)
COMPTEL event bin container class.
virtual void set_energies(void)
Set log mean energy and energy width of event cube.
const GCOMDri & dre(void) const
Return reference to DRE data.
int m_npix
Number of DRI pixels.
void copy_members(const GCOMEventCube &cube)
Copy class members.
virtual std::string classname(void) const
Return class name.
COMPTEL Data Space class.
Definition: GCOMDri.hpp:62
virtual int number(void) const
Return number of events in cube.
GEnergy m_ewidth
Event cube energy bin width.
GEnergy m_energy
Event cube mean energy.
virtual ~GCOMEventCube(void)
Destructor.
COMPTEL instrument direction class definition.
Abstract event bin container class.
Definition: GEventCube.hpp:46
virtual int naxis(const int &axis) const
Return number of bins in axis.
Time class interface definition.
virtual GCOMEventBin * operator[](const int &index)
Event bin access operator.
virtual GCOMEventCube & operator=(const GCOMEventCube &cube)
Assignment operator.
std::vector< double > m_solidangle
Array of solid angles (sr)
Interface for the COMPTEL instrument direction class.
Definition: GCOMInstDir.hpp:45
void set_bin(const int &index)
Set event bin.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48
GTime m_time
Event cube mean time.
virtual void write(GFits &file) const
Write COMPTEL event cube into FITS file.