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

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