GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATRoi.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GLATRoi.hpp - Fermi/LAT region of interest class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-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 GLATRoi.hpp
23  * @brief Fermi/LAT region of interest class definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GLATROI_HPP
28 #define GLATROI_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GRoi.hpp"
33 #include "GLATInstDir.hpp"
34 
35 
36 /***********************************************************************//**
37  * @class GLATRoi
38  *
39  * @brief Fermi/LAT region of interest class
40  *
41  * The Fermi/LAT region of interest class defines the region of photon
42  * arrival directions that is used for unbinned data analysis. A circular
43  * region on the sky has been implemented.
44  ***************************************************************************/
45 class GLATRoi : public GRoi {
46 
47 public:
48  // Constructors and destructors
49  GLATRoi(void);
50  GLATRoi(const GLATInstDir& centre, const double& radius);
51  GLATRoi(const GLATRoi& roi);
52  virtual ~GLATRoi(void);
53 
54  // Operators
55  GLATRoi& operator=(const GLATRoi& roi);
56 
57  // Implemented pure virtual base class methods
58  virtual void clear(void);
59  virtual GLATRoi* clone(void) const;
60  virtual std::string classname(void) const;
61  virtual bool contains(const GEvent& event) const;
62  virtual std::string print(const GChatter& chatter = NORMAL) const;
63 
64  // Other methods
65  const GLATInstDir& centre(void) const;
66  const double& radius(void) const;
67  void centre(const GLATInstDir& centre);
68  void radius(const double& radius);
69 
70 protected:
71  // Protected methods
72  void init_members(void);
73  void copy_members(const GLATRoi& roi);
74  void free_members(void);
75 
76  // Protected members
77  GLATInstDir m_centre; //!< Centre of ROI in instrument coordinates
78  double m_radius; //!< Radius of ROI in degrees
79 };
80 
81 
82 /***********************************************************************//**
83  * @brief Return class name
84  *
85  * @return String containing the class name ("GLATRoi").
86  ***************************************************************************/
87 inline
88 std::string GLATRoi::classname(void) const
89 {
90  return ("GLATRoi");
91 }
92 
93 
94 /***********************************************************************//**
95  * @brief Returns region of interest centre
96  *
97  * @return Region of interest centre instrument direction.
98  *
99  * Returns the instrument direction of the region of interest centre.
100  ***************************************************************************/
101 inline
102 const GLATInstDir& GLATRoi::centre(void) const
103 {
104  return (m_centre);
105 }
106 
107 
108 /***********************************************************************//**
109  * @brief Returns radius of region of interest in degrees
110  *
111  * @return Region of interest radius (degrees).
112  *
113  * Returns the radius of the region of interest in degrees.
114  ***************************************************************************/
115 inline
116 const double& GLATRoi::radius(void) const
117 {
118  return (m_radius);
119 }
120 
121 
122 /***********************************************************************//**
123  * @brief Set region of interest centre
124  *
125  * @param[in] centre Region of interest centre instrument direction.
126  *
127  * Set the instrument direction of the region of interest centre.
128  ***************************************************************************/
129 inline
131 {
132  m_centre = centre;
133  return;
134 }
135 
136 
137 /***********************************************************************//**
138  * @brief Set radius of region of interest
139  *
140  * @param[in] radius Region of interest radius (degrees).
141  *
142  * Set the radius of the region of interest.
143  ***************************************************************************/
144 inline
145 void GLATRoi::radius(const double& radius)
146 {
147  m_radius = radius;
148  return;
149 }
150 
151 #endif /* GLATROI_HPP */
void free_members(void)
Delete class members.
Definition: GLATRoi.cpp:281
Fermi/LAT instrument direction class.
Definition: GLATInstDir.hpp:48
virtual GLATRoi * clone(void) const
Clone region of interest.
Definition: GLATRoi.cpp:180
double m_radius
Radius of ROI in degrees.
Definition: GLATRoi.hpp:78
Abstract interface for the event classes.
Definition: GEvent.hpp:71
const double & radius(void) const
Returns radius of region of interest in degrees.
Definition: GLATRoi.hpp:116
Abstract Region of interest base class definition.
GLATRoi & operator=(const GLATRoi &roi)
Assignment operator.
Definition: GLATRoi.cpp:127
std::string centre(const std::string &s, const int &n, const char &c= ' ')
Centre string to achieve a length of n characters.
Definition: GTools.cpp:1118
virtual bool contains(const GEvent &event) const
Check if region of interest contains an event.
Definition: GLATRoi.cpp:191
virtual std::string print(const GChatter &chatter=NORMAL) const
Print region of interest information.
Definition: GLATRoi.cpp:218
void init_members(void)
Initialise class members.
Definition: GLATRoi.cpp:251
GChatter
Definition: GTypemaps.hpp:33
virtual void clear(void)
Clear region of interest.
Definition: GLATRoi.cpp:160
GLATRoi(void)
Void constructor.
Definition: GLATRoi.cpp:54
virtual ~GLATRoi(void)
Destructor.
Definition: GLATRoi.cpp:105
Fermi/LAT instrument direction class definition.
virtual std::string classname(void) const
Return class name.
Definition: GLATRoi.hpp:88
void copy_members(const GLATRoi &roi)
Copy class members.
Definition: GLATRoi.cpp:267
GLATInstDir m_centre
Centre of ROI in instrument coordinates.
Definition: GLATRoi.hpp:77
Interface for the region of interest classes.
Definition: GRoi.hpp:48
const GLATInstDir & centre(void) const
Returns region of interest centre.
Definition: GLATRoi.hpp:102
Fermi/LAT region of interest class.
Definition: GLATRoi.hpp:45