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