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): Thomas Bretz, 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | ! Markus Gaug, 02/2004 <mailto:markus@ifae.es>
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MJCalibration
|
---|
28 | //
|
---|
29 | // Do one calibration loop over serious of runs with the same pulser
|
---|
30 | // colour and the same intensity. The following containers (rectangular) and
|
---|
31 | // tasks (ellipses) are called to produce an MCalibrationChargeCam and to
|
---|
32 | // update the MCalibrationQECam: (MCalibrate is not called from this class)
|
---|
33 | //
|
---|
34 | //Begin_Html
|
---|
35 | /*
|
---|
36 | <img src="images/CalibClasses.gif">
|
---|
37 | */
|
---|
38 | //End_Html
|
---|
39 | //
|
---|
40 | // Different signal extractors can be chosen via the command SetExtractorLevel(UInt_t i)
|
---|
41 | // Up to now, the following extractors are available:
|
---|
42 | // i=1: Use MExtractSignal (fixed window)
|
---|
43 | // i=2: Use MExtractSignal2 (sliding window: default)
|
---|
44 | // i=3: Use MExtractSignal3 (coherent sliding window for all pixels)
|
---|
45 | //
|
---|
46 | // At the end of the eventloop, plots and results are displayed, depending on
|
---|
47 | // the flags set (see DisplayResult())
|
---|
48 | //
|
---|
49 | // If the flag SetFullDisplay() is set, all MHCameras will be displayed.
|
---|
50 | // if the flag SetDataCheckDisplay() is set, only the most important ones are displayed
|
---|
51 | // Otherwise, (default: SetNormalDisplay()), a good selection of plots is given
|
---|
52 | //
|
---|
53 | // If the flag SetDataCheck() is set, the calibration is used as in the data check at
|
---|
54 | // La Palma, which mean especially running it on raw data files.
|
---|
55 | //
|
---|
56 | // See also: MHCalibrationChargePix, MHCalibrationChargeCam, MHGausEvents
|
---|
57 | // MHCalibrationChargeBlindPix, MHCalibrationChargePINDiode
|
---|
58 | // MCalibrationChargePix, MCalibrationChargeCam, MCalibrationChargeCalc
|
---|
59 | // MCalibrationChargeBlindPix, MCalibrationChargePINDiode,
|
---|
60 | // MCalibrationQECam, MBadPixelsPix, MBadPixelsCam
|
---|
61 | //
|
---|
62 | // If the flag RelTimeCalibration() is set, a calibration of the relative arrival
|
---|
63 | // times is also performed. The following containers (rectangular) and
|
---|
64 | // tasks (ellipses) are called to produce an MCalibrationRelTimeCam used by
|
---|
65 | // MCalibrateTime to correct timing offset between pixels: (MCalibrateTime is not
|
---|
66 | // called from this class)
|
---|
67 | //
|
---|
68 | //Begin_Html
|
---|
69 | /*
|
---|
70 | <img src="images/RelTimeClasses.gif">
|
---|
71 | */
|
---|
72 | //End_Html
|
---|
73 | //
|
---|
74 | // Different arrival time extractors can be chosen via the command SetArrivalTimeLevel(UInt_t i)
|
---|
75 | // Up to now, the following extractors are available:
|
---|
76 | // i=1: Use MArrivalTimeCalc (using MCubicSpline, arrival time == position at half maximum)
|
---|
77 | // i=2: Use MArrivalTimeCalc2 (mean time of fWindowSize time slices with the highest integral content: default)
|
---|
78 | //
|
---|
79 | // See also: MHCalibrationRelTimePix, MHCalibrationRelTimeCam, MHGausEvents
|
---|
80 | // MCalibrationRelTimePix, MCalibrationRelTimeCam
|
---|
81 | // MBadPixelsPix, MBadPixelsCam
|
---|
82 | //
|
---|
83 | /////////////////////////////////////////////////////////////////////////////
|
---|
84 | #include "MJCalibration.h"
|
---|
85 |
|
---|
86 | #include <TF1.h>
|
---|
87 | #include <TFile.h>
|
---|
88 | #include <TStyle.h>
|
---|
89 | #include <TCanvas.h>
|
---|
90 | #include <TSystem.h>
|
---|
91 | #include <TProfile.h>
|
---|
92 |
|
---|
93 | #include "MLog.h"
|
---|
94 | #include "MLogManip.h"
|
---|
95 |
|
---|
96 | #include "MRunIter.h"
|
---|
97 | #include "MParList.h"
|
---|
98 | #include "MTaskList.h"
|
---|
99 | #include "MEvtLoop.h"
|
---|
100 |
|
---|
101 | #include "MHCamera.h"
|
---|
102 | #include "MGeomCam.h"
|
---|
103 |
|
---|
104 | #include "MPedestalCam.h"
|
---|
105 | #include "MCalibrationCam.h"
|
---|
106 | #include "MCalibrationQECam.h"
|
---|
107 | #include "MCalibrationChargeCam.h"
|
---|
108 | #include "MCalibrationChargePINDiode.h"
|
---|
109 | #include "MCalibrationChargeBlindPix.h"
|
---|
110 | #include "MCalibrationChargeCalc.h"
|
---|
111 |
|
---|
112 | #include "MHGausEvents.h"
|
---|
113 | #include "MHCalibrationCam.h"
|
---|
114 | #include "MHCalibrationChargeCam.h"
|
---|
115 | #include "MHCalibrationRelTimeCam.h"
|
---|
116 | #include "MCalibrationRelTimeCam.h"
|
---|
117 |
|
---|
118 | #include "MReadMarsFile.h"
|
---|
119 | #include "MRawFileRead.h"
|
---|
120 | #include "MGeomApply.h"
|
---|
121 | #include "MBadPixelsMerge.h"
|
---|
122 | #include "MBadPixelsCam.h"
|
---|
123 | #include "MExtractSignal.h"
|
---|
124 | #include "MExtractPINDiode.h"
|
---|
125 | #include "MExtractBlindPixel.h"
|
---|
126 | #include "MExtractSignal2.h"
|
---|
127 | #include "MExtractSignal3.h"
|
---|
128 | #include "MFCosmics.h"
|
---|
129 | #include "MContinue.h"
|
---|
130 | #include "MFillH.h"
|
---|
131 |
|
---|
132 | #include "MArrivalTimeCam.h"
|
---|
133 | #include "MArrivalTimeCalc.h"
|
---|
134 | #include "MArrivalTimeCalc2.h"
|
---|
135 |
|
---|
136 | #include "MJCalibration.h"
|
---|
137 | #include "MStatusDisplay.h"
|
---|
138 |
|
---|
139 | ClassImp(MJCalibration);
|
---|
140 |
|
---|
141 | using namespace std;
|
---|
142 |
|
---|
143 | const Int_t MJCalibration::gkIFAEBoxInaugurationRun = 20113;
|
---|
144 | // --------------------------------------------------------------------------
|
---|
145 | //
|
---|
146 | // Default constructor.
|
---|
147 | //
|
---|
148 | // Sets fRuns to 0, fColor to kNONE, fDisplay to kNormalDisplay,
|
---|
149 | // fRelTime to kFALSE, fExtractorLevel to 2, fArrivalTimeLevel to 2
|
---|
150 | //
|
---|
151 | MJCalibration::MJCalibration(const char *name, const char *title)
|
---|
152 | : fRuns(0), fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay),
|
---|
153 | fRelTimes(kFALSE), fDataCheck(kFALSE), fExtractorLevel(2), fArrivalTimeLevel(2)
|
---|
154 | {
|
---|
155 | fName = name ? name : "MJCalibration";
|
---|
156 | fTitle = title ? title : "Tool to create the calibration constants for one calibration run";
|
---|
157 |
|
---|
158 | }
|
---|
159 |
|
---|
160 | // --------------------------------------------------------------------------
|
---|
161 | //
|
---|
162 | // Draw the MHCamera into the MStatusDisplay:
|
---|
163 | //
|
---|
164 | // 1) Draw it as histogram (MHCamera::DrawCopy("hist")
|
---|
165 | // 2) Draw it as a camera, with MHCamera::SetPrettyPalette() set.
|
---|
166 | // 3) If "rad" is not zero, draw its values vs. the radius from the camera center.
|
---|
167 | // (DrawRadialProfile())
|
---|
168 | // 4) Depending on the variable "fit", draw the values projection on the y-axis
|
---|
169 | // (DrawProjection()):
|
---|
170 | // 0: don't draw
|
---|
171 | // 1: Draw fit to Single Gauss (for distributions flat-fielded over the whole camera)
|
---|
172 | // 2: Draw and fit to Double Gauss (for distributions different for inner and outer pixels)
|
---|
173 | // 3: Draw and fit to Triple Gauss (for distributions with inner, outer pixels and outliers)
|
---|
174 | // 4: Draw and fit to Polynomial grade 0: (for the probability distributions)
|
---|
175 | // >4: Draw and don;t fit.
|
---|
176 | //
|
---|
177 | void MJCalibration::CamDraw(TCanvas &c, const Int_t x, const Int_t y, const MHCamera &cam1,
|
---|
178 | const Int_t fit, const Int_t rad)
|
---|
179 | {
|
---|
180 | c.cd(x);
|
---|
181 | gPad->SetBorderMode(0);
|
---|
182 | gPad->SetTicks();
|
---|
183 | MHCamera *obj1=(MHCamera*)cam1.DrawCopy("hist");
|
---|
184 | obj1->SetDirectory(NULL);
|
---|
185 |
|
---|
186 | c.cd(x+y);
|
---|
187 | gPad->SetBorderMode(0);
|
---|
188 | obj1->SetPrettyPalette();
|
---|
189 | obj1->AddNotify(&fCalibrationCam);
|
---|
190 | obj1->Draw();
|
---|
191 |
|
---|
192 | if (rad)
|
---|
193 | {
|
---|
194 | c.cd(x+2*y);
|
---|
195 | gPad->SetBorderMode(0);
|
---|
196 | gPad->SetTicks();
|
---|
197 | DrawRadialProfile(obj1);
|
---|
198 | }
|
---|
199 |
|
---|
200 |
|
---|
201 | if (!fit)
|
---|
202 | return;
|
---|
203 |
|
---|
204 | c.cd(rad ? x+3*y : x+2*y);
|
---|
205 | gPad->SetBorderMode(0);
|
---|
206 | gPad->SetTicks();
|
---|
207 | DrawProjection(obj1, fit);
|
---|
208 | }
|
---|
209 |
|
---|
210 | // --------------------------------------------------------------------------
|
---|
211 | //
|
---|
212 | // Display the results in MStatusDisplay:
|
---|
213 | //
|
---|
214 | // - Add "Calibration" to the MStatusDisplay title
|
---|
215 | // - Retrieve the MGeomCam from MParList
|
---|
216 | // - Initialize the following MHCamera's:
|
---|
217 | // 1) MCalibrationPix::GetMean()
|
---|
218 | // 2) MCalibrationPix::Sigma()
|
---|
219 | // 3) MCalibrationChargePix::GetRSigma()
|
---|
220 | // 4) MCalibrationChargePix::GetRSigmaPerCharge()
|
---|
221 | // 5) MCalibrationChargePix::GetPheFFactorMethod()
|
---|
222 | // 6) MCalibrationChargePix::GetMeanConvFADC2Phe()
|
---|
223 | // 7) MCalibrationChargePix::GetMeanFFactorFADC2Phot()
|
---|
224 | // 8) MCalibrationQEPix::GetQECascadesFFactor()
|
---|
225 | // 9) MCalibrationQEPix::GetQECascadesBlindPixel()
|
---|
226 | // 10) MCalibrationQEPix::GetQECascadesPINDiode()
|
---|
227 | // 11) MCalibrationQEPix::GetQECascadesCombined()
|
---|
228 | // 12) MCalibrationQEPix::IsAverageQEFFactorAvailable()
|
---|
229 | // 13) MCalibrationQEPix::IsAverageQEBlindPixelAvailable()
|
---|
230 | // 14) MCalibrationQEPix::IsAverageQEPINDiodeAvailable()
|
---|
231 | // 15) MCalibrationQEPix::IsAverageQECombinedAvailable()
|
---|
232 | // 16) MCalibrationChargePix::IsHiGainSaturation()
|
---|
233 | // 17) MCalibrationPix::GetHiLoMeansDivided()
|
---|
234 | // 18) MCalibrationPix::GetHiLoSigmasDivided()
|
---|
235 | // 19) MCalibrationChargePix::GetHiGainPickup()
|
---|
236 | // 20) MCalibrationChargePix::GetLoGainPickup()
|
---|
237 | // 21) MCalibrationChargePix::GetHiGainBlackout()
|
---|
238 | // 22) MCalibrationChargePix::GetLoGainBlackout()
|
---|
239 | // 23) MCalibrationPix::IsExcluded()
|
---|
240 | // 24) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
241 | // 25) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnreliableRun)
|
---|
242 | // 26) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOscillating)
|
---|
243 | // 27) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOscillating)
|
---|
244 | // 28) MCalibrationChargePix::GetAbsTimeMean()
|
---|
245 | // 29) MCalibrationChargePix::GetAbsTimeRms()
|
---|
246 | //
|
---|
247 | // If the flag SetFullDisplay() is set, all MHCameras will be displayed.
|
---|
248 | // if the flag SetDataCheckDisplay() is set, only the most important ones are displayed
|
---|
249 | // and otherwise, (default: SetNormalDisplay()), a good selection of plots is given
|
---|
250 | //
|
---|
251 | void MJCalibration::DisplayResult(MParList &plist)
|
---|
252 | {
|
---|
253 | if (!fDisplay)
|
---|
254 | return;
|
---|
255 |
|
---|
256 | //
|
---|
257 | // Update display
|
---|
258 | //
|
---|
259 | TString title = fDisplay->GetTitle();
|
---|
260 | title += "-- Calibration ";
|
---|
261 | title += fRuns->GetRunsAsString();
|
---|
262 | title += " --";
|
---|
263 | fDisplay->SetTitle(title);
|
---|
264 |
|
---|
265 | //
|
---|
266 | // Get container from list
|
---|
267 | //
|
---|
268 | MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam");
|
---|
269 |
|
---|
270 | // Create histograms to display
|
---|
271 | MHCamera disp1 (geomcam, "Cal;Charge", "Fitted Mean Charges");
|
---|
272 | MHCamera disp2 (geomcam, "Cal;SigmaCharge", "Sigma of Fitted Charges");
|
---|
273 | MHCamera disp3 (geomcam, "Cal;RSigma", "Reduced Sigmas");
|
---|
274 | MHCamera disp4 (geomcam, "Cal;RSigma/Charge", "Reduced Sigma per Charge");
|
---|
275 | MHCamera disp5 (geomcam, "Cal;FFactorPhe", "Nr. of Phe's (F-Factor Method)");
|
---|
276 | MHCamera disp6 (geomcam, "Cal;FFactorConv", "Conversion Factor (F-Factor Method)");
|
---|
277 | MHCamera disp7 (geomcam, "Cal;FFactorFFactor", "Total F-Factor (F-Factor Method)");
|
---|
278 | MHCamera disp8 (geomcam, "Cal;CascadesQEFFactor", "Cascades QE (F-Factor Method)");
|
---|
279 | MHCamera disp9 (geomcam, "Cal;CascadesQEBlindPix","Cascades QE (Blind Pixel Method)");
|
---|
280 | MHCamera disp10(geomcam, "Cal;CascadesQEPINDiode","Cascades QE (PIN Diode Method)");
|
---|
281 | MHCamera disp11(geomcam, "Cal;CascadesQECombined","Cascades QE (Combined Method)");
|
---|
282 | MHCamera disp12(geomcam, "Cal;FFactorValid", "Pixels with valid F-Factor calibration");
|
---|
283 | MHCamera disp13(geomcam, "Cal;BlindPixelValid", "Pixels with valid BlindPixel calibration");
|
---|
284 | MHCamera disp14(geomcam, "Cal;PINdiodeValid", "Pixels with valid PINDiode calibration");
|
---|
285 | MHCamera disp15(geomcam, "Cal;CombinedValid", "Pixels with valid Combined calibration");
|
---|
286 | MHCamera disp16(geomcam, "Cal;Saturation", "Pixels with saturated Hi Gain");
|
---|
287 | MHCamera disp17(geomcam, "Cal;ConversionMeans", "Conversion HiGain.vs.LoGain Means");
|
---|
288 | MHCamera disp18(geomcam, "Cal;ConversionSigmas", "Conversion HiGain.vs.LoGain Sigmas");
|
---|
289 | MHCamera disp19(geomcam, "Cal;HiGainPickup", "Number Pickup events Hi Gain");
|
---|
290 | MHCamera disp20(geomcam, "Cal;LoGainPickup", "Number Pickup events Lo Gain");
|
---|
291 | MHCamera disp21(geomcam, "Cal;HiGainBlackout", "Number Blackout events Hi Gain");
|
---|
292 | MHCamera disp22(geomcam, "Cal;LoGainBlackout", "Number Blackout events Lo Gain");
|
---|
293 | MHCamera disp23(geomcam, "Cal;Excluded", "Pixels previously excluded");
|
---|
294 | MHCamera disp24(geomcam, "Bad;UnSuitable", "Pixels not suited for further analysis");
|
---|
295 | MHCamera disp25(geomcam, "Bad;UnReliable", "Pixels not reliable for further analysis");
|
---|
296 | MHCamera disp26(geomcam, "Bad;HiGainOscillating", "Oscillating Pixels High Gain");
|
---|
297 | MHCamera disp27(geomcam, "Bad;LoGainOscillating", "Oscillating Pixels Low Gain");
|
---|
298 | MHCamera disp28(geomcam, "Cal;AbsTimeMean", "Abs. Arrival Times");
|
---|
299 | MHCamera disp29(geomcam, "Cal;AbsTimeRms", "RMS of Arrival Times");
|
---|
300 | MHCamera disp30(geomcam, "time;MeanTime", "Mean Rel. Arrival Times");
|
---|
301 | MHCamera disp31(geomcam, "time;SigmaTime", "Sigma Rel. Arrival Times");
|
---|
302 | MHCamera disp32(geomcam, "time;TimeProb", "Probability of Time Fit");
|
---|
303 | MHCamera disp33(geomcam, "time;NotFitValid", "Pixels with not valid fit results");
|
---|
304 | MHCamera disp34(geomcam, "time;Oscillating", "Oscillating Pixels");
|
---|
305 |
|
---|
306 |
|
---|
307 |
|
---|
308 | // Fitted charge means and sigmas
|
---|
309 | disp1.SetCamContent(fCalibrationCam, 0);
|
---|
310 | disp1.SetCamError( fCalibrationCam, 1);
|
---|
311 | disp2.SetCamContent(fCalibrationCam, 2);
|
---|
312 | disp2.SetCamError( fCalibrationCam, 3);
|
---|
313 |
|
---|
314 | // Reduced Sigmas and reduced sigmas per charge
|
---|
315 | disp3.SetCamContent(fCalibrationCam, 5);
|
---|
316 | disp3.SetCamError( fCalibrationCam, 6);
|
---|
317 | disp4.SetCamContent(fCalibrationCam, 7);
|
---|
318 | disp4.SetCamError( fCalibrationCam, 8);
|
---|
319 |
|
---|
320 | // F-Factor Method
|
---|
321 | disp5.SetCamContent(fCalibrationCam, 9);
|
---|
322 | disp5.SetCamError( fCalibrationCam, 10);
|
---|
323 | disp6.SetCamContent(fCalibrationCam, 11);
|
---|
324 | disp6.SetCamError( fCalibrationCam, 12);
|
---|
325 | disp7.SetCamContent(fCalibrationCam, 13);
|
---|
326 | disp7.SetCamError( fCalibrationCam, 14);
|
---|
327 |
|
---|
328 | // Quantum Efficiencies
|
---|
329 | disp8.SetCamContent (fQECam, 0 );
|
---|
330 | disp8.SetCamError (fQECam, 1 );
|
---|
331 | disp9.SetCamContent (fQECam, 2 );
|
---|
332 | disp9.SetCamError (fQECam, 3 );
|
---|
333 | disp10.SetCamContent(fQECam, 4 );
|
---|
334 | disp10.SetCamError (fQECam, 5 );
|
---|
335 | disp11.SetCamContent(fQECam, 6 );
|
---|
336 | disp11.SetCamError (fQECam, 7 );
|
---|
337 |
|
---|
338 | // Valid flags
|
---|
339 | disp12.SetCamContent(fQECam, 8 );
|
---|
340 | disp13.SetCamContent(fQECam, 9 );
|
---|
341 | disp14.SetCamContent(fQECam, 10);
|
---|
342 | disp15.SetCamContent(fQECam, 11);
|
---|
343 |
|
---|
344 | // Conversion Hi-Lo
|
---|
345 | disp16.SetCamContent(fCalibrationCam, 25);
|
---|
346 | disp17.SetCamContent(fCalibrationCam, 16);
|
---|
347 | disp17.SetCamError (fCalibrationCam, 17);
|
---|
348 | disp18.SetCamContent(fCalibrationCam, 18);
|
---|
349 | disp18.SetCamError (fCalibrationCam, 19);
|
---|
350 |
|
---|
351 | // Pickup and Blackout
|
---|
352 | disp19.SetCamContent(fCalibrationCam, 21);
|
---|
353 | disp20.SetCamContent(fCalibrationCam, 22);
|
---|
354 | disp21.SetCamContent(fCalibrationCam, 23);
|
---|
355 | disp22.SetCamContent(fCalibrationCam, 24);
|
---|
356 |
|
---|
357 | // Pixels with defects
|
---|
358 | disp23.SetCamContent(fCalibrationCam, 20);
|
---|
359 | disp24.SetCamContent(fBadPixels, 1);
|
---|
360 | disp25.SetCamContent(fBadPixels, 3);
|
---|
361 |
|
---|
362 | // Oscillations
|
---|
363 | disp26.SetCamContent(fBadPixels, 10);
|
---|
364 | disp27.SetCamContent(fBadPixels, 11);
|
---|
365 |
|
---|
366 | // Arrival Times
|
---|
367 | disp28.SetCamContent(fCalibrationCam, 26);
|
---|
368 | disp28.SetCamError( fCalibrationCam, 27);
|
---|
369 | disp29.SetCamContent(fCalibrationCam, 27);
|
---|
370 |
|
---|
371 | disp1.SetYTitle("Q [FADC counts]");
|
---|
372 | disp2.SetYTitle("\\sigma_{Q} [FADC counts]");
|
---|
373 |
|
---|
374 | disp3.SetYTitle("\\sqrt{\\sigma^{2}_{Q} - RMS^{2}_{Ped}} [FADC Counts]");
|
---|
375 | disp4.SetYTitle("Red.Sigma/<Q> [1]");
|
---|
376 |
|
---|
377 | disp5.SetYTitle("Nr. Phe's [1]");
|
---|
378 | disp6.SetYTitle("Conv.Factor [PhE/FADC counts]");
|
---|
379 | disp7.SetYTitle("Total F-Factor [1]");
|
---|
380 |
|
---|
381 | disp8.SetYTitle("QE [1]");
|
---|
382 | disp9.SetYTitle("QE [1]");
|
---|
383 | disp10.SetYTitle("QE [1]");
|
---|
384 | disp11.SetYTitle("QE [1]");
|
---|
385 |
|
---|
386 | disp12.SetYTitle("[1]");
|
---|
387 | disp13.SetYTitle("[1]");
|
---|
388 | disp14.SetYTitle("[1]");
|
---|
389 | disp15.SetYTitle("[1]");
|
---|
390 | disp16.SetYTitle("[1]");
|
---|
391 |
|
---|
392 | disp17.SetYTitle("<Q>(High)/<Q>(Low) [1]");
|
---|
393 | disp18.SetYTitle("\\sigma_{Q}(High)/\\sigma_{Q}(Low) [1]");
|
---|
394 |
|
---|
395 | disp19.SetYTitle("[1]");
|
---|
396 | disp20.SetYTitle("[1]");
|
---|
397 | disp21.SetYTitle("[1]");
|
---|
398 | disp22.SetYTitle("[1]");
|
---|
399 | disp23.SetYTitle("[1]");
|
---|
400 | disp24.SetYTitle("[1]");
|
---|
401 | disp25.SetYTitle("[1]");
|
---|
402 | disp26.SetYTitle("[1]");
|
---|
403 | disp27.SetYTitle("[1]");
|
---|
404 |
|
---|
405 | disp28.SetYTitle("Mean Abs. Time [FADC slice]");
|
---|
406 | disp29.SetYTitle("RMS Abs. Time [FADC slices]");
|
---|
407 |
|
---|
408 | if (fRelTimes)
|
---|
409 | {
|
---|
410 |
|
---|
411 | disp30.SetCamContent(fRelTimeCam,0);
|
---|
412 | disp30.SetCamError( fRelTimeCam,1);
|
---|
413 | disp31.SetCamContent(fRelTimeCam,2);
|
---|
414 | disp31.SetCamError( fRelTimeCam,3);
|
---|
415 | disp32.SetCamContent(fRelTimeCam,4);
|
---|
416 | disp33.SetCamContent(fBadPixels,20);
|
---|
417 | disp34.SetCamContent(fBadPixels,21);
|
---|
418 |
|
---|
419 | disp30.SetYTitle("Time Offset [ns]");
|
---|
420 | disp31.SetYTitle("Timing resolution [ns]");
|
---|
421 | disp32.SetYTitle("P_{Time} [1]");
|
---|
422 | disp33.SetYTitle("[1]");
|
---|
423 | disp34.SetYTitle("[1]");
|
---|
424 | }
|
---|
425 |
|
---|
426 | gStyle->SetOptStat(1111);
|
---|
427 | gStyle->SetOptFit();
|
---|
428 |
|
---|
429 | if (fDisplayType == kDataCheckDisplay)
|
---|
430 | {
|
---|
431 | TCanvas &c1 = fDisplay->AddTab("Fit.Charge");
|
---|
432 | c1.Divide(3, 3);
|
---|
433 |
|
---|
434 | CamDraw(c1, 1, 3, disp1, 2);
|
---|
435 | CamDraw(c1, 2, 3, disp4, 2);
|
---|
436 | CamDraw(c1, 3, 3, disp28, 2);
|
---|
437 |
|
---|
438 | // F-Factor
|
---|
439 | TCanvas &c2 = fDisplay->AddTab("Phe's");
|
---|
440 | c2.Divide(3,4);
|
---|
441 |
|
---|
442 | CamDraw(c2, 1, 3, disp6, 2, 1);
|
---|
443 | CamDraw(c2, 2, 3, disp7, 2, 1);
|
---|
444 | CamDraw(c2, 3, 3, disp8, 2, 1);
|
---|
445 |
|
---|
446 | // QE's
|
---|
447 | TCanvas &c3 = fDisplay->AddTab("QE's");
|
---|
448 | c3.Divide(3,4);
|
---|
449 |
|
---|
450 | CamDraw(c3, 1, 3, disp8, 2, 1);
|
---|
451 | CamDraw(c3, 2, 3, disp9, 2, 1);
|
---|
452 | CamDraw(c3, 3, 3, disp10, 2, 1);
|
---|
453 |
|
---|
454 | // Defects
|
---|
455 | TCanvas &c4 = fDisplay->AddTab("Defect");
|
---|
456 | c4.Divide(3,2);
|
---|
457 |
|
---|
458 | CamDraw(c4, 1, 3, disp23, 0);
|
---|
459 | CamDraw(c4, 2, 3, disp24, 0);
|
---|
460 | CamDraw(c4, 3, 3, disp25, 0);
|
---|
461 |
|
---|
462 | if (fRelTimes)
|
---|
463 | {
|
---|
464 | // Rel. Times
|
---|
465 | TCanvas &c5 = fDisplay->AddTab("Rel. Times");
|
---|
466 | c5.Divide(2,4);
|
---|
467 |
|
---|
468 | CamDraw(c5, 1, 2, disp30, 2);
|
---|
469 | CamDraw(c5, 2, 2, disp31, 2);
|
---|
470 | }
|
---|
471 |
|
---|
472 |
|
---|
473 | return;
|
---|
474 | }
|
---|
475 |
|
---|
476 | if (fDisplayType == kNormalDisplay)
|
---|
477 | {
|
---|
478 |
|
---|
479 | // Charges
|
---|
480 | TCanvas &c11 = fDisplay->AddTab("Fit.Charge");
|
---|
481 | c11.Divide(2, 4);
|
---|
482 |
|
---|
483 | CamDraw(c11, 1, 2, disp1, 2, 1);
|
---|
484 | CamDraw(c11, 2, 2, disp2, 2, 1);
|
---|
485 |
|
---|
486 | // Reduced Sigmas
|
---|
487 | TCanvas &c12 = fDisplay->AddTab("Red.Sigma");
|
---|
488 | c12.Divide(2,4);
|
---|
489 |
|
---|
490 | CamDraw(c12, 1, 2, disp3, 2, 1);
|
---|
491 | CamDraw(c12, 2, 2, disp4, 2, 1);
|
---|
492 |
|
---|
493 | // F-Factor
|
---|
494 | TCanvas &c13 = fDisplay->AddTab("Phe's");
|
---|
495 | c13.Divide(3,4);
|
---|
496 |
|
---|
497 | CamDraw(c13, 1, 3, disp5, 2, 1);
|
---|
498 | CamDraw(c13, 2, 3, disp6, 2, 1);
|
---|
499 | CamDraw(c13, 3, 3, disp7, 2, 1);
|
---|
500 |
|
---|
501 | // QE's
|
---|
502 | TCanvas &c14 = fDisplay->AddTab("QE's");
|
---|
503 | c14.Divide(4,4);
|
---|
504 |
|
---|
505 | CamDraw(c14, 1, 4, disp8, 2, 1);
|
---|
506 | CamDraw(c14, 2, 4, disp9, 2, 1);
|
---|
507 | CamDraw(c14, 3, 4, disp10, 2, 1);
|
---|
508 | CamDraw(c14, 4, 4, disp11, 2, 1);
|
---|
509 |
|
---|
510 | // Defects
|
---|
511 | TCanvas &c15 = fDisplay->AddTab("Defect");
|
---|
512 | c15.Divide(5,2);
|
---|
513 |
|
---|
514 | CamDraw(c15, 1, 5, disp23, 0);
|
---|
515 | CamDraw(c15, 2, 5, disp24, 0);
|
---|
516 | CamDraw(c15, 3, 5, disp25, 0);
|
---|
517 | CamDraw(c15, 4, 5, disp26, 0);
|
---|
518 | CamDraw(c15, 5, 5, disp27, 0);
|
---|
519 |
|
---|
520 | // Abs. Times
|
---|
521 | TCanvas &c16 = fDisplay->AddTab("Abs. Times");
|
---|
522 | c16.Divide(2,3);
|
---|
523 |
|
---|
524 | CamDraw(c16, 1, 2, disp28, 2);
|
---|
525 | CamDraw(c16, 2, 2, disp29, 1);
|
---|
526 |
|
---|
527 | if (fRelTimes)
|
---|
528 | {
|
---|
529 | // Rel. Times
|
---|
530 | TCanvas &c17 = fDisplay->AddTab("Rel. Times");
|
---|
531 | c17.Divide(2,4);
|
---|
532 |
|
---|
533 | CamDraw(c17, 1, 2, disp30, 2, 1);
|
---|
534 | CamDraw(c17, 2, 2, disp31, 2, 1);
|
---|
535 | }
|
---|
536 |
|
---|
537 | return;
|
---|
538 | }
|
---|
539 |
|
---|
540 | if (fDisplayType == kFullDisplay)
|
---|
541 | {
|
---|
542 |
|
---|
543 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationChargeCam");
|
---|
544 |
|
---|
545 | for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++)
|
---|
546 | {
|
---|
547 | cam->GetAverageHiGainArea(aidx).DrawClone("all");
|
---|
548 | cam->GetAverageLoGainArea(aidx).DrawClone("all");
|
---|
549 | }
|
---|
550 |
|
---|
551 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
---|
552 | {
|
---|
553 | cam->GetAverageHiGainSector(sector).DrawClone("all");
|
---|
554 | cam->GetAverageLoGainSector(sector).DrawClone("all");
|
---|
555 | }
|
---|
556 |
|
---|
557 | // Charges
|
---|
558 | TCanvas &c21 = fDisplay->AddTab("Fit.Charge");
|
---|
559 | c21.Divide(2, 4);
|
---|
560 |
|
---|
561 | CamDraw(c21, 1, 2, disp1, 2, 1);
|
---|
562 | CamDraw(c21, 2, 2, disp2, 2, 1);
|
---|
563 |
|
---|
564 | // Reduced Sigmas
|
---|
565 | TCanvas &c23 = fDisplay->AddTab("Red.Sigma");
|
---|
566 | c23.Divide(2,4);
|
---|
567 |
|
---|
568 | CamDraw(c23, 1, 2, disp3, 2, 1);
|
---|
569 | CamDraw(c23, 2, 2, disp4, 2, 1);
|
---|
570 |
|
---|
571 | // F-Factor
|
---|
572 | TCanvas &c24 = fDisplay->AddTab("Phe's");
|
---|
573 | c24.Divide(3,4);
|
---|
574 |
|
---|
575 | CamDraw(c24, 1, 3, disp5, 2, 1);
|
---|
576 | CamDraw(c24, 2, 3, disp6, 2, 1);
|
---|
577 | CamDraw(c24, 3, 3, disp7, 2, 1);
|
---|
578 |
|
---|
579 | // QE's
|
---|
580 | TCanvas &c25 = fDisplay->AddTab("QE's");
|
---|
581 | c25.Divide(4,4);
|
---|
582 |
|
---|
583 | CamDraw(c25, 1, 4, disp8, 2, 1);
|
---|
584 | CamDraw(c25, 2, 4, disp9, 2, 1);
|
---|
585 | CamDraw(c25, 3, 4, disp10, 2, 1);
|
---|
586 | CamDraw(c25, 4, 4, disp11, 2, 1);
|
---|
587 |
|
---|
588 | // Validity
|
---|
589 | TCanvas &c26 = fDisplay->AddTab("Valid");
|
---|
590 | c26.Divide(4,2);
|
---|
591 |
|
---|
592 | CamDraw(c26, 1, 4, disp12, 0);
|
---|
593 | CamDraw(c26, 2, 4, disp13, 0);
|
---|
594 | CamDraw(c26, 3, 4, disp14, 0);
|
---|
595 | CamDraw(c26, 4, 4, disp15, 0);
|
---|
596 |
|
---|
597 | // Other info
|
---|
598 | TCanvas &c27 = fDisplay->AddTab("HiLoGain");
|
---|
599 | c27.Divide(3,3);
|
---|
600 |
|
---|
601 | CamDraw(c27, 1, 3, disp16, 0);
|
---|
602 | CamDraw(c27, 2, 3, disp17, 1);
|
---|
603 | CamDraw(c27, 3, 3, disp18, 1);
|
---|
604 |
|
---|
605 | // Pickup
|
---|
606 | TCanvas &c28 = fDisplay->AddTab("Pickup");
|
---|
607 | c28.Divide(4,2);
|
---|
608 |
|
---|
609 | CamDraw(c28, 1, 4, disp19, 0);
|
---|
610 | CamDraw(c28, 2, 4, disp20, 0);
|
---|
611 | CamDraw(c28, 3, 4, disp21, 0);
|
---|
612 | CamDraw(c28, 4, 4, disp22, 0);
|
---|
613 |
|
---|
614 | // Defects
|
---|
615 | TCanvas &c29 = fDisplay->AddTab("Defect");
|
---|
616 | c29.Divide(5,2);
|
---|
617 |
|
---|
618 | CamDraw(c29, 1, 5, disp23, 0);
|
---|
619 | CamDraw(c29, 2, 5, disp24, 0);
|
---|
620 | CamDraw(c29, 3, 5, disp25, 0);
|
---|
621 | CamDraw(c29, 4, 5, disp26, 0);
|
---|
622 | CamDraw(c29, 5, 5, disp27, 0);
|
---|
623 |
|
---|
624 | // Abs. Times
|
---|
625 | TCanvas &c30 = fDisplay->AddTab("Abs. Times");
|
---|
626 | c30.Divide(2,3);
|
---|
627 |
|
---|
628 | CamDraw(c30, 1, 2, disp28, 2);
|
---|
629 | CamDraw(c30, 2, 2, disp29, 1);
|
---|
630 |
|
---|
631 | if (fRelTimes)
|
---|
632 | {
|
---|
633 | // Rel. Times
|
---|
634 | TCanvas &c31 = fDisplay->AddTab("Rel. Times");
|
---|
635 | c31.Divide(3,4);
|
---|
636 |
|
---|
637 | CamDraw(c31, 1, 3, disp30, 2, 1);
|
---|
638 | CamDraw(c31, 2, 3, disp31, 2, 1);
|
---|
639 | CamDraw(c31, 3, 3, disp32, 4, 1);
|
---|
640 |
|
---|
641 | // Time Defects
|
---|
642 | TCanvas &c32 = fDisplay->AddTab("Time Def.");
|
---|
643 | c32.Divide(2,2);
|
---|
644 |
|
---|
645 | CamDraw(c32, 1, 2, disp33,0);
|
---|
646 | CamDraw(c32, 2, 2, disp34,0);
|
---|
647 |
|
---|
648 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationRelTimeCam");
|
---|
649 |
|
---|
650 | for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++)
|
---|
651 | {
|
---|
652 | cam->GetAverageHiGainArea(aidx).DrawClone("fourierevents");
|
---|
653 | cam->GetAverageLoGainArea(aidx).DrawClone("fourierevents");
|
---|
654 | }
|
---|
655 |
|
---|
656 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
---|
657 | {
|
---|
658 | cam->GetAverageHiGainSector(sector).DrawClone("fourierevents");
|
---|
659 | cam->GetAverageLoGainSector(sector).DrawClone("fourierevents");
|
---|
660 | }
|
---|
661 |
|
---|
662 | }
|
---|
663 |
|
---|
664 | return;
|
---|
665 | }
|
---|
666 | }
|
---|
667 |
|
---|
668 | // --------------------------------------------------------------------------
|
---|
669 | //
|
---|
670 | // Draw a projection of MHCamera onto the y-axis values. Depending on the
|
---|
671 | // variable fit, the following fits are performed:
|
---|
672 | //
|
---|
673 | // 1: Single Gauss (for distributions flat-fielded over the whole camera)
|
---|
674 | // 2: Double Gauss (for distributions different for inner and outer pixels)
|
---|
675 | // 3: Triple Gauss (for distributions with inner, outer pixels and outliers)
|
---|
676 | // 4: flat (for the probability distributions)
|
---|
677 | //
|
---|
678 | // Moreover, sectors 6,1 and 2 of the camera and sectors 3,4 and 5 are
|
---|
679 | // drawn separately, for inner and outer pixels.
|
---|
680 | //
|
---|
681 | void MJCalibration::DrawProjection(MHCamera *obj, Int_t fit) const
|
---|
682 | {
|
---|
683 |
|
---|
684 | TH1D *obj2 = (TH1D*)obj->Projection(obj->GetName());
|
---|
685 | obj2->SetDirectory(0);
|
---|
686 | obj2->Draw();
|
---|
687 | obj2->SetBit(kCanDelete);
|
---|
688 |
|
---|
689 | if (obj->GetGeomCam().InheritsFrom("MGeomCamMagic"))
|
---|
690 | {
|
---|
691 | TArrayI s0(3);
|
---|
692 | s0[0] = 6;
|
---|
693 | s0[1] = 1;
|
---|
694 | s0[2] = 2;
|
---|
695 |
|
---|
696 | TArrayI s1(3);
|
---|
697 | s1[0] = 3;
|
---|
698 | s1[1] = 4;
|
---|
699 | s1[2] = 5;
|
---|
700 |
|
---|
701 | TArrayI inner(1);
|
---|
702 | inner[0] = 0;
|
---|
703 |
|
---|
704 | TArrayI outer(1);
|
---|
705 | outer[0] = 1;
|
---|
706 |
|
---|
707 | // Just to get the right (maximum) binning
|
---|
708 | TH1D *half[4];
|
---|
709 | half[0] = obj->ProjectionS(s0, inner, "Sector 6-1-2 Inner");
|
---|
710 | half[1] = obj->ProjectionS(s1, inner, "Sector 3-4-5 Inner");
|
---|
711 | half[2] = obj->ProjectionS(s0, outer, "Sector 6-1-2 Outer");
|
---|
712 | half[3] = obj->ProjectionS(s1, outer, "Sector 3-4-5 Outer");
|
---|
713 |
|
---|
714 | for (int i=0; i<4; i++)
|
---|
715 | {
|
---|
716 | half[i]->SetLineColor(kRed+i);
|
---|
717 | half[i]->SetDirectory(0);
|
---|
718 | half[i]->SetBit(kCanDelete);
|
---|
719 | half[i]->Draw("same");
|
---|
720 | }
|
---|
721 | }
|
---|
722 |
|
---|
723 | const Double_t min = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
|
---|
724 | const Double_t max = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());
|
---|
725 | const Double_t integ = obj2->Integral("width")/2.5;
|
---|
726 | const Double_t mean = obj2->GetMean();
|
---|
727 | const Double_t rms = obj2->GetRMS();
|
---|
728 | const Double_t width = max-min;
|
---|
729 |
|
---|
730 | const TString dgausformula = "([0]-[3])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"
|
---|
731 | "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])";
|
---|
732 |
|
---|
733 | const TString tgausformula = "([0]-[3]-[6])/[2]*exp(-0.5*(x-[1])*(x-[1])/[2]/[2])"
|
---|
734 | "+[3]/[5]*exp(-0.5*(x-[4])*(x-[4])/[5]/[5])"
|
---|
735 | "+[6]/[8]*exp(-0.5*(x-[7])*(x-[7])/[8]/[8])";
|
---|
736 | TF1 *f=0;
|
---|
737 | switch (fit)
|
---|
738 | {
|
---|
739 | case 1:
|
---|
740 | f = new TF1("sgaus", "gaus(0)", min, max);
|
---|
741 | f->SetLineColor(kYellow);
|
---|
742 | f->SetBit(kCanDelete);
|
---|
743 | f->SetParNames("Area", "#mu", "#sigma");
|
---|
744 | f->SetParameters(integ/rms, mean, rms);
|
---|
745 | f->SetParLimits(0, 0, integ);
|
---|
746 | f->SetParLimits(1, min, max);
|
---|
747 | f->SetParLimits(2, 0, width/1.5);
|
---|
748 |
|
---|
749 | obj2->Fit(f, "QLR");
|
---|
750 | break;
|
---|
751 |
|
---|
752 | case 2:
|
---|
753 | f = new TF1("dgaus",dgausformula.Data(),min,max);
|
---|
754 | f->SetLineColor(kYellow);
|
---|
755 | f->SetBit(kCanDelete);
|
---|
756 | f->SetParNames("A_{tot}", "#mu1", "#sigma1", "A2", "#mu2", "#sigma2");
|
---|
757 | f->SetParameters(integ,(min+mean)/2.,width/4.,
|
---|
758 | integ/width/2.,(max+mean)/2.,width/4.);
|
---|
759 | // The left-sided Gauss
|
---|
760 | f->SetParLimits(0,integ-1.5 , integ+1.5);
|
---|
761 | f->SetParLimits(1,min+(width/10.), mean);
|
---|
762 | f->SetParLimits(2,0 , width/2.);
|
---|
763 | // The right-sided Gauss
|
---|
764 | f->SetParLimits(3,0 , integ);
|
---|
765 | f->SetParLimits(4,mean, max-(width/10.));
|
---|
766 | f->SetParLimits(5,0 , width/2.);
|
---|
767 | obj2->Fit(f,"QLRM");
|
---|
768 | break;
|
---|
769 |
|
---|
770 | case 3:
|
---|
771 | f = new TF1("tgaus",tgausformula.Data(),min,max);
|
---|
772 | f->SetLineColor(kYellow);
|
---|
773 | f->SetBit(kCanDelete);
|
---|
774 | f->SetParNames("A_{tot}","#mu_{1}","#sigma_{1}",
|
---|
775 | "A_{2}","#mu_{2}","#sigma_{2}",
|
---|
776 | "A_{3}","#mu_{3}","#sigma_{3}");
|
---|
777 | f->SetParameters(integ,(min+mean)/2,width/4.,
|
---|
778 | integ/width/3.,(max+mean)/2.,width/4.,
|
---|
779 | integ/width/3.,mean,width/2.);
|
---|
780 | // The left-sided Gauss
|
---|
781 | f->SetParLimits(0,integ-1.5,integ+1.5);
|
---|
782 | f->SetParLimits(1,min+(width/10.),mean);
|
---|
783 | f->SetParLimits(2,width/15.,width/2.);
|
---|
784 | // The right-sided Gauss
|
---|
785 | f->SetParLimits(3,0.,integ);
|
---|
786 | f->SetParLimits(4,mean,max-(width/10.));
|
---|
787 | f->SetParLimits(5,width/15.,width/2.);
|
---|
788 | // The Gauss describing the outliers
|
---|
789 | f->SetParLimits(6,0.,integ);
|
---|
790 | f->SetParLimits(7,min,max);
|
---|
791 | f->SetParLimits(8,width/4.,width/1.5);
|
---|
792 | obj2->Fit(f,"QLRM");
|
---|
793 | break;
|
---|
794 |
|
---|
795 | case 4:
|
---|
796 | obj2->Fit("pol0", "Q");
|
---|
797 | obj2->GetFunction("pol0")->SetLineColor(kYellow);
|
---|
798 | break;
|
---|
799 |
|
---|
800 | case 9:
|
---|
801 | break;
|
---|
802 |
|
---|
803 | default:
|
---|
804 | obj2->Fit("gaus", "Q");
|
---|
805 | obj2->GetFunction("gaus")->SetLineColor(kYellow);
|
---|
806 | break;
|
---|
807 | }
|
---|
808 | }
|
---|
809 |
|
---|
810 | // --------------------------------------------------------------------------
|
---|
811 | //
|
---|
812 | // Draw a projection of MHCamera vs. the radius from the central pixel.
|
---|
813 | //
|
---|
814 | // The inner and outer pixels are drawn separately, both fitted by a polynomial
|
---|
815 | // of grade 1.
|
---|
816 | //
|
---|
817 | void MJCalibration::DrawRadialProfile(MHCamera *obj) const
|
---|
818 | {
|
---|
819 |
|
---|
820 | TProfile *obj2 = (TProfile*)obj->RadialProfile(obj->GetName());
|
---|
821 | obj2->SetDirectory(0);
|
---|
822 | obj2->Draw();
|
---|
823 | obj2->SetBit(kCanDelete);
|
---|
824 |
|
---|
825 | if (obj->GetGeomCam().InheritsFrom("MGeomCamMagic"))
|
---|
826 | {
|
---|
827 |
|
---|
828 | TArrayI s0(6);
|
---|
829 | s0[0] = 1;
|
---|
830 | s0[1] = 2;
|
---|
831 | s0[2] = 3;
|
---|
832 | s0[3] = 4;
|
---|
833 | s0[4] = 5;
|
---|
834 | s0[5] = 6;
|
---|
835 |
|
---|
836 | TArrayI inner(1);
|
---|
837 | inner[0] = 0;
|
---|
838 |
|
---|
839 | TArrayI outer(1);
|
---|
840 | outer[0] = 1;
|
---|
841 |
|
---|
842 | // Just to get the right (maximum) binning
|
---|
843 | TProfile *half[2];
|
---|
844 | half[0] = obj->RadialProfileS(s0, inner,Form("%s%s",obj->GetName(),"Inner"));
|
---|
845 | half[1] = obj->RadialProfileS(s0, outer,Form("%s%s",obj->GetName(),"Outer"));
|
---|
846 |
|
---|
847 | for (Int_t i=0; i<2; i++)
|
---|
848 | {
|
---|
849 | Double_t min = obj->GetGeomCam().GetMinRadius(i);
|
---|
850 | Double_t max = obj->GetGeomCam().GetMaxRadius(i);
|
---|
851 |
|
---|
852 | half[i]->SetLineColor(kRed+i);
|
---|
853 | half[i]->SetDirectory(0);
|
---|
854 | half[i]->SetBit(kCanDelete);
|
---|
855 | half[i]->Draw("same");
|
---|
856 | half[i]->Fit("pol1","Q","",min,max);
|
---|
857 | half[i]->GetFunction("pol1")->SetLineColor(kRed+i);
|
---|
858 | half[i]->GetFunction("pol1")->SetLineWidth(1);
|
---|
859 | }
|
---|
860 | }
|
---|
861 | }
|
---|
862 |
|
---|
863 |
|
---|
864 | // --------------------------------------------------------------------------
|
---|
865 | //
|
---|
866 | // Find the colour of the pulsing LED:
|
---|
867 | // - If the run number is smaller than gkIFAEBoxInaugurationRun, take MCalibrationCam::kCT1
|
---|
868 | // - Otherwise find the colour out of the run name
|
---|
869 | // - If no colour is found, return kFALSE
|
---|
870 | //
|
---|
871 | Bool_t MJCalibration::FindColor()
|
---|
872 | {
|
---|
873 |
|
---|
874 | const UInt_t nruns = fRuns->GetNumRuns();
|
---|
875 |
|
---|
876 | if (nruns == 0)
|
---|
877 | return kFALSE;
|
---|
878 |
|
---|
879 | TArrayI arr = fRuns->GetRuns();
|
---|
880 |
|
---|
881 | if (arr[nruns-1] < gkIFAEBoxInaugurationRun)
|
---|
882 | {
|
---|
883 | *fLog << "Found colour kCT1 in runs: " << fRuns->GetRunsAsString() << endl;
|
---|
884 | fColor = MCalibrationCam::kCT1;
|
---|
885 | return kTRUE;
|
---|
886 | }
|
---|
887 |
|
---|
888 | TString filenames;
|
---|
889 |
|
---|
890 | while (!(filenames=((MDirIter*)fRuns)->Next()).IsNull())
|
---|
891 | {
|
---|
892 |
|
---|
893 | filenames.ToLower();
|
---|
894 |
|
---|
895 | if (filenames.Contains("green"))
|
---|
896 | if (fColor == MCalibrationCam::kNONE)
|
---|
897 | {
|
---|
898 | *fLog << "Found colour: kGREEN in " << filenames << endl;
|
---|
899 | fColor = MCalibrationCam::kGREEN;
|
---|
900 | }
|
---|
901 | else if (fColor != MCalibrationCam::kGREEN)
|
---|
902 | {
|
---|
903 | *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
|
---|
904 | return kFALSE;
|
---|
905 | }
|
---|
906 |
|
---|
907 | if (filenames.Contains("blue"))
|
---|
908 | if (fColor == MCalibrationCam::kNONE)
|
---|
909 | {
|
---|
910 | *fLog << "Found colour: kBLUE in " << filenames << endl;
|
---|
911 | fColor = MCalibrationCam::kBLUE;
|
---|
912 | }
|
---|
913 | else if (fColor != MCalibrationCam::kBLUE)
|
---|
914 | {
|
---|
915 | *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
|
---|
916 | return kFALSE;
|
---|
917 | }
|
---|
918 |
|
---|
919 | if (filenames.Contains("uv"))
|
---|
920 | if (fColor == MCalibrationCam::kNONE)
|
---|
921 | {
|
---|
922 | *fLog << "Found colour: kUV in " << filenames << endl;
|
---|
923 | fColor = MCalibrationCam::kUV;
|
---|
924 | }
|
---|
925 | else if (fColor != MCalibrationCam::kUV)
|
---|
926 | {
|
---|
927 | *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
|
---|
928 | return kFALSE;
|
---|
929 | }
|
---|
930 |
|
---|
931 | if (filenames.Contains("ct1"))
|
---|
932 | if (fColor == MCalibrationCam::kNONE)
|
---|
933 | {
|
---|
934 | *fLog << "Found colour: kCT1 in " << filenames << endl;
|
---|
935 | fColor = MCalibrationCam::kCT1;
|
---|
936 | }
|
---|
937 | else if (fColor != MCalibrationCam::kCT1)
|
---|
938 | {
|
---|
939 | *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
|
---|
940 | return kFALSE;
|
---|
941 | }
|
---|
942 |
|
---|
943 | }
|
---|
944 |
|
---|
945 | if (fColor == MCalibrationCam::kNONE)
|
---|
946 | {
|
---|
947 | *fLog << "No colour found in filenames of runs: " << fRuns->GetRunsAsString()
|
---|
948 | << "... abort" << endl;
|
---|
949 | return kFALSE;
|
---|
950 | }
|
---|
951 |
|
---|
952 | return kTRUE;
|
---|
953 | }
|
---|
954 |
|
---|
955 |
|
---|
956 |
|
---|
957 |
|
---|
958 | // --------------------------------------------------------------------------
|
---|
959 | //
|
---|
960 | // Retrieve the output file written by WriteResult()
|
---|
961 | //
|
---|
962 | TString MJCalibration::GetOutputFile() const
|
---|
963 | {
|
---|
964 | if (!fRuns)
|
---|
965 | return "";
|
---|
966 |
|
---|
967 | return Form("%s/%s-F1.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName());
|
---|
968 | }
|
---|
969 |
|
---|
970 |
|
---|
971 | // --------------------------------------------------------------------------
|
---|
972 | //
|
---|
973 | // Call the ProcessFile(MPedestalCam)
|
---|
974 | //
|
---|
975 | Bool_t MJCalibration::Process(MPedestalCam &pedcam)
|
---|
976 | {
|
---|
977 | if (!ReadCalibrationCam())
|
---|
978 | return ProcessFile(pedcam);
|
---|
979 |
|
---|
980 | return kTRUE;
|
---|
981 | }
|
---|
982 |
|
---|
983 | // --------------------------------------------------------------------------
|
---|
984 | //
|
---|
985 | // Execute the task list and the eventloop:
|
---|
986 | //
|
---|
987 | // - Check if there are fRuns, otherwise return
|
---|
988 | // - Check the colour of the files in fRuns (FindColor()), otherwise return
|
---|
989 | // - Check for consistency between run numbers and number of files
|
---|
990 | // - Add fRuns to MReadMarsFile
|
---|
991 | // - Put into MParList:
|
---|
992 | // 1) MPedestalCam (pedcam)
|
---|
993 | // 2) MCalibrationQECam (fQECam)
|
---|
994 | // 3) MCalibrationChargeCam (fCalibrationCam)
|
---|
995 | // 4) MCalibrationRelTimeCam (fRelTimeCam) (only if flag fRelTimes is chosen)
|
---|
996 | // 5) MBadPixelsCam (fBadPixels)
|
---|
997 | // 6) MCalibrationChargePINDiode
|
---|
998 | // 7) MCalibrationChargeBlindPix
|
---|
999 | // - Put into the MTaskList:
|
---|
1000 | // 1) MReadMarsFile
|
---|
1001 | // 2) MBadPixelsMerge
|
---|
1002 | // 3) MGeomApply
|
---|
1003 | // 4) MExtractSignal, MExtractSignal2 or MExtractSignal3, depending on fExtractorLevel
|
---|
1004 | // 5) MExtractPINDiode
|
---|
1005 | // 6) MExtractBlindPixel
|
---|
1006 | // 7) MArrivalTimeCalc, MArrivalTimeCalc2, depending on fArrivalTimeLevel (only if flag fRelTimes is chosen)
|
---|
1007 | // 8) MContinue(MFCosmics)
|
---|
1008 | // 9) MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode")
|
---|
1009 | // 10) MFillH("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel")
|
---|
1010 | // 11) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam")
|
---|
1011 | // 12) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam")
|
---|
1012 | // 13) MCalibrationChargeCalc
|
---|
1013 | // 14) MFillH("MHCalibrationRelTimeCam", "MArrivalTimeCam") (only if flag fRelTimes is chosen)
|
---|
1014 | // - Execute MEvtLoop
|
---|
1015 | // - DisplayResult()
|
---|
1016 | // - WriteResult()
|
---|
1017 | //
|
---|
1018 | Bool_t MJCalibration::ProcessFile(MPedestalCam &pedcam)
|
---|
1019 | {
|
---|
1020 | if (!fRuns)
|
---|
1021 | {
|
---|
1022 | *fLog << err << "No Runs choosen... abort." << endl;
|
---|
1023 | return kFALSE;
|
---|
1024 | }
|
---|
1025 |
|
---|
1026 | if (fRuns->GetNumRuns() != fRuns->GetNumEntries())
|
---|
1027 | {
|
---|
1028 | *fLog << err << "Number of files found doesn't match number of runs... abort."
|
---|
1029 | << fRuns->GetNumRuns() << " vs. " << fRuns->GetNumEntries() << endl;
|
---|
1030 | return kFALSE;
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | *fLog << inf;
|
---|
1034 | fLog->Separator(GetDescriptor());
|
---|
1035 |
|
---|
1036 | if (!FindColor())
|
---|
1037 | return kFALSE;
|
---|
1038 |
|
---|
1039 | *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl;
|
---|
1040 | *fLog << endl;
|
---|
1041 |
|
---|
1042 | // Setup Tasklist
|
---|
1043 | MParList plist;
|
---|
1044 | MTaskList tlist;
|
---|
1045 | plist.AddToList(&tlist);
|
---|
1046 |
|
---|
1047 | MReadMarsFile read("Events");
|
---|
1048 | MRawFileRead rawread("");
|
---|
1049 |
|
---|
1050 | if (fDataCheck)
|
---|
1051 | {
|
---|
1052 | // rawread.AddFiles(*fRuns);
|
---|
1053 | tlist.AddToList(&rawread);
|
---|
1054 | }
|
---|
1055 | else
|
---|
1056 | {
|
---|
1057 | read.DisableAutoScheme();
|
---|
1058 | static_cast<MRead&>(read).AddFiles(*fRuns);
|
---|
1059 | tlist.AddToList(&read);
|
---|
1060 | }
|
---|
1061 |
|
---|
1062 |
|
---|
1063 | MCalibrationChargePINDiode pindiode;
|
---|
1064 | MCalibrationChargeBlindPix blindpix;
|
---|
1065 |
|
---|
1066 | plist.AddToList(&pedcam);
|
---|
1067 | plist.AddToList(&fBadPixels);
|
---|
1068 | plist.AddToList(&fQECam);
|
---|
1069 | plist.AddToList(&fCalibrationCam);
|
---|
1070 | plist.AddToList(&pindiode);
|
---|
1071 | plist.AddToList(&blindpix);
|
---|
1072 |
|
---|
1073 | MGeomApply apply;
|
---|
1074 | // MBadPixelsMerge merge(&fBadPixels);
|
---|
1075 | MExtractPINDiode pinext;
|
---|
1076 | MExtractBlindPixel blindext;
|
---|
1077 | MExtractSignal extract1;
|
---|
1078 | MExtractSignal2 extract2;
|
---|
1079 | MExtractSignal3 extract3;
|
---|
1080 | MArrivalTimeCalc tmecalc1;
|
---|
1081 | MArrivalTimeCalc2 tmecalc2;
|
---|
1082 | MCalibrationChargeCalc calcalc;
|
---|
1083 |
|
---|
1084 | //
|
---|
1085 | // As long as there are no DM's, have to colour by hand
|
---|
1086 | //
|
---|
1087 | calcalc.SetPulserColor(fColor);
|
---|
1088 |
|
---|
1089 | MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
|
---|
1090 | MFillH fillbnd("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel");
|
---|
1091 | MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam");
|
---|
1092 | MFillH filltme("MHCalibrationRelTimeCam", "MArrivalTimeCam");
|
---|
1093 | fillpin.SetNameTab("PINDiode");
|
---|
1094 | fillbnd.SetNameTab("BlindPix");
|
---|
1095 | fillcam.SetNameTab("Charge");
|
---|
1096 | filltme.SetNameTab("RelTimes");
|
---|
1097 |
|
---|
1098 |
|
---|
1099 | //
|
---|
1100 | // Apply a filter against cosmics
|
---|
1101 | // (will have to be needed in the future
|
---|
1102 | // when the calibration hardware-trigger is working)
|
---|
1103 | //
|
---|
1104 | MFCosmics cosmics;
|
---|
1105 | MContinue cont(&cosmics);
|
---|
1106 |
|
---|
1107 | // tlist.AddToList(&merge);
|
---|
1108 | tlist.AddToList(&apply);
|
---|
1109 |
|
---|
1110 | if (fExtractorLevel <= 1)
|
---|
1111 | tlist.AddToList(&extract1);
|
---|
1112 | else if (fExtractorLevel == 2)
|
---|
1113 | tlist.AddToList(&extract2);
|
---|
1114 | else if (fExtractorLevel == 3)
|
---|
1115 | tlist.AddToList(&extract3);
|
---|
1116 | else
|
---|
1117 | {
|
---|
1118 | *fLog << err << GetDescriptor()
|
---|
1119 | << ": No valid Signal extractor has been chosen, have only: " << fExtractorLevel
|
---|
1120 | << " aborting..." << endl;
|
---|
1121 | return kFALSE;
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 |
|
---|
1125 | tlist.AddToList(&pinext);
|
---|
1126 | tlist.AddToList(&blindext);
|
---|
1127 |
|
---|
1128 | if (fRelTimes)
|
---|
1129 | {
|
---|
1130 | plist.AddToList(&fRelTimeCam);
|
---|
1131 | if (fArrivalTimeLevel <= 1)
|
---|
1132 | tlist.AddToList(&tmecalc1);
|
---|
1133 | else if (fArrivalTimeLevel == 2)
|
---|
1134 | tlist.AddToList(&tmecalc2);
|
---|
1135 | else
|
---|
1136 | {
|
---|
1137 | *fLog << err << GetDescriptor()
|
---|
1138 | << ": No valid Signal ArrivalTime Level has been chosen, have only: " << fArrivalTimeLevel
|
---|
1139 | << " aborting..." << endl;
|
---|
1140 | return kFALSE;
|
---|
1141 | }
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 | tlist.AddToList(&cont);
|
---|
1145 | tlist.AddToList(&fillcam);
|
---|
1146 | tlist.AddToList(&fillpin);
|
---|
1147 | tlist.AddToList(&fillbnd);
|
---|
1148 | tlist.AddToList(&calcalc);
|
---|
1149 |
|
---|
1150 | if (fRelTimes)
|
---|
1151 | tlist.AddToList(&filltme);
|
---|
1152 |
|
---|
1153 | // Create and setup the eventloop
|
---|
1154 | MEvtLoop evtloop(fName);
|
---|
1155 | evtloop.SetParList(&plist);
|
---|
1156 | evtloop.SetDisplay(fDisplay);
|
---|
1157 | evtloop.SetLogStream(fLog);
|
---|
1158 |
|
---|
1159 | // Execute first analysis
|
---|
1160 | if (!evtloop.Eventloop())
|
---|
1161 | {
|
---|
1162 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
---|
1163 | return kFALSE;
|
---|
1164 | }
|
---|
1165 |
|
---|
1166 | tlist.PrintStatistics();
|
---|
1167 |
|
---|
1168 | DisplayResult(plist);
|
---|
1169 |
|
---|
1170 | if (!WriteResult())
|
---|
1171 | return kFALSE;
|
---|
1172 |
|
---|
1173 | *fLog << inf << GetDescriptor() << ": Done." << endl;
|
---|
1174 |
|
---|
1175 | return kTRUE;
|
---|
1176 | }
|
---|
1177 |
|
---|
1178 | // --------------------------------------------------------------------------
|
---|
1179 | //
|
---|
1180 | // Read the following containers from GetOutputFile()
|
---|
1181 | // - MCalibrationChargeCam
|
---|
1182 | // - MCalibrationQECam
|
---|
1183 | // - MBadPixelsCam
|
---|
1184 | //
|
---|
1185 | Bool_t MJCalibration::ReadCalibrationCam()
|
---|
1186 | {
|
---|
1187 | const TString fname = GetOutputFile();
|
---|
1188 |
|
---|
1189 | if (gSystem->AccessPathName(fname, kFileExists))
|
---|
1190 | {
|
---|
1191 | *fLog << err << "Input file " << fname << " doesn't exist." << endl;
|
---|
1192 | return kFALSE;
|
---|
1193 | }
|
---|
1194 |
|
---|
1195 | *fLog << inf << "Reading from file: " << fname << endl;
|
---|
1196 |
|
---|
1197 | TFile file(fname, "READ");
|
---|
1198 | if (fCalibrationCam.Read()<=0)
|
---|
1199 | {
|
---|
1200 | *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
|
---|
1201 | return kFALSE;
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | if (fQECam.Read()<=0)
|
---|
1205 | {
|
---|
1206 | *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
|
---|
1207 | return kFALSE;
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 | if (file.FindKey("MBadPixelsCam"))
|
---|
1211 | {
|
---|
1212 | MBadPixelsCam bad;
|
---|
1213 | if (bad.Read()<=0)
|
---|
1214 | {
|
---|
1215 | *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
|
---|
1216 | return kFALSE;
|
---|
1217 | }
|
---|
1218 | fBadPixels.Merge(bad);
|
---|
1219 | }
|
---|
1220 |
|
---|
1221 | if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
|
---|
1222 | fDisplay->Read();
|
---|
1223 |
|
---|
1224 | return kTRUE;
|
---|
1225 | }
|
---|
1226 |
|
---|
1227 |
|
---|
1228 | // --------------------------------------------------------------------------
|
---|
1229 | //
|
---|
1230 | // Set the path for output files, written by WriteResult()
|
---|
1231 | //
|
---|
1232 | void MJCalibration::SetOutputPath(const char *path)
|
---|
1233 | {
|
---|
1234 | fOutputPath = path;
|
---|
1235 | if (fOutputPath.EndsWith("/"))
|
---|
1236 | fOutputPath = fOutputPath(0, fOutputPath.Length()-1);
|
---|
1237 | }
|
---|
1238 |
|
---|
1239 |
|
---|
1240 | // --------------------------------------------------------------------------
|
---|
1241 | //
|
---|
1242 | // Write the result into the output file GetOutputFile(), if fOutputPath exists.
|
---|
1243 | //
|
---|
1244 | // The following containers are written:
|
---|
1245 | // - MStatusDisplay
|
---|
1246 | // - MCalibrationChargeCam
|
---|
1247 | // - MCalibrationQECam
|
---|
1248 | // - MBadPixelsCam
|
---|
1249 | //
|
---|
1250 | Bool_t MJCalibration::WriteResult()
|
---|
1251 | {
|
---|
1252 | if (fOutputPath.IsNull())
|
---|
1253 | return kTRUE;
|
---|
1254 |
|
---|
1255 | const TString oname(GetOutputFile());
|
---|
1256 |
|
---|
1257 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
1258 |
|
---|
1259 | TFile file(oname, "UPDATE");
|
---|
1260 |
|
---|
1261 | if (fDisplay && fDisplay->Write()<=0)
|
---|
1262 | {
|
---|
1263 | *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
|
---|
1264 | return kFALSE;
|
---|
1265 | }
|
---|
1266 |
|
---|
1267 | if (fCalibrationCam.Write()<=0)
|
---|
1268 | {
|
---|
1269 | *fLog << err << "Unable to write MCalibrationChargeCam to " << oname << endl;
|
---|
1270 | return kFALSE;
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | if (fQECam.Write()<=0)
|
---|
1274 | {
|
---|
1275 | *fLog << err << "Unable to write MCalibrationQECam to " << oname << endl;
|
---|
1276 | return kFALSE;
|
---|
1277 | }
|
---|
1278 |
|
---|
1279 | if (fBadPixels.Write()<=0)
|
---|
1280 | {
|
---|
1281 | *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl;
|
---|
1282 | return kFALSE;
|
---|
1283 | }
|
---|
1284 |
|
---|
1285 | return kTRUE;
|
---|
1286 |
|
---|
1287 | }
|
---|
1288 |
|
---|