Changeset 3371
- Timestamp:
- 03/01/04 15:33:06 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3369 r3371 9 9 - now the arrival time is at the half max of the spline: 10 10 half max = (maximum - pedestal)/2 11 12 11 13 12 14 2004/03/01: Wolfgang Wittek … … 28 30 - fixed a bug in determin the file-type 29 31 32 * mbase/MTime.[h,cc]: 33 - added GetGmst() member function 34 30 35 * mastro/MAstro.[h,cc]: 31 36 - added Coordinate2Angle 32 37 - added AngularDistance 38 - implemented UT2GMST 39 - replaced defined by TMath::Pi() 33 40 34 41 * mastro/MObservatory.[h,cc]: -
trunk/MagicSoft/Mars/mastro/MAstro.cc
r3366 r3371 18 18 ! Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 320 ! Copyright: MAGIC Software Development, 2000-2004 21 21 ! 22 22 ! … … 33 33 #include <TVector3.h> // TVector3 34 34 35 #include "MTime.h" // MTime::GetGmst 36 35 37 ClassImp(MAstro); 36 38 … … 56 58 { 57 59 /* pi/(180*3600): arcseconds to radians */ 58 #define DAS2R 4.8481368110953599358991410235794797595635330237270e-659 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*/; 60 62 } 61 63 … … 63 65 { 64 66 /* pi/(12*3600): seconds of time to radians */ 65 #define DS2R 7.2722052166430399038487115353692196393452995355905e-566 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*/; 67 69 } 68 70 … … 295 297 return v0.Angle(v1); 296 298 } 299 300 // -------------------------------------------------------------------------- 301 // 302 // Calls MTime::GetGmst() Better use MTime::GetGmst() directly 303 // 304 Double_t MAstro::UT2GMST(Double_t ut1) 305 { 306 return MTime(ut1).GetGmst(); 307 } -
trunk/MagicSoft/Mars/mastro/MAstro.h
r3366 r3371 13 13 14 14 public: 15 // Angle/Time conversion functions 15 16 static Double_t Hms2Sec(Int_t deg, UInt_t min, Double_t sec, char sgn='+'); 16 17 static Double_t Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+'); … … 37 38 static void Hor2Hm(Double_t rad, Char_t &sgn, UShort_t °, Double_t &min); 38 39 40 // Angle treatment functions 39 41 static Bool_t String2Angle(TString &str, Double_t &ret); 40 42 static Bool_t Coordinate2Angle(const TString &str, Double_t &ret); 41 43 42 44 static Double_t AngularDistance(Double_t theta0, Double_t phi0, Double_t theta1, Double_t phi1); 43 45 46 // Time treatment functions 44 47 static void Mjd2Ymd(UInt_t mjd, UShort_t &y, Byte_t &m, Byte_t &d); 45 48 static Int_t Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d); 49 50 static Double_t UT2GMST(Double_t ut1); 46 51 47 52 ClassDef(MAstro, 0) -
trunk/MagicSoft/Mars/mbase/MTime.cc
r3148 r3371 317 317 return kTRUE; 318 318 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 // 351 Double_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(); 319 365 } 320 366 -
trunk/MagicSoft/Mars/mbase/MTime.h
r3148 r3371 56 56 Set(tm); 57 57 } 58 MTime(Double_t d);58 MTime(Double_t mjd); 59 59 MTime(const MTime& t) : fMjd(t.fMjd), fTime(t.fTime), fNanoSec(t.fNanoSec) 60 60 { … … 85 85 void SetMjd(Double_t m); 86 86 Double_t GetMjd() const; 87 Double_t GetGmst() const; 87 88 TString GetString() const; 88 89 TString GetStringFmt(const char *fmt=0) const;
Note:
See TracChangeset
for help on using the changeset viewer.