source: branches/Mars_IncreaseNsb/fact/processing/lidar.C@ 20115

Last change on this file since 20115 was 18524, checked in by Daniela Dorner, 8 years ago
fixed bugs
File size: 1.6 KB
Line 
1void lidar(const char *fname, double beg=0, double end=100000)
2{
3 fits file(fname);
4
5 //file.PrintColumns();
6 //file.PrintKeys();
7
8 Double_t time;
9 Float_t t3, t6, t9, t12;
10 file.SetPtrAddress("Time", &time);
11 file.SetPtrAddress("T3", &t3);
12 file.SetPtrAddress("T6", &t6);
13 file.SetPtrAddress("T9", &t9);
14 file.SetPtrAddress("T12", &t12);
15
16 UInt_t offset = file.GetUInt("MJDREF");
17 if (beg < 30000)
18 beg+=offset;
19 if (end < 30000)
20 end+=offset;
21
22 Double_t lastt;
23 Float_t trans[4];
24
25 Double_t avg[4] = {0,0,0,0};
26 Int_t cnt = 0;
27 while (file.GetNextRow())
28 {
29 if (time<50000)
30 time += 682607./45;
31
32 time += offset;
33
34 if (time<beg)
35 {
36 trans[0] = t3;
37 trans[1] = t6;
38 trans[2] = t9;
39 trans[3] = t12;
40 lastt = time;
41 continue;
42 }
43
44 if (time>end)
45 break;
46
47 avg[0] += t3;
48 avg[1] += t6;
49 avg[2] += t9;
50 avg[3] += t12;
51 cnt++;
52
53 }
54
55 if (cnt>0)
56 {
57 cout << "result " << avg[0]/cnt << " " << avg[1]/cnt << " " << avg[2]/cnt << " " << avg[3]/cnt << endl;
58 return;
59 }
60
61 if (beg-lastt<time-end && (beg-lastt)*24*3600<10*60)
62 {
63 cout << "result " << trans[0] << " " << trans[1] << " " << trans[2] << " " << trans[3] << endl;
64 return;
65 }
66 if (beg-lastt>time-end && (time-end)*24*3600<10*60)
67 {
68 cout << "result " << t3 << " " << t6 << " " << t9 << " " << t12 << endl;
69 return;
70 }
71 cout << "result " << endl;
72 return;
73}
Note: See TracBrowser for help on using the repository browser.