source: trunk/MagicSoft/Cosy/catalog/Slalib.cc@ 4730

Last change on this file since 4730 was 4104, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 1.1 KB
Line 
1#include "Slalib.h"
2
3#include <time.h>
4#include <iostream.h> // cout
5
6#include "coord.h"
7
8#include "slalib.h"
9
10ClassImp(Slalib);
11
12Slalib::Slalib(MObservatory::LocationName_t key) : MObservatory(key)
13{
14}
15
16Double_t Slalib::Trunc(Double_t val)
17{
18 /* dint(A) - truncate to nearest whole number towards zero (double) */
19 return val<0 ? TMath::Ceil(val) : TMath::Floor(val);
20}
21
22Double_t Slalib::Round(Double_t val)
23{
24 /* dnint(A) - round to nearest whole number (double) */
25 return val<0 ? TMath::Ceil(val-0.5) : TMath::Floor(val+0.5);
26}
27
28void Slalib::SetMjd(double mjd)
29{
30 fTime.SetMjd(mjd);
31
32 fAlpha = slaGmst(GetMjd()) + GetElong();
33}
34
35void Slalib::Now(double offset)
36{
37 fTime.Now();
38 SetMjd(fTime.GetMjd()+offset/(24*60*60));
39}
40
41
42ZdAz Slalib::XYZ2ZdAz(double coord[3]) const
43{
44 //
45 // -- xyz to spherical coordinates --
46 //
47 double ra, dec;
48 slaDcc2s(coord, &ra, &dec);
49
50 //
51 // radec[rad] -> hadec[rad]
52 //
53 const double ha = fAlpha-ra;
54
55 //
56 // hadec[rad] -> altaz[rad]
57 //
58 double alt, az;
59 slaDe2h(ha, dec, GetPhi(), &az, &alt);
60
61 return ZdAz(kPiDiv2-alt, az);
62}
Note: See TracBrowser for help on using the repository browser.