source: trunk/Mars/mastro/MAstro.h@ 15207

Last change on this file since 15207 was 9195, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 4.9 KB
Line 
1#ifndef MARS_MAstro
2#define MARS_MAstro
3
4#ifndef ROOT_TROOT
5#include <TROOT.h>
6#endif
7#ifndef ROOT_TVector2
8#include <TVector2.h>
9#endif
10
11class TArrayD;
12class TVector3;
13class MTime;
14
15class MAstro
16{
17private:
18 static const Double_t kSynMonth; // synodic month (new Moon to new Moon)
19 static const Double_t kEpoch0; // First full moon after 1980/1/1
20
21 static Double_t Round(Double_t val);
22 static Double_t Trunc(Double_t val);
23
24 static Double_t Kepler(Double_t m, Double_t ecc);
25
26public:
27 virtual ~MAstro() { }
28
29 // Unit conversion
30 static Double_t Parsec2Meter() { return 3.0856776e+16; }
31 static Double_t Parsec2Lighyear() { return 3.2615644; }
32
33 static Double_t DegToHor() { return 15; }
34 static Double_t HorToDeg() { return 1./15; }
35
36 static Double_t RadToHor(); // { return 24/TMath::TwoPi(); }
37 static Double_t HorToRad(); // { return TMath::TwoPi()/24; }
38
39 // Angle/Time conversion functions
40 static Double_t Hms2Sec(Int_t deg, UInt_t min, Double_t sec, char sgn='+');
41 static Double_t Dms2Rad(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
42 static Double_t Hms2Rad(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
43 static Double_t Dms2Deg(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
44 static Double_t Hms2Deg(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
45 static Double_t Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn='+');
46 static Double_t Hms2Hor(Int_t hor, UInt_t min, Double_t sec, Char_t sgn='+');
47
48 static void Day2Hms(Double_t day, Char_t &sgn, UShort_t &h, UShort_t &m, UShort_t &s);
49 static void Rad2Dms(Double_t rad, Char_t &sgn, UShort_t &d, UShort_t &m, UShort_t &s);
50 static void Rad2Hms(Double_t rad, Char_t &sgn, UShort_t &h, UShort_t &m, UShort_t &s);
51 static void Deg2Dms(Double_t deg, Char_t &sgn, UShort_t &d, UShort_t &m, UShort_t &s);
52 static void Deg2Hms(Double_t deg, Char_t &sgn, UShort_t &h, UShort_t &m, UShort_t &s);
53 static void Hor2Dms(Double_t hor, Char_t &sgn, UShort_t &d, UShort_t &m, UShort_t &s);
54 static void Hor2Hms(Double_t hor, Char_t &sgn, UShort_t &h, UShort_t &m, UShort_t &s);
55
56 static void Day2Hm(Double_t day, Char_t &sgn, UShort_t &h, Double_t &m);
57 static void Rad2Dm(Double_t rad, Char_t &sgn, UShort_t &d, Double_t &m);
58 static void Rad2Hm(Double_t rad, Char_t &sgn, UShort_t &h, Double_t &m);
59 static void Deg2Dm(Double_t deg, Char_t &sgn, UShort_t &d, Double_t &m);
60 static void Deg2Hm(Double_t deg, Char_t &sgn, UShort_t &h, Double_t &m);
61 static void Hor2Dm(Double_t rad, Char_t &sgn, UShort_t &d, Double_t &m);
62 static void Hor2Hm(Double_t rad, Char_t &sgn, UShort_t &h, Double_t &m);
63
64 // Print funtions
65 static TString GetStringDeg(Double_t deg, const char *fmt="%c%d:%02d:%02d");
66 static TString GetStringHor(Double_t deg, const char *fmt="%c%d:%02d:%02d");
67
68 // Angle treatment functions
69 static Bool_t String2Angle(TString &str, Double_t &ret);
70 static Bool_t Coordinate2Angle(const TString &str, Double_t &ret);
71 static TString Angle2Coordinate(Double_t val);
72
73 static Double_t AngularDistance(Double_t theta0, Double_t phi0, Double_t theta1, Double_t phi1);
74
75 // Time treatment functions
76 static void Mjd2Ymd(UInt_t mjd, UShort_t &y, Byte_t &m, Byte_t &d);
77 static Int_t Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d);
78
79 static UInt_t Mjd2Yymmdd(UInt_t mjd);
80 static UInt_t Yymmdd2Mjd(UInt_t yymmdd);
81
82 static Double_t UT2GMST(Double_t ut1);
83
84 // Rotation angle between local and sky coordinate system
85 static void RotationAngle(Double_t sinl, Double_t cosl, Double_t theta, Double_t phi, Double_t &sin, Double_t &cos);
86 static Double_t RotationAngle(Double_t sinl, Double_t cosl, Double_t theta, Double_t phi);
87
88 static void GetMoonRaDec(Double_t mjd, Double_t &ra, Double_t &dec);
89
90 static Double_t GetMoonPhase(Double_t mjd);
91 static Double_t GetMoonPeriod(Double_t mjd);
92 static Double_t GetMoonPeriodMjd(Double_t p);
93 static Int_t GetMagicPeriod(Double_t mjd);
94 static Double_t GetMagicPeriodStart(Int_t p);
95
96 static Double_t EstimateCulminationTime(Double_t mjd, Double_t longit, Double_t ra);
97
98 // Estimate some parameters around the sun
99 static Double_t GetSunRaDec(Double_t mjd, Double_t &ra, Double_t &dec);
100 static Double_t GetEquationOfTime(Double_t mjd);
101 static Double_t GetNoonTime(Double_t mjd, Double_t longit);
102 static Double_t GetTimeFromNoonToAlt(Double_t mjd, Double_t latit, Double_t alt);
103 static TArrayD GetSunRiseSet(Double_t mjd, Double_t longit, Double_t latit, Double_t alt=0);
104
105 // Get distance between v1 and v0 in a plain perpendicular to v0 in distance dist
106 static TVector2 GetDistOnPlain(const TVector3 &v0, TVector3 v1, Double_t dist=1);
107
108 // Calculate absolute misspointing from error in zd and error in az
109 static Double_t GetDevAbs(Double_t nomzd, Double_t devzd, Double_t devaz);
110
111 static Int_t GetEasterOffset(UShort_t year);
112
113 ClassDef(MAstro, 0)
114};
115
116#endif
Note: See TracBrowser for help on using the repository browser.