Last change
on this file since 19266 was 18689, checked in by Daniela Dorner, 8 years ago |
ignore values that do not make sense
|
File size:
1.7 KB
|
Line | |
---|
1 | void 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 | //ignore strange values
|
---|
30 | if (t3<0 || t3>1.5)
|
---|
31 | continue;
|
---|
32 |
|
---|
33 | //handle overflow in time
|
---|
34 | if (time<50000)
|
---|
35 | time += 682607./45;
|
---|
36 |
|
---|
37 | time += offset;
|
---|
38 |
|
---|
39 | if (time<beg)
|
---|
40 | {
|
---|
41 | trans[0] = t3;
|
---|
42 | trans[1] = t6;
|
---|
43 | trans[2] = t9;
|
---|
44 | trans[3] = t12;
|
---|
45 | lastt = time;
|
---|
46 | continue;
|
---|
47 | }
|
---|
48 |
|
---|
49 | if (time>end)
|
---|
50 | break;
|
---|
51 |
|
---|
52 | avg[0] += t3;
|
---|
53 | avg[1] += t6;
|
---|
54 | avg[2] += t9;
|
---|
55 | avg[3] += t12;
|
---|
56 | cnt++;
|
---|
57 |
|
---|
58 | }
|
---|
59 |
|
---|
60 | if (cnt>0)
|
---|
61 | {
|
---|
62 | cout << "result " << avg[0]/cnt << " " << avg[1]/cnt << " " << avg[2]/cnt << " " << avg[3]/cnt << endl;
|
---|
63 | return;
|
---|
64 | }
|
---|
65 |
|
---|
66 | if (beg-lastt<time-end && (beg-lastt)*24*3600<10*60)
|
---|
67 | {
|
---|
68 | cout << "result " << trans[0] << " " << trans[1] << " " << trans[2] << " " << trans[3] << endl;
|
---|
69 | return;
|
---|
70 | }
|
---|
71 | if (beg-lastt>time-end && (time-end)*24*3600<10*60 && t3>=0)
|
---|
72 | {
|
---|
73 | cout << "result " << t3 << " " << t6 << " " << t9 << " " << t12 << endl;
|
---|
74 | return;
|
---|
75 | }
|
---|
76 | cout << "result " << endl;
|
---|
77 | return;
|
---|
78 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.