source: trunk/Mars/fact/processing/ctrldev.C@ 19266

Last change on this file since 19266 was 15226, checked in by Daniela Dorner, 12 years ago
added (macro to extract control deviation from the file DRIVE_CONTROL_TRACKING_POSITION)
File size: 1.2 KB
Line 
1void ctrldev(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 Double_t zd, dzd, daz;
10 file.SetPtrAddress("Time", &time);
11 file.SetPtrAddress("Zd", &zd);
12 file.SetPtrAddress("dZd", &dzd);
13 file.SetPtrAddress("dAz", &daz);
14
15 UInt_t offset = file.GetUInt("MJDREF");
16 if (beg < 30000)
17 beg+=offset;
18 if (end < 30000)
19 end+=offset;
20
21 double avg = 0;
22 double rms = 0;
23 int cnt = 0;
24
25 double last = -1;
26 double diff = -1;
27
28 while (file.GetNextRow())
29 {
30 time += offset;
31
32 if (time>end)
33 break;
34
35 // Calculate absolute misspointing from error in zd and error in az
36 Double_t dev = MAstro::GetDevAbs(zd, dzd, daz)*60;
37
38 if (time<beg)
39 {
40 last = dev;
41 diff = beg-time;
42 continue;
43 }
44
45 avg += dev;
46 rms += dev*dev;
47 cnt ++;
48 }
49
50 if (cnt==0)
51 {
52 if (diff<5./24/3600)
53 return;
54
55 cout << "result " << last << " 0 " << endl;
56 return;
57 }
58
59 avg /= cnt;
60 rms /= cnt;
61
62 rms = sqrt(rms-avg*avg);
63
64 cout << "result " << avg << " " << rms << endl;
65}
Note: See TracBrowser for help on using the repository browser.