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 | // calcalc.SetSkipTFits();
|
---|
110 | MExtractedSignalCam sigcam;
|
---|
111 |
|
---|
112 | plist2.AddToList(&geomcam);
|
---|
113 | plist2.AddToList(&sigcam);
|
---|
114 |
|
---|
115 | //
|
---|
116 | // As long, as we don't have digital modules,
|
---|
117 | // we have to set the color of the pulser LED by hand
|
---|
118 | //
|
---|
119 | calcalc.SetPulserColor(MCalibrationCalc::kECT1);
|
---|
120 |
|
---|
121 | tlist2.AddToList(&read2);
|
---|
122 | tlist2.AddToList(&calcalc);
|
---|
123 | tlist2.AddToList(&sigsig);
|
---|
124 |
|
---|
125 | MHCamEvent hist2;
|
---|
126 | hist2.SetType(8);
|
---|
127 | plist2.AddToList(&hist2);
|
---|
128 | MFillH fill2("MHCamEvent", "MCalibrationCam");
|
---|
129 | tlist2.AddToList(&fill2);
|
---|
130 |
|
---|
131 | //
|
---|
132 | // Create and setup the eventloop
|
---|
133 | //
|
---|
134 | MEvtLoop evtloop2;
|
---|
135 | evtloop2.SetParList(&plist2);
|
---|
136 |
|
---|
137 | //
|
---|
138 | // Execute second analysis
|
---|
139 | //
|
---|
140 | if (!evtloop2.Eventloop())
|
---|
141 | return;
|
---|
142 |
|
---|
143 | tlist2.PrintStatistics();
|
---|
144 |
|
---|
145 | //
|
---|
146 | // just one example how to get the plots of individual pixels
|
---|
147 | //
|
---|
148 | MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
|
---|
149 | cam.Print();
|
---|
150 |
|
---|
151 | //
|
---|
152 | // Here we are confronted to a serious bug in ROOT:
|
---|
153 | // If we do not apply the next command, gPad will get
|
---|
154 | // screwed up completely: (Thanks to tbretz for finding out
|
---|
155 | // the reason during several hours!!!)
|
---|
156 | //
|
---|
157 | gROOT->GetListOfCanvases()->Delete();
|
---|
158 |
|
---|
159 | MHCamEvent &h = *(MHCamEvent*)plist2->FindObject("MHCamEvent");
|
---|
160 | MHCamera &disp0 = *h.GetHistByName();
|
---|
161 | MHCamera disp1 (geomcam, "MCalibrationCam;q", "Fitted Mean Charges");
|
---|
162 | // MHCamera disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges");
|
---|
163 | MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges");
|
---|
164 | // MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges");
|
---|
165 | MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit");
|
---|
166 | MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times");
|
---|
167 | MHCamera disp7 (geomcam, "MCalibrationCam;sigmat", "Sigma of Arrival Times");
|
---|
168 | MHCamera disp8 (geomcam, "MCalibrationCam;probt", "Probability of Time Fit");
|
---|
169 | MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals");
|
---|
170 | MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
|
---|
171 | MHCamera disp11 (geomcam, "MCalibrationCam;rsigma", "Reduced Sigmas");
|
---|
172 | MHCamera disp12 (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)");
|
---|
173 | MHCamera disp13 (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)");
|
---|
174 | MHCamera disp14 (geomcam, "MCalibrationCam;photons", "Nr. of Photons (Blind Pixel Method)");
|
---|
175 | MHCamera disp15 (geomcam, "MCalibrationCam;convphot", "Conversion Factor (Blind Pixel Method)");
|
---|
176 | MHCamera disp16 (geomcam, "MCalibrationCam;sigma/charge", "Sigma per Charge");
|
---|
177 |
|
---|
178 | disp1.SetCamContent(*cam, 0);
|
---|
179 | disp1.SetCamError(*cam,1);
|
---|
180 | // disp2.SetCamContent(*cam, 1);
|
---|
181 |
|
---|
182 | disp3.SetCamContent(*cam, 2);
|
---|
183 | disp3.SetCamError(*cam,3);
|
---|
184 | // disp4.SetCamContent(*cam, 3);
|
---|
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 | disp13.SetCamContent(*cam, 12);
|
---|
200 | disp14.SetCamContent(*cam, 13);
|
---|
201 | disp15.SetCamContent(*cam, 14);
|
---|
202 | disp16.SetCamContent(*cam, 15);
|
---|
203 |
|
---|
204 |
|
---|
205 | disp1.SetYTitle("Q [FADC counts]");
|
---|
206 | // disp2.SetYTitle("\\Delta Q [FADC counts]");
|
---|
207 | disp3.SetYTitle("\\sigma_{Q} [FADC counts]");
|
---|
208 | // disp4.SetYTitle("\\Delta {\\sigma_{Q}} [FADC counts]");
|
---|
209 | disp5.SetYTitle("P [au]");
|
---|
210 | disp6.SetYTitle("T [FADC slices]");
|
---|
211 | disp7.SetYTitle("\\Delta T [FADC slices]");
|
---|
212 | disp8.SetYTitle("P [au]");
|
---|
213 | disp9.SetYTitle("P [FADC counts/ slice ]");
|
---|
214 | disp10.SetYTitle("RMS_{P} [FADC counts / slice ]");
|
---|
215 | disp11.SetYTitle("\\sigma^2_{Q} - RMS^2_{P} [FADC counts^2]");
|
---|
216 | disp12.SetYTitle("Nr Phe's");
|
---|
217 | disp13.SetYTitle("Conversion Factor [Phe/FADC count]");
|
---|
218 | disp14.SetYTitle("Nr Photons");
|
---|
219 | disp15.SetYTitle("Conversion Factor [Ph/FADC count]");
|
---|
220 | disp16.SetYTitle("Sigma per Charge [1]");
|
---|
221 |
|
---|
222 | disp1.SetPrettyPalette();
|
---|
223 | disp3.SetPrettyPalette();
|
---|
224 | disp5.SetPrettyPalette();
|
---|
225 | disp6.SetPrettyPalette();
|
---|
226 | disp7.SetPrettyPalette();
|
---|
227 | disp8.SetPrettyPalette();
|
---|
228 | disp9.SetPrettyPalette();
|
---|
229 | disp10.SetPrettyPalette();
|
---|
230 | disp11.SetPrettyPalette();
|
---|
231 | disp12.SetPrettyPalette();
|
---|
232 | disp13.SetPrettyPalette();
|
---|
233 | disp14.SetPrettyPalette();
|
---|
234 | disp15.SetPrettyPalette();
|
---|
235 | disp16.SetPrettyPalette();
|
---|
236 |
|
---|
237 |
|
---|
238 |
|
---|
239 | MStatusDisplay *d2 = new MStatusDisplay;
|
---|
240 |
|
---|
241 | // Set update time to 1s
|
---|
242 | d2->SetUpdateTime(1000);
|
---|
243 |
|
---|
244 | TCanvas *c1 = &d2->AddTab("Fitted Charges");
|
---|
245 | c1->Divide(2, 2);
|
---|
246 |
|
---|
247 | TObject *obj;
|
---|
248 |
|
---|
249 | c1->cd(1);
|
---|
250 | gStyle->SetOptStat(1111);
|
---|
251 | obj=disp1.DrawCopy("hist");
|
---|
252 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
253 |
|
---|
254 | c1->cd(3);
|
---|
255 | gPad->SetBorderMode(0);
|
---|
256 | obj->Draw();
|
---|
257 |
|
---|
258 | c1->cd(2);
|
---|
259 | gStyle->SetOptStat(1101);
|
---|
260 | obj=disp3.DrawCopy("hist");
|
---|
261 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
262 |
|
---|
263 | c1->cd(4);
|
---|
264 | gPad->SetBorderMode(0);
|
---|
265 | obj->Draw();
|
---|
266 |
|
---|
267 |
|
---|
268 | TCanvas *c12 = &d2->AddTab("Fit Prob.");
|
---|
269 | c12->Divide(1, 2);
|
---|
270 |
|
---|
271 | c12->cd(1);
|
---|
272 | gStyle->SetOptStat(1101);
|
---|
273 | obj=disp5.DrawCopy("hist");
|
---|
274 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
275 |
|
---|
276 | c12->cd(2);
|
---|
277 | gPad->SetBorderMode(0);
|
---|
278 | obj->Draw();
|
---|
279 |
|
---|
280 | TCanvas *c2 = &d2->AddTab("Fitted Times");
|
---|
281 | c2->Divide(3, 2);
|
---|
282 |
|
---|
283 | c2->cd(1);
|
---|
284 | gStyle->SetOptStat(1111);
|
---|
285 | obj=disp6.DrawCopy("hist");
|
---|
286 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
287 |
|
---|
288 | c2->cd(4);
|
---|
289 | obj->Draw();
|
---|
290 |
|
---|
291 | c2->cd(2);
|
---|
292 | gStyle->SetOptStat(1101);
|
---|
293 | obj=disp7.DrawCopy("hist");
|
---|
294 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
295 |
|
---|
296 | c2->cd(5);
|
---|
297 | obj->Draw();
|
---|
298 |
|
---|
299 | c2->cd(3);
|
---|
300 | gStyle->SetOptStat(1101);
|
---|
301 | obj=disp8.DrawCopy("hist");
|
---|
302 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
303 |
|
---|
304 | c2->cd(6);
|
---|
305 | obj->Draw();
|
---|
306 |
|
---|
307 | TCanvas *c3 = &d2->AddTab("Pedestals");
|
---|
308 | c3->Divide(2, 2);
|
---|
309 |
|
---|
310 | c3->cd(1);
|
---|
311 | gStyle->SetOptStat(1111);
|
---|
312 | obj=disp9.DrawCopy("hist");
|
---|
313 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
314 |
|
---|
315 | c3->cd(3);
|
---|
316 | obj->Draw();
|
---|
317 |
|
---|
318 | c3->cd(2);
|
---|
319 | gStyle->SetOptStat(1111);
|
---|
320 | obj=disp10.DrawCopy("hist");
|
---|
321 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
322 |
|
---|
323 | c3->cd(4);
|
---|
324 | obj->Draw();
|
---|
325 |
|
---|
326 | TCanvas *c4 = &d2->AddTab("Reduced Charges");
|
---|
327 | c4->Divide(2,2);
|
---|
328 |
|
---|
329 | c4->cd(1);
|
---|
330 | gStyle->SetOptStat(1111);
|
---|
331 | obj=disp11.DrawCopy("hist");
|
---|
332 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
333 |
|
---|
334 | c4->cd(3);
|
---|
335 | obj->Draw();
|
---|
336 |
|
---|
337 | c4->cd(2);
|
---|
338 | gStyle->SetOptStat(1111);
|
---|
339 | obj=disp16.DrawCopy("hist");
|
---|
340 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
341 |
|
---|
342 | c4->cd(4);
|
---|
343 | obj->Draw();
|
---|
344 |
|
---|
345 | TCanvas *c5 = &d2->AddTab("F-Factor Method");
|
---|
346 | c5->Divide(2, 2);
|
---|
347 |
|
---|
348 | c5->cd(1);
|
---|
349 | gStyle->SetOptStat(1111);
|
---|
350 | obj=disp12.DrawCopy("hist");
|
---|
351 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
352 |
|
---|
353 | c5->cd(3);
|
---|
354 | obj->Draw();
|
---|
355 |
|
---|
356 | c5->cd(2);
|
---|
357 | gStyle->SetOptStat(1101);
|
---|
358 | obj=disp13.DrawCopy("hist");
|
---|
359 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
360 |
|
---|
361 | c5->cd(4);
|
---|
362 | obj->Draw();
|
---|
363 |
|
---|
364 | TCanvas *c6 = &d2->AddTab("Blind Pixel Method");
|
---|
365 | c6->Divide(2, 2);
|
---|
366 |
|
---|
367 | c6->cd(1);
|
---|
368 | gStyle->SetOptStat(1111);
|
---|
369 | obj=disp14.DrawCopy("hist");
|
---|
370 | ((MHCamera*)obj)->AddNotify(*cam);
|
---|
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 |
|
---|
380 | c6->cd(4);
|
---|
381 | obj->Draw();
|
---|
382 |
|
---|
383 | }
|
---|
384 |
|
---|