1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Markus Gaug, 11/2003 <mailto:markus@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | void calibration(TString pedname="/data/MAGIC/rootdata/2003_12_01/20031130_03340_P_CrabNebula_E.root",
|
---|
26 | TString calname="/data/MAGIC/rootdata/2003_12_01/20031130_03341_C_CrabNebula_E.root")
|
---|
27 | {
|
---|
28 |
|
---|
29 | //
|
---|
30 | // Create a empty Parameter List and an empty Task List
|
---|
31 | // The tasklist is identified in the eventloop by its name
|
---|
32 | //
|
---|
33 | MParList plist;
|
---|
34 |
|
---|
35 | MTaskList tlist;
|
---|
36 | plist.AddToList(&tlist);
|
---|
37 |
|
---|
38 | //
|
---|
39 | // Now setup the tasks and tasklist for the pedestals:
|
---|
40 | // ---------------------------------------------------
|
---|
41 | //
|
---|
42 |
|
---|
43 | MReadMarsFile read("Events", pedname);
|
---|
44 | read.DisableAutoScheme();
|
---|
45 |
|
---|
46 | MGeomApply geomapl;
|
---|
47 | MPedCalcPedRun pedcalc;
|
---|
48 | MGeomCamMagic geomcam;
|
---|
49 | MPedestalCam pedcam;
|
---|
50 |
|
---|
51 | tlist.AddToList(&read);
|
---|
52 | tlist.AddToList(&geomapl);
|
---|
53 | tlist.AddToList(&pedcalc);
|
---|
54 |
|
---|
55 | plist.AddToList(&pedcam);
|
---|
56 |
|
---|
57 | MHCamEvent hist("Pedestal");
|
---|
58 | hist.SetType(0);
|
---|
59 | plist.AddToList(&hist);
|
---|
60 | MFillH fill(&hist, "MPedestalCam");
|
---|
61 |
|
---|
62 | tlist.AddToList(&fill);
|
---|
63 |
|
---|
64 | MStatusDisplay *d1 = new MStatusDisplay;
|
---|
65 |
|
---|
66 | // Set update time to 3s
|
---|
67 | d1->SetUpdateTime(3000);
|
---|
68 |
|
---|
69 | //
|
---|
70 | // Create and setup the eventloop
|
---|
71 | //
|
---|
72 | MEvtLoop evtloop;
|
---|
73 | evtloop.SetParList(&plist);
|
---|
74 | evtloop.SetDisplay(d1);
|
---|
75 |
|
---|
76 | //
|
---|
77 | // Execute first analysis
|
---|
78 | //
|
---|
79 | if (!evtloop.Eventloop())
|
---|
80 | return;
|
---|
81 |
|
---|
82 | tlist.PrintStatistics();
|
---|
83 |
|
---|
84 |
|
---|
85 | //
|
---|
86 | // Create a empty Parameter List and an empty Task List
|
---|
87 | //
|
---|
88 | MParList plist2;
|
---|
89 |
|
---|
90 | MTaskList tlist2;
|
---|
91 | plist2.AddToList(&tlist2);
|
---|
92 |
|
---|
93 |
|
---|
94 | plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam"));
|
---|
95 |
|
---|
96 | // MGeomApply geomapl2;
|
---|
97 | tlist2.AddToList(&geomapl);
|
---|
98 |
|
---|
99 | //
|
---|
100 | // Now setup the new tasks and tasklist for the calibration
|
---|
101 | // ---------------------------------------------------
|
---|
102 | //
|
---|
103 |
|
---|
104 | MReadMarsFile read2("Events", calname);
|
---|
105 | read2.DisableAutoScheme();
|
---|
106 |
|
---|
107 | MExtractSignal sigsig;
|
---|
108 | MCalibrationCalc calcalc;
|
---|
109 | MExtractedSignalCam sigcam;
|
---|
110 |
|
---|
111 | plist2.AddToList(&geomcam);
|
---|
112 | plist2.AddToList(&sigcam);
|
---|
113 |
|
---|
114 | //
|
---|
115 | // As long, as we don't have digital modules,
|
---|
116 | // we have to set the color of the pulser LED by hand
|
---|
117 | //
|
---|
118 | calcalc.SetPulserColor(MCalibrationCalc::kECT1);
|
---|
119 |
|
---|
120 | tlist2.AddToList(&read2);
|
---|
121 | tlist2.AddToList(&sigsig);
|
---|
122 | tlist2.AddToList(&calcalc);
|
---|
123 |
|
---|
124 | MHCamEvent hist2;
|
---|
125 | hist2.SetType(8);
|
---|
126 | plist2.AddToList(&hist2);
|
---|
127 | MFillH fill2("MHCamEvent", "MCalibrationCam");
|
---|
128 | tlist2.AddToList(&fill2);
|
---|
129 |
|
---|
130 | MStatusDisplay *d2 = new MStatusDisplay;
|
---|
131 | d2->SetUpdateTime(3000);
|
---|
132 |
|
---|
133 | //
|
---|
134 | // Create and setup the eventloop
|
---|
135 | //
|
---|
136 | MEvtLoop evtloop2;
|
---|
137 | evtloop2.SetParList(&plist2);
|
---|
138 | evtloop2.SetDisplay(d2);
|
---|
139 |
|
---|
140 | //
|
---|
141 | // Execute second analysis
|
---|
142 | //
|
---|
143 | if (!evtloop2.Eventloop())
|
---|
144 | return;
|
---|
145 |
|
---|
146 | tlist2.PrintStatistics();
|
---|
147 |
|
---|
148 | //
|
---|
149 | // just one example how to get the plots of individual pixels
|
---|
150 | //
|
---|
151 | MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
|
---|
152 | cam.Print();
|
---|
153 |
|
---|
154 | //
|
---|
155 | // Here we are confronted to a serious bug in ROOT:
|
---|
156 | // If we do not apply the next command, gPad will get
|
---|
157 | // screwed up completely: (Thanks to tbretz for finding out
|
---|
158 | // the reason during several hours!!!)
|
---|
159 | //
|
---|
160 | gROOT->GetListOfCanvases()->Delete();
|
---|
161 |
|
---|
162 | MHCamEvent &h = *(MHCamEvent*)plist2->FindObject("MHCamEvent");
|
---|
163 | MHCamera &disp0 = *h.GetHistByName();
|
---|
164 | MHCamera disp1 (geomcam, "MCalibrationCam;q", "Fitted Mean Charges");
|
---|
165 | MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges");
|
---|
166 | MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit");
|
---|
167 | MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times");
|
---|
168 | MHCamera disp7 (geomcam, "MCalibrationCam;sigmat", "Sigma of Arrival Times");
|
---|
169 | MHCamera disp8 (geomcam, "MCalibrationCam;probt", "Chi Square of Time Fit");
|
---|
170 | MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals");
|
---|
171 | MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
|
---|
172 | MHCamera disp11 (geomcam, "MCalibrationCam;rsigma", "Reduced Sigmas");
|
---|
173 | MHCamera disp12 (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)");
|
---|
174 | MHCamera disp13 (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)");
|
---|
175 | MHCamera disp14 (geomcam, "MCalibrationCam;photons", "Nr. of Photons (Blind Pixel Method)");
|
---|
176 | MHCamera disp15 (geomcam, "MCalibrationCam;convphot", "Conversion Factor (Blind Pixel Method)");
|
---|
177 | MHCamera disp16 (geomcam, "MCalibrationCam;sigsqchargesq", "Sigma Square per Charges Square");
|
---|
178 |
|
---|
179 | disp1.SetCamContent(*cam, 0);
|
---|
180 | disp1.SetCamError(*cam,1);
|
---|
181 |
|
---|
182 | disp3.SetCamContent(*cam, 2);
|
---|
183 | disp3.SetCamError(*cam,3);
|
---|
184 |
|
---|
185 | disp5.SetCamContent(*cam, 4);
|
---|
186 |
|
---|
187 | disp6.SetCamContent(*cam, 5);
|
---|
188 | disp6.SetCamError(*cam, 6);
|
---|
189 | disp7.SetCamContent(*cam, 6);
|
---|
190 | disp8.SetCamContent(*cam, 7);
|
---|
191 |
|
---|
192 | disp9.SetCamContent(*cam, 8);
|
---|
193 | disp9.SetCamError(*cam, 9);
|
---|
194 | disp10.SetCamContent(*cam, 9);
|
---|
195 |
|
---|
196 | disp11.SetCamContent(*cam, 10);
|
---|
197 |
|
---|
198 | disp12.SetCamContent(*cam, 11);
|
---|
199 | disp12.SetCamError(*cam, 12);
|
---|
200 |
|
---|
201 | disp13.SetCamContent(*cam, 13);
|
---|
202 | disp13.SetCamError(*cam, 14);
|
---|
203 |
|
---|
204 | disp14.SetCamContent(*cam, 15);
|
---|
205 | disp15.SetCamContent(*cam, 16);
|
---|
206 | disp16.SetCamContent(*cam, 17);
|
---|
207 |
|
---|
208 |
|
---|
209 | disp1.SetYTitle("Q [FADC counts]");
|
---|
210 | // disp2.SetYTitle("\\Delta Q [FADC counts]");
|
---|
211 | disp3.SetYTitle("\\sigma_{Q} [FADC counts]");
|
---|
212 | // disp4.SetYTitle("\\Delta {\\sigma_{Q}} [FADC counts]");
|
---|
213 | disp5.SetYTitle("P [au]");
|
---|
214 | disp6.SetYTitle("T [FADC slices]");
|
---|
215 | disp7.SetYTitle("\\Delta T [FADC slices]");
|
---|
216 | disp8.SetYTitle("\\Chi^2 T [au]");
|
---|
217 | disp9.SetYTitle("P [Total FADC counts ]");
|
---|
218 | disp10.SetYTitle("RMS_{P} [Total FADC counts ]");
|
---|
219 | disp11.SetYTitle("\\sigma^2_{Q} - RMS^2_{P} [FADC counts^2]");
|
---|
220 | disp12.SetYTitle("Nr Phe's");
|
---|
221 | disp13.SetYTitle("Conversion Factor [Phe/FADC count]");
|
---|
222 | disp14.SetYTitle("Nr Photons");
|
---|
223 | disp15.SetYTitle("Conversion Factor [Ph/FADC count]");
|
---|
224 | disp16.SetYTitle("Sigma^2 per Charge^2 [1]");
|
---|
225 |
|
---|
226 | MStatusDisplay *d3 = new MStatusDisplay;
|
---|
227 |
|
---|
228 | // Set update time to 3s
|
---|
229 | d3->SetUpdateTime(3000);
|
---|
230 |
|
---|
231 | TCanvas *c1 = &d3->AddTab("Fitted Charges");
|
---|
232 | c1->Divide(2, 2);
|
---|
233 |
|
---|
234 | TObject *obj;
|
---|
235 |
|
---|
236 | c1->cd(1);
|
---|
237 | gStyle->SetOptStat(1111);
|
---|
238 | obj=disp1.DrawCopy("hist");
|
---|
239 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
240 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
241 |
|
---|
242 | c1->cd(3);
|
---|
243 | gPad->SetBorderMode(0);
|
---|
244 | obj->Draw();
|
---|
245 |
|
---|
246 | c1->cd(2);
|
---|
247 | gStyle->SetOptStat(1101);
|
---|
248 | obj=disp3.DrawCopy("hist");
|
---|
249 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
250 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
251 |
|
---|
252 | c1->cd(4);
|
---|
253 | gPad->SetBorderMode(0);
|
---|
254 | obj->Draw();
|
---|
255 |
|
---|
256 |
|
---|
257 | TCanvas *c12 = &d3->AddTab("Fit Prob.");
|
---|
258 | c12->Divide(1, 2);
|
---|
259 |
|
---|
260 | c12->cd(1);
|
---|
261 | gStyle->SetOptStat(1101);
|
---|
262 | obj=disp5.DrawCopy("hist");
|
---|
263 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
264 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
265 |
|
---|
266 | c12->cd(2);
|
---|
267 | gPad->SetBorderMode(0);
|
---|
268 | obj->Draw();
|
---|
269 |
|
---|
270 | TCanvas *c2 = &d3->AddTab("Fitted Times");
|
---|
271 | c2->Divide(3, 2);
|
---|
272 |
|
---|
273 | c2->cd(1);
|
---|
274 | gStyle->SetOptStat(1111);
|
---|
275 | obj=disp6.DrawCopy("hist");
|
---|
276 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
277 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
278 |
|
---|
279 | c2->cd(4);
|
---|
280 | obj->Draw();
|
---|
281 |
|
---|
282 | c2->cd(2);
|
---|
283 | gStyle->SetOptStat(1101);
|
---|
284 | obj=disp7.DrawCopy("hist");
|
---|
285 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
286 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
287 |
|
---|
288 | c2->cd(5);
|
---|
289 | obj->Draw();
|
---|
290 |
|
---|
291 | c2->cd(3);
|
---|
292 | gStyle->SetOptStat(1101);
|
---|
293 | obj=disp8.DrawCopy("hist");
|
---|
294 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
295 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
296 |
|
---|
297 | c2->cd(6);
|
---|
298 | obj->Draw();
|
---|
299 |
|
---|
300 | TCanvas *c3 = &d3->AddTab("Pedestals");
|
---|
301 | c3->Divide(2, 2);
|
---|
302 |
|
---|
303 | c3->cd(1);
|
---|
304 | gStyle->SetOptStat(1111);
|
---|
305 | obj=disp9.DrawCopy("hist");
|
---|
306 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
307 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
308 |
|
---|
309 | c3->cd(3);
|
---|
310 | obj->Draw();
|
---|
311 |
|
---|
312 | c3->cd(2);
|
---|
313 | gStyle->SetOptStat(1111);
|
---|
314 | obj=disp10.DrawCopy("hist");
|
---|
315 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
316 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
317 |
|
---|
318 | c3->cd(4);
|
---|
319 | obj->Draw();
|
---|
320 |
|
---|
321 | TCanvas *c4 = &d3->AddTab("Reduced Charges");
|
---|
322 | c4->Divide(2,2);
|
---|
323 |
|
---|
324 | c4->cd(1);
|
---|
325 | gStyle->SetOptStat(1111);
|
---|
326 | obj=disp11.DrawCopy("hist");
|
---|
327 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
328 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
329 |
|
---|
330 | c4->cd(3);
|
---|
331 | obj->Draw();
|
---|
332 |
|
---|
333 | c4->cd(2);
|
---|
334 | gStyle->SetOptStat(1111);
|
---|
335 | obj=disp16.DrawCopy("hist");
|
---|
336 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
337 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
338 |
|
---|
339 | c4->cd(4);
|
---|
340 | obj->Draw();
|
---|
341 |
|
---|
342 | TCanvas *c5 = &d3->AddTab("F-Factor Method");
|
---|
343 | c5->Divide(2, 2);
|
---|
344 |
|
---|
345 | c5->cd(1);
|
---|
346 | gStyle->SetOptStat(1111);
|
---|
347 | obj=disp12.DrawCopy("hist");
|
---|
348 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
349 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
350 |
|
---|
351 | c5->cd(3);
|
---|
352 | obj->Draw();
|
---|
353 |
|
---|
354 | c5->cd(2);
|
---|
355 | gStyle->SetOptStat(1101);
|
---|
356 | obj=disp13.DrawCopy("hist");
|
---|
357 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
358 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
359 |
|
---|
360 | c5->cd(4);
|
---|
361 | obj->Draw();
|
---|
362 |
|
---|
363 | TCanvas *c6 = &d3->AddTab("Blind Pixel Method");
|
---|
364 | c6->Divide(2, 2);
|
---|
365 |
|
---|
366 | c6->cd(1);
|
---|
367 | gStyle->SetOptStat(1111);
|
---|
368 | obj=disp14.DrawCopy("hist");
|
---|
369 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
370 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
371 |
|
---|
372 | c6->cd(3);
|
---|
373 | obj->Draw();
|
---|
374 |
|
---|
375 | c6->cd(2);
|
---|
376 | gStyle->SetOptStat(1101);
|
---|
377 | obj=disp15.DrawCopy("hist");
|
---|
378 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
379 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
380 |
|
---|
381 | c6->cd(4);
|
---|
382 | obj->Draw();
|
---|
383 |
|
---|
384 | }
|
---|
385 |
|
---|