GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMOad.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMOad.hpp - COMPTEL Orbit Aspect Data class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2017 by Juergen 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 GCOMOad.hpp
23  * @brief COMPTEL Orbit Aspect Data class definition
24  * @author Juergen Knodlseder
25  */
26 
27 #ifndef GCOMOAD_HPP
28 #define GCOMOAD_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GBase.hpp"
33 #include "GTime.hpp"
34 #include "GSkyDir.hpp"
35 
36 /* __ Forward declarations _______________________________________________ */
37 
38 /* __ Constants __________________________________________________________ */
39 
40 
41 /***********************************************************************//**
42  * @class GCOMOad
43  *
44  * @brief COMPTEL Orbit Aspect Data class
45  *
46  * The class holds one record of a COMPTEL Orbit Aspect Data file.
47  ***************************************************************************/
48 class GCOMOad : public GBase {
49 
50 public:
51  // Constructors and destructors
52  GCOMOad(void);
53  GCOMOad(const GCOMOad& oad);
54  virtual ~GCOMOad(void);
55 
56  // Operators
57  GCOMOad& operator=(const GCOMOad& oad);
58 
59  // Implemented pure virtual base class methods
60  virtual void clear(void);
61  virtual GCOMOad* clone(void) const;
62  virtual std::string classname(void) const;
63  virtual std::string print(const GChatter& chatter = NORMAL) const;
64 
65  // Other methods
66  const GTime& tstart(void) const;
67  void tstart(const GTime& tstart);
68  const GTime& tstop(void) const;
69  void tstop(const GTime& tstop);
70  const int& tjd(void) const;
71  void tjd(const int& tjd);
72  const int& tics(void) const;
73  void tics(const int& tics);
74  const float& gcaz(void) const;
75  void gcaz(const float& gcaz);
76  const float& gcel(void) const;
77  void gcel(const float& gcel);
78  const float& georad(void) const;
79  void georad(const float& georad);
80  const GSkyDir& zaxis(void) const;
81  void zaxis(const GSkyDir& zaxis);
82  const GSkyDir& xaxis(void) const;
83  void xaxis(const GSkyDir& xaxis);
84  double theta(const GSkyDir& sky) const;
85  double phi(const GSkyDir& sky) const;
86 
87 protected:
88  // Protected methods
89  void init_members(void);
90  void copy_members(const GCOMOad& oad);
91  void free_members(void);
92 
93  // Protected members
94  GTime m_tstart; //!< Start time of superpacket
95  GTime m_tstop; //!< Stop time of superpacket
96  GSkyDir m_zaxis; //!< Telescope z-axis
97  GSkyDir m_xaxis; //!< Telescope x-axis
98  int m_tjd; //!< TJD of OAD record
99  int m_tics; //!< Tics of OAD record
100  float m_gcaz; //!< Geocentre azimuth angle (deg)
101  float m_gcel; //!< Geocentre zenith angle (deg)
102  float m_georad; //!< Apparent radius of Earth (deg)
103 
104  // Precomputation cache
105  mutable double m_posang; //!< X-axis position angle in COMPTEL system
106 };
107 
108 
109 /***********************************************************************//**
110  * @brief Return class name
111  *
112  * @return String containing the class name ("GCOMOad").
113  ***************************************************************************/
114 inline
115 std::string GCOMOad::classname(void) const
116 {
117  return ("GCOMOad");
118 }
119 
120 
121 /***********************************************************************//**
122  * @brief Return start time of superpacket
123  *
124  * @return Start time of superpacket.
125  *
126  * Returns the start time of the superpacket.
127  ***************************************************************************/
128 inline
129 const GTime& GCOMOad::tstart(void) const
130 {
131  return (m_tstart);
132 }
133 
134 
135 /***********************************************************************//**
136  * @brief Set start time of superpacket
137  *
138  * @param[in] tstart Start time of superpacket.
139  *
140  * Set the start time of the superpacket.
141  ***************************************************************************/
142 inline
143 void GCOMOad::tstart(const GTime& tstart)
144 {
145  m_tstart = tstart;
146  return;
147 }
148 
149 
150 /***********************************************************************//**
151  * @brief Return stop time of superpacket
152  *
153  * @return Stop time of superpacket.
154  *
155  * Returns the stop time of the superpacket. The stop time is defined as the
156  * start time plus 131071 tics, since the length of one superpacket is
157  * 16.384 secs, i.e. 16.384 * 8000 = 131072 ticks.
158  ***************************************************************************/
159 inline
160 const GTime& GCOMOad::tstop(void) const
161 {
162  return (m_tstop);
163 }
164 
165 
166 /***********************************************************************//**
167  * @brief Set stop time of superpacket
168  *
169  * @param[in] tstop Stop time of superpacket.
170  *
171  * Set the stop time of the superpacket.
172  ***************************************************************************/
173 inline
174 void GCOMOad::tstop(const GTime& tstop)
175 {
176  m_tstop = tstop;
177  return;
178 }
179 
180 
181 /***********************************************************************//**
182  * @brief Return Truncated Julian Days of Orbit Aspect Record
183  *
184  * @return Truncated Julian Days of Orbit Aspect Record.
185  *
186  * Returns the Truncated Julian Days of the Orbit Aspect Record.
187  ***************************************************************************/
188 inline
189 const int& GCOMOad::tjd(void) const
190 {
191  return (m_tjd);
192 }
193 
194 
195 /***********************************************************************//**
196  * @brief Set Truncated Julian Days of Orbit Aspect Record
197  *
198  * @param[in] tjd Truncated Julian Days of Orbit Aspect Record.
199  *
200  * Set the Truncated Julian Days of the Orbit Aspect Record.
201  ***************************************************************************/
202 inline
203 void GCOMOad::tjd(const int& tjd)
204 {
205  m_tjd = tjd;
206  return;
207 }
208 
209 
210 /***********************************************************************//**
211  * @brief Return tics of Orbit Aspect Record
212  *
213  * @return Tics of Orbit Aspect Record.
214  *
215  * Returns the tics of the Orbit Aspect Record.
216  ***************************************************************************/
217 inline
218 const int& GCOMOad::tics(void) const
219 {
220  return (m_tics);
221 }
222 
223 
224 /***********************************************************************//**
225  * @brief Set tics of Orbit Aspect Record
226  *
227  * @param[in] tics Tics of Orbit Aspect Record.
228  *
229  * Set the tics of the Orbit Aspect Record.
230  ***************************************************************************/
231 inline
232 void GCOMOad::tics(const int& tics)
233 {
234  m_tics = tics;
235  return;
236 }
237 
238 
239 /***********************************************************************//**
240  * @brief Return Geocentre azimuth angle
241  *
242  * @return Geocentre azimuth angle (deg).
243  *
244  * Returns the Geocentre azimuth angle in degrees.
245  ***************************************************************************/
246 inline
247 const float& GCOMOad::gcaz(void) const
248 {
249  return (m_gcaz);
250 }
251 
252 
253 /***********************************************************************//**
254  * @brief Set Geocentre azimuth angle
255  *
256  * @param[in] gcaz Geocentre azimuth angle (deg).
257  *
258  * Set the Geocentre azimuth angle.
259  ***************************************************************************/
260 inline
261 void GCOMOad::gcaz(const float& gcaz)
262 {
263  m_gcaz = gcaz;
264  return;
265 }
266 
267 
268 /***********************************************************************//**
269  * @brief Return Geocentre zenith angle
270  *
271  * @return Geocentre zenith angle (deg).
272  *
273  * Returns the Geocentre zenith angle in degrees.
274  ***************************************************************************/
275 inline
276 const float& GCOMOad::gcel(void) const
277 {
278  return (m_gcel);
279 }
280 
281 
282 /***********************************************************************//**
283  * @brief Set Geocentre zenith angle
284  *
285  * @param[in] gcel Geocentre zenith angle (deg).
286  *
287  * Set the Geocentre zenith angle.
288  ***************************************************************************/
289 inline
290 void GCOMOad::gcel(const float& gcel)
291 {
292  m_gcel = gcel;
293  return;
294 }
295 
296 
297 /***********************************************************************//**
298  * @brief Return apparent radius of Earth
299  *
300  * @return Apparent radius of Earth (deg).
301  *
302  * Returns the apparent radius of Earth in degrees.
303  ***************************************************************************/
304 inline
305 const float& GCOMOad::georad(void) const
306 {
307  return (m_georad);
308 }
309 
310 
311 /***********************************************************************//**
312  * @brief Set apparent radius of Earth
313  *
314  * @param[in] georad Apparent radius of Earth (deg).
315  *
316  * Set the apparent radius of Earth.
317  ***************************************************************************/
318 inline
319 void GCOMOad::georad(const float& georad)
320 {
321  m_georad = georad;
322  return;
323 }
324 
325 
326 /***********************************************************************//**
327  * @brief Return telescope Z-axis
328  *
329  * @return Telescope Z-axis.
330  *
331  * Returns the telescope Z-axis.
332  ***************************************************************************/
333 inline
334 const GSkyDir& GCOMOad::zaxis(void) const
335 {
336  return (m_zaxis);
337 }
338 
339 
340 /***********************************************************************//**
341  * @brief Set telescope Z-axis
342  *
343  * @param[in] zaxis Telescope Z-axis.
344  *
345  * Set the telescope Z-axis.
346  ***************************************************************************/
347 inline
348 void GCOMOad::zaxis(const GSkyDir& zaxis)
349 {
350  m_posang = 1.0e30; // To assure initialisation of position angle
351  m_zaxis = zaxis;
352  return;
353 }
354 
355 
356 /***********************************************************************//**
357  * @brief Return telescope X-axis
358  *
359  * @return Telescope X-axis.
360  *
361  * Returns the telescope X-axis.
362  ***************************************************************************/
363 inline
364 const GSkyDir& GCOMOad::xaxis(void) const
365 {
366  return (m_xaxis);
367 }
368 
369 
370 /***********************************************************************//**
371  * @brief Set telescope X-axis
372  *
373  * @param[in] xaxis Telescope X-axis.
374  *
375  * Set the telescope X-axis.
376  ***************************************************************************/
377 inline
378 void GCOMOad::xaxis(const GSkyDir& xaxis)
379 {
380  m_posang = 1.0e30; // To assure initialisation of position angle
381  m_xaxis = xaxis;
382  return;
383 }
384 
385 
386 /***********************************************************************//**
387  * @brief Return zenith angle of sky direction in COMPTEL coordinates
388  *
389  * @param[in] sky Sky direction.
390  * @return Zenith angle of sky direction in COMPTEL coordinates (deg).
391  *
392  * Returns the zenith angle of a sky direction in COMPTEL coordinates.
393  ***************************************************************************/
394 inline
395 double GCOMOad::theta(const GSkyDir& sky) const
396 {
397  return (m_zaxis.dist_deg(sky));
398 }
399 
400 
401 /***********************************************************************//**
402  * @brief Return azimuth angle of sky direction in COMPTEL coordinates
403  *
404  * @param[in] sky Sky direction.
405  * @return Azimuth angle of sky direction in COMPTEL coordinates (deg).
406  *
407  * Returns the azimuth angle of a sky direction in COMPTEL coordinates.
408  ***************************************************************************/
409 inline
410 double GCOMOad::phi(const GSkyDir& sky) const
411 {
412  // If position angle has not be initialised the do it now
413  if (m_posang > 1.0e20) {
415  }
416  //return (m_zaxis.posang_deg(m_xaxis) - m_zaxis.posang_deg(sky));
417  return (m_posang - m_zaxis.posang_deg(sky));
418 }
419 
420 #endif /* GCOMOAD_HPP */
GSkyDir m_zaxis
Telescope z-axis.
Definition: GCOMOad.hpp:96
double dist_deg(const GSkyDir &dir) const
Compute angular distance between sky directions in degrees.
Definition: GSkyDir.hpp:280
virtual ~GCOMOad(void)
Destructor.
Definition: GCOMOad.cpp:84
Sky direction class interface definition.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL Orbit Aspect Data.
Definition: GCOMOad.cpp:166
GSkyDir m_xaxis
Telescope x-axis.
Definition: GCOMOad.hpp:97
GCOMOad(void)
Void constructor.
Definition: GCOMOad.cpp:53
Definition of interface for all GammaLib classes.
const float & gcel(void) const
Return Geocentre zenith angle.
Definition: GCOMOad.hpp:276
int m_tics
Tics of OAD record.
Definition: GCOMOad.hpp:99
double phi(const GSkyDir &sky) const
Return azimuth angle of sky direction in COMPTEL coordinates.
Definition: GCOMOad.hpp:410
const GSkyDir & xaxis(void) const
Return telescope X-axis.
Definition: GCOMOad.hpp:364
Time class.
Definition: GTime.hpp:54
const GTime & tstop(void) const
Return stop time of superpacket.
Definition: GCOMOad.hpp:160
GTime m_tstop
Stop time of superpacket.
Definition: GCOMOad.hpp:95
const float & georad(void) const
Return apparent radius of Earth.
Definition: GCOMOad.hpp:305
COMPTEL Orbit Aspect Data class.
Definition: GCOMOad.hpp:48
const GTime & tstart(void) const
Return start time of superpacket.
Definition: GCOMOad.hpp:129
double posang_deg(const GSkyDir &dir) const
Compute position angle between sky directions in degrees.
Definition: GSkyDir.hpp:298
void free_members(void)
Delete class members.
Definition: GCOMOad.cpp:254
const GSkyDir & zaxis(void) const
Return telescope Z-axis.
Definition: GCOMOad.hpp:334
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
GChatter
Definition: GTypemaps.hpp:33
double m_posang
X-axis position angle in COMPTEL system.
Definition: GCOMOad.hpp:105
virtual void clear(void)
Clear COMPTEL Orbit Aspect Data.
Definition: GCOMOad.cpp:136
float m_gcaz
Geocentre azimuth angle (deg)
Definition: GCOMOad.hpp:100
float m_georad
Apparent radius of Earth (deg)
Definition: GCOMOad.hpp:102
void init_members(void)
Initialise class members.
Definition: GCOMOad.cpp:208
const int & tjd(void) const
Return Truncated Julian Days of Orbit Aspect Record.
Definition: GCOMOad.hpp:189
int m_tjd
TJD of OAD record.
Definition: GCOMOad.hpp:98
GTime m_tstart
Start time of superpacket.
Definition: GCOMOad.hpp:94
GCOMOad & operator=(const GCOMOad &oad)
Assignment operator.
Definition: GCOMOad.cpp:106
void copy_members(const GCOMOad &oad)
Copy class members.
Definition: GCOMOad.cpp:232
float m_gcel
Geocentre zenith angle (deg)
Definition: GCOMOad.hpp:101
const int & tics(void) const
Return tics of Orbit Aspect Record.
Definition: GCOMOad.hpp:218
Sky direction class.
Definition: GSkyDir.hpp:62
Time class interface definition.
virtual GCOMOad * clone(void) const
Clone COMPTEL Orbit Aspect Data.
Definition: GCOMOad.cpp:154
virtual std::string classname(void) const
Return class name.
Definition: GCOMOad.hpp:115
double theta(const GSkyDir &sky) const
Return zenith angle of sky direction in COMPTEL coordinates.
Definition: GCOMOad.hpp:395
const float & gcaz(void) const
Return Geocentre azimuth angle.
Definition: GCOMOad.hpp:247