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&)"
209 if (index < 0 || index >=
size()) {
233 if (index < 0 || index >=
size()) {
277 #if defined(G_RANGE_CHECK)
281 "Solar System Barycentre Data index",
286 if (index < 0 || index >=
size()) {
288 "Solar System Barycentre Data index",
315 #if defined(G_RANGE_CHECK)
316 if (index < 0 || index >=
size()) {
318 "Solar System Barycentre Data index",
346 int num = bvcs.
size();
352 for (
int i = 0; i < num; ++i) {
353 m_bvcs.push_back(bvcs[i]);
373 GFits fits(filename);
402 int num = table.
nrows();
419 for (
int i = 0; i < num; ++i) {
426 int tics = ptr_tics->
integer(i);
479 int oad_tjd = oad.
tjd();
480 int oad_tics = oad.
tics() + 65536;
485 int max_tics_difference = 700000000;
487 for (
int i = 0; i <
size; ++i) {
488 if (
m_bvcs[i].tjd() == oad_tjd) {
490 if (tics_difference < max_tics_difference) {
492 max_tics_difference = tics_difference;
502 if (max_tics_difference < 131072) {
567 const double t_sun = 4.92549089483e-6;
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.";
587 if (time <
m_bvcs[0].time()) {
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();
598 else if (time >
m_bvcs[size-1].time()) {
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();
618 int max_tics_difference = 700000000;
620 for (
int i = 0; i <
size; ++i) {
621 if (
m_bvcs[i].tjd() == tjd) {
623 if (tics_difference < max_tics_difference) {
625 max_tics_difference = tics_difference;
635 if (
m_bvcs[ibest].tics() <= tics) {
637 if (ibest < size-1) {
661 ssb = wlow *
m_bvcs[ilow].ssb() + wup *
m_bvcs[iup].ssb();
662 tdelta = wlow *
m_bvcs[ilow].tdelta() + wup *
m_bvcs[iup].tdelta();
671 double travt = ssb * n * 1.0e-6;
674 double r =
norm(ssb) * 1.0e-6;
675 double relat = -2.0 * t_sun *
std::log(1.0 + (travt/r));
678 tdelta = travt - relat +
tdelta;
701 result.append(
"=== GCOMBvcs ===");
713 result.append(
" - ");
719 result.append(
" - ");
721 result.append(
" days");
723 result.append(
m_bvcs[0].time().utc());
724 result.append(
" - ");
729 if (reduced_chatter >
SILENT) {
734 for (
int i = 0; i <
size(); ++i) {
735 if (
m_bvcs[i].tjd() != tjd) {
GCOMBvcs(void)
Void constructor.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
double norm(const GVector &vector)
Computes vector norm.
GCOMBvc & insert(const int &index, const GCOMBvc &bvc)
Insert Solar System Barycentre Data into container.
GVector abs(const GVector &vector)
Computes absolute of vector elements.
COMPTEL Solar System Barycentre Data container class definition.
COMPTEL Solar System Barycentre Data class.
GCOMBvcs & operator=(const GCOMBvcs &bvcs)
Assignment operator.
void extend(const GCOMBvcs &bvcs)
Append Solar System Barycentre Data container.
virtual ~GCOMBvcs(void)
Destructor.
void remove(const int &index)
Remove Solar System Barycentre Data from container.
FITS file class interface definition.
GTime com_time(const int &tjd, const int &tics)
Convert TJD and COMPTEL tics in GTime object.
bool is_empty(void) const
Signals if there are no Solar System Barycentre Data in container.
COMPTEL Orbit Aspect Data class.
Implementation of support function used by COMPTEL classes.
void init_members(void)
Initialise class members.
double tdelta(const GSkyDir &dir, const GTime &time) const
Return time difference between photon arrival time at CGRO and the Solar System Barycentre (SSB) ...
void read(const GFitsTable &table)
Read COMPTEL Solar System Barycentre Data FITS table.
GCOMBvcs * clone(void) const
Clone COMPTEL Solar System Barycentre Data container.
Abstract interface for FITS table column.
void celvector(const GVector &vector)
Set sky direction from 3D vector in celestial coordinates.
int com_tjd(const GTime &time)
Convert GTime in COMPTEL TJD.
const GCOMBvc * find(const GCOMOad &oad) const
Find Solar System Barycentre Data for Orbit Aspect Data.
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
Abstract interface for FITS table.
int size(void) const
Return number of Solar System Barycentre Data in container.
const GVector & ssb(void) const
Return Solar System Barycentre vector.
const int & nrows(void) const
Return number of rows in table.
void copy_members(const GCOMBvcs &bvcs)
Copy class members.
std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL Solar System Barycentre Data container.
int com_tics(const GTime &time)
Convert GTime in COMPTEL tics.
void reserve(const int &num)
Reserves space for Solar System Barycentre Data in container.
virtual int integer(const int &row, const int &inx=0) const =0
const GTime & time(void) const
Return time of Solar System Barycentre Data.
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.
const int & tjd(void) const
Return Truncated Julian Days of Solar System Barycentre Data.
GCOMBvc & append(const GCOMBvc &bvc)
Append Solar System Barycentre Data to container.
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
void clear(void)
Clear COMPTEL Solar System Barycentre Data container.
Exception handler interface definition.
GCOMBvc & at(const int &index)
Return reference to Solar System Barycentre Data.
const int & tics(void) const
Return tics of Orbit Aspect Record.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
const double & tdelta(void) const
Return TDB-UTC time difference.
COMPTEL Solar System Barycentre Data container class.
void free_members(void)
Delete class members.
void load(const GFilename &filename)
Load COMPTEL Solar System Barycentre Data FITS file.
void close(void)
Close FITS file.
std::vector< GCOMBvc > m_bvcs
Solar System Barycentre Data records.
COMPTEL Orbit Aspect Data class definition.
Mathematical function definitions.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
FITS table abstract base class interface definition.
const int & tics(void) const
Return tics of Solar System Barycentre Data.