GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAPointing.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAPointing.hpp - CTA pointing class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2019 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 GCTAPointing.hpp
23  * @brief CTA pointing class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAPOINTING_HPP
28 #define GCTAPOINTING_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GMatrix.hpp"
33 #include "GNodeArray.hpp"
34 #include "GSkyDir.hpp"
35 
36 /* __ Forward declarations _______________________________________________ */
37 class GFilename;
38 class GXmlElement;
39 class GCTAInstDir;
40 
41 
42 /***********************************************************************//**
43  * @class GCTAPointing
44  *
45  * @brief CTA pointing class.
46  *
47  * This class implements a CTA pointing. For the time being it is assumed
48  * that the pointing direction is time-independent.
49  *
50  * @todo No transformation from sky coordinates to geographic coordinates
51  * has so far been implemented. The azimuth and zenith angle are not
52  * meaningful.
53  ***************************************************************************/
54 class GCTAPointing : public GBase {
55 
56 public:
57  // Constructors and destructors
58  GCTAPointing(void);
59  explicit GCTAPointing(const GSkyDir& dir);
60  explicit GCTAPointing(const GXmlElement& xml);
61  GCTAPointing(const GCTAPointing& pnt);
62  virtual ~GCTAPointing(void);
63 
64  // Operators
65  virtual GCTAPointing& operator=(const GCTAPointing& pnt);
66 
67  // Methods
68  void clear(void);
69  GCTAPointing* clone(void) const;
70  std::string classname(void) const;
71  const bool& is_valid(void) const;
72  const GSkyDir& dir(void) const;
73  void dir(const GSkyDir& dir);
74  GCTAInstDir instdir(const GSkyDir& skydir) const;
75  GSkyDir skydir(const GCTAInstDir& instdir) const;
76  const GMatrix& rot(void) const;
77  const double& zenith(void) const;
78  const double& azimuth(void) const;
79  void zenith(const double& zenith);
80  void azimuth(const double& azimuth);
81  void read(const GXmlElement& xml);
82  void write(GXmlElement& xml) const;
83  std::string print(const GChatter& chatter = NORMAL) const;
84 
85 protected:
86  // Protected methods
87  void init_members(void);
88  void copy_members(const GCTAPointing& pnt);
89  void free_members(void);
90  void update(void) const;
91 
92  // Protected members
93  GSkyDir m_dir; //!< Pointing direction in sky coordinates
94  bool m_valid; //!< Validity flag
95  double m_zenith; //!< Pointing zenith angle (deg)
96  double m_azimuth; //!< Pointing azimuth angle (deg)
97 
98  // Cached members
99  mutable bool m_has_cache; //!< Has transformation cache
100  mutable GMatrix m_Rback; //!< Rotation matrix
101 };
102 
103 
104 /***********************************************************************//**
105  * @brief Return class name
106  *
107  * @return String containing the class name ("GCTAPointing").
108  ***************************************************************************/
109 inline
110 std::string GCTAPointing::classname(void) const
111 {
112  return ("GCTAPointing");
113 }
114 
115 
116 /***********************************************************************//**
117  * @brief Return pointing sky direction
118  *
119  * @return Pointing sky direction.
120  ***************************************************************************/
121 inline
122 const GSkyDir& GCTAPointing::dir(void) const
123 {
124  return m_dir;
125 }
126 
127 
128 /***********************************************************************//**
129  * @brief Return pointing zenith angle
130  *
131  * @return Pointing zenith angle (deg).
132  ***************************************************************************/
133 inline
134 const double& GCTAPointing::zenith(void) const
135 {
136  return m_zenith;
137 }
138 
139 
140 /***********************************************************************//**
141  * @brief Return pointing azimuth angle
142  *
143  * @return Pointing azimuth angle (deg).
144  ***************************************************************************/
145 inline
146 const double& GCTAPointing::azimuth(void) const
147 {
148  return m_azimuth;
149 }
150 
151 /***********************************************************************//**
152  * @brief assign zenith angle
153  *
154  * @param[in] zenith The zenith angle (deg).
155  ***************************************************************************/
156 inline
157 void GCTAPointing::zenith(const double& zenith)
158 {
159  m_zenith = zenith;
160 }
161 
162 
163 /***********************************************************************//**
164  * @brief assign azimuth angle
165  *
166  * @param[in] azimuth The azimuth angle (deg).
167  ***************************************************************************/
168 inline
169 void GCTAPointing::azimuth(const double& azimuth)
170 {
171  m_azimuth = azimuth;
172 }
173 
174 
175 /***********************************************************************//**
176  * @brief Checks if pointing is valid
177  *
178  * @return True if pointing information is valid.
179  ***************************************************************************/
180 inline
181 const bool& GCTAPointing::is_valid(void) const
182 {
183  return m_valid;
184 }
185 
186 #endif /* GCTAPOINTING_HPP */
void clear(void)
Clear CTA pointing.
GMatrix m_Rback
Rotation matrix.
const bool & is_valid(void) const
Checks if pointing is valid.
GSkyDir skydir(const GCTAInstDir &instdir) const
Get sky direction direction from instrument direction.
Sky direction class interface definition.
Generic matrix class definition.
XML element node class.
Definition: GXmlElement.hpp:47
virtual ~GCTAPointing(void)
Destructor.
const double & zenith(void) const
Return pointing zenith angle.
void free_members(void)
Delete class members.
void read(const GXmlElement &xml)
Read pointing from XML element.
void write(GXmlElement &xml) const
Write pointing information into XML element.
bool m_has_cache
Has transformation cache.
Node array class interface definition.
double m_zenith
Pointing zenith angle (deg)
const GMatrix & rot(void) const
Return rotation matrix.
Filename class.
Definition: GFilename.hpp:62
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
double m_azimuth
Pointing azimuth angle (deg)
GCTAInstDir instdir(const GSkyDir &skydir) const
Get instrument direction from sky direction.
CTA pointing class.
GCTAPointing * clone(void) const
Clone CTA pointing.
std::string classname(void) const
Return class name.
GChatter
Definition: GTypemaps.hpp:33
virtual GCTAPointing & operator=(const GCTAPointing &pnt)
Assignment operator.
const double & azimuth(void) const
Return pointing azimuth angle.
bool m_valid
Validity flag.
std::string print(const GChatter &chatter=NORMAL) const
Print CTA pointing information.
void copy_members(const GCTAPointing &pnt)
Copy class members.
CTA instrument direction class.
Definition: GCTAInstDir.hpp:59
const GSkyDir & dir(void) const
Return pointing sky direction.
Generic matrix class definition.
Definition: GMatrix.hpp:79
Sky direction class.
Definition: GSkyDir.hpp:62
void update(void) const
Update coordinate transformation cache.
GSkyDir m_dir
Pointing direction in sky coordinates.
GCTAPointing(void)
Void constructor.
void init_members(void)
Initialise class members.