source: branches/Mars_McMismatchStudy/fact/processing/camhum.C@ 20029

Last change on this file since 20029 was 17962, checked in by dneise, 10 years ago
these modifications I found in the Mars.svn.2014.05.26 folder of Simona and added them to this branch without further thinking about them.
File size: 1.1 KB
Line 
1void camhum(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 hum[4];
10 file.SetPtrAddress("Time", &time);
11 file.SetPtrAddress("H", hum);
12
13 UInt_t offset = file.GetUInt("MJDREF");
14 if (beg < 30000)
15 beg+=offset;
16 if (end < 30000)
17 end+=offset;
18
19 double avg = 0;
20 int cnt = 0;
21
22 double last = -1;
23 double diff = -1;
24
25 while (file.GetNextRow())
26 {
27 time += offset;
28
29 if (time>end)
30 break;
31
32 int n = 0;
33 double h = 0;
34 for (int i=0; i<4; i++)
35 if (hum[i]>0)
36 {
37 h += hum[i];
38 n++;
39 }
40
41 if (n==0)
42 continue;
43
44 if (time<beg)
45 {
46 last = h/n;
47 diff = beg-time;
48 continue;
49 }
50
51 avg += h/n;
52 cnt ++;
53 }
54
55 if (cnt==0)
56 {
57 if (diff<5./24/3600)
58 return;
59
60 cout << "result " << last << endl;
61 return;
62 }
63
64 cout << "result " << avg/cnt << endl;
65}
Note: See TracBrowser for help on using the repository browser.