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