source: trunk/Mars/macros/libnova/sun.C@ 16973

Last change on this file since 16973 was 15198, checked in by tbretz, 12 years ago
Updated to C++ wrapper
File size: 1.2 KB
Line 
1void sun()
2{
3 TGraph gr, gs;
4
5 MTime t(MTime(-1).Year(), 01, 01, 00);
6
7 const double jd = t.GetJD();
8 const double at = t.GetAxisTime();
9
10 for (int d=0; d<365; d++)
11 {
12 Nova::RstTime sun_day = Nova::GetSolarRst(jd+d);
13
14 gr.SetPoint(gr.GetN(), at+d*24*3600, (fmod(sun_day.rise, 1)-0.5)*24*3600+at);
15 gs.SetPoint(gs.GetN(), at+d*24*3600, (fmod(sun_day.set, 1)+0.5)*24*3600+at);
16 }
17
18 TH1S h("", "", 12*60, at+2*24*3600, at+365*24*3600);
19 h.SetStats(kFALSE);
20 h.SetMinimum(at);
21 h.SetMaximum(at+24*3600);
22
23 h.GetXaxis()->CenterLabels();
24 h.GetXaxis()->CenterTitle();
25 h.GetXaxis()->SetNdivisions(412, kFALSE); // 4 weeks per month, 12 months per year
26 h.GetXaxis()->SetTitle("Month");
27 h.GetXaxis()->SetTimeDisplay(true);
28 h.GetXaxis()->SetTimeFormat("%m %F1995-01-01 00:00:00 GMT");
29
30 h.GetYaxis()->SetTitle("UTC");
31 h.GetYaxis()->SetNdivisions(412, kFALSE); // 12 'hours' ticks every 15min.
32 h.GetYaxis()->SetTitleOffset(1.4);
33 h.GetYaxis()->SetTimeDisplay(true);
34 h.GetYaxis()->SetTimeFormat("%Hh %F1995-01-01 00:00:00 GMT");
35
36 h.DrawCopy();
37
38 gPad->SetGrid();
39
40 gr.DrawClone("P");
41 gs.DrawClone("P");
42}
Note: See TracBrowser for help on using the repository browser.