Changeset 3371 for trunk


Ignore:
Timestamp:
03/01/04 15:33:06 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3369 r3371  
    99     - now the arrival time is at the half max of the spline:
    1010       half max = (maximum - pedestal)/2
     11
     12
    1113
    1214 2004/03/01: Wolfgang Wittek
     
    2830     - fixed a bug in determin the file-type
    2931
     32   * mbase/MTime.[h,cc]:
     33     - added GetGmst() member function
     34
    3035   * mastro/MAstro.[h,cc]:
    3136     - added Coordinate2Angle
    3237     - added AngularDistance
     38     - implemented UT2GMST
     39     - replaced defined by TMath::Pi()
    3340
    3441   * mastro/MObservatory.[h,cc]:
  • trunk/MagicSoft/Mars/mastro/MAstro.cc

    r3366 r3371  
    1818!   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    3333#include <TVector3.h> // TVector3
    3434
     35#include "MTime.h"    // MTime::GetGmst
     36
    3537ClassImp(MAstro);
    3638
     
    5658{
    5759    /* pi/(180*3600):  arcseconds to radians */
    58 #define DAS2R 4.8481368110953599358991410235794797595635330237270e-6
    59     return Hms2Sec(deg, min, sec, sgn)*DAS2R;
     60    //#define DAS2R 4.8481368110953599358991410235794797595635330237270e-6
     61    return Hms2Sec(deg, min, sec, sgn)*TMath::Pi()/(180*3600)/**DAS2R*/;
    6062}
    6163
     
    6365{
    6466    /* pi/(12*3600):  seconds of time to radians */
    65 #define DS2R 7.2722052166430399038487115353692196393452995355905e-5
    66     return Hms2Sec(hor, min, sec, sgn)*DS2R;
     67//#define DS2R 7.2722052166430399038487115353692196393452995355905e-5
     68    return Hms2Sec(hor, min, sec, sgn)*TMath::Pi()/(12*3600)/**DS2R*/;
    6769}
    6870
     
    295297    return v0.Angle(v1);
    296298}
     299
     300// --------------------------------------------------------------------------
     301//
     302// Calls MTime::GetGmst() Better use MTime::GetGmst() directly
     303//
     304Double_t MAstro::UT2GMST(Double_t ut1)
     305{
     306    return MTime(ut1).GetGmst();
     307}
  • trunk/MagicSoft/Mars/mastro/MAstro.h

    r3366 r3371  
    1313
    1414public:
     15    // Angle/Time conversion functions
    1516    static Double_t Hms2Sec(Int_t deg, UInt_t min, Double_t sec, char sgn='+');
    1617    static Double_t Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
     
    3738    static void Hor2Hm(Double_t rad, Char_t &sgn, UShort_t &deg, Double_t &min);
    3839
     40    // Angle treatment functions
    3941    static Bool_t String2Angle(TString &str, Double_t &ret);
    4042    static Bool_t Coordinate2Angle(const TString &str, Double_t &ret);
    4143
    4244    static Double_t AngularDistance(Double_t theta0, Double_t phi0, Double_t theta1, Double_t phi1);
    43  
     45
     46    // Time treatment functions
    4447    static void  Mjd2Ymd(UInt_t mjd, UShort_t &y, Byte_t &m, Byte_t &d);
    4548    static Int_t Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d);
     49
     50    static Double_t UT2GMST(Double_t ut1);
    4651
    4752    ClassDef(MAstro, 0)
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r3148 r3371  
    317317    return kTRUE;
    318318
     319}
     320
     321// --------------------------------------------------------------------------
     322//
     323//  Conversion from Universal Time to Greenwich mean sidereal time,
     324//  with rounding errors minimized.
     325//
     326//  The result is the Greenwich Mean Sidereal Time (radians)
     327//
     328//  There is no restriction on how the UT is apportioned between the
     329//  date and ut1 arguments.  Either of the two arguments could, for
     330//  example, be zero and the entire date+time supplied in the other.
     331//  However, the routine is designed to deliver maximum accuracy when
     332//  the date argument is a whole number and the ut argument lies in
     333//  the range 0 to 1, or vice versa.
     334//
     335//  The algorithm is based on the IAU 1982 expression (see page S15 of
     336//  the 1984 Astronomical Almanac).  This is always described as giving
     337//  the GMST at 0 hours UT1.  In fact, it gives the difference between
     338//  the GMST and the UT, the steady 4-minutes-per-day drawing-ahead of
     339//  ST with respect to UT.  When whole days are ignored, the expression
     340//  happens to equal the GMST at 0 hours UT1 each day.
     341//
     342//  In this routine, the entire UT1 (the sum of the two arguments date
     343//  and ut) is used directly as the argument for the standard formula.
     344//  The UT1 is then added, but omitting whole days to conserve accuracy.
     345//
     346//  The extra numerical precision delivered by the present routine is
     347//  unlikely to be important in an absolute sense, but may be useful
     348//  when critically comparing algorithms and in applications where two
     349//  sidereal times close together are differenced.
     350//
     351Double_t MTime::GetGmst() const
     352{
     353    const Double_t ut = (Double_t)(fNanoSec/1e6+(Long_t)fTime)/kDay;
     354
     355    // Julian centuries since J2000.
     356    const Double_t t = (ut -(51544.5-fMjd)) / 36525.0;
     357
     358    // GMST at this UT1
     359    const Double_t r1 = 24110.54841+(8640184.812866+(0.093104-6.2e-6*t)*t)*t;
     360    const Double_t r2 = 86400.0*ut;
     361
     362    const Double_t sum = (r1+r2)/(24*3600);
     363
     364    return fmod(sum, 1)*TMath::TwoPi()+TMath::TwoPi();
    319365}
    320366
  • trunk/MagicSoft/Mars/mbase/MTime.h

    r3148 r3371  
    5656        Set(tm);
    5757    }
    58     MTime(Double_t d);
     58    MTime(Double_t mjd);
    5959    MTime(const MTime& t) : fMjd(t.fMjd), fTime(t.fTime), fNanoSec(t.fNanoSec)
    6060    {
     
    8585    void     SetMjd(Double_t m);
    8686    Double_t GetMjd() const;
     87    Double_t GetGmst() const;
    8788    TString  GetString() const;
    8889    TString  GetStringFmt(const char *fmt=0) const;
Note: See TracChangeset for help on using the changeset viewer.