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