source: trunk/MagicSoft/Cosy/catalog/SlaStars.cc@ 1170

Last change on this file since 1170 was 1109, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.9 KB
Line 
1#include "SlaStars.h"
2
3#include "slalib.h"
4
5ClassImp(SlaStars);
6
7SlaStars::SlaStars() : Slalib()
8{
9}
10
11SlaStars::~SlaStars()
12{
13}
14
15void SlaStars::Set(const AltAz &altaz)
16{
17 fAltAz = altaz * kDeg2Rad;
18 fRaDec = CalcRaDec(fAltAz);
19}
20
21void SlaStars::Set(const ZdAz &zdaz)
22{
23 fAltAz = AltAz(kPiDiv2-zdaz.Zd(), zdaz.Az()) * kDeg2Rad;
24 fRaDec = CalcRaDec(fAltAz);
25}
26
27void SlaStars::Set(const RaDec &radec)
28{
29 fRaDec = radec * kDeg2Rad;
30 fAltAz = CalcAltAz(fRaDec);
31}
32
33void SlaStars::SetMjd(const double mjd)
34{
35 Slalib::SetMjd(mjd);
36
37 //
38 // ----- calculate star independent parameters ----------
39 //
40 slaMappa(2000.0, mjd, fAmprms);
41 slaAoppa(mjd, 0, // mjd, UT1-UTC
42 GetElong(), GetPhi(), 148, // g”ttingen long, lat, height
43 0, 0, // polar motion x, y-coordinate (radians)
44 273.155, 1013.25, 0.5, // temp, pressure, humidity
45 0.2, 0.0065, // wavelength, tropo lapse rate
46 fAoprms);
47}
48
49RaDec SlaStars::CalcRaDec(const AltAz &altaz) const
50{
51 return CalcRaDec(ZdAz(kPiDiv2-altaz.Alt(), altaz.Az()));
52}
53
54RaDec SlaStars::CalcRaDec(const ZdAz &zdaz) const
55{
56 //
57 // -- observed to apparent --
58 // Workaraound for slalib: discard const
59 //
60 double r=0, d=0;
61 slaOapqk((char*)"A", zdaz.Az(), zdaz.Zd(), (double*)fAoprms, &r, &d);
62
63 //
64 // -- apparent to mean --
65 // Workaraound for slalib: discard const
66 //
67 double ra, dec;
68 slaAmpqk(r, d, (double*)fAmprms, &ra, &dec);
69
70 return RaDec(ra, dec);
71}
72
73ZdAz SlaStars::CalcZdAz(const RaDec &radec) const
74{
75 //
76 // ---- Mean to apparent ----
77 //
78
79 double r=0, d=0;
80 slaMapqkz(radec.Ra(), radec.Dec(), (double*)fAmprms, &r, &d);
81 //
82 // Doesn't work - don't know why
83 //
84 // slaMapqk (radec.Ra(), radec.Dec(), rdpm.Ra(), rdpm.Dec(),
85 // 0, 0, (double*)fAmprms, &r, &d);
86 //
87
88 //
89 // -- apparent to observed --
90 //
91 double r1=0; // ra
92 double d1=0; // dec
93 double h0=0; // ha
94
95 double zd;
96 double az;
97 slaAopqk (r, d, (double*)fAoprms,
98 &az, // observed azimuth (radians: N=0,E=90)
99 &zd, // observed zenith distance (radians) [-pi/2, pi/2]
100 &h0, // observed hour angle (radians)
101 &d1, // observed declination (radians)
102 &r1); // observed right ascension (radians)
103
104 return ZdAz(zd, az);
105}
106AltAz SlaStars::CalcAltAz(const RaDec &radec) const
107{
108 ZdAz zdaz = CalcZdAz(radec);
109 return AltAz(kPiDiv2-zdaz.Zd(), zdaz.Az());
110}
111
112ZdAz SlaStars::GetApproxVel(const RaDec &radec) const // [rad/rad]
113{
114 double az, vaz, aaz;
115 double el, vel, ael;
116 double pa, vpa, apa;
117 slaAltaz(GetAlpha()-radec.Ra(), radec.Dec(), GetPhi(),
118 &az, &vaz, &aaz,
119 &el, &vel, &ael,
120 &pa, &vpa, &apa);
121
122 return ZdAz(-vel, vaz);
123}
Note: See TracBrowser for help on using the repository browser.