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 | //const TString pedfile = "/mnt/users/mdoro/Mars/Data/20040201_14418_P_OffMrk421-1_E.root";
|
---|
26 | //const TString calfile = "/mnt/users/mdoro/Mars/Data/20040201_1441*_C_OffMrk421-1_E.root";
|
---|
27 |
|
---|
28 | const TString pedfile = "/mnt/Data/rootdata/CrabNebula/2004_02_10/20040210_14607_P_CrabNebula_E.root";
|
---|
29 | const TString calfile = "/mnt/Data/rootdata/CrabNebula/2004_02_10/20040210_14608_C_CrabNebula_E.root";
|
---|
30 |
|
---|
31 | //const TString pedfile = "/mnt/Data/rootdata/CrabNebula/2004_01_26/20040125_10412_P_Crab-On_E.root";
|
---|
32 | //const TString calfile = "/mnt/Data/rootdata/CrabNebula/2004_01_26/20040125_1041*_C_Crab-On_E.root";
|
---|
33 |
|
---|
34 | //const TString pedfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03522_P_Park_E.root";
|
---|
35 | //const TString calfile = "/mnt/Data/rootdata/Miscellaneous/2003_12_19/20031218_03527_C_Park_E.root";
|
---|
36 |
|
---|
37 | void calibration(TString pedname=pedfile,
|
---|
38 | TString calname=calfile)
|
---|
39 | {
|
---|
40 |
|
---|
41 | gStyle->SetOptStat(1111);
|
---|
42 | gStyle->SetOptFit();
|
---|
43 |
|
---|
44 | MStatusDisplay *display = new MStatusDisplay;
|
---|
45 | display->SetUpdateTime(3000);
|
---|
46 | display->Resize(850,700);
|
---|
47 |
|
---|
48 | //
|
---|
49 | // Create a empty Parameter List and an empty Task List
|
---|
50 | // The tasklist is identified in the eventloop by its name
|
---|
51 | //
|
---|
52 | MParList plist;
|
---|
53 |
|
---|
54 | MTaskList tlist;
|
---|
55 | plist.AddToList(&tlist);
|
---|
56 |
|
---|
57 | //
|
---|
58 | // Now setup the tasks and tasklist for the pedestals:
|
---|
59 | // ---------------------------------------------------
|
---|
60 | //
|
---|
61 |
|
---|
62 | MReadMarsFile read("Events", pedname);
|
---|
63 | read.DisableAutoScheme();
|
---|
64 |
|
---|
65 | MGeomApply geomapl;
|
---|
66 | MExtractSignal sigcalc;
|
---|
67 |
|
---|
68 | //
|
---|
69 | // Set the extraction range higher:
|
---|
70 | //
|
---|
71 | //sigcalc.SetRange(1,14,1,14);
|
---|
72 |
|
---|
73 | MPedCalcPedRun pedcalc;
|
---|
74 |
|
---|
75 | //
|
---|
76 | // Additionally to calculating the pedestals,
|
---|
77 | // you can fill histograms and look at them
|
---|
78 | //
|
---|
79 | MFillH fill("MHPedestalCam", "MExtractedSignalCam");
|
---|
80 |
|
---|
81 | tlist.AddToList(&read);
|
---|
82 | tlist.AddToList(&geomapl);
|
---|
83 | tlist.AddToList(&sigcalc);
|
---|
84 | tlist.AddToList(&pedcalc);
|
---|
85 | tlist.AddToList(&fill);
|
---|
86 |
|
---|
87 | MGeomCamMagic geomcam;
|
---|
88 | MPedestalCam pedcam;
|
---|
89 | MHPedestalCam hpedcam;
|
---|
90 | plist.AddToList(&geomcam);
|
---|
91 | plist.AddToList(&pedcam);
|
---|
92 | plist.AddToList(&hpedcam);
|
---|
93 |
|
---|
94 | //
|
---|
95 | // Create and setup the eventloop
|
---|
96 | //
|
---|
97 | MEvtLoop evtloop;
|
---|
98 | evtloop.SetParList(&plist);
|
---|
99 | evtloop.SetDisplay(display);
|
---|
100 |
|
---|
101 | //
|
---|
102 | // Execute first analysis
|
---|
103 | //
|
---|
104 | if (!evtloop.Eventloop())
|
---|
105 | return;
|
---|
106 |
|
---|
107 | tlist.PrintStatistics();
|
---|
108 |
|
---|
109 | //
|
---|
110 | // Look at one specific pixel, after all the histogram manipulations:
|
---|
111 | //
|
---|
112 | hpedcam[9].DrawClone("fourier");
|
---|
113 |
|
---|
114 |
|
---|
115 | MHCamera dispped0 (geomcam, "Ped;Pedestal", "Mean per Slice");
|
---|
116 | MHCamera dispped1 (geomcam, "Ped;PedestalErr", "Mean Error per Slice");
|
---|
117 | MHCamera dispped2 (geomcam, "Ped;PedestalRms", "RMS per Slice");
|
---|
118 | MHCamera dispped3 (geomcam, "Ped;PedestalRmsErr", "RMS Error per Slice");
|
---|
119 |
|
---|
120 | MHCamera dispped4 (geomcam, "Ped;Mean", "Fitted Mean per Slice");
|
---|
121 | MHCamera dispped5 (geomcam, "Ped;MeanErr", "Fitted Error of Mean per Slice");
|
---|
122 | MHCamera dispped6 (geomcam, "Ped;Sigma", "Fitted Sigma per Slice");
|
---|
123 | MHCamera dispped7 (geomcam, "Ped;SigmaErr", "Fitted Error of Sigma per Slice");
|
---|
124 | MHCamera dispped8 (geomcam, "Ped;Prob", "Probability of Fit");
|
---|
125 | MHCamera dispped9 (geomcam, "Ped;DeltaPedestalMean", "Rel. Diff. Mean per Slice (Calc.-Fitte)");
|
---|
126 | MHCamera dispped10 (geomcam, "Ped;DeltaPedestalMeanError", "Rel. Diff. Mean Error per Slice (Calc.-Fitted)");
|
---|
127 | MHCamera dispped11 (geomcam, "Ped;DeltaRmsSigma", "Rel. Diff. RMS per Slice (Calc.-Fitted)");
|
---|
128 | MHCamera dispped12 (geomcam, "Ped;DeltaRmsSigmaError", "Rel. Diff. RMS Error per Slice (Calc.-Fitted)");
|
---|
129 | MHCamera dispped13 (geomcam, "Ped;FitOK", "Gaus Fit not OK");
|
---|
130 | MHCamera dispped14 (geomcam, "Ped;FourierOK", "Fourier Analysis not OK");
|
---|
131 |
|
---|
132 | dispped0.SetCamContent( pedcam, 0);
|
---|
133 | dispped0.SetCamError( pedcam, 1);
|
---|
134 | dispped1.SetCamContent( pedcam, 1);
|
---|
135 | dispped2.SetCamContent( pedcam, 2);
|
---|
136 | dispped2.SetCamError( pedcam, 3);
|
---|
137 | dispped3.SetCamContent( pedcam, 3);
|
---|
138 |
|
---|
139 | dispped4.SetCamContent( hpedcam, 0);
|
---|
140 | dispped4.SetCamError( hpedcam, 1);
|
---|
141 | dispped5.SetCamContent( hpedcam, 1);
|
---|
142 | dispped6.SetCamContent( hpedcam, 2);
|
---|
143 | dispped6.SetCamError( hpedcam, 3);
|
---|
144 | dispped7.SetCamContent( hpedcam, 3);
|
---|
145 | dispped8.SetCamContent( hpedcam, 4);
|
---|
146 | dispped9.SetCamContent( hpedcam, 5);
|
---|
147 | dispped9.SetCamError( hpedcam, 6);
|
---|
148 | dispped10.SetCamContent(hpedcam, 7);
|
---|
149 | dispped11.SetCamContent(hpedcam, 8);
|
---|
150 | dispped11.SetCamError( hpedcam, 9);
|
---|
151 | dispped12.SetCamContent(hpedcam, 10);
|
---|
152 | dispped13.SetCamContent(hpedcam, 11);
|
---|
153 | dispped14.SetCamContent(hpedcam, 12);
|
---|
154 |
|
---|
155 | dispped0.SetYTitle("Calc. Pedestal per slice [FADC counts]");
|
---|
156 | dispped1.SetYTitle("Calc. Pedestal Error per slice [FADC counts]");
|
---|
157 | dispped2.SetYTitle("Calc. Pedestal RMS per slice [FADC counts]");
|
---|
158 | dispped3.SetYTitle("Calc. Pedestal RMS Error per slice [FADC counts]");
|
---|
159 | dispped4.SetYTitle("Fitted Mean per slice [FADC counts]");
|
---|
160 | dispped5.SetYTitle("Error of Fitted Mean per slice [FADC counts]");
|
---|
161 | dispped6.SetYTitle("Fitted Sigma per slice [FADC counts]");
|
---|
162 | dispped7.SetYTitle("Error of Fitted Sigma per slice [FADC counts]");
|
---|
163 | dispped8.SetYTitle("Fit Probability [1]");
|
---|
164 | dispped9.SetYTitle("Rel. Diff. Pedestal Calc.-Fitted per slice [1]");
|
---|
165 | dispped10.SetYTitle("Rel. Diff. Pedestal Error Calc.-Fitted per slice [1]");
|
---|
166 | dispped11.SetYTitle("Rel. Diff. Pedestal RMS Calc.-Fitted per slice [1]");
|
---|
167 | dispped12.SetYTitle("Rel. Diff. Pedestal RMS Error Calc.-Fitted per slice [1]");
|
---|
168 | dispped13.SetYTitle("[1]");
|
---|
169 | dispped14.SetYTitle("[1]");
|
---|
170 |
|
---|
171 | // Histogram values
|
---|
172 | TCanvas &b1 = display->AddTab("Ped.Calc.");
|
---|
173 | b1.Divide(4,3);
|
---|
174 |
|
---|
175 | CamDraw(b1,dispped0,pedcam,1,4,1);
|
---|
176 | CamDraw(b1,dispped1,pedcam,2,4,2);
|
---|
177 | CamDraw(b1,dispped2,pedcam,3,4,2);
|
---|
178 | CamDraw(b1,dispped3,pedcam,4,4,2);
|
---|
179 |
|
---|
180 | // Fitted values
|
---|
181 | TCanvas &b2 = display->AddTab("Ped.Fit");
|
---|
182 | b2.Divide(4,3);
|
---|
183 |
|
---|
184 | CamDraw(b2,dispped4,hpedcam,1,4,1);
|
---|
185 | CamDraw(b2,dispped5,hpedcam,2,4,2);
|
---|
186 | CamDraw(b2,dispped6,hpedcam,3,4,2);
|
---|
187 | CamDraw(b2,dispped7,hpedcam,4,4,2);
|
---|
188 |
|
---|
189 |
|
---|
190 | // Fits Probability
|
---|
191 | TCanvas &b3 = display->AddTab("Ped.Fit Prob.");
|
---|
192 | b3.Divide(1,3);
|
---|
193 |
|
---|
194 | CamDraw(b3,dispped8,hpedcam,1,1,3);
|
---|
195 |
|
---|
196 | // Differences
|
---|
197 | TCanvas &c4 = display->AddTab("Rel.Diff.Calc.-Fit");
|
---|
198 | c4.Divide(4,3);
|
---|
199 |
|
---|
200 | CamDraw(c4,dispped9,hpedcam,1,4,1);
|
---|
201 | CamDraw(c4,dispped10,hpedcam,2,4,1);
|
---|
202 | CamDraw(c4,dispped11,hpedcam,3,4,1);
|
---|
203 | CamDraw(c4,dispped12,hpedcam,4,4,1);
|
---|
204 |
|
---|
205 | // Defects
|
---|
206 | TCanvas &c5 = display->AddTab("Defects");
|
---|
207 | c5.Divide(2,2);
|
---|
208 |
|
---|
209 | CamDraw(c5,dispped13,hpedcam,1,2,0);
|
---|
210 | CamDraw(c5,dispped14,hpedcam,2,2,0);
|
---|
211 |
|
---|
212 | //
|
---|
213 | // Create a empty Parameter List and an empty Task List
|
---|
214 | //
|
---|
215 | MParList plist2;
|
---|
216 | MTaskList tlist2;
|
---|
217 | plist2.AddToList(&tlist2);
|
---|
218 |
|
---|
219 | MExtractedSignalCam sigcam;
|
---|
220 | MCalibrationCam calcam;
|
---|
221 | MHCalibrationRelTimeCam timecam;
|
---|
222 | //
|
---|
223 | // Get the previously created MPedestalCam into the new Parameter List
|
---|
224 | //
|
---|
225 | plist2.AddToList(&geomcam);
|
---|
226 | plist2.AddToList(&pedcam);
|
---|
227 | plist2.AddToList(&sigcam);
|
---|
228 | plist2.AddToList(&calcam);
|
---|
229 | plist2.AddToList(&timecam);
|
---|
230 | //
|
---|
231 | // Get the MAGIC geometry
|
---|
232 | //
|
---|
233 | tlist2.AddToList(&geomapl);
|
---|
234 | //
|
---|
235 | // Now setup the new tasks and tasklist for the calibration
|
---|
236 | // ---------------------------------------------------
|
---|
237 | //
|
---|
238 |
|
---|
239 | MReadMarsFile read2("Events", calname);
|
---|
240 | read2.DisableAutoScheme();
|
---|
241 |
|
---|
242 | //
|
---|
243 | // We saw that the signal jumps between slices,
|
---|
244 | // thus take the sliding window
|
---|
245 | //
|
---|
246 | MExtractPINDiode pincalc;
|
---|
247 | MExtractBlindPixel blindcalc;
|
---|
248 | MExtractSignal2 sigcalc2;
|
---|
249 | MArrivalTimeCalc2 timecalc;
|
---|
250 | MCalibrationCalc calcalc;
|
---|
251 |
|
---|
252 | MFillH filltime("MHCalibrationRelTimeCam", "MArrivalTime");
|
---|
253 | MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
|
---|
254 |
|
---|
255 | //
|
---|
256 | // Set the range (other than default)
|
---|
257 | // of FADC slices for the blind pixel
|
---|
258 | //
|
---|
259 | // calcalc.SetBlindPixelRange(10,25);
|
---|
260 |
|
---|
261 | //
|
---|
262 | // Set the cut upon which a superposition of the blind pixel
|
---|
263 | // FADC slices will be filled into the SinglePHE histogram
|
---|
264 | //
|
---|
265 | calcalc.SetBlindPixelSinglePheCut(500);
|
---|
266 |
|
---|
267 | //
|
---|
268 | // Skip the HiGain vs. LoGain calibration
|
---|
269 | //
|
---|
270 | calcalc.SkipHiLoGainCalibration();
|
---|
271 |
|
---|
272 | //
|
---|
273 | // As long, as we don't have digital modules,
|
---|
274 | // we have to set the color of the pulser LED by hand
|
---|
275 | //
|
---|
276 | calcalc.SetPulserColor(MCalibrationCalc::kECT1);
|
---|
277 |
|
---|
278 | //
|
---|
279 | // In case, we want to exclude a pre-defined list of bad pixels:
|
---|
280 | // (This is a preliminary feature)
|
---|
281 | //
|
---|
282 | // calcalc.ExcludePixelsFromAsciiFile("badpixels.dat");
|
---|
283 |
|
---|
284 | //
|
---|
285 | // In case, you want to skip the blind pixel method:
|
---|
286 | // (NOT RECOMMENDED!!!)
|
---|
287 | //
|
---|
288 | // calcalc.SkipBlindPixelFit();
|
---|
289 |
|
---|
290 | //
|
---|
291 | // In case, you want to skip the quality checks
|
---|
292 | // (NOT RECOMMENDED!!!)
|
---|
293 | //
|
---|
294 | // calcalc.SkipQualityChecks();
|
---|
295 |
|
---|
296 | //
|
---|
297 | // In case, we want to apply another fit function to the
|
---|
298 | // blind pixel
|
---|
299 | //
|
---|
300 | MCalibrationBlindPix *bp = calcam.GetBlindPixel();
|
---|
301 | bp->ChangeFitFunc(MHCalibrationBlindPixel::kEPoisson5);
|
---|
302 |
|
---|
303 | //
|
---|
304 | // Apply a filter against cosmics
|
---|
305 | // (was directly in MCalibrationCalc in earlier versions)
|
---|
306 | //
|
---|
307 | MFCosmics cosmics;
|
---|
308 | MContinue cont(&cosmics);
|
---|
309 |
|
---|
310 | tlist2.AddToList(&read2);
|
---|
311 | tlist2.AddToList(&blindcalc);
|
---|
312 | tlist2.AddToList(&pincalc);
|
---|
313 | tlist2.AddToList(&sigcalc2);
|
---|
314 | //
|
---|
315 | // In case, you want to skip the cosmics rejection,
|
---|
316 | // uncomment the next line
|
---|
317 | //
|
---|
318 | tlist2.AddToList(&cont);
|
---|
319 | //
|
---|
320 | // In case, you want to skip the somewhat lengthy calculation
|
---|
321 | // of the arrival times using a spline, uncomment the next two lines
|
---|
322 | //
|
---|
323 | tlist2.AddToList(&timecalc);
|
---|
324 | tlist2.AddToList(&filltime);
|
---|
325 | tlist2.AddToList(&fillpin);
|
---|
326 | //
|
---|
327 | tlist2.AddToList(&calcalc);
|
---|
328 | //
|
---|
329 | // Create and setup the eventloop
|
---|
330 | //
|
---|
331 | MEvtLoop evtloop2;
|
---|
332 | evtloop2.SetParList(&plist2);
|
---|
333 | evtloop2.SetDisplay(display);
|
---|
334 |
|
---|
335 | //
|
---|
336 | // Execute second analysis
|
---|
337 | //
|
---|
338 | if (!evtloop2.Eventloop())
|
---|
339 | return;
|
---|
340 |
|
---|
341 | tlist2.PrintStatistics();
|
---|
342 |
|
---|
343 | //
|
---|
344 | // print the most important results of all pixels
|
---|
345 | //
|
---|
346 | // calcam.Print();
|
---|
347 |
|
---|
348 | //
|
---|
349 | // just one example how to get the plots of individual pixels
|
---|
350 | //
|
---|
351 | // calcam[563].DrawClone();
|
---|
352 | // calcam[564].DrawClone();
|
---|
353 |
|
---|
354 | // Create histograms to display
|
---|
355 | MHCamera disp1 (geomcam, "Cal;Charge", "Fitted Mean Charges");
|
---|
356 | MHCamera disp2 (geomcam, "Cal;SigmaCharge", "Sigma of Fitted Charges");
|
---|
357 | MHCamera disp3 (geomcam, "Cal;FitProb", "Probability of Fit");
|
---|
358 | MHCamera disp4 (geomcam, "Cal;RSigma", "Reduced Sigmas");
|
---|
359 | MHCamera disp5 (geomcam, "Cal;RSigma/Charge", "Reduced Sigma per Charge");
|
---|
360 | MHCamera disp6 (geomcam, "Cal;FFactorPhe", "Nr. of Phe's (F-Factor Method)");
|
---|
361 | MHCamera disp7 (geomcam, "Cal;FFactorConv", "Conversion Factor (F-Factor Method)");
|
---|
362 | MHCamera disp8 (geomcam, "Cal;FFactorFFactor", "Total F-Factor (F-Factor Method)");
|
---|
363 | MHCamera disp9 (geomcam, "Cal;BlindPixPh", "Photon flux inside plexiglass (Blind Pixel Method)");
|
---|
364 | MHCamera disp10 (geomcam, "Cal;BlindPixConv", "Conversion Factor (Blind Pixel Method)");
|
---|
365 | MHCamera disp11 (geomcam, "Cal;BlindPixFFactor","Total F-Factor (Blind Pixel Method)");
|
---|
366 | MHCamera disp12 (geomcam, "Cal;PINDiodePh", "Photon flux outside plexiglass (PIN Diode Method)");
|
---|
367 | MHCamera disp13 (geomcam, "Cal;PINDiodeConv", "Conversion Factor (PIN Diode Method)");
|
---|
368 | MHCamera disp14 (geomcam, "Cal;PINDiodeFFactor","Total F-Factor (PIN Diode Method)");
|
---|
369 | MHCamera disp15 (geomcam, "Cal;Excluded", "Pixels previously excluded");
|
---|
370 | MHCamera disp16 (geomcam, "Cal;NotFitted", "Pixels that could not be fitted");
|
---|
371 | MHCamera disp17 (geomcam, "Cal;NotFitValid", "Pixels with not valid fit results");
|
---|
372 | MHCamera disp18 (geomcam, "Cal;Oscillating", "Oscillating Pixels");
|
---|
373 | MHCamera disp19 (geomcam, "Cal;Saturation", "Pixels with saturated Hi Gain");
|
---|
374 |
|
---|
375 | MHCamera disp20 (geomcam, "Cal;Ped", "Pedestals");
|
---|
376 | MHCamera disp21 (geomcam, "Cal;PedRms", "Pedestal RMS");
|
---|
377 |
|
---|
378 | MHCamera disp22 (geomcam, "time;Time", "Rel. Arrival Times");
|
---|
379 | MHCamera disp23 (geomcam, "time;SigmaTime", "Sigma of Rel. Arrival Times");
|
---|
380 | MHCamera disp24 (geomcam, "time;TimeProb", "Probability of Time Fit");
|
---|
381 | MHCamera disp25 (geomcam, "time;NotFitValid", "Pixels with not valid fit results");
|
---|
382 | MHCamera disp26 (geomcam, "time;Oscillating", "Oscillating Pixels");
|
---|
383 |
|
---|
384 | MHCamera disp27 (geomcam, "Cal;AbsTimeMean", "Abs. Arrival Times");
|
---|
385 | MHCamera disp28 (geomcam, "Cal;AbsTimeRms", "RMS of Arrival Times");
|
---|
386 |
|
---|
387 | // Fitted charge means and sigmas
|
---|
388 | disp1.SetCamContent(calcam, 0);
|
---|
389 | disp1.SetCamError( calcam, 1);
|
---|
390 | disp2.SetCamContent(calcam, 2);
|
---|
391 | disp2.SetCamError( calcam, 3);
|
---|
392 |
|
---|
393 | // Fit probabilities
|
---|
394 | disp3.SetCamContent(calcam, 4);
|
---|
395 |
|
---|
396 | // Reduced Sigmas and reduced sigmas per charge
|
---|
397 | disp4.SetCamContent(calcam, 5);
|
---|
398 | disp4.SetCamError( calcam, 6);
|
---|
399 | disp5.SetCamContent(calcam, 7);
|
---|
400 | disp5.SetCamError( calcam, 8);
|
---|
401 |
|
---|
402 | // F-Factor Method
|
---|
403 | disp6.SetCamContent(calcam, 9);
|
---|
404 | disp6.SetCamError( calcam, 10);
|
---|
405 | disp7.SetCamContent(calcam, 11);
|
---|
406 | disp7.SetCamError( calcam, 12);
|
---|
407 | disp8.SetCamContent(calcam, 13);
|
---|
408 | disp8.SetCamError( calcam, 14);
|
---|
409 |
|
---|
410 | /// Blind Pixel Method
|
---|
411 | disp9.SetCamContent(calcam, 15);
|
---|
412 | disp9.SetCamError( calcam, 16);
|
---|
413 | disp10.SetCamContent(calcam,17);
|
---|
414 | disp10.SetCamError( calcam,18);
|
---|
415 | disp11.SetCamContent(calcam,19);
|
---|
416 | disp11.SetCamError( calcam,20);
|
---|
417 |
|
---|
418 | // PIN Diode Method
|
---|
419 | disp12.SetCamContent(calcam,21);
|
---|
420 | disp12.SetCamError( calcam,22);
|
---|
421 | disp13.SetCamContent(calcam,23);
|
---|
422 | disp13.SetCamError( calcam,24);
|
---|
423 | disp14.SetCamContent(calcam,25);
|
---|
424 | disp14.SetCamError( calcam,26);
|
---|
425 |
|
---|
426 | // Pixels with defects
|
---|
427 | disp15.SetCamContent(calcam,27);
|
---|
428 | disp16.SetCamContent(calcam,28);
|
---|
429 | disp17.SetCamContent(calcam,29);
|
---|
430 | disp18.SetCamContent(calcam,30);
|
---|
431 |
|
---|
432 | // Lo Gain calibration
|
---|
433 | disp19.SetCamContent(calcam,31);
|
---|
434 |
|
---|
435 |
|
---|
436 | // Pedestals
|
---|
437 | disp20.SetCamContent(calcam,35);
|
---|
438 | disp20.SetCamError( calcam,36);
|
---|
439 | disp21.SetCamContent(calcam,37);
|
---|
440 | disp21.SetCamError( calcam,38);
|
---|
441 |
|
---|
442 |
|
---|
443 | // Relative Times
|
---|
444 | disp22.SetCamContent(timecam,0);
|
---|
445 | disp22.SetCamError( timecam,1);
|
---|
446 | disp23.SetCamContent(timecam,2);
|
---|
447 | disp23.SetCamError( timecam,3);
|
---|
448 | disp24.SetCamContent(timecam,4);
|
---|
449 | disp25.SetCamContent(timecam,5);
|
---|
450 | disp26.SetCamContent(timecam,6);
|
---|
451 |
|
---|
452 | // Absolute Times
|
---|
453 | disp27.SetCamContent(calcam,39);
|
---|
454 | disp27.SetCamError( calcam,40);
|
---|
455 | disp28.SetCamContent(calcam,41);
|
---|
456 | disp28.SetCamError( calcam,42);
|
---|
457 |
|
---|
458 |
|
---|
459 | disp1.SetYTitle("Charge [FADC units]");
|
---|
460 | disp2.SetYTitle("\\sigma_{Charge} [FADC units]");
|
---|
461 | disp3.SetYTitle("P_{Charge} [1]");
|
---|
462 |
|
---|
463 | disp4.SetYTitle("\\sqrt{\\sigma^{2}_{Charge} - RMS^{2}_{Ped}} [FADC Counts]");
|
---|
464 | disp5.SetYTitle("Reduced Sigma / Mean Charge [1]");
|
---|
465 |
|
---|
466 | disp6.SetYTitle("Nr. Photo-Electrons [1]");
|
---|
467 | disp7.SetYTitle("Conversion Factor [PhE/FADC Count]");
|
---|
468 | disp8.SetYTitle("\\sqrt{N_{PhE}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
|
---|
469 |
|
---|
470 | disp9.SetYTitle("Photon flux [ph/mm^2]");
|
---|
471 | disp10.SetYTitle("Conversion Factor [Phot/FADC Count]");
|
---|
472 | disp11.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
|
---|
473 |
|
---|
474 | disp12.SetYTitle("Photon flux [ph/mm^2]");
|
---|
475 | disp13.SetYTitle("Conversion Factor [Phot/FADC Count]");
|
---|
476 | disp14.SetYTitle("\\sqrt{N_{Ph}}*\\sigma_{Charge}/\\mu_{Charge} [1]");
|
---|
477 |
|
---|
478 | disp15.SetYTitle("[1]");
|
---|
479 | disp16.SetYTitle("[1]");
|
---|
480 | disp17.SetYTitle("[1]");
|
---|
481 | disp18.SetYTitle("[1]");
|
---|
482 | disp19.SetYTitle("[1]");
|
---|
483 |
|
---|
484 | disp20.SetYTitle("Ped [FADC Counts ]");
|
---|
485 | disp21.SetYTitle("RMS_{Ped} [FADC Counts ]");
|
---|
486 |
|
---|
487 | disp22.SetYTitle("Time Offset [ns]");
|
---|
488 | disp23.SetYTitle("Timing resolution [ns]");
|
---|
489 | disp24.SetYTitle("P_{Time} [1]");
|
---|
490 |
|
---|
491 | disp25.SetYTitle("[1]");
|
---|
492 | disp26.SetYTitle("[1]");
|
---|
493 |
|
---|
494 | disp27.SetYTitle("Mean Abs. Time [FADC slice]");
|
---|
495 | disp28.SetYTitle("RMS Abs. Time [FADC slices]");
|
---|
496 |
|
---|
497 | gStyle->SetOptStat(1111);
|
---|
498 | gStyle->SetOptFit();
|
---|
499 |
|
---|
500 | // Charges
|
---|
501 | TCanvas &c1 = display->AddTab("Fit.Charge");
|
---|
502 | c1.Divide(2, 3);
|
---|
503 |
|
---|
504 | CamDraw(c1, disp1,calcam,1, 2 , 2);
|
---|
505 | CamDraw(c1, disp2,calcam,2, 2 , 2);
|
---|
506 |
|
---|
507 | // Fit Probability
|
---|
508 | TCanvas &c2 = display->AddTab("Fit.Prob");
|
---|
509 | c2.Divide(1,3);
|
---|
510 |
|
---|
511 | CamDraw(c2, disp3,calcam,1, 1 , 4);
|
---|
512 |
|
---|
513 | // Reduced Sigmas
|
---|
514 | TCanvas &c3 = display->AddTab("Red.Sigma");
|
---|
515 | c3.Divide(2,3);
|
---|
516 |
|
---|
517 | CamDraw(c3, disp4,calcam,1, 2 , 2);
|
---|
518 | CamDraw(c3, disp5,calcam,2, 2 , 2);
|
---|
519 |
|
---|
520 | // F-Factor Method
|
---|
521 | TCanvas &c4 = display->AddTab("F-Factor");
|
---|
522 | c4.Divide(2,3);
|
---|
523 |
|
---|
524 | CamDraw(c4, disp6,calcam,1, 2 , 2);
|
---|
525 | CamDraw(c4, disp7,calcam,2, 2 , 2);
|
---|
526 | CamDraw(c4, disp8,calcam,3, 3 , 2);
|
---|
527 |
|
---|
528 | // Blind Pixel Method
|
---|
529 | TCanvas &c5 = display->AddTab("BlindPix");
|
---|
530 | c5.Divide(3, 3);
|
---|
531 |
|
---|
532 | CamDraw(c5, disp9,calcam,1, 3 , 9);
|
---|
533 | CamDraw(c5, disp10,calcam,2, 3 , 2);
|
---|
534 | CamDraw(c5, disp11,calcam,3, 3 , 2);
|
---|
535 |
|
---|
536 | // PIN Diode Method
|
---|
537 | TCanvas &c6 = display->AddTab("PINDiode");
|
---|
538 | c6.Divide(3,3);
|
---|
539 |
|
---|
540 | CamDraw(c6, disp12,calcam,1, 3 , 9);
|
---|
541 | CamDraw(c6, disp13,calcam,2, 3 , 2);
|
---|
542 | CamDraw(c6, disp14,calcam,3, 3 , 2);
|
---|
543 |
|
---|
544 | // Defects
|
---|
545 | TCanvas &c7 = display->AddTab("Defects");
|
---|
546 | c7.Divide(4,2);
|
---|
547 |
|
---|
548 | CamDraw(c7, disp15,calcam,1,4, 0);
|
---|
549 | CamDraw(c7, disp16,calcam,2,4, 0);
|
---|
550 | CamDraw(c7, disp17,calcam,3,4, 0);
|
---|
551 | CamDraw(c7, disp18,calcam,4,4,0);
|
---|
552 |
|
---|
553 | // Lo Gain Calibration
|
---|
554 | TCanvas &c8 = display->AddTab("LowGain");
|
---|
555 | c8.Divide(1,3);
|
---|
556 |
|
---|
557 | CamDraw(c8, disp19,calcam,1,4,0);
|
---|
558 |
|
---|
559 |
|
---|
560 | // Pedestals
|
---|
561 | TCanvas &c9 = display->AddTab("Pedestals");
|
---|
562 | c9.Divide(2,3);
|
---|
563 |
|
---|
564 | CamDraw(c9,disp20,calcam,1,2,1);
|
---|
565 | CamDraw(c9,disp21,calcam,2,2,2);
|
---|
566 |
|
---|
567 |
|
---|
568 | // Rel. Times
|
---|
569 | TCanvas &c10 = display->AddTab("Fitted Rel. Times");
|
---|
570 | c10.Divide(3,3);
|
---|
571 |
|
---|
572 | CamDraw(c10,disp22,calcam,1,3,2);
|
---|
573 | CamDraw(c10,disp23,calcam,2,3,2);
|
---|
574 | CamDraw(c10,disp24,calcam,3,3,4);
|
---|
575 |
|
---|
576 | // Time Defects
|
---|
577 | TCanvas &c11 = display->AddTab("Time Def.");
|
---|
578 | c11.Divide(2,2);
|
---|
579 |
|
---|
580 | CamDraw(c11, disp25,calcam,1,2, 0);
|
---|
581 | CamDraw(c11, disp26,calcam,2,2, 0);
|
---|
582 |
|
---|
583 | // Abs. Times
|
---|
584 | TCanvas &c12 = display->AddTab("Abs. Times");
|
---|
585 | c12.Divide(2,3);
|
---|
586 |
|
---|
587 | CamDraw(c12,disp27,calcam,1,2,2);
|
---|
588 | CamDraw(c12,disp28,calcam,2,2,2);
|
---|
589 |
|
---|
590 | }
|
---|
591 |
|
---|
592 | void CamDraw(TCanvas &c, MHCamera &cam, MCamEvent &evt, Int_t i, Int_t j, Int_t fit)
|
---|
593 | {
|
---|
594 |
|
---|
595 | c.cd(i);
|
---|
596 | gPad->SetBorderMode(0);
|
---|
597 | MHCamera *obj1=(MHCamera*)cam.DrawCopy("hist");
|
---|
598 | // obj1->AddNotify(evt);
|
---|
599 |
|
---|
600 | c.cd(i+j);
|
---|
601 | gPad->SetBorderMode(0);
|
---|
602 | obj1->Draw();
|
---|
603 | ((MHCamera*)obj1)->SetPrettyPalette();
|
---|
604 |
|
---|
605 | if (fit != 0)
|
---|
606 | {
|
---|
607 | c.cd(i+2*j);
|
---|
608 | gPad->SetBorderMode(0);
|
---|
609 | TH1D *obj2 = (TH1D*)obj1->Projection();
|
---|
610 |
|
---|
611 | obj2->Draw();
|
---|
612 | obj2->SetBit(kCanDelete);
|
---|
613 |
|
---|
614 |
|
---|
615 | const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
|
---|
616 | const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());
|
---|
617 | const Double_t integ = obj2->Integral("width")/2.5066283;
|
---|
618 | const Double_t mean = obj2->GetMean();
|
---|
619 | const Double_t rms = obj2->GetRMS();
|
---|
620 | const Double_t width = max-min;
|
---|
621 |
|
---|
622 | if (rms == 0. || width == 0. )
|
---|
623 | return;
|
---|
624 |
|
---|
625 | switch (fit)
|
---|
626 | {
|
---|
627 | case 1:
|
---|
628 | TF1 *sgaus = new TF1("sgaus","gaus(0)",min,max);
|
---|
629 | sgaus->SetBit(kCanDelete);
|
---|
630 | sgaus->SetParNames("Area","#mu","#sigma");
|
---|
631 | sgaus->SetParameters(integ/rms,mean,rms);
|
---|
632 | sgaus->SetParLimits(0,0.,integ);
|
---|
633 | sgaus->SetParLimits(1,min,max);
|
---|
634 | sgaus->SetParLimits(2,0,width/1.5);
|
---|
635 | obj2->Fit("sgaus","QLR");
|
---|
636 | obj2->GetFunction("sgaus")->SetLineColor(kYellow);
|
---|
637 | break;
|
---|
638 |
|
---|
639 | case 2:
|
---|
640 | TString dgausform = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])";
|
---|
641 | dgausform += "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])";
|
---|
642 | TF1 *dgaus = new TF1("dgaus",dgausform.Data(),min,max);
|
---|
643 | dgaus->SetBit(kCanDelete);
|
---|
644 | dgaus->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}","A_{2}","#mu_{2}","#sigma_{2}");
|
---|
645 | dgaus->SetParameters(integ,(min+mean)/2.,width/4.,
|
---|
646 | integ/width/2.,(max+mean)/2.,width/4.);
|
---|
647 | // The left-sided Gauss
|
---|
648 | dgaus->SetParLimits(0,integ-1.5,integ+1.5);
|
---|
649 | dgaus->SetParLimits(1,min+(width/10.),mean);
|
---|
650 | dgaus->SetParLimits(2,0,width/2.);
|
---|
651 | // The right-sided Gauss
|
---|
652 | dgaus->SetParLimits(3,0,integ);
|
---|
653 | dgaus->SetParLimits(4,mean,max-(width/10.));
|
---|
654 | dgaus->SetParLimits(5,0,width/2.);
|
---|
655 | obj2->Fit("dgaus","QLRM");
|
---|
656 | obj2->GetFunction("dgaus")->SetLineColor(kYellow);
|
---|
657 | break;
|
---|
658 |
|
---|
659 | case 3:
|
---|
660 | TString tgausform = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])";
|
---|
661 | tgausform += "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])";
|
---|
662 | tgausform += "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])";
|
---|
663 | TF1 *tgaus = new TF1("tgaus",tgausform.Data(),min,max);
|
---|
664 | tgaus->SetBit(kCanDelete);
|
---|
665 | tgaus->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}",
|
---|
666 | "A_{2}","#mu_{2}","#sigma_{2}",
|
---|
667 | "A_{3}","#mu_{3}","#sigma_{3}");
|
---|
668 | tgaus->SetParameters(integ,(min+mean)/2,width/4.,
|
---|
669 | integ/width/3.,(max+mean)/2.,width/4.,
|
---|
670 | integ/width/3.,mean,width/2.);
|
---|
671 | // The left-sided Gauss
|
---|
672 | tgaus->SetParLimits(0,integ-1.5,integ+1.5);
|
---|
673 | tgaus->SetParLimits(1,min+(width/10.),mean);
|
---|
674 | tgaus->SetParLimits(2,width/15.,width/2.);
|
---|
675 | // The right-sided Gauss
|
---|
676 | tgaus->SetParLimits(3,0.,integ);
|
---|
677 | tgaus->SetParLimits(4,mean,max-(width/10.));
|
---|
678 | tgaus->SetParLimits(5,width/15.,width/2.);
|
---|
679 | // The Gauss describing the outliers
|
---|
680 | tgaus->SetParLimits(6,0.,integ);
|
---|
681 | tgaus->SetParLimits(7,min,max);
|
---|
682 | tgaus->SetParLimits(8,width/4.,width/1.5);
|
---|
683 | obj2->Fit("tgaus","QLRM");
|
---|
684 | obj2->GetFunction("tgaus")->SetLineColor(kYellow);
|
---|
685 | break;
|
---|
686 | case 4:
|
---|
687 | obj2->Fit("pol0","Q");
|
---|
688 | obj2->GetFunction("pol0")->SetLineColor(kYellow);
|
---|
689 | break;
|
---|
690 | case 9:
|
---|
691 | break;
|
---|
692 | default:
|
---|
693 | obj2->Fit("gaus","Q");
|
---|
694 | obj2->GetFunction("gaus")->SetLineColor(kYellow);
|
---|
695 | break;
|
---|
696 | }
|
---|
697 |
|
---|
698 | gPad->Modified();
|
---|
699 | gPad->Update();
|
---|
700 |
|
---|
701 | }
|
---|
702 | }
|
---|