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 disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges");
|
---|
166 | MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges");
|
---|
167 | // MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges");
|
---|
168 | MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit");
|
---|
169 | MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times");
|
---|
170 | MHCamera disp7 (geomcam, "MCalibrationCam;sigmat", "Sigma of Arrival Times");
|
---|
171 | MHCamera disp8 (geomcam, "MCalibrationCam;probt", "Chi Square of Time Fit");
|
---|
172 | MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals");
|
---|
173 | MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
|
---|
174 | MHCamera disp11 (geomcam, "MCalibrationCam;rsigma", "Reduced Sigmas");
|
---|
175 | MHCamera disp12 (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)");
|
---|
176 | MHCamera disp13 (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)");
|
---|
177 | MHCamera disp14 (geomcam, "MCalibrationCam;photons", "Nr. of Photons (Blind Pixel Method)");
|
---|
178 | MHCamera disp15 (geomcam, "MCalibrationCam;convphot", "Conversion Factor (Blind Pixel Method)");
|
---|
179 | MHCamera disp16 (geomcam, "MCalibrationCam;sigma/charge", "Sigma^2 per Charge^2");
|
---|
180 |
|
---|
181 | disp1.SetCamContent(*cam, 0);
|
---|
182 | disp1.SetCamError(*cam,1);
|
---|
183 | // disp2.SetCamContent(*cam, 1);
|
---|
184 |
|
---|
185 | disp3.SetCamContent(*cam, 2);
|
---|
186 | disp3.SetCamError(*cam,3);
|
---|
187 | // disp4.SetCamContent(*cam, 3);
|
---|
188 | disp5.SetCamContent(*cam, 4);
|
---|
189 |
|
---|
190 | disp6.SetCamContent(*cam, 5);
|
---|
191 | disp6.SetCamError(*cam, 6);
|
---|
192 | disp7.SetCamContent(*cam, 6);
|
---|
193 | disp8.SetCamContent(*cam, 7);
|
---|
194 |
|
---|
195 | disp9.SetCamContent(*cam, 8);
|
---|
196 | disp9.SetCamError(*cam, 9);
|
---|
197 | disp10.SetCamContent(*cam, 9);
|
---|
198 |
|
---|
199 | disp11.SetCamContent(*cam, 10);
|
---|
200 |
|
---|
201 | disp12.SetCamContent(*cam, 11);
|
---|
202 | disp13.SetCamContent(*cam, 12);
|
---|
203 | disp14.SetCamContent(*cam, 13);
|
---|
204 | disp15.SetCamContent(*cam, 14);
|
---|
205 | disp16.SetCamContent(*cam, 15);
|
---|
206 |
|
---|
207 |
|
---|
208 | disp1.SetYTitle("Q [FADC counts]");
|
---|
209 | // disp2.SetYTitle("\\Delta Q [FADC counts]");
|
---|
210 | disp3.SetYTitle("\\sigma_{Q} [FADC counts]");
|
---|
211 | // disp4.SetYTitle("\\Delta {\\sigma_{Q}} [FADC counts]");
|
---|
212 | disp5.SetYTitle("P [au]");
|
---|
213 | disp6.SetYTitle("T [FADC slices]");
|
---|
214 | disp7.SetYTitle("\\Delta T [FADC slices]");
|
---|
215 | disp8.SetYTitle("\\Chi^2 T [au]");
|
---|
216 | disp9.SetYTitle("P [Total FADC counts ]");
|
---|
217 | disp10.SetYTitle("RMS_{P} [Total FADC counts ]");
|
---|
218 | disp11.SetYTitle("\\sigma^2_{Q} - RMS^2_{P} [FADC counts^2]");
|
---|
219 | disp12.SetYTitle("Nr Phe's");
|
---|
220 | disp13.SetYTitle("Conversion Factor [Phe/FADC count]");
|
---|
221 | disp14.SetYTitle("Nr Photons");
|
---|
222 | disp15.SetYTitle("Conversion Factor [Ph/FADC count]");
|
---|
223 | disp16.SetYTitle("Sigma^2 per Charge^2 [1]");
|
---|
224 |
|
---|
225 | MStatusDisplay *d3 = new MStatusDisplay;
|
---|
226 |
|
---|
227 | // Set update time to 1s
|
---|
228 | d3->SetUpdateTime(1000);
|
---|
229 |
|
---|
230 | TCanvas *c1 = &d3->AddTab("Fitted Charges");
|
---|
231 | c1->Divide(2, 2);
|
---|
232 |
|
---|
233 | TObject *obj;
|
---|
234 |
|
---|
235 | c1->cd(1);
|
---|
236 | gStyle->SetOptStat(1111);
|
---|
237 | obj=disp1.DrawCopy("hist");
|
---|
238 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
239 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
240 |
|
---|
241 | c1->cd(3);
|
---|
242 | gPad->SetBorderMode(0);
|
---|
243 | obj->Draw();
|
---|
244 |
|
---|
245 | c1->cd(2);
|
---|
246 | gStyle->SetOptStat(1101);
|
---|
247 | obj=disp3.DrawCopy("hist");
|
---|
248 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
249 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
250 |
|
---|
251 | c1->cd(4);
|
---|
252 | gPad->SetBorderMode(0);
|
---|
253 | obj->Draw();
|
---|
254 |
|
---|
255 |
|
---|
256 | TCanvas *c12 = &d3->AddTab("Fit Prob.");
|
---|
257 | c12->Divide(1, 2);
|
---|
258 |
|
---|
259 | c12->cd(1);
|
---|
260 | gStyle->SetOptStat(1101);
|
---|
261 | obj=disp5.DrawCopy("hist");
|
---|
262 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
263 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
264 |
|
---|
265 | c12->cd(2);
|
---|
266 | gPad->SetBorderMode(0);
|
---|
267 | obj->Draw();
|
---|
268 |
|
---|
269 | TCanvas *c2 = &d3->AddTab("Fitted Times");
|
---|
270 | c2->Divide(3, 2);
|
---|
271 |
|
---|
272 | c2->cd(1);
|
---|
273 | gStyle->SetOptStat(1111);
|
---|
274 | obj=disp6.DrawCopy("hist");
|
---|
275 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
276 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
277 |
|
---|
278 | c2->cd(4);
|
---|
279 | obj->Draw();
|
---|
280 |
|
---|
281 | c2->cd(2);
|
---|
282 | gStyle->SetOptStat(1101);
|
---|
283 | obj=disp7.DrawCopy("hist");
|
---|
284 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
285 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
286 |
|
---|
287 | c2->cd(5);
|
---|
288 | obj->Draw();
|
---|
289 |
|
---|
290 | c2->cd(3);
|
---|
291 | gStyle->SetOptStat(1101);
|
---|
292 | obj=disp8.DrawCopy("hist");
|
---|
293 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
294 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
295 |
|
---|
296 | c2->cd(6);
|
---|
297 | obj->Draw();
|
---|
298 |
|
---|
299 | TCanvas *c3 = &d3->AddTab("Pedestals");
|
---|
300 | c3->Divide(2, 2);
|
---|
301 |
|
---|
302 | c3->cd(1);
|
---|
303 | gStyle->SetOptStat(1111);
|
---|
304 | obj=disp9.DrawCopy("hist");
|
---|
305 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
306 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
307 |
|
---|
308 | c3->cd(3);
|
---|
309 | obj->Draw();
|
---|
310 |
|
---|
311 | c3->cd(2);
|
---|
312 | gStyle->SetOptStat(1111);
|
---|
313 | obj=disp10.DrawCopy("hist");
|
---|
314 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
315 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
316 |
|
---|
317 | c3->cd(4);
|
---|
318 | obj->Draw();
|
---|
319 |
|
---|
320 | TCanvas *c4 = &d3->AddTab("Reduced Charges");
|
---|
321 | c4->Divide(2,2);
|
---|
322 |
|
---|
323 | c4->cd(1);
|
---|
324 | gStyle->SetOptStat(1111);
|
---|
325 | obj=disp11.DrawCopy("hist");
|
---|
326 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
327 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
328 |
|
---|
329 | c4->cd(3);
|
---|
330 | obj->Draw();
|
---|
331 |
|
---|
332 | c4->cd(2);
|
---|
333 | gStyle->SetOptStat(1111);
|
---|
334 | obj=disp16.DrawCopy("hist");
|
---|
335 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
336 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
337 |
|
---|
338 | c4->cd(4);
|
---|
339 | obj->Draw();
|
---|
340 |
|
---|
341 | TCanvas *c5 = &d3->AddTab("F-Factor Method");
|
---|
342 | c5->Divide(2, 2);
|
---|
343 |
|
---|
344 | c5->cd(1);
|
---|
345 | gStyle->SetOptStat(1111);
|
---|
346 | obj=disp12.DrawCopy("hist");
|
---|
347 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
348 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
349 |
|
---|
350 | c5->cd(3);
|
---|
351 | obj->Draw();
|
---|
352 |
|
---|
353 | c5->cd(2);
|
---|
354 | gStyle->SetOptStat(1101);
|
---|
355 | obj=disp13.DrawCopy("hist");
|
---|
356 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
357 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
358 |
|
---|
359 | c5->cd(4);
|
---|
360 | obj->Draw();
|
---|
361 |
|
---|
362 | TCanvas *c6 = &d3->AddTab("Blind Pixel Method");
|
---|
363 | c6->Divide(2, 2);
|
---|
364 |
|
---|
365 | c6->cd(1);
|
---|
366 | gStyle->SetOptStat(1111);
|
---|
367 | obj=disp14.DrawCopy("hist");
|
---|
368 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
369 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
370 |
|
---|
371 | c6->cd(3);
|
---|
372 | obj->Draw();
|
---|
373 |
|
---|
374 | c6->cd(2);
|
---|
375 | gStyle->SetOptStat(1101);
|
---|
376 | obj=disp15.DrawCopy("hist");
|
---|
377 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
378 | ((MHCamera*)obj)->SetPrettyPalette();
|
---|
379 |
|
---|
380 | c6->cd(4);
|
---|
381 | obj->Draw();
|
---|
382 |
|
---|
383 | }
|
---|
384 |
|
---|