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 | MPedestalCam *ped = plist.FindObject("MPedestalCam");
|
---|
85 | ped.Print();
|
---|
86 |
|
---|
87 | //
|
---|
88 | // Create a empty Parameter List and an empty Task List
|
---|
89 | //
|
---|
90 | MParList plist2;
|
---|
91 |
|
---|
92 | MTaskList tlist2;
|
---|
93 | plist2.AddToList(&tlist2);
|
---|
94 |
|
---|
95 |
|
---|
96 | plist2.AddToList((MPedestalCam*)plist.FindObject("MPedestalCam"));
|
---|
97 |
|
---|
98 | // MGeomApply geomapl2;
|
---|
99 | tlist2.AddToList(&geomapl);
|
---|
100 |
|
---|
101 | //
|
---|
102 | // Now setup the new tasks and tasklist for the calibration
|
---|
103 | // ---------------------------------------------------
|
---|
104 | //
|
---|
105 |
|
---|
106 | MReadMarsFile read2("Events", calname);
|
---|
107 | read2.DisableAutoScheme();
|
---|
108 |
|
---|
109 | MCalibrationCalc calcalc;
|
---|
110 | // calcalc.SetSkipTFits();
|
---|
111 |
|
---|
112 | plist2.AddToList(&geomcam);
|
---|
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::kEBlue);
|
---|
119 |
|
---|
120 | tlist2.AddToList(&read2);
|
---|
121 | tlist2.AddToList(&calcalc);
|
---|
122 |
|
---|
123 | MHCamEvent hist2;
|
---|
124 | hist2.SetType(0);
|
---|
125 | plist2.AddToList(&hist2);
|
---|
126 | MFillH fill2("MHCamEvent", "MCalibrationCam");
|
---|
127 | tlist2.AddToList(&fill2);
|
---|
128 |
|
---|
129 | //
|
---|
130 | // Create and setup the eventloop
|
---|
131 | //
|
---|
132 | MEvtLoop evtloop2;
|
---|
133 | evtloop2.SetParList(&plist2);
|
---|
134 |
|
---|
135 | //
|
---|
136 | // Execute second analysis
|
---|
137 | //
|
---|
138 | if (!evtloop2.Eventloop())
|
---|
139 | return;
|
---|
140 |
|
---|
141 | tlist2.PrintStatistics();
|
---|
142 |
|
---|
143 | //
|
---|
144 | // just one example how to get the plots of individual pixels
|
---|
145 | //
|
---|
146 | MCalibrationCam *cam = plist2.FindObject("MCalibrationCam");
|
---|
147 | MCalibrationPix *pix = cam->GetCalibrationPix(523);
|
---|
148 | pix->Draw();
|
---|
149 |
|
---|
150 | //
|
---|
151 | // Here we are confronted to a serious bug in ROOT:
|
---|
152 | // If we do not apply the next command, gPad will get
|
---|
153 | // screwed up completely: (Thanks to tbretz for finding out
|
---|
154 | // the reason during several hours!!!)
|
---|
155 | //
|
---|
156 | gROOT->GetListOfCanvases()->Delete();
|
---|
157 |
|
---|
158 | MHCamEvent &h = *(MHCamEvent*)plist2->FindObject("MHCamEvent");
|
---|
159 | MHCamera &disp0 = *h.GetHistByName();
|
---|
160 | MHCamera disp1 (geomcam, "MCalibrationCam;q", "Fitted Mean Charges");
|
---|
161 | MHCamera disp2 (geomcam, "MCalibrationCam;errq", "Error of Fitted Mean Charges");
|
---|
162 | MHCamera disp3 (geomcam, "MCalibrationCam;sigmaq", "Sigma of Fitted Mean Charges");
|
---|
163 | MHCamera disp4 (geomcam, "MCalibrationCam;errsigmaq", "Error of Sigma of Fitted Mean Charges");
|
---|
164 | MHCamera disp5 (geomcam, "MCalibrationCam;probq", "Probability of Fit");
|
---|
165 | MHCamera disp6 (geomcam, "MCalibrationCam;t", "Arrival Times");
|
---|
166 | MHCamera disp7 (geomcam, "MCalibrationCam;sigmat", "Sigma of Arrival Times");
|
---|
167 | MHCamera disp8 (geomcam, "MCalibrationCam;probt", "Probability of Time Fit");
|
---|
168 | MHCamera disp9 (geomcam, "MCalibrationCam;ped", "Pedestals");
|
---|
169 | MHCamera disp10 (geomcam, "MCalibrationCam;pedrms", "Pedestal RMS");
|
---|
170 | MHCamera disp11 (geomcam, "MCalibrationCam;rq", "Reduced Charges");
|
---|
171 | MHCamera disp12 (geomcam, "MCalibrationCam;errrq", "Error of Reduced Charges");
|
---|
172 |
|
---|
173 | disp1.SetCamContent(*cam, 0);
|
---|
174 | disp2.SetCamContent(*cam, 1);
|
---|
175 | disp3.SetCamContent(*cam, 2);
|
---|
176 | disp4.SetCamContent(*cam, 3);
|
---|
177 | disp5.SetCamContent(*cam, 4);
|
---|
178 | disp6.SetCamContent(*cam, 5);
|
---|
179 | disp7.SetCamContent(*cam, 6);
|
---|
180 | disp8.SetCamContent(*cam, 7);
|
---|
181 | disp9.SetCamContent(*cam, 8);
|
---|
182 | disp10.SetCamContent(*cam, 9);
|
---|
183 | disp11.SetCamContent(*cam, 10);
|
---|
184 | disp12.SetCamContent(*cam, 11);
|
---|
185 |
|
---|
186 | disp1.SetYTitle("Q [FADC counts]");
|
---|
187 | disp2.SetYTitle("\\Delta_{Q} [FADC counts]");
|
---|
188 | disp3.SetYTitle("\\sigma_{Q} [FADC counts]");
|
---|
189 | disp4.SetYTitle("\\Delta_{\\sigma_{Q}} [FADC counts]");
|
---|
190 | disp5.SetYTitle("P [au]");
|
---|
191 | disp6.SetYTitle("T [FADC slices]");
|
---|
192 | disp7.SetYTitle("\\Delta_{T} [FADC slices]");
|
---|
193 | disp8.SetYTitle("P [au]");
|
---|
194 | disp9.SetYTitle("P [FADC counts/ slice ]");
|
---|
195 | disp10.SetYTitle("RMS_{P} [FADC counts / slice ]");
|
---|
196 | disp11.SetYTitle("Q [FADC counts]");
|
---|
197 | disp12.SetYTitle("\\Delta_{Q} [FADC counts]");
|
---|
198 |
|
---|
199 | MStatusDisplay *d2 = new MStatusDisplay;
|
---|
200 |
|
---|
201 | // Set update time to 1s
|
---|
202 | d2->SetUpdateTime(1000);
|
---|
203 |
|
---|
204 | TCanvas *c1 = &d2->AddTab("Fitted Charges");
|
---|
205 | c1->Divide(5, 2);
|
---|
206 |
|
---|
207 | TObject *obj;
|
---|
208 |
|
---|
209 | c1->cd(1);
|
---|
210 | gStyle->SetOptStat(1111);
|
---|
211 | obj=disp1.DrawCopy("hist");
|
---|
212 |
|
---|
213 | c1->cd(6);
|
---|
214 | gPad->SetBorderMode(0);
|
---|
215 | obj->Draw();
|
---|
216 |
|
---|
217 | c1->cd(2);
|
---|
218 | gStyle->SetOptStat(1101);
|
---|
219 | obj=disp2.DrawCopy("hist");
|
---|
220 |
|
---|
221 | c1->cd(7);
|
---|
222 | gPad->SetBorderMode(0);
|
---|
223 | obj->Draw();
|
---|
224 |
|
---|
225 | c1->cd(3);
|
---|
226 | gStyle->SetOptStat(1101);
|
---|
227 | obj=disp3.DrawCopy("hist");
|
---|
228 |
|
---|
229 | c1->cd(8);
|
---|
230 | gPad->SetBorderMode(0);
|
---|
231 | obj->Draw();
|
---|
232 |
|
---|
233 | c1->cd(4);
|
---|
234 | gStyle->SetOptStat(1101);
|
---|
235 | obj=disp4.DrawCopy("hist");
|
---|
236 |
|
---|
237 | c1->cd(9);
|
---|
238 | gPad->SetBorderMode(0);
|
---|
239 | obj->Draw();
|
---|
240 |
|
---|
241 | c1->cd(5);
|
---|
242 | gStyle->SetOptStat(1101);
|
---|
243 | obj=disp5.DrawCopy("hist");
|
---|
244 |
|
---|
245 | c1->cd(10);
|
---|
246 | gPad->SetBorderMode(0);
|
---|
247 | obj->Draw();
|
---|
248 |
|
---|
249 | TCanvas *c2 = &d2->AddTab("Fitted Times");
|
---|
250 | c2->Divide(3, 2);
|
---|
251 |
|
---|
252 | c2->cd(1);
|
---|
253 | gStyle->SetOptStat(1111);
|
---|
254 | obj=disp6.DrawCopy("hist");
|
---|
255 |
|
---|
256 | c2->cd(4);
|
---|
257 | obj->Draw();
|
---|
258 |
|
---|
259 | c2->cd(2);
|
---|
260 | gStyle->SetOptStat(1101);
|
---|
261 | obj=disp7.DrawCopy("hist");
|
---|
262 |
|
---|
263 | c2->cd(5);
|
---|
264 | obj->Draw();
|
---|
265 |
|
---|
266 | c2->cd(3);
|
---|
267 | gStyle->SetOptStat(1101);
|
---|
268 | obj=disp8.DrawCopy("hist");
|
---|
269 |
|
---|
270 | c2->cd(6);
|
---|
271 | obj->Draw();
|
---|
272 |
|
---|
273 | TCanvas *c3 = &d2->AddTab("Pedestals");
|
---|
274 | c3->Divide(2, 2);
|
---|
275 |
|
---|
276 | c3->cd(1);
|
---|
277 | gStyle->SetOptStat(1111);
|
---|
278 | obj=disp9.DrawCopy("hist");
|
---|
279 |
|
---|
280 | c3->cd(3);
|
---|
281 | obj->Draw();
|
---|
282 |
|
---|
283 | c3->cd(2);
|
---|
284 | gStyle->SetOptStat(1101);
|
---|
285 | obj=disp10.DrawCopy("hist");
|
---|
286 |
|
---|
287 | c3->cd(4);
|
---|
288 | obj->Draw();
|
---|
289 |
|
---|
290 | TCanvas *c4 = &d2->AddTab("Reduced Charges");
|
---|
291 | c4->Divide(2, 2);
|
---|
292 |
|
---|
293 | c4->cd(1);
|
---|
294 | gStyle->SetOptStat(1111);
|
---|
295 | obj=disp11.DrawCopy("hist");
|
---|
296 |
|
---|
297 | c4->cd(3);
|
---|
298 | obj->Draw();
|
---|
299 |
|
---|
300 | c4->cd(2);
|
---|
301 | gStyle->SetOptStat(1101);
|
---|
302 | obj=disp12.DrawCopy("hist");
|
---|
303 |
|
---|
304 | c4->cd(4);
|
---|
305 | obj->Draw();
|
---|
306 |
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | }
|
---|
310 |
|
---|