source: trunk/MagicSoft/Cosy/tpoint/plot_m1.C@ 9510

Last change on this file since 9510 was 9496, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 22.9 KB
Line 
1#include <iomanip>
2
3void DrawMarker(TVirtualPad *pad, Double_t r0, Double_t phi0, Double_t r1, Double_t phi1)
4 {
5 TView *view = pad->GetView();
6
7 if (!view)
8 {
9 cout << "No View!" << endl;
10 return;
11 }
12
13 TMarker mark0;
14 TMarker mark1;
15 mark0.SetMarkerStyle(kStar);
16 mark1.SetMarkerStyle(kStar);
17 mark1.SetMarkerColor(kRed);
18
19 r0 /= 90;
20 r1 /= 90;
21 phi0 *= TMath::DegToRad();
22 phi1 *= TMath::DegToRad();
23
24 Double_t x0[3] = { r0*cos(phi0), r0*sin(phi0), 0};
25 Double_t x1[3] = { r1*cos(phi1), r1*sin(phi1), 0};
26
27 mark0.DrawMarker(x0[0], x0[1]);
28 mark1.DrawMarker(x1[0], x1[1]);
29
30 return;
31 Double_t y0[3], y1[3];
32
33 view->WCtoNDC(x0, y0);
34 view->WCtoNDC(x1, y1);
35
36 mark0.DrawMarker(y0[0], y0[1]);
37 mark1.DrawMarker(y1[0], y1[1]);
38 }
39
40int fill(const char *fname, TGraph *g, TH1 *h)
41{
42/*
43 TH2F h2res1("Res2D1", " Dataset positions on the sky ", 32, 0, 360, 10, 0, 90);
44 h2res1.SetBit(TH1::kNoStats);
45 h2res1.DrawCopy("surf1pol");
46 gPad->Modified();
47 gPad->Update();
48 gPad->SetTheta(90);
49 gPad->SetPhi(-90);
50
51 DrawMarker(gPad, 45, 0, 0, 0);
52 gPad->Modified();
53 gPad->Update();
54
55 return;
56
57 */
58 ifstream fin(fname);
59
60 cout << "Reading " << setw(23) << gSystem->BaseName(fname) << "..." << flush;
61
62 while (1)
63 {
64 TString str;
65 str.ReadLine(fin);
66 if (!fin)
67 break;
68
69 if (str.Contains("#"))
70 continue;
71
72 Float_t alt, az, dalt, daz, mjd;
73 sscanf(str.Data(), "%f %f %*f %*f %*f %*f %f %f %f",
74 &az, &alt, &dalt, &daz, &mjd);
75
76 if (dalt==0/* || GetResidual(alt, az, alt+dalt, az+daz)>0.1*/)
77 continue;
78
79 mjd -= 53140.097505;
80
81 Double_t res = MAstro::GetDevAbs(90-(alt-dalt), -dalt, -daz);
82
83 g[0].SetPoint(g[0].GetN(), g[0].GetN(), fabs(dalt));
84 g[1].SetPoint(g[1].GetN(), g[1].GetN(), fabs(daz));
85 g[2].SetPoint(g[2].GetN(), g[2].GetN(), res);
86
87 h->Fill(res);
88 }
89
90 cout << "done (" << setw(3) << (Int_t)h->GetEntries() << "/";
91 cout << setw(4) << g[0].GetN() << ") " << flush;
92
93 return g[0].GetN();
94}
95
96struct Description_t
97{
98 const char *fName;
99 const char *fTitle;
100 const char *fFile;
101};
102
103const Int_t counts = 29+10+18+1+13+11+31;
104Description_t desc[counts] =
105{
106 /*
107 // 29. Apr. 2004 ~25800
108 // 5. Aug. 2004 ~32000
109 // 19. Aug. 2004 ~33530
110 // 7. Jun. 2005 ~57650
111 // 8. Jun. 2005
112 // 9. Jun. 2005 ~57860
113 // 12. Sep. 2005 ~68338
114 // 24. Nov. 2005 ~75562
115 // 17. Oct. 2006 ~103130
116 // 17. Jun. 2007 ~248193
117 */
118
119 // Culmination tests
120 //{"0411", "TPoints Residuals 11/2004" , "tpoint/tpoint0411.txt"},
121 //{"+0412", "TPoints Residuals 12/2004" , "tpoint/tpoint0412.txt"},
122
123 // 1: Worse pointing due to realignment of the mirror
124 {"0503", "TPoints Residuals 3/2005" , "tpoint/tpoint0503.txt"},
125
126 // New pointing model installed (29.4.2005)
127 // MIRROR MISALIGNMENT (WHEN?)
128 {"0504", "TPoints Residuals 4/2005" , "tpoint/tpoint0504.txt"},
129 {"+05051", "TPoints Residuals 5/2005-1" , "tpoint/tpoint0505-1.txt"},
130
131 // 2: Mirror alignment has been fixed
132 {"05052", "TPoints Residuals 5/2005-2" , "tpoint/tpoint0505-2.txt"},
133
134 // Pointing model changed due to fixing a screw
135 {"0506", "TPoints Residuals 6/2005" , "tpoint/tpoint0506.txt"},
136 // New pointing model applied (7.-9.6.2005)
137 {"0508", "TPoints Residuals 8/2005" , "tpoint/tpoint0508.txt"},
138
139 // New pointing model applied (12.9.2005)
140 {"0509", "TPoints Residuals 9/2005" , "tpoint/tpoint0509.txt"},
141 // Quick-and-dirty mirror alignment (only 4 TPoints)
142 {"+0510", "TPoints Residuals 10/2005" , "tpoint/tpoint0510.txt"},
143
144 // 3: New mirror alignment after Tenerife meeting
145 //{"05111", "TPoints Residuals 11/2005-1" , "tpoint/tpoint0511-1.txt"},
146
147 //New pointing model installed (24.11.2005)
148 {"05112", "TPoints Residuals 11/2005-2" , "tpoint/tpoint0511-2.txt"},
149 {"+0512", "TPoints Residuals 12/2005" , "tpoint/tpoint0512.txt"},
150 {"+0601", "TPoints Residuals 1/2006" , "tpoint/tpoint0601.txt"},
151 {"+0603-1", "TPoints Residuals 3/2006-1" , "tpoint/tpoint0603-1.txt"},
152
153 // Changes to the mirror
154 {"0603-2", "TPoints Residuals 3/2006-2" , "tpoint/tpoint0603-2.txt"},
155 {"+0604", "TPoints Residuals 4/2006" , "tpoint/tpoint0604.txt"},
156 {"+0607", "TPoints Residuals 7/2006" , "tpoint/tpoint0607.txt"},
157 {"+0608", "TPoints Residuals 8/2006" , "tpoint/tpoint0608.txt"},
158 {"+0609", "TPoints Residuals 9/2006" , "tpoint/tpoint0609.txt"},
159 {"+0610", "TPoints Residuals 10/2006" , "tpoint/tpoint0610.txt"},
160
161 // 5: 6/10/17
162 {"0611", "TPoints Residuals 11/2006" , "tpoint/tpoint0611.txt"},
163 {"+0612", "TPoints Residuals 12/2006" , "tpoint/tpoint0612.txt"},
164 {"+0701", "TPoints Residuals 1/2007" , "tpoint/tpoint0701.txt"},
165 {"+0702", "TPoints Residuals 2/2007" , "tpoint/tpoint0702.txt"},
166 {"+0703", "TPoints Residuals 3/2007" , "tpoint/tpoint0703.txt"},
167
168 {"+0704", "TPoints Residuals 4/2007" , "tpoint/tpoint0704.txt"},
169 {"+0705", "TPoints Residuals 5/2007" , "tpoint/tpoint0705.txt"},
170 {"+0706", "TPoints Residuals 6/2007" , "tpoint/tpoint0706.txt"},
171 {"+07071", "TPoints Residuals 7/2007-1" , "tpoint/tpoint0707-1.txt"},
172 {"+07072", "TPoints Residuals 7/2007-2" , "tpoint/tpoint0707-2.txt"},
173 // 7/6/17
174
175 {"0708", "TPoints Residuals 7/8/23", "tpoint/2007_08_23_TPoints.txt"},
176 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_08_24_TPoints.txt"},
177 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_08_25_TPoints.txt"},
178 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_08_26_TPoints.txt"},
179 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_09_01_TPoints.txt"},
180 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_09_03_TPoints.txt"},
181 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_09_13_TPoints.txt"},
182 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_09_15_TPoints.txt"},
183 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_09_20_TPoints.txt"},
184 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_10_04_TPoints.txt"},
185 {"+0708", "TPoints Residuals 7/8/23", "tpoint/2007_10_05_TPoints.txt"},
186
187 {"0801", "TPoints Residuals 7/8/23", "tpoint/2008_01_15_TPoints.txt"},
188 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_01_18_TPoints.txt"},
189 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_01_25_TPoints.txt"},
190 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_01_26_TPoints.txt"},
191 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_02_26_TPoints.txt"},
192 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_03_16_TPoints.txt"},
193 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_03_17_TPoints.txt"},
194 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_03_18_TPoints.txt"},
195 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_03_19_TPoints.txt"},
196 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_03_25_TPoints.txt"},
197 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_13_TPoints.txt"},
198 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_14_TPoints.txt"},
199 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_15_TPoints.txt"},
200 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_16_TPoints.txt"},
201 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_17_TPoints.txt"},
202 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_23_TPoints.txt"},
203 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_24_TPoints.txt"},
204 {"+0801", "TPoints Residuals 7/8/23", "tpoint/2008_04_25_TPoints.txt"},
205
206 // New pointing model 080611
207 {"0806", "TPoints Residuals 7/8/23", "tpoint/tpoint0806.txt"},
208 // New pointing model 080618
209
210 // Drive Upgrade finished 090511
211 {"090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090511_220118.txt"},
212 {"+090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090511_221333.txt"},
213 {"+090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090511_222434.txt"},
214 {"+090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090511_223152.txt"},
215 {"+090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090511_223706.txt"},
216 {"+090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090511_224056.txt"},
217 {"+090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090511_231933.txt"},
218 {"+090512", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_12/tpoint_20090512_011131.txt"},
219
220 // First new pointing model 090512
221 {"090513", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_13/tpoint_20090512_210644.txt"},
222 {"+090513", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_13/tpoint_20090513_002757.txt"},
223 {"+090513", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_13/tpoint_20090513_025124.txt"},
224 {"+090513", "TPoints Residuals 7/8/23", "tpoint/m1/2009_05_13/tpoint_20090513_033505.txt"},
225
226 // Second new pointing model 090513
227 {"090514", "TPoints 09/05/14", "tpoint/m1/2009_05_14/tpoint_20090514_011903.txt"},
228
229 {"090517", "TPoints 09/05/17" ,"tpoint/m1/2009_05_17/tpoint_20090516_234825.txt"},
230 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_05_17/tpoint_20090517_023340.txt"},
231 // New period
232 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_01/tpoint_20090531_215148.txt"},
233 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_01/tpoint_20090531_222549.txt"},
234 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_02/tpoint_20090601_223009.txt"},
235 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_03/tpoint_20090602_213509.txt"},
236 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_03/tpoint_20090603_011936.txt"},
237 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_04/tpoint_20090603_215840.txt"},
238 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_04/tpoint_20090603_230510.txt"},
239 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_05/tpoint_20090604_215943.txt"},
240 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_05/tpoint_20090604_232320.txt"},
241 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_10/tpoint_20090609_231948.txt"},
242 {"+090517","TPoints 09/05/17", "tpoint/m1/2009_06_11/tpoint_20090611_011155.txt"},
243
244 // ------- Something happened (reason unknown) --------
245
246 {"090613","TPoints 09/05/17", "tpoint/m1/2009_06_11/tpoint_20090611_023625.txt"},
247
248 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_06_13/tpoint_20090613_033838.txt"},
249 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_06_14/tpoint_20090614_021257.txt"},
250 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_06_18/tpoint_20090618_041433.txt"},
251
252 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_02/tpoint_20090701_215304.txt"},
253 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_02/tpoint_20090701_222059.txt"},
254 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_02/tpoint_20090701_224051.txt"},
255 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_02/tpoint_20090701_225615.txt"},
256 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_02/tpoint_20090701_230946.txt"},
257
258 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_03/tpoint_20090702_225940.txt"},
259 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_04/tpoint_20090703_224721.txt"},
260 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_05/tpoint_20090705_012638.txt"},
261
262 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_12/tpoint_20090712_014300.txt"},
263 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_12/tpoint_20090712_024710.txt"},
264 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_13/tpoint_20090713_004241.txt"},
265 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_13/tpoint_20090713_025934.txt"},
266
267 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_14/tpoint_20090714_024729.txt"},
268 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_15/tpoint_20090715_021320.txt"},
269 {"+090613","TPoints 09/05/17", "tpoint/m1/2009_07_15/tpoint_20090715_025237.txt"},
270
271 // ----- AMC adjust (23.7.) -----
272
273 {"090723","TPoints 09/05/17", "tpoint/m1/2009_07_24/tpoint_20090724_051142.txt"},
274 {"+090723", "TPoints 08/2009" , "tpoint/m1/2009_08_02/tpoint_20090801_223848.txt"},
275 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_03/tpoint_20090802_224434.txt"},
276 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_04/tpoint_20090803_230214.txt"},
277 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_10/tpoint_20090809_233524.txt"},
278 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_10/tpoint_20090810_014642.txt"},
279 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_10/tpoint_20090810_020616.txt"},
280 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_11/tpoint_20090810_232543.txt"},
281 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_12/tpoint_20090812_001846.txt"},
282 {"+090723","TPoints 08/2009" , "tpoint/m1/2009_08_13/tpoint_20090813_030807.txt"},
283
284 // ------ 09/08/17 new pointing model -------
285};
286
287void plot_m1()
288{
289 TGraph g[3];
290
291 MBinning bins(100, 0, 0.2);
292
293 TArrayI n(counts);
294
295 TH1F hx[counts];
296 Int_t num = -1;
297 for (int i=0; i<counts; i++)
298 {
299 if (desc[i].fName[0]!='+')
300 {
301 num++;
302
303 hx[num].SetNameTitle(desc[i].fName, desc[i].fTitle);
304 hx[num].SetDirectory(0);
305 bins.Apply(hx[num]);
306 }
307
308 cout << setw(2) << num << ": " << flush;
309 n[num] = fill(desc[i].fFile, g, &hx[num]);
310 cout << " Mean: " << setw(5) << setprecision(3) << hx[num].GetMean()*3600 << " sec +/- " << hx[num].GetRMS()*3600 << endl;
311 }
312
313 n.Set(++num);
314
315 g[0].SetMarkerColor(kGreen);
316 g[1].SetMarkerColor(kMagenta);
317 g[2].SetMarkerColor(kBlack);
318 //g[2].SetLineColor(kBlack);
319 g[0].SetMarkerStyle(kFullDotMedium);
320 g[1].SetMarkerStyle(kFullDotMedium);
321 g[2].SetMarkerStyle(kFullDotLarge);
322
323 // --------- First Canvas ----------
324
325 new TCanvas("Vs Time", "");
326
327 TObject *obj[4];
328
329 for (int i=0; i<3; i++)
330 {
331 g[i].SetFillColor(kWhite);
332 g[i].SetLineColor(kWhite);
333 obj[i] = g[i].Clone();
334 obj[i]->SetBit(kCanDelete);
335 obj[i]->Draw(i==0?"AP":"P");
336 }
337
338 TLegend leg(0.905, 0.86, 0.99, 0.99);
339 leg.AddEntry(obj[0], " \\Delta\\theta");
340 leg.AddEntry(obj[1], " \\Delta\\phi");
341 leg.AddEntry(obj[2], " \\Delta");
342 leg.DrawClone()->SetBit(kCanDelete);
343
344 TLine l;
345 l.SetLineColor(kBlue);
346 for (int i=0; i<n.GetSize(); i++)
347 l.DrawLine(n[i], 0, n[i], 0.2);
348
349 // --------- Second Canvas ----------
350
351 new TCanvas("Distrib", "");
352
353 Double_t max=0;
354 for (int i=0; i<n.GetSize(); i++)
355 {
356 if (hx[i].GetEntries()==0)
357 {
358 cout << "Skip #" << i << endl;
359 continue;
360 }
361
362 hx[i].Scale(1./hx[i].GetEntries());
363 max = TMath::Max(max, hx[i].GetMaximum());
364 }
365 for (int i=0; i<n.GetSize(); i++)
366 {
367 hx[i].SetMaximum(max*1.05);
368 if (i<6)
369 hx[i].SetLineColor(kRed+i);
370 else
371 hx[i].SetMarkerStyle(kPlus+i-6);
372
373
374 }
375
376 for (int i=0; i<counts; i++)
377 hx[i].DrawCopy(i==0?"LP":"LPsame");
378
379 Double_t time[] = {
380 MTime(2005, 3, 20).GetAxisTime(),
381 MTime(2005, 4, 29).GetAxisTime(),
382 MTime(2005, 5, 25).GetAxisTime(),
383 MTime(2005, 6, 8).GetAxisTime(),
384 MTime(2005, 8, 15).GetAxisTime(),
385// MTime(2005, 9, 12).GetAxisTime(),
386 MTime(2005, 11, 10).GetAxisTime(),
387 MTime(2005, 11, 24).GetAxisTime(),
388 MTime(2006, 3, 19).GetAxisTime(),
389 MTime(2006, 10, 17).GetAxisTime(),
390 MTime(2007, 7, 31).GetAxisTime(),
391 MTime(2008, 1, 14).GetAxisTime(),
392 MTime(2008, 6, 11).GetAxisTime(),
393 //MTime(2008, 6, 18).GetAxisTime(),
394 // Are we missing TPoints between 080618 and 090501??
395 MTime(2009, 5, 1).GetAxisTime(),
396 MTime(2009, 5, 11).GetAxisTime(),
397 MTime(2009, 5, 12).GetAxisTime(),
398 MTime(2009, 5, 13).GetAxisTime(),
399 MTime(2009, 6, 11).GetAxisTime(),
400 MTime(2009, 7, 23).GetAxisTime(),
401 MTime(2009, 8, 17).GetAxisTime(),
402 MTime(2009, 12, 31).GetAxisTime(),
403 };
404
405 TH1D histres[4];
406
407 MBinning bins;
408 bins.SetEdges(TArrayD(20, time));
409
410 bins.Apply(histres[0]);
411 bins.Apply(histres[1]);
412 bins.Apply(histres[2]);
413 bins.Apply(histres[3]);
414
415 TGraphAsymmErrors result[4];
416 TGraph resultm;
417 for (int i=0; i<n.GetSize(); i++)
418 {
419 cout << i+1 << " - Mean: " << Form("%5.1f +- %5.1f", hx[i].GetMean()*3600, hx[i].GetRMS()*3600);
420 cout << " (Overflows=" << hx[i].GetBinContent(hx[i].GetNbinsX()+1)*hx[i].GetEntries() << ") " << (int)hx[i].GetEntries() << endl;
421
422 /*
423 TF1 fg("fg", "gaus", 0, 1);
424 hx[i].Fit(&fg);
425 result2.SetPoint(result.GetN(), result.GetN()+7, hx[i].GetMean());
426 result2.SetPointError(result.GetN()-1, 0, hx[i].GetRMS()/sqrt(hx[i].GetEntries()));
427 result.SetPoint(result.GetN(), result.GetN()+7, fg.GetParameter(1));
428 result.SetPointError(result.GetN()-1, 0, fg.GetParameter(2));
429 */
430
431 //Double_t q[4] = { MMath::GaussProb(0.5), MMath::GaussProb(1), MMath::GaussProb(2), MMath::GaussProb(3) };
432 Double_t q[4] = { 0.5, MMath::GaussProb(1), MMath::GaussProb(2), MMath::GaussProb(3) };
433 Double_t rc[4];
434 hx[i].GetQuantiles(4, rc, q);
435
436 for (int j=0; j<4; j++)
437 {
438 histres[j].SetBinContent(i+1, 60*rc[j]);
439
440 result[j].SetPoint(i, time[i], 60*rc[j]);
441 result[j].SetPointError(i, 0, 0, 60*rc[j], 0);
442
443 //result[j].SetPoint(result[j].GetN(), result[j].GetN()+1, 60*rc[j]);
444 //result[j].SetPointError(result[j].GetN()-1, 0, 0, 60*rc[j], 0);
445 }
446
447// result.SetPoint(result.GetN(), result.GetN()+1, rc[1]);
448// result2.SetPoint(result2.GetN(), result2.GetN()+1, rc[2]);
449
450 //result.SetPointError(result.GetN()-1, 0.5, 0);//rc[2]-rc[1]);
451 //result2.SetPointError(result.GetN()-1, 0.5, 0);//rc[2]-rc[1]);
452
453// result.SetPointError(result.GetN()-1, 0, 0, 0/*rc[1]-rc[0]*/, rc[2]-rc[1]);
454// result2.SetPointError(result.GetN()-1, 0, 0, 0/*rc[1]-rc[0]*/, rc[2]-rc[1]);
455
456// result2.SetPointError(result.GetN()-1, 0, 0, rc[2], 0);
457
458// resultm.SetPoint(resultm.GetN(), resultm.GetN()+1, 60*hx[i].GetMean());
459 resultm.SetPoint(resultm.GetN(), (time[i]+time[i+1])/2, 60*hx[i].GetMean());
460
461 }
462
463 new TCanvas;
464
465 gPad->SetBorderMode(0);
466 gPad->SetFrameBorderMode(0);
467 gPad->SetFillColor(kWhite);
468 gPad->SetRightMargin(0.01);
469 gPad->SetTopMargin(0.01);
470 gPad->SetLeftMargin(0.06);
471 gPad->SetGridy();
472
473 //Int_t col[] = { 12, 15, 17, 19 };
474 //Int_t col[] = { 12, 16, 18, 0 };
475 Int_t col[] = { 13, 16, 19, 0 };
476
477 TH1 *h = &histres[2];//result[3].GetHistogram();
478 h->SetXTitle("");
479 h->SetYTitle("Residual / arcmin");
480 h->SetBit(TH1::kNoStats);
481 h->GetXaxis()->CenterTitle();
482 h->GetYaxis()->CenterTitle();
483 h->GetYaxis()->SetTitleOffset(0.75);
484// h->GetXaxis()->SetTimeFormat("%m/%y %F1995-01-01 00:00:00 GMT");
485// h->GetXaxis()->SetTimeDisplay(1);
486
487 h->GetXaxis()->SetLabelColor(kWhite);
488
489 TLine line;
490
491 for (int j=2; j>=0; j--)
492 {
493 histres[j].SetMinimum(0);
494 histres[j].SetFillColor(col[j]);//12+2*j);
495
496 histres[j].DrawCopy(j==2?"":"same");
497
498 /*
499 //result[j].SetLineColor(kBlue);
500 //result[j].SetLineWidth(2);
501 //result[j].SetMarkerColor(kBlue);
502 result[j].SetMinimum(0);
503 //result2.SetMarkerStyle(kFullDotMedium);
504 //result[j].SetMarkerStyle(23);
505 result[j].SetFillColor(col[j]);//12+2*j);
506 result[j].DrawClone(j==3 ? "ABX" : "B"); // E3 B
507 */
508 }
509
510
511 resultm.SetMarkerStyle(20);
512 resultm.SetMarkerSize(0.8);
513 resultm.DrawClone("P");
514
515 line.DrawLine(time[0], 0, time[0], histres[2].GetMaximum());
516 for (int i=0; i<bins.GetNumBins()-1; i++)
517 line.DrawLine(time[i+1], 0, time[i+1], histres[2].GetBinContent(i+1));
518
519 TText txt;
520 txt.SetTextSize(0.037);
521// txt.SetTextAngle(-45);
522 txt.SetTextAlign(23);
523 for (int m=4; m<13; m++)
524 {
525 Double_t monl = MTime(2005, m, 1,0).GetAxisTime();
526 Double_t mont = MTime(2005, m, 15,0).GetAxisTime();
527// txt.DrawText(mon, -0.12, Form("%02d/05", m));
528 txt.DrawText(mont, -0.10, Form("%d", m));
529 line.DrawLine(monl, -0.12, monl, 0.12);
530 }
531 for (int m=1; m<13; m++)
532 {
533 Double_t monl = MTime(2006, m, 1,0).GetAxisTime();
534 Double_t mont = MTime(2006, m, 15,0).GetAxisTime();
535// txt.DrawText(mon, -0.12, Form("%02d/06", m));
536 txt.DrawText(mont, -0.10, Form("%d", m));
537 line.DrawLine(monl, -0.12, monl, 0.12);
538 }
539 for (int m=1; m<13; m++)
540 {
541 Double_t monl = MTime(2007, m, 1,0).GetAxisTime();
542 Double_t mont = MTime(2007, m, 15,0).GetAxisTime();
543// txt.DrawText(mon, -0.12, Form("%02d/07", m));
544 txt.DrawText(mont, -0.10, Form("%d", m));
545 line.DrawLine(monl, -0.12, monl, 0.12);
546 }
547 for (int m=1; m<13; m++)
548 {
549 Double_t monl = MTime(2008, m, 1,0).GetAxisTime();
550 Double_t mont = MTime(2008, m, 15,0).GetAxisTime();
551// txt.DrawText(mon, -0.12, Form("%02d/07", m));
552 txt.DrawText(mont, -0.10, Form("%d", m));
553 line.DrawLine(monl, -0.12, monl, 0.12);
554 }
555
556 for (int m=1; m<13; m++)
557 {
558 Double_t monl = MTime(2009, m, 1,0).GetAxisTime();
559 Double_t mont = MTime(2009, m, 15,0).GetAxisTime();
560// txt.DrawText(mon, -0.12, Form("%02d/07", m));
561 txt.DrawText(mont, -0.10, Form("%d", m));
562 line.DrawLine(monl, -0.12, monl, 0.12);
563 }
564
565 Double_t y6 = MTime(2006,1,1,0).GetAxisTime();
566 Double_t y7 = MTime(2007,1,1,0).GetAxisTime();
567 Double_t y8 = MTime(2008,1,1,0).GetAxisTime();
568 Double_t y9 = MTime(2009,1,1,0).GetAxisTime();
569 Double_t y0 = MTime(2010,1,1,0).GetAxisTime();
570// Double_t y0 = MTime(2009,5,1,0).GetAxisTime();
571
572 txt.SetTextSize(0.042);
573 txt.DrawText(y6-(y7-y6)/2, -0.6, "2005");
574 txt.DrawText((y6+y7)/2, -0.6, "2006");
575 txt.DrawText((y7+y8)/2, -0.6, "2007");
576 txt.DrawText((y8+y9)/2, -0.6, "2008");
577 txt.DrawText((y9+y0)/2, -0.6, "2009");
578
579 line.DrawLine(y6, -0.7, y6, 0.26);
580 line.DrawLine(y7, -0.7, y7, 0.26);
581 line.DrawLine(y8, -0.7, y8, 0.26);
582 line.DrawLine(y9, -0.7, y9, 0.26);
583 line.SetLineStyle(3);
584 line.DrawLine(y6, 0.26, y6, 1.05*histres[2].GetMaximum());
585 line.DrawLine(y7, 0.26, y7, 1.05*histres[2].GetMaximum());
586 line.DrawLine(y8, 0.26, y8, 1.05*histres[2].GetMaximum());
587 line.DrawLine(y9, 0.26, y9, 1.05*histres[2].GetMaximum());
588
589 line.SetLineColor(kBlue);
590 line.SetLineWidth(2);
591 line.SetLineStyle(kSolid);
592 line.DrawLine(time[0], 1*360/16384.*60, time[bins.GetNumBins()], 1*360/16384.*60);
593 line.SetLineStyle(9);
594 line.DrawLine(time[0], 2*360/16384.*60, time[bins.GetNumBins()], 2*360/16384.*60);
595 line.SetLineStyle(7);
596 line.DrawLine(time[0], 3*360/16384.*60, time[bins.GetNumBins()], 3*360/16384.*60);
597
598 /* result.SetMinimum(-0.06);
599 result.SetMarkerStyle(kFullDotMedium);
600 result.DrawClone("LP");*/
601}
Note: See TracBrowser for help on using the repository browser.