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="../../Mars-0.8.2/20031102_02399_P_Unavailable_E.root",
|
---|
26 | TString calname="../../Mars-0.8.2/20031102_02400_D_Flip500Hz_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 | MCalibrationCalc calcalc;
|
---|
108 | // calcalc.SetSkipTFits();
|
---|
109 |
|
---|
110 | plist2.AddToList(&geomcam);
|
---|
111 |
|
---|
112 | //
|
---|
113 | // As long, as we don't have digital modules,
|
---|
114 | // we have to set the color of the pulser LED by hand
|
---|
115 | //
|
---|
116 | calcalc.SetPulserColor(MCalibrationCalc::kEBlue);
|
---|
117 |
|
---|
118 | tlist2.AddToList(&read2);
|
---|
119 | tlist2.AddToList(&calcalc);
|
---|
120 |
|
---|
121 | MHCamEvent hist2;
|
---|
122 | hist2.SetType(8);
|
---|
123 | plist2.AddToList(&hist2);
|
---|
124 | MFillH fill2("MHCamEvent", "MCalibrationCam");
|
---|
125 | tlist2.AddToList(&fill2);
|
---|
126 |
|
---|
127 | //
|
---|
128 | // Create and setup the eventloop
|
---|
129 | //
|
---|
130 | MEvtLoop evtloop2;
|
---|
131 | evtloop2.SetParList(&plist2);
|
---|
132 |
|
---|
133 | //
|
---|
134 | // Execute second analysis
|
---|
135 | //
|
---|
136 | if (!evtloop2.Eventloop())
|
---|
137 | return;
|
---|
138 |
|
---|
139 | tlist2.PrintStatistics();
|
---|
140 |
|
---|
141 | //
|
---|
142 | // just one example how to get the plots of individual pixels
|
---|
143 | //
|
---|
144 | MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
|
---|
145 | cam.Print();
|
---|
146 |
|
---|
147 | Int_t pixnr;
|
---|
148 |
|
---|
149 | while (1)
|
---|
150 | {
|
---|
151 |
|
---|
152 | cout << "Which pixel number do you want to display? (Press 0 to exit)" << endl;
|
---|
153 | cin >> pixnr;
|
---|
154 | if (pixnr == 0)
|
---|
155 | break;
|
---|
156 |
|
---|
157 | if (pixnr >= 577)
|
---|
158 | break;
|
---|
159 |
|
---|
160 | MCalibrationPix *pix = cam->GetCalibrationPix(pixnr);
|
---|
161 | pix->Draw();
|
---|
162 |
|
---|
163 | }
|
---|
164 |
|
---|
165 | //
|
---|
166 | // Here we are confronted to a serious bug in ROOT:
|
---|
167 | // If we do not apply the next command, gPad will get
|
---|
168 | // screwed up completely: (Thanks to tbretz for finding out
|
---|
169 | // the reason during several hours!!!)
|
---|
170 | //
|
---|
171 | gROOT->GetListOfCanvases()->Delete();
|
---|
172 |
|
---|
173 | MHCamEvent &h = *(MHCamEvent*)plist2->FindObject("MHCamEvent");
|
---|
174 | MHCamera &disp0 = *h.GetHistByName();
|
---|
175 | MHCamera disp1 (geomcam, "MCalibrationCam;q", "Fitted Mean Charges");
|
---|
176 | MHCamera disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges");
|
---|
177 | MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges");
|
---|
178 | MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges");
|
---|
179 | MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit");
|
---|
180 | MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times");
|
---|
181 | MHCamera disp7 (geomcam, "MCalibrationCam;sigmat", "Sigma of Arrival Times");
|
---|
182 | MHCamera disp8 (geomcam, "MCalibrationCam;probt", "Probability of Time Fit");
|
---|
183 | MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals");
|
---|
184 | MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
|
---|
185 | MHCamera disp11 (geomcam, "MCalibrationCam;rq", "Reduced Charges");
|
---|
186 | MHCamera disp12 (geomcam, "MCalibrationCam;errrq", "Error of Reduced Charges");
|
---|
187 | MHCamera disp13 (geomcam, "MCalibrationCam;phe", "Nr. of Phe's (F-Factor Method)");
|
---|
188 | MHCamera disp14 (geomcam, "MCalibrationCam;convphe", "Conversion Factor (F-Factor Method)");
|
---|
189 |
|
---|
190 | disp1.SetCamContent(*cam, 0);
|
---|
191 | disp2.SetCamContent(*cam, 1);
|
---|
192 | disp3.SetCamContent(*cam, 2);
|
---|
193 | disp4.SetCamContent(*cam, 3);
|
---|
194 | disp5.SetCamContent(*cam, 4);
|
---|
195 | disp6.SetCamContent(*cam, 5);
|
---|
196 | disp7.SetCamContent(*cam, 6);
|
---|
197 | disp8.SetCamContent(*cam, 7);
|
---|
198 | disp9.SetCamContent(*cam, 8);
|
---|
199 | disp10.SetCamContent(*cam, 9);
|
---|
200 | disp11.SetCamContent(*cam, 10);
|
---|
201 | disp12.SetCamContent(*cam, 11);
|
---|
202 | disp12.SetCamContent(*cam, 12);
|
---|
203 | disp13.SetCamContent(*cam, 13);
|
---|
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("Q [FADC counts]");
|
---|
216 | disp12.SetYTitle("\\Delta_{Q} [FADC counts]");
|
---|
217 | disp13.SetYTitle("Nr Phe's");
|
---|
218 | disp14.SetYTitle("Conversion Factor [Phe/FADC count]");
|
---|
219 |
|
---|
220 | MStatusDisplay *d2 = new MStatusDisplay;
|
---|
221 |
|
---|
222 | // Set update time to 1s
|
---|
223 | d2->SetUpdateTime(1000);
|
---|
224 |
|
---|
225 | TCanvas *c1 = &d2->AddTab("Charges Mean");
|
---|
226 | c1->Divide(2, 2);
|
---|
227 |
|
---|
228 | TObject *obj;
|
---|
229 |
|
---|
230 | c1->cd(1);
|
---|
231 | gStyle->SetOptStat(1111);
|
---|
232 | obj=disp1.DrawCopy("hist");
|
---|
233 |
|
---|
234 | c1->cd(3);
|
---|
235 | gPad->SetBorderMode(0);
|
---|
236 | obj->Draw();
|
---|
237 |
|
---|
238 | c1->cd(2);
|
---|
239 | gStyle->SetOptStat(1101);
|
---|
240 | obj=disp2.DrawCopy("hist");
|
---|
241 |
|
---|
242 | c1->cd(4);
|
---|
243 | gPad->SetBorderMode(0);
|
---|
244 | obj->Draw();
|
---|
245 |
|
---|
246 | TCanvas *c11 = &d2->AddTab("Charges Sigma");
|
---|
247 | c11->Divide(2, 2);
|
---|
248 |
|
---|
249 | c11->cd(1);
|
---|
250 | gStyle->SetOptStat(1101);
|
---|
251 | obj=disp3.DrawCopy("hist");
|
---|
252 |
|
---|
253 | c11->cd(3);
|
---|
254 | gPad->SetBorderMode(0);
|
---|
255 | obj->Draw();
|
---|
256 |
|
---|
257 | c11->cd(2);
|
---|
258 | gStyle->SetOptStat(1101);
|
---|
259 | obj=disp4.DrawCopy("hist");
|
---|
260 |
|
---|
261 | c11->cd(4);
|
---|
262 | gPad->SetBorderMode(0);
|
---|
263 | obj->Draw();
|
---|
264 |
|
---|
265 |
|
---|
266 | TCanvas *c12 = &d2->AddTab("Fit Prob.");
|
---|
267 | c12->Divide(1, 2);
|
---|
268 |
|
---|
269 | c12->cd(1);
|
---|
270 | gStyle->SetOptStat(1101);
|
---|
271 | obj=disp5.DrawCopy("hist");
|
---|
272 |
|
---|
273 | c12->cd(2);
|
---|
274 | gPad->SetBorderMode(0);
|
---|
275 | obj->Draw();
|
---|
276 |
|
---|
277 | TCanvas *c2 = &d2->AddTab("Fitted Times");
|
---|
278 | c2->Divide(3, 2);
|
---|
279 |
|
---|
280 | c2->cd(1);
|
---|
281 | gStyle->SetOptStat(1111);
|
---|
282 | obj=disp6.DrawCopy("hist");
|
---|
283 |
|
---|
284 | c2->cd(4);
|
---|
285 | obj->Draw();
|
---|
286 |
|
---|
287 | c2->cd(2);
|
---|
288 | gStyle->SetOptStat(1101);
|
---|
289 | obj=disp7.DrawCopy("hist");
|
---|
290 |
|
---|
291 | c2->cd(5);
|
---|
292 | obj->Draw();
|
---|
293 |
|
---|
294 | c2->cd(3);
|
---|
295 | gStyle->SetOptStat(1101);
|
---|
296 | obj=disp8.DrawCopy("hist");
|
---|
297 |
|
---|
298 | c2->cd(6);
|
---|
299 | obj->Draw();
|
---|
300 |
|
---|
301 | TCanvas *c3 = &d2->AddTab("Pedestals");
|
---|
302 | c3->Divide(2, 2);
|
---|
303 |
|
---|
304 | c3->cd(1);
|
---|
305 | gStyle->SetOptStat(1111);
|
---|
306 | obj=disp9.DrawCopy("hist");
|
---|
307 |
|
---|
308 | c3->cd(3);
|
---|
309 | obj->Draw();
|
---|
310 |
|
---|
311 | c3->cd(2);
|
---|
312 | gStyle->SetOptStat(1111);
|
---|
313 | obj=disp10.DrawCopy("hist");
|
---|
314 |
|
---|
315 | c3->cd(4);
|
---|
316 | obj->Draw();
|
---|
317 |
|
---|
318 | TCanvas *c4 = &d2->AddTab("Reduced Charges");
|
---|
319 | c4->Divide(2, 2);
|
---|
320 |
|
---|
321 | c4->cd(1);
|
---|
322 | gStyle->SetOptStat(1111);
|
---|
323 | obj=disp11.DrawCopy("hist");
|
---|
324 |
|
---|
325 | c4->cd(3);
|
---|
326 | obj->Draw();
|
---|
327 |
|
---|
328 | c4->cd(2);
|
---|
329 | gStyle->SetOptStat(1101);
|
---|
330 | obj=disp12.DrawCopy("hist");
|
---|
331 |
|
---|
332 | c4->cd(4);
|
---|
333 | obj->Draw();
|
---|
334 |
|
---|
335 | TCanvas *c5 = &d2->AddTab("F-Factor Method");
|
---|
336 | c5->Divide(2, 2);
|
---|
337 |
|
---|
338 | c5->cd(1);
|
---|
339 | gStyle->SetOptStat(1111);
|
---|
340 | obj=disp13.DrawCopy("hist");
|
---|
341 |
|
---|
342 | c5->cd(3);
|
---|
343 | obj->Draw();
|
---|
344 |
|
---|
345 | c5->cd(2);
|
---|
346 | gStyle->SetOptStat(1101);
|
---|
347 | obj=disp14.DrawCopy("hist");
|
---|
348 |
|
---|
349 | c5->cd(4);
|
---|
350 | obj->Draw();
|
---|
351 |
|
---|
352 |
|
---|
353 | #endif
|
---|
354 |
|
---|
355 | }
|
---|
356 |
|
---|