GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMBvcs.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMBvcs.cpp - COMPTEL Solar System Barycentre Data container class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 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 GCOMBvcs.hpp
23  * @brief COMPTEL Solar System Barycentre Data container class implementation
24  * @author Juergen Knodlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include <cstdlib> // for std::abs(int)
32 #include "GException.hpp"
33 #include "GMath.hpp"
34 #include "GFits.hpp"
35 #include "GFitsTable.hpp"
36 #include "GCOMTools.hpp"
37 #include "GCOMSupport.hpp"
38 #include "GCOMBvcs.hpp"
39 #include "GCOMOad.hpp"
40 
41 /* __ Method name definitions ____________________________________________ */
42 #define G_AT "GCOMBvcs::at(int&)"
43 #define G_INSERT "GCOMBvcs::insert(int&, GCOMBvc&)"
44 #define G_REMOVE "GCOMBvcs::remove(int&)"
45 #define G_READ "GCOMBvcs::read(GFitsTable&)"
46 #define G_TDELTA "GCOMBvcs::tdelta(GSkyDir&, GTime&)"
47 
48 /* __ Macros _____________________________________________________________ */
49 
50 /* __ Coding definitions _________________________________________________ */
51 
52 /* __ Debug definitions __________________________________________________ */
53 
54 
55 /*==========================================================================
56  = =
57  = Constructors/destructors =
58  = =
59  ==========================================================================*/
60 
61 /***********************************************************************//**
62  * @brief Void constructor
63  *
64  * Constructs an empty COMPTEL Solar System Barycentre Data container
65  ***************************************************************************/
67 {
68  // Initialise class members
69  init_members();
70 
71  // Return
72  return;
73 }
74 
75 
76 /***********************************************************************//**
77  * @brief Filename constructor
78  *
79  * @param[in] filename COMPTEL Solar System Barycentre Data FITS file
80  *
81  * Constructs a COMPTEL Solar System Barycentre Data container from a BVC
82  * FITS file.
83  ***************************************************************************/
84 GCOMBvcs::GCOMBvcs(const GFilename& filename)
85 {
86  // Initialise class members
87  init_members();
88 
89  // Load data
90  load(filename);
91 
92  // Return
93  return;
94 }
95 
96 
97 /***********************************************************************//**
98  * @brief Copy constructor
99  *
100  * @param[in] bvcs COMPTEL Solar System Barycentre Data container.
101  ***************************************************************************/
103 {
104  // Initialise class members
105  init_members();
106 
107  // Copy members
108  copy_members(bvcs);
109 
110  // Return
111  return;
112 }
113 
114 
115 /***********************************************************************//**
116  * @brief Destructor
117  ***************************************************************************/
119 {
120  // Free members
121  free_members();
122 
123  // Return
124  return;
125 }
126 
127 
128 /*==========================================================================
129  = =
130  = Operators =
131  = =
132  ==========================================================================*/
133 
134 /***********************************************************************//**
135  * @brief Assignment operator
136  *
137  * @param[in] bvcs COMPTEL Solar System Barycentre Data container.
138  * @return COMPTEL Solar System Barycentre Data container.
139  ***************************************************************************/
141 {
142  // Execute only if object is not identical
143  if (this != &bvcs) {
144 
145  // Free members
146  free_members();
147 
148  // Initialise private members
149  init_members();
150 
151  // Copy members
152  copy_members(bvcs);
153 
154  } // endif: object was not identical
155 
156  // Return this object
157  return *this;
158 }
159 
160 
161 /*==========================================================================
162  = =
163  = Public methods =
164  = =
165  ==========================================================================*/
166 
167 /***********************************************************************//**
168  * @brief Clear COMPTEL Solar System Barycentre Data container
169  ***************************************************************************/
170 void GCOMBvcs::clear(void)
171 {
172  // Free members
173  free_members();
174 
175  // Initialise private members
176  init_members();
177 
178  // Return
179  return;
180 }
181 
182 
183 /***********************************************************************//**
184  * @brief Clone COMPTEL Solar System Barycentre Data container
185  *
186  * @return Pointer to deep copy of COMPTEL Solar System Barycentre Data
187  * container.
188  ***************************************************************************/
190 {
191  return new GCOMBvcs(*this);
192 }
193 
194 
195 /***********************************************************************//**
196  * @brief Return reference to Solar System Barycentre Data
197  *
198  * @param[in] index Solar System Barycentre Data index [0,...,size()-1].
199  *
200  * @exception GException::out_of_range
201  * Solar System Barycentre Data index is out of range.
202  *
203  * Returns a reference to the Solar System Barycentre Data with the specified
204  * @p index.
205  ***************************************************************************/
206 GCOMBvc& GCOMBvcs::at(const int& index)
207 {
208  // Raise exception if index is out of range
209  if (index < 0 || index >= size()) {
210  throw GException::out_of_range(G_AT, "Solar System Barycentre Data index",
211  index, size());
212  }
213 
214  // Return reference
215  return m_bvcs[index];
216 }
217 
218 
219 /***********************************************************************//**
220  * @brief Return reference to Solar System Barycentre Data (const version)
221  *
222  * @param[in] index Solar System Barycentre Data index [0,...,size()-1].
223  *
224  * @exception GException::out_of_range
225  * Solar System Barycentre Data index is out of range.
226  *
227  * Returns a reference to the Solar System Barycentre Data with the specified
228  * @p index.
229  ***************************************************************************/
230 const GCOMBvc& GCOMBvcs::at(const int& index) const
231 {
232  // Raise exception if index is out of range
233  if (index < 0 || index >= size()) {
234  throw GException::out_of_range(G_AT, "Solar System Barycentre Data index",
235  index, size());
236  }
237 
238  // Return reference
239  return m_bvcs[index];
240 }
241 
242 
243 /***********************************************************************//**
244  * @brief Append Solar System Barycentre Data to container
245  *
246  * @param[in] bvc Solar System Barycentre Data.
247  * @return Reference to appended Solar System Barycentre Data.
248  *
249  * Appends Solar System Barycentre Data to the container by making a deep
250  * copy of the Solar System Barycentre Data.
251  ***************************************************************************/
253 {
254  // Append bvc to list
255  m_bvcs.push_back(bvc);
256 
257  // Return reference
258  return m_bvcs[size()-1];
259 }
260 
261 
262 /***********************************************************************//**
263  * @brief Insert Solar System Barycentre Data into container
264  *
265  * @param[in] index Solar System Barycentre Data index (0,...,size()-1).
266  * @param[in] bvc Solar System Barycentre Data.
267  *
268  * @exception GException::out_of_range
269  * Solar System Barycentre Data index is out of range.
270  *
271  * Inserts Solar System Barycentre Data into the container before the Solar
272  * System Barycentre Data with the specified @p index.
273  ***************************************************************************/
274 GCOMBvc& GCOMBvcs::insert(const int& index, const GCOMBvc& bvc)
275 {
276  // Compile option: raise exception if index is out of range
277  #if defined(G_RANGE_CHECK)
278  if (is_empty()) {
279  if (index > 0) {
281  "Solar System Barycentre Data index",
282  index, size());
283  }
284  }
285  else {
286  if (index < 0 || index >= size()) {
288  "Solar System Barycentre Data index",
289  index, size());
290  }
291  }
292  #endif
293 
294  // Inserts Solar System Barycentre Data
295  m_bvcs.insert(m_bvcs.begin()+index, bvc);
296 
297  // Return reference
298  return m_bvcs[index];
299 }
300 
301 
302 /***********************************************************************//**
303  * @brief Remove Solar System Barycentre Data from container
304  *
305  * @param[in] index Solar System Barycentre Data index (0,...,size()-1).
306  *
307  * @exception GException::out_of_range
308  * Solar System Barycentre Data index is out of range.
309  *
310  * Remove Solar System Barycentre Data of specified @p index from container.
311  ***************************************************************************/
312 void GCOMBvcs::remove(const int& index)
313 {
314  // Compile option: raise exception if index is out of range
315  #if defined(G_RANGE_CHECK)
316  if (index < 0 || index >= size()) {
318  "Solar System Barycentre Data index",
319  index, size());
320  }
321  #endif
322 
323  // Erase Solar System Barycentre Data from container
324  m_bvcs.erase(m_bvcs.begin() + index);
325 
326  // Return
327  return;
328 }
329 
330 
331 /***********************************************************************//**
332  * @brief Append Solar System Barycentre Data container
333  *
334  * @param[in] bvcs COMPTEL Solar System Barycentre Data container.
335  *
336  * Append COMPTEL Solar System Barycentre Data container to the container.
337  ***************************************************************************/
338 void GCOMBvcs::extend(const GCOMBvcs& bvcs)
339 {
340  // Do nothing if COMPTEL Solar System Barycentre Data container is empty
341  if (!bvcs.is_empty()) {
342 
343  // Get size. Note that we extract the size first to avoid an
344  // endless loop that arises when a container is appended to
345  // itself.
346  int num = bvcs.size();
347 
348  // Reserve enough space
349  reserve(size() + num);
350 
351  // Loop over all elements and append them to container
352  for (int i = 0; i < num; ++i) {
353  m_bvcs.push_back(bvcs[i]);
354  }
355 
356  } // endif: COMPTEL Solar System Barycentre Data container was not empty
357 
358  // Return
359  return;
360 }
361 
362 
363 /***********************************************************************//**
364  * @brief Load COMPTEL Solar System Barycentre Data FITS file
365  *
366  * @param[in] filename COMPTEL BVC FITS file name.
367  *
368  * Loads an COMPTEL Solar System Barycentre FITS file in the container.
369  ***************************************************************************/
370 void GCOMBvcs::load(const GFilename& filename)
371 {
372  // Open FITS file
373  GFits fits(filename);
374 
375  // Get HDU (pointer is always valid)
376  const GFitsTable& hdu = *fits.table(1);
377 
378  // Read Solar System Barycentre Data FITS table
379  read(hdu);
380 
381  // Close FITS file
382  fits.close();
383 
384  // Return
385  return;
386 }
387 
388 
389 /***********************************************************************//**
390  * @brief Read COMPTEL Solar System Barycentre Data FITS table
391  *
392  * @param[in] table COMPTEL BVC FITS table.
393  *
394  * Reads COMPTEL Solar System Barycentre Data FITS table into the container.
395  ***************************************************************************/
396 void GCOMBvcs::read(const GFitsTable& table)
397 {
398  // Clear
399  clear();
400 
401  // Extract number of records in FITS file
402  int num = table.nrows();
403 
404  // If there are records then load them
405  if (num > 0) {
406 
407  // Reserve data
408  m_bvcs.reserve(num);
409 
410  // Get column pointers
411  const GFitsTableCol* ptr_tjd = table["TJD"]; // days
412  const GFitsTableCol* ptr_tics = table["TICS"]; // ticks
413  const GFitsTableCol* ptr_ssbx = table["SSB_X"]; // km
414  const GFitsTableCol* ptr_ssby = table["SSB_Y"]; // km
415  const GFitsTableCol* ptr_ssbz = table["SSB_Z"]; // km
416  const GFitsTableCol* ptr_tdelta = table["TDELTA"]; // s
417 
418  // Copy data from columns into records
419  for (int i = 0; i < num; ++i) {
420 
421  // Allocate BVC record
422  GCOMBvc bvc;
423 
424  // Get time of record
425  int tjd = ptr_tjd->integer(i);
426  int tics = ptr_tics->integer(i);
427 
428  // Store time information, both as native COMPTEL time and as
429  // GTime object
430  bvc.tjd(tjd);
431  bvc.tics(tics);
432  bvc.time(gammalib::com_time(tjd, tics));
433 
434  // Set Solar System Barycentre vector in celestial system
435  GVector ssb(ptr_ssbx->real(i), ptr_ssby->real(i), ptr_ssbz->real(i));
436  bvc.ssb(ssb);
437 
438  // Set TDB-UTC time difference
439  bvc.tdelta(ptr_tdelta->real(i));
440 
441  // Append record
442  m_bvcs.push_back(bvc);
443 
444  } // endfor: looped over BVC records
445 
446  } // endif: there were records to load
447 
448  // Return
449  return;
450 }
451 
452 
453 /***********************************************************************//**
454  * @brief Find Solar System Barycentre Data for Orbit Aspect Data
455  *
456  * @param[in] oad Orbit Aspect Data.
457  * @return Pointer to Solar System Barycentre Data (NULL if no data were found)
458  *
459  * Finds Solar System Barycentre Data that correspond to the specified Orbit
460  * Aspect Data. The method returns the Solar System Barycentre Data with the
461  * same TJD as the Orbit Aspect Data and the smallest difference in the
462  * number of tics.
463  *
464  * If this smallest difference is larger than 131072, which is the length
465  * of one superpacket, the method returns a NULL pointer.
466  *
467  * The method also returns a NULL pointer in case that no matching Solar
468  * System Barycentre Data was found.
469  *
470  * The client needs to verify the validity of the Solar System Barycentre
471  * Data pointer. The client must not deallocate the associated memory.
472  ***************************************************************************/
473 const GCOMBvc* GCOMBvcs::find(const GCOMOad& oad) const
474 {
475  // Initialise Solar System Barycentre Data
476  const GCOMBvc* bvc = NULL;
477 
478  // Compute TJD and tics at the centre of the OAD superpacket
479  int oad_tjd = oad.tjd();
480  int oad_tics = oad.tics() + 65536;
481 
482  // Loop over all records and among those that have the same TJD find
483  // the one with the closest number of tics
484  int size = this->size();
485  int max_tics_difference = 700000000;
486  int ibest = -1;
487  for (int i = 0; i < size; ++i) {
488  if (m_bvcs[i].tjd() == oad_tjd) {
489  int tics_difference = std::abs(m_bvcs[i].tics() - oad_tics);
490  if (tics_difference < max_tics_difference) {
491  ibest = i;
492  max_tics_difference = tics_difference;
493  }
494  }
495  }
496 
497  // If matching Solar System Barycentre Data were found then check
498  // whether the tics difference is acceptable. A maximum difference
499  // of 131072 tics, corresponding to the duration of one superpacket
500  // of 16.384 sec, is considered as acceptable.
501  if (ibest >= 0) {
502  if (max_tics_difference < 131072) {
503  bvc = &(m_bvcs[ibest]);
504  }
505  }
506 
507  // Return Solar System Barycentre Data
508  return bvc;
509 }
510 
511 
512 /***********************************************************************//**
513  * @brief Return time difference between photon arrival time at CGRO and
514  * the Solar System Barycentre (SSB)
515  *
516  * @param[in] dir Source position.
517  * @param[in] time CGRO photon arrival time.
518  * @return Time difference between photon arrival times (s)
519  *
520  * @exception GException::invalid_value
521  * Not enough SSB vectors loaded for computation
522  *
523  * Returns the time difference between photon arrival time at CGRO and the
524  * Solar System Barycentre (SSB). The arrival time at the SSB is computed
525  * by adding the time difference to the photon arrival time as measured by
526  * COMPTEL
527  *
528  * \f[
529  * T_{\rm SSB} = T_{\rm CGRO} + \Delta T
530  * \f]
531  *
532  * The routine implements the algorithm PUL-AL-004 and is inspried from the
533  * COMPASS code evpbin02.pulssb.f.
534  *
535  * It computes
536  *
537  * \f[
538  * \Delta T = \Delta T_{\rm travel} - \Delta T_{\rm rel} + \Delta T_{\rm BVC}
539  * \f]
540  *
541  * where
542  *
543  * \f[
544  * \Delta T_{\rm travel} = \left( \vec{SSB} \cdot \vec{n} \right) \times 10^{-6}
545  * \f]
546  *
547  * is the light travel time in seconds between CGRO and the SSB, with
548  * \f$\vec{SSB}\f$ being the vector going from the SSB to CGRO, and
549  * \f$\vec{n}\f$ is the normalised vector of the source position, provided
550  * by the GSkyDir::celvector() method,
551  *
552  * \f[
553  * \Delta T_{\rm rel} =
554  * -2 R \log \left( 1 + \frac{\Delta T_{\rm travel}}{|\vec{SSB}| * 10^{-6}} \right)
555  * \f]
556  *
557  * is the relativistic delay due to the Sun in seconds, with
558  * \f$R=0.49254909 \times 10^{-5}\f$ s, and \f$\Delta T_{\rm BVC}\f$ is the
559  * difference in seconds due to the time unit conversion.
560  *
561  * The values of \f$\vec{SSB}\f$ and \f$\Delta T_{\rm BVC}\f$ are linearly
562  * interpolated from the tabulated values based on the specified @p time.
563  ***************************************************************************/
564 double GCOMBvcs::tdelta(const GSkyDir& dir, const GTime& time) const
565 {
566  // Set Schwartzschild radius of sun in lightseconds
567  const double t_sun = 4.92549089483e-6;
568 
569  // Initialise SSB vector and time difference
570  GVector ssb;
571  double tdelta = 0.0;
572 
573  // Get number of elements in container
574  int size = this->size();
575 
576  // Throw an exception if no vectors were loaded
577  if (size < 2) {
578  std::string msg = gammalib::str(size)+" SSB vectors loaded but at "
579  "least two vectors are needed to compute the time "
580  "delay. Please load SSB vectors from a BVC file "
581  "before calling this method.";
583  }
584 
585  // If time is before first BVC element then extrapolate using the first
586  // two BVC elements
587  if (time < m_bvcs[0].time()) {
588  int ilow = 0;
589  int iup = 1;
590  double wlow = (m_bvcs[iup].time() - time) / (m_bvcs[iup].time() - m_bvcs[ilow].time());
591  double wup = 1.0 - wlow;
592  ssb = wlow * m_bvcs[ilow].ssb() + wup * m_bvcs[iup].ssb();
593  tdelta = wlow * m_bvcs[ilow].tdelta() + wup * m_bvcs[iup].tdelta();
594  }
595 
596  // ... else if time is after last BVC element then extrapolate using the last
597  // two BVC elements
598  else if (time > m_bvcs[size-1].time()) {
599  int ilow = size-2;
600  int iup = size-1;
601  double wlow = (m_bvcs[iup].time() - time) / (m_bvcs[iup].time() - m_bvcs[ilow].time());
602  double wup = 1.0 - wlow;
603  ssb = wlow * m_bvcs[ilow].ssb() + wup * m_bvcs[iup].ssb();
604  tdelta = wlow * m_bvcs[ilow].tdelta() + wup * m_bvcs[iup].tdelta();
605  }
606 
607  // ... otherwise time is comprised in the elements hence we search for
608  // the bracketing elements and perform a linear interpolation of the
609  // vector and time delay
610  else {
611 
612  // Compute TJD and tics from CGRO photon arrival time
613  int tjd = gammalib::com_tjd(time);
614  int tics = gammalib::com_tics(time);
615 
616  // Loop over all records and among those that have the same TJD find
617  // the one with the closest number of tics
618  int max_tics_difference = 700000000;
619  int ibest = -1;
620  for (int i = 0; i < size; ++i) {
621  if (m_bvcs[i].tjd() == tjd) {
622  int tics_difference = std::abs(m_bvcs[i].tics() - tics);
623  if (tics_difference < max_tics_difference) {
624  ibest = i;
625  max_tics_difference = tics_difference;
626  }
627  }
628  }
629 
630  // Find bracketing records and interpolating weighting factors
631  int ilow = -1;
632  int iup = -1;
633  double wlow = 0.0;
634  double wup = 0.0;
635  if (m_bvcs[ibest].tics() <= tics) {
636  ilow = ibest;
637  if (ibest < size-1) {
638  iup = ibest + 1;
639  wlow = (m_bvcs[iup].time() - time) / (m_bvcs[iup].time() - m_bvcs[ilow].time());
640  wup = 1.0 - wlow;
641  }
642  else {
643  iup = ibest;
644  wlow = 1.0;
645  }
646  }
647  else {
648  iup = ibest;
649  if (ibest > 0) {
650  ilow = ibest - 1;
651  wlow = (m_bvcs[iup].time() - time) / (m_bvcs[iup].time() - m_bvcs[ilow].time());
652  wup = 1.0 - wlow;
653  }
654  else {
655  ilow = ibest;
656  wup = 1.0;
657  }
658  }
659 
660  // Interpolate vector and time difference
661  ssb = wlow * m_bvcs[ilow].ssb() + wup * m_bvcs[iup].ssb();
662  tdelta = wlow * m_bvcs[ilow].tdelta() + wup * m_bvcs[iup].tdelta();
663 
664  } // endelse: performed linear interpolation
665 
666  // Get celestial vector
667  GVector n = dir.celvector();
668 
669  // Compute the light travel time from the satellite to SSB along the
670  // pulsar direction
671  double travt = ssb * n * 1.0e-6;
672 
673  // Compute the relativistic delay due to the Sun
674  double r = norm(ssb) * 1.0e-6;
675  double relat = -2.0 * t_sun * std::log(1.0 + (travt/r));
676 
677  // Compute the time difference at SSB
678  tdelta = travt - relat + tdelta;
679 
680  // Return
681  return tdelta;
682 }
683 
684 
685 /***********************************************************************//**
686  * @brief Print COMPTEL Solar System Barycentre Data container
687  *
688  * @param[in] chatter Chattiness.
689  * @return String containing COMPTEL Solar System Barycentre Data container
690  * information.
691  ***************************************************************************/
692 std::string GCOMBvcs::print(const GChatter& chatter) const
693 {
694  // Initialise result string
695  std::string result;
696 
697  // Continue only if chatter is not silent
698  if (chatter != SILENT) {
699 
700  // Append header
701  result.append("=== GCOMBvcs ===");
702 
703  // Append container information
704  result.append("\n"+gammalib::parformat("Superpackets"));
705  result.append(gammalib::str(size()));
706  if (size() > 0) {
707 
708  // Append time range
709  result.append("\n"+gammalib::parformat("TJD range"));
710  result.append(gammalib::str(m_bvcs[0].tjd()));
711  result.append(":");
712  result.append(gammalib::str(m_bvcs[0].tics()));
713  result.append(" - ");
714  result.append(gammalib::str(m_bvcs[size()-1].tjd()));
715  result.append(":");
716  result.append(gammalib::str(m_bvcs[size()-1].tics()));
717  result.append("\n"+gammalib::parformat("MJD range"));
718  result.append(gammalib::str(m_bvcs[0].time().mjd()));
719  result.append(" - ");
720  result.append(gammalib::str(m_bvcs[size()-1].time().mjd()));
721  result.append(" days");
722  result.append("\n"+gammalib::parformat("UTC range"));
723  result.append(m_bvcs[0].time().utc());
724  result.append(" - ");
725  result.append(m_bvcs[size()-1].time().utc());
726 
727  // Append detailed information
728  GChatter reduced_chatter = gammalib::reduce(chatter);
729  if (reduced_chatter > SILENT) {
730 
731  // Append TJDs
732  int tjd = 0;
733  int num = 0;
734  for (int i = 0; i < size(); ++i) {
735  if (m_bvcs[i].tjd() != tjd) {
736  if (num > 0) {
737  std::string key = "TJD "+gammalib::str(tjd);
738  result.append("\n"+gammalib::parformat(key));
739  result.append(gammalib::str(num)+" superpackets");
740  }
741  tjd = m_bvcs[i].tjd();
742  num = 1;
743  }
744  else {
745  num++;
746  }
747  }
748  std::string key = "TJD "+gammalib::str(tjd);
749  result.append("\n"+gammalib::parformat(key));
750  result.append(gammalib::str(num)+" superpackets");
751 
752  } // endif: detailed information requested
753 
754  } // endif: there were records
755 
756  } // endif: chatter was not silent
757 
758  // Return result
759  return result;
760 }
761 
762 
763 /*==========================================================================
764  = =
765  = Private methods =
766  = =
767  ==========================================================================*/
768 
769 /***********************************************************************//**
770  * @brief Initialise class members
771  ***************************************************************************/
773 {
774  // Initialise members
775  m_bvcs.clear();
776 
777  // Return
778  return;
779 }
780 
781 
782 /***********************************************************************//**
783  * @brief Copy class members
784  *
785  * @param[in] bvcs COMPTEL Solar System Barycentre Data container.
786  ***************************************************************************/
788 {
789  // Copy members
790  m_bvcs = bvcs.m_bvcs;
791 
792  // Return
793  return;
794 }
795 
796 
797 /***********************************************************************//**
798  * @brief Delete class members
799  ***************************************************************************/
801 {
802  // Return
803  return;
804 }
GCOMBvcs(void)
Void constructor.
Definition: GCOMBvcs.cpp:66
GFitsTable * table(const int &extno)
Get pointer to table HDU.
Definition: GFits.cpp:482
double norm(const GVector &vector)
Computes vector norm.
Definition: GVector.cpp:864
GCOMBvc & insert(const int &index, const GCOMBvc &bvc)
Insert Solar System Barycentre Data into container.
Definition: GCOMBvcs.cpp:274
Definition of COMPTEL tools.
GVector abs(const GVector &vector)
Computes absolute of vector elements.
Definition: GVector.cpp:1253
COMPTEL Solar System Barycentre Data container class definition.
COMPTEL Solar System Barycentre Data class.
Definition: GCOMBvc.hpp:49
GCOMBvcs & operator=(const GCOMBvcs &bvcs)
Assignment operator.
Definition: GCOMBvcs.cpp:140
void extend(const GCOMBvcs &bvcs)
Append Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:338
virtual ~GCOMBvcs(void)
Destructor.
Definition: GCOMBvcs.cpp:118
void remove(const int &index)
Remove Solar System Barycentre Data from container.
Definition: GCOMBvcs.cpp:312
Time class.
Definition: GTime.hpp:55
FITS file class.
Definition: GFits.hpp:63
FITS file class interface definition.
GTime com_time(const int &tjd, const int &tics)
Convert TJD and COMPTEL tics in GTime object.
Definition: GCOMTools.cpp:55
bool is_empty(void) const
Signals if there are no Solar System Barycentre Data in container.
Definition: GCOMBvcs.hpp:163
COMPTEL Orbit Aspect Data class.
Definition: GCOMOad.hpp:49
Implementation of support function used by COMPTEL classes.
void init_members(void)
Initialise class members.
Definition: GCOMBvcs.cpp:772
double tdelta(const GSkyDir &dir, const GTime &time) const
Return time difference between photon arrival time at CGRO and the Solar System Barycentre (SSB) ...
Definition: GCOMBvcs.cpp:564
#define G_REMOVE
Definition: GCOMBvcs.cpp:44
void read(const GFitsTable &table)
Read COMPTEL Solar System Barycentre Data FITS table.
Definition: GCOMBvcs.cpp:396
Filename class.
Definition: GFilename.hpp:62
GCOMBvcs * clone(void) const
Clone COMPTEL Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:189
Abstract interface for FITS table column.
void celvector(const GVector &vector)
Set sky direction from 3D vector in celestial coordinates.
Definition: GSkyDir.cpp:313
int com_tjd(const GTime &time)
Convert GTime in COMPTEL TJD.
Definition: GCOMTools.cpp:91
const GCOMBvc * find(const GCOMOad &oad) const
Find Solar System Barycentre Data for Orbit Aspect Data.
Definition: GCOMBvcs.cpp:473
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
Definition: GVector.cpp:1274
Abstract interface for FITS table.
Definition: GFitsTable.hpp:44
int size(void) const
Return number of Solar System Barycentre Data in container.
Definition: GCOMBvcs.hpp:148
GChatter
Definition: GTypemaps.hpp:33
const GVector & ssb(void) const
Return Solar System Barycentre vector.
Definition: GCOMBvc.hpp:205
#define G_AT
Definition: GCOMBvcs.cpp:42
const int & nrows(void) const
Return number of rows in table.
Definition: GFitsTable.hpp:119
void copy_members(const GCOMBvcs &bvcs)
Copy class members.
Definition: GCOMBvcs.cpp:787
std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:692
int com_tics(const GTime &time)
Convert GTime in COMPTEL tics.
Definition: GCOMTools.cpp:125
void reserve(const int &num)
Reserves space for Solar System Barycentre Data in container.
Definition: GCOMBvcs.hpp:177
virtual int integer(const int &row, const int &inx=0) const =0
const GTime & time(void) const
Return time of Solar System Barycentre Data.
Definition: GCOMBvc.hpp:115
virtual double real(const int &row, const int &inx=0) const =0
const int & tjd(void) const
Return Truncated Julian Days of Orbit Aspect Record.
Definition: GCOMOad.hpp:193
const int & tjd(void) const
Return Truncated Julian Days of Solar System Barycentre Data.
Definition: GCOMBvc.hpp:145
GCOMBvc & append(const GCOMBvc &bvc)
Append Solar System Barycentre Data to container.
Definition: GCOMBvcs.cpp:252
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
Definition: GTypemaps.hpp:65
#define G_INSERT
Definition: GCOMBvcs.cpp:43
void clear(void)
Clear COMPTEL Solar System Barycentre Data container.
Definition: GCOMBvcs.cpp:170
Exception handler interface definition.
GCOMBvc & at(const int &index)
Return reference to Solar System Barycentre Data.
Definition: GCOMBvcs.cpp:206
Vector class.
Definition: GVector.hpp:46
const int & tics(void) const
Return tics of Orbit Aspect Record.
Definition: GCOMOad.hpp:222
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition: GTools.cpp:1143
const double & tdelta(void) const
Return TDB-UTC time difference.
Definition: GCOMBvc.hpp:236
COMPTEL Solar System Barycentre Data container class.
Definition: GCOMBvcs.hpp:54
void free_members(void)
Delete class members.
Definition: GCOMBvcs.cpp:800
#define G_TDELTA
Definition: GCOMBvcs.cpp:46
Sky direction class.
Definition: GSkyDir.hpp:62
void load(const GFilename &filename)
Load COMPTEL Solar System Barycentre Data FITS file.
Definition: GCOMBvcs.cpp:370
void close(void)
Close FITS file.
Definition: GFits.cpp:1342
std::vector< GCOMBvc > m_bvcs
Solar System Barycentre Data records.
Definition: GCOMBvcs.hpp:94
COMPTEL Orbit Aspect Data class definition.
Mathematical function definitions.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:489
FITS table abstract base class interface definition.
const int & tics(void) const
Return tics of Solar System Barycentre Data.
Definition: GCOMBvc.hpp:174