GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMBvcs Class Reference

COMPTEL Solar System Barycentre Data container class. More...

#include <GCOMBvcs.hpp>

Inheritance diagram for GCOMBvcs:
GContainer GBase

Public Member Functions

 GCOMBvcs (void)
 Void constructor. More...
 
 GCOMBvcs (const GFilename &filename)
 Filename constructor. More...
 
 GCOMBvcs (const GCOMBvcs &bvcs)
 Copy constructor. More...
 
virtual ~GCOMBvcs (void)
 Destructor. More...
 
GCOMBvcsoperator= (const GCOMBvcs &bvcs)
 Assignment operator. More...
 
GCOMBvcoperator[] (const int &index)
 Return reference to Solar System Barycentre Data. More...
 
const GCOMBvcoperator[] (const int &index) const
 Return reference to Solar System Barycentre Data (const version) More...
 
void clear (void)
 Clear COMPTEL Solar System Barycentre Data container. More...
 
GCOMBvcsclone (void) const
 Clone COMPTEL Solar System Barycentre Data container. More...
 
std::string classname (void) const
 Return class name. More...
 
GCOMBvcat (const int &index)
 Return reference to Solar System Barycentre Data. More...
 
const GCOMBvcat (const int &index) const
 Return reference to Solar System Barycentre Data (const version) More...
 
int size (void) const
 Return number of Solar System Barycentre Data in container. More...
 
bool is_empty (void) const
 Signals if there are no Solar System Barycentre Data in container. More...
 
GCOMBvcappend (const GCOMBvc &bvc)
 Append Solar System Barycentre Data to container. More...
 
GCOMBvcinsert (const int &index, const GCOMBvc &bvc)
 Insert Solar System Barycentre Data into container. More...
 
void remove (const int &index)
 Remove Solar System Barycentre Data from container. More...
 
void reserve (const int &num)
 Reserves space for Solar System Barycentre Data in container. More...
 
void extend (const GCOMBvcs &bvcs)
 Append Solar System Barycentre Data container. More...
 
void load (const GFilename &filename)
 Load COMPTEL Solar System Barycentre Data FITS file. More...
 
void read (const GFitsTable &table)
 Read COMPTEL Solar System Barycentre Data FITS table. More...
 
const GCOMBvcfind (const GCOMOad &oad) const
 Find Solar System Barycentre Data for Orbit Aspect Data. More...
 
double tdelta (const GSkyDir &dir, const GTime &time) const
 Return time difference between photon arrival time at CGRO and the Solar System Barycentre (SSB) More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print COMPTEL Solar System Barycentre Data container. More...
 
- Public Member Functions inherited from GContainer
virtual ~GContainer (void)
 Destructor. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GCOMBvcs &bvcs)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

std::vector< GCOMBvcm_bvcs
 Solar System Barycentre Data records. More...
 

Detailed Description

COMPTEL Solar System Barycentre Data container class.

The COMPTEL Solar System Barycentre Data container class holds records of Solar System Barycentre data that were extracted from one COMPTEL BVC FITS file.

Definition at line 54 of file GCOMBvcs.hpp.

Constructor & Destructor Documentation

GCOMBvcs::GCOMBvcs ( void  )

Void constructor.

Constructs an empty COMPTEL Solar System Barycentre Data container

Definition at line 66 of file GCOMBvcs.cpp.

References init_members().

Referenced by clone().

GCOMBvcs::GCOMBvcs ( const GFilename filename)
explicit

Filename constructor.

Parameters
[in]filenameCOMPTEL Solar System Barycentre Data FITS file

Constructs a COMPTEL Solar System Barycentre Data container from a BVC FITS file.

Definition at line 84 of file GCOMBvcs.cpp.

References init_members(), and load().

GCOMBvcs::GCOMBvcs ( const GCOMBvcs bvcs)

Copy constructor.

Parameters
[in]bvcsCOMPTEL Solar System Barycentre Data container.

Definition at line 102 of file GCOMBvcs.cpp.

References copy_members(), and init_members().

GCOMBvcs::~GCOMBvcs ( void  )
virtual

Destructor.

Definition at line 118 of file GCOMBvcs.cpp.

References free_members().

Member Function Documentation

GCOMBvc & GCOMBvcs::append ( const GCOMBvc bvc)

Append Solar System Barycentre Data to container.

Parameters
[in]bvcSolar System Barycentre Data.
Returns
Reference to appended Solar System Barycentre Data.

Appends Solar System Barycentre Data to the container by making a deep copy of the Solar System Barycentre Data.

Definition at line 252 of file GCOMBvcs.cpp.

References m_bvcs, and size().

GCOMBvc & GCOMBvcs::at ( const int &  index)

Return reference to Solar System Barycentre Data.

Parameters
[in]indexSolar System Barycentre Data index [0,...,size()-1].
Exceptions
GException::out_of_rangeSolar System Barycentre Data index is out of range.

Returns a reference to the Solar System Barycentre Data with the specified index.

Definition at line 206 of file GCOMBvcs.cpp.

References G_AT, m_bvcs, and size().

const GCOMBvc & GCOMBvcs::at ( const int &  index) const

Return reference to Solar System Barycentre Data (const version)

Parameters
[in]indexSolar System Barycentre Data index [0,...,size()-1].
Exceptions
GException::out_of_rangeSolar System Barycentre Data index is out of range.

Returns a reference to the Solar System Barycentre Data with the specified index.

Definition at line 230 of file GCOMBvcs.cpp.

References G_AT, m_bvcs, and size().

std::string GCOMBvcs::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GCOMBvcs").

Implements GBase.

Definition at line 104 of file GCOMBvcs.hpp.

void GCOMBvcs::clear ( void  )
virtual

Clear COMPTEL Solar System Barycentre Data container.

Implements GBase.

Definition at line 170 of file GCOMBvcs.cpp.

References free_members(), and init_members().

Referenced by GCOMObservation::init_members(), and read().

GCOMBvcs * GCOMBvcs::clone ( void  ) const
virtual

Clone COMPTEL Solar System Barycentre Data container.

Returns
Pointer to deep copy of COMPTEL Solar System Barycentre Data container.

Implements GBase.

Definition at line 189 of file GCOMBvcs.cpp.

References GCOMBvcs().

void GCOMBvcs::copy_members ( const GCOMBvcs bvcs)
protected

Copy class members.

Parameters
[in]bvcsCOMPTEL Solar System Barycentre Data container.

Definition at line 787 of file GCOMBvcs.cpp.

References m_bvcs.

Referenced by GCOMBvcs(), and operator=().

void GCOMBvcs::extend ( const GCOMBvcs bvcs)

Append Solar System Barycentre Data container.

Parameters
[in]bvcsCOMPTEL Solar System Barycentre Data container.

Append COMPTEL Solar System Barycentre Data container to the container.

Definition at line 338 of file GCOMBvcs.cpp.

References is_empty(), m_bvcs, reserve(), and size().

const GCOMBvc * GCOMBvcs::find ( const GCOMOad oad) const

Find Solar System Barycentre Data for Orbit Aspect Data.

Parameters
[in]oadOrbit Aspect Data.
Returns
Pointer to Solar System Barycentre Data (NULL if no data were found)

Finds Solar System Barycentre Data that correspond to the specified Orbit Aspect Data. The method returns the Solar System Barycentre Data with the same TJD as the Orbit Aspect Data and the smallest difference in the number of tics.

If this smallest difference is larger than 131072, which is the length of one superpacket, the method returns a NULL pointer.

The method also returns a NULL pointer in case that no matching Solar System Barycentre Data was found.

The client needs to verify the validity of the Solar System Barycentre Data pointer. The client must not deallocate the associated memory.

Definition at line 473 of file GCOMBvcs.cpp.

References abs(), m_bvcs, size(), GCOMOad::tics(), and GCOMOad::tjd().

void GCOMBvcs::free_members ( void  )
protected

Delete class members.

Definition at line 800 of file GCOMBvcs.cpp.

Referenced by clear(), operator=(), and ~GCOMBvcs().

void GCOMBvcs::init_members ( void  )
protected

Initialise class members.

Definition at line 772 of file GCOMBvcs.cpp.

References m_bvcs.

Referenced by clear(), GCOMBvcs(), and operator=().

GCOMBvc & GCOMBvcs::insert ( const int &  index,
const GCOMBvc bvc 
)

Insert Solar System Barycentre Data into container.

Parameters
[in]indexSolar System Barycentre Data index (0,...,size()-1).
[in]bvcSolar System Barycentre Data.
Exceptions
GException::out_of_rangeSolar System Barycentre Data index is out of range.

Inserts Solar System Barycentre Data into the container before the Solar System Barycentre Data with the specified index.

Definition at line 274 of file GCOMBvcs.cpp.

References G_INSERT, is_empty(), m_bvcs, and size().

bool GCOMBvcs::is_empty ( void  ) const
inlinevirtual

Signals if there are no Solar System Barycentre Data in container.

Returns
True if container is empty, false otherwise.

Signals if the Solar System Barycentre Data container does not contain any Solar System Barycentre Data.

Implements GContainer.

Definition at line 163 of file GCOMBvcs.hpp.

References m_bvcs.

Referenced by GCOMDri::compute_dre(), extend(), insert(), GCOMObservation::print(), and GCOMObservation::write().

void GCOMBvcs::load ( const GFilename filename)

Load COMPTEL Solar System Barycentre Data FITS file.

Parameters
[in]filenameCOMPTEL BVC FITS file name.

Loads an COMPTEL Solar System Barycentre FITS file in the container.

Definition at line 370 of file GCOMBvcs.cpp.

References GFits::close(), read(), and GFits::table().

Referenced by GCOMBvcs(), and GCOMObservation::load().

GCOMBvcs & GCOMBvcs::operator= ( const GCOMBvcs bvcs)

Assignment operator.

Parameters
[in]bvcsCOMPTEL Solar System Barycentre Data container.
Returns
COMPTEL Solar System Barycentre Data container.

Definition at line 140 of file GCOMBvcs.cpp.

References copy_members(), free_members(), and init_members().

GCOMBvc & GCOMBvcs::operator[] ( const int &  index)
inline

Return reference to Solar System Barycentre Data.

Parameters
[in]indexSolar System Barycentre Data index [0,...,size()-1].

Returns a reference to the Solar System Barycentre Data with the specified index.

Definition at line 119 of file GCOMBvcs.hpp.

References m_bvcs.

const GCOMBvc & GCOMBvcs::operator[] ( const int &  index) const
inline

Return reference to Solar System Barycentre Data (const version)

Parameters
[in]indexSolar System Barycentre Data index [0,...,size()-1].

Returns a reference to the Solar System Barycentre Data with the specified index.

Definition at line 134 of file GCOMBvcs.hpp.

References m_bvcs.

std::string GCOMBvcs::print ( const GChatter chatter = NORMAL) const
virtual

Print COMPTEL Solar System Barycentre Data container.

Parameters
[in]chatterChattiness.
Returns
String containing COMPTEL Solar System Barycentre Data container information.

Implements GBase.

Definition at line 692 of file GCOMBvcs.cpp.

References m_bvcs, gammalib::parformat(), gammalib::reduce(), SILENT, size(), and gammalib::str().

Referenced by GCOMObservation::print().

void GCOMBvcs::read ( const GFitsTable table)

Read COMPTEL Solar System Barycentre Data FITS table.

Parameters
[in]tableCOMPTEL BVC FITS table.

Reads COMPTEL Solar System Barycentre Data FITS table into the container.

Definition at line 396 of file GCOMBvcs.cpp.

References clear(), gammalib::com_time(), GFitsTableCol::integer(), m_bvcs, GFitsTable::nrows(), GFitsTableCol::real(), GCOMBvc::ssb(), GCOMBvc::tdelta(), GCOMBvc::tics(), GCOMBvc::time(), and GCOMBvc::tjd().

Referenced by load().

void GCOMBvcs::remove ( const int &  index)
virtual

Remove Solar System Barycentre Data from container.

Parameters
[in]indexSolar System Barycentre Data index (0,...,size()-1).
Exceptions
GException::out_of_rangeSolar System Barycentre Data index is out of range.

Remove Solar System Barycentre Data of specified index from container.

Implements GContainer.

Definition at line 312 of file GCOMBvcs.cpp.

References G_REMOVE, m_bvcs, and size().

void GCOMBvcs::reserve ( const int &  num)
inlinevirtual

Reserves space for Solar System Barycentre Data in container.

Parameters
[in]numNumber of Solar System Barycentre Data.

Reserves space for num Solar System Barycentre Data in the container.

Implements GContainer.

Definition at line 177 of file GCOMBvcs.hpp.

References m_bvcs.

Referenced by extend().

int GCOMBvcs::size ( void  ) const
inlinevirtual

Return number of Solar System Barycentre Data in container.

Returns
Number of Solar System Barycentre Data in container.

Returns the number of Solar System Barycentre Data in the container.

Implements GContainer.

Definition at line 148 of file GCOMBvcs.hpp.

References m_bvcs.

Referenced by append(), at(), extend(), find(), insert(), print(), remove(), and tdelta().

double GCOMBvcs::tdelta ( const GSkyDir dir,
const GTime time 
) const

Return time difference between photon arrival time at CGRO and the Solar System Barycentre (SSB)

Parameters
[in]dirSource position.
[in]timeCGRO photon arrival time.
Returns
Time difference between photon arrival times (s)
Exceptions
GException::invalid_valueNot enough SSB vectors loaded for computation

Returns the time difference between photon arrival time at CGRO and the Solar System Barycentre (SSB). The arrival time at the SSB is computed by adding the time difference to the photon arrival time as measured by COMPTEL

\[ T_{\rm SSB} = T_{\rm CGRO} + \Delta T \]

The routine implements the algorithm PUL-AL-004 and is inspried from the COMPASS code evpbin02.pulssb.f.

It computes

\[ \Delta T = \Delta T_{\rm travel} - \Delta T_{\rm rel} + \Delta T_{\rm BVC} \]

where

\[ \Delta T_{\rm travel} = \left( \vec{SSB} \cdot \vec{n} \right) \times 10^{-6} \]

is the light travel time in seconds between CGRO and the SSB, with \(\vec{SSB}\) being the vector going from the SSB to CGRO, and \(\vec{n}\) is the normalised vector of the source position, provided by the GSkyDir::celvector() method,

\[ \Delta T_{\rm rel} = -2 R \log \left( 1 + \frac{\Delta T_{\rm travel}}{|\vec{SSB}| * 10^{-6}} \right) \]

is the relativistic delay due to the Sun in seconds, with \(R=0.49254909 \times 10^{-5}\) s, and \(\Delta T_{\rm BVC}\) is the difference in seconds due to the time unit conversion.

The values of \(\vec{SSB}\) and \(\Delta T_{\rm BVC}\) are linearly interpolated from the tabulated values based on the specified time.

Definition at line 564 of file GCOMBvcs.cpp.

References abs(), GSkyDir::celvector(), gammalib::com_tics(), gammalib::com_tjd(), G_TDELTA, log(), m_bvcs, norm(), size(), and gammalib::str().

Referenced by GCOMDri::compute_dre().

Member Data Documentation

std::vector<GCOMBvc> GCOMBvcs::m_bvcs
protected

Solar System Barycentre Data records.

Definition at line 94 of file GCOMBvcs.hpp.

Referenced by append(), at(), copy_members(), extend(), find(), init_members(), insert(), is_empty(), operator[](), print(), read(), remove(), reserve(), size(), and tdelta().


The documentation for this class was generated from the following files: