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(2,2);
|
---|
445 |
|
---|
446 | disp24.CamDraw(c4, 1, 2, 0);
|
---|
447 | disp25.CamDraw(c4, 2, 2, 0);
|
---|
448 |
|
---|
449 | if (fRelTimes)
|
---|
450 | {
|
---|
451 | // Rel. Times
|
---|
452 | TCanvas &c5 = fDisplay->AddTab("Rel. Times");
|
---|
453 | c5.Divide(2,4);
|
---|
454 |
|
---|
455 | disp30.CamDraw(c5, 1, 2, 2);
|
---|
456 | disp31.CamDraw(c5, 2, 2, 2);
|
---|
457 | }
|
---|
458 |
|
---|
459 |
|
---|
460 | return;
|
---|
461 | }
|
---|
462 |
|
---|
463 | if (fDisplayType == kNormalDisplay)
|
---|
464 | {
|
---|
465 |
|
---|
466 | // Charges
|
---|
467 | TCanvas &c11 = fDisplay->AddTab("Fit.Charge");
|
---|
468 | c11.Divide(2, 4);
|
---|
469 |
|
---|
470 | disp1.CamDraw(c11, 1, 2, 5, 1);
|
---|
471 | disp2.CamDraw(c11, 2, 2, 5, 1);
|
---|
472 |
|
---|
473 | // Reduced Sigmas
|
---|
474 | TCanvas &c12 = fDisplay->AddTab("Red.Sigma");
|
---|
475 | c12.Divide(2,4);
|
---|
476 |
|
---|
477 | disp3.CamDraw(c12, 1, 2, 5, 1);
|
---|
478 | disp4.CamDraw(c12, 2, 2, 5, 1);
|
---|
479 |
|
---|
480 | // F-Factor
|
---|
481 | TCanvas &c13 = fDisplay->AddTab("Phe's");
|
---|
482 | c13.Divide(3,4);
|
---|
483 |
|
---|
484 | disp5.CamDraw(c13, 1, 3, 5, 1);
|
---|
485 | disp6.CamDraw(c13, 2, 3, 5, 1);
|
---|
486 | disp7.CamDraw(c13, 3, 3, 5, 1);
|
---|
487 |
|
---|
488 | // QE's
|
---|
489 | TCanvas &c14 = fDisplay->AddTab("QE's");
|
---|
490 | c14.Divide(4,4);
|
---|
491 |
|
---|
492 | disp8.CamDraw(c14, 1, 4, 5, 1);
|
---|
493 | disp9.CamDraw(c14, 2, 4, 5, 1);
|
---|
494 | disp10.CamDraw(c14, 3, 4, 5, 1);
|
---|
495 | disp11.CamDraw(c14, 4, 4, 5, 1);
|
---|
496 |
|
---|
497 | // Defects
|
---|
498 | TCanvas &c15 = fDisplay->AddTab("Defect");
|
---|
499 | // c15.Divide(5,2);
|
---|
500 | c15.Divide(4,2);
|
---|
501 |
|
---|
502 | /*
|
---|
503 | disp23.CamDraw(c15, 1, 5, 0);
|
---|
504 | disp24.CamDraw(c15, 2, 5, 0);
|
---|
505 | disp25.CamDraw(c15, 3, 5, 0);
|
---|
506 | disp26.CamDraw(c15, 4, 5, 0);
|
---|
507 | disp27.CamDraw(c15, 5, 5, 0);
|
---|
508 | */
|
---|
509 | disp24.CamDraw(c15, 1, 4, 0);
|
---|
510 | disp25.CamDraw(c15, 2, 4, 0);
|
---|
511 | disp26.CamDraw(c15, 3, 4, 0);
|
---|
512 | disp27.CamDraw(c15, 4, 4, 0);
|
---|
513 |
|
---|
514 | // Abs. Times
|
---|
515 | TCanvas &c16 = fDisplay->AddTab("Abs. Times");
|
---|
516 | c16.Divide(2,3);
|
---|
517 |
|
---|
518 | disp28.CamDraw(c16, 1, 2, 5);
|
---|
519 | disp29.CamDraw(c16, 2, 2, 5);
|
---|
520 |
|
---|
521 | if (fRelTimes)
|
---|
522 | {
|
---|
523 | // Rel. Times
|
---|
524 | TCanvas &c17 = fDisplay->AddTab("Rel. Times");
|
---|
525 | c17.Divide(2,4);
|
---|
526 |
|
---|
527 | disp30.CamDraw(c17, 1, 2, 5, 1);
|
---|
528 | disp31.CamDraw(c17, 2, 2, 5, 1);
|
---|
529 | }
|
---|
530 |
|
---|
531 | return;
|
---|
532 | }
|
---|
533 |
|
---|
534 | if (fDisplayType == kFullDisplay)
|
---|
535 | {
|
---|
536 |
|
---|
537 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationChargeCam");
|
---|
538 |
|
---|
539 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
---|
540 | {
|
---|
541 | cam->GetAverageHiGainSector(sector).DrawClone("all");
|
---|
542 | cam->GetAverageLoGainSector(sector).DrawClone("all");
|
---|
543 | }
|
---|
544 |
|
---|
545 | // Charges
|
---|
546 | TCanvas &c21 = fDisplay->AddTab("Fit.Charge");
|
---|
547 | c21.Divide(2, 4);
|
---|
548 |
|
---|
549 | disp1.CamDraw(c21, 1, 2, 2, 1);
|
---|
550 | disp2.CamDraw(c21, 2, 2, 2, 1);
|
---|
551 |
|
---|
552 | // Reduced Sigmas
|
---|
553 | TCanvas &c23 = fDisplay->AddTab("Red.Sigma");
|
---|
554 | c23.Divide(2,4);
|
---|
555 |
|
---|
556 | disp3.CamDraw(c23, 1, 2, 2, 1);
|
---|
557 | disp4.CamDraw(c23, 2, 2, 2, 1);
|
---|
558 |
|
---|
559 | // F-Factor
|
---|
560 | TCanvas &c24 = fDisplay->AddTab("Phe's");
|
---|
561 | c24.Divide(3,5);
|
---|
562 |
|
---|
563 | disp5.CamDraw(c24, 1, 3, 2, 1, 1);
|
---|
564 | disp6.CamDraw(c24, 2, 3, 2, 1, 1);
|
---|
565 | disp7.CamDraw(c24, 3, 3, 2, 1, 1);
|
---|
566 |
|
---|
567 | // QE's
|
---|
568 | TCanvas &c25 = fDisplay->AddTab("QE's");
|
---|
569 | c25.Divide(4,5);
|
---|
570 |
|
---|
571 | disp8.CamDraw(c25, 1, 4, 2, 1, 1);
|
---|
572 | disp9.CamDraw(c25, 2, 4, 2, 1, 1);
|
---|
573 | disp10.CamDraw(c25, 3, 4, 2, 1, 1);
|
---|
574 | disp11.CamDraw(c25, 4, 4, 2, 1, 1);
|
---|
575 |
|
---|
576 | // Validity
|
---|
577 | TCanvas &c26 = fDisplay->AddTab("Valid");
|
---|
578 | c26.Divide(4,2);
|
---|
579 |
|
---|
580 | disp12.CamDraw(c26, 1, 4, 0);
|
---|
581 | disp13.CamDraw(c26, 2, 4, 0);
|
---|
582 | disp14.CamDraw(c26, 3, 4, 0);
|
---|
583 | disp15.CamDraw(c26, 4, 4, 0);
|
---|
584 |
|
---|
585 | // Other info
|
---|
586 | TCanvas &c27 = fDisplay->AddTab("HiLoGain");
|
---|
587 | c27.Divide(3,3);
|
---|
588 |
|
---|
589 | disp16.CamDraw(c27, 1, 3, 0);
|
---|
590 | disp17.CamDraw(c27, 2, 3, 1);
|
---|
591 | disp18.CamDraw(c27, 3, 3, 1);
|
---|
592 |
|
---|
593 | // Pickup
|
---|
594 | TCanvas &c28 = fDisplay->AddTab("Pickup");
|
---|
595 | c28.Divide(4,2);
|
---|
596 |
|
---|
597 | disp19.CamDraw(c28, 1, 4, 0);
|
---|
598 | disp20.CamDraw(c28, 2, 4, 0);
|
---|
599 | disp21.CamDraw(c28, 3, 4, 0);
|
---|
600 | disp22.CamDraw(c28, 4, 4, 0);
|
---|
601 |
|
---|
602 | // Defects
|
---|
603 | TCanvas &c29 = fDisplay->AddTab("Defect");
|
---|
604 | // c29.Divide(5,2);
|
---|
605 | c29.Divide(4,2);
|
---|
606 |
|
---|
607 | disp24.CamDraw(c29, 1, 4, 0);
|
---|
608 | disp25.CamDraw(c29, 2, 4, 0);
|
---|
609 | disp26.CamDraw(c29, 3, 4, 0);
|
---|
610 | disp27.CamDraw(c29, 4, 4, 0);
|
---|
611 |
|
---|
612 | // Abs. Times
|
---|
613 | TCanvas &c30 = fDisplay->AddTab("Abs. Times");
|
---|
614 | c30.Divide(2,3);
|
---|
615 |
|
---|
616 | disp28.CamDraw(c30, 1, 2, 2);
|
---|
617 | disp29.CamDraw(c30, 2, 2, 1);
|
---|
618 |
|
---|
619 | if (fRelTimes)
|
---|
620 | {
|
---|
621 | // Rel. Times
|
---|
622 | TCanvas &c31 = fDisplay->AddTab("Rel. Times");
|
---|
623 | c31.Divide(3,5);
|
---|
624 |
|
---|
625 | disp30.CamDraw(c31, 1, 3, 2, 1, 1);
|
---|
626 | disp31.CamDraw(c31, 2, 3, 2, 1, 1);
|
---|
627 | disp32.CamDraw(c31, 3, 3, 4, 1, 1);
|
---|
628 |
|
---|
629 | // Time Defects
|
---|
630 | TCanvas &c32 = fDisplay->AddTab("Time Def.");
|
---|
631 | c32.Divide(2,2);
|
---|
632 |
|
---|
633 | disp33.CamDraw(c32, 1, 2, 0);
|
---|
634 | disp34.CamDraw(c32, 2, 2, 0);
|
---|
635 |
|
---|
636 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationRelTimeCam");
|
---|
637 |
|
---|
638 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
---|
639 | {
|
---|
640 | cam->GetAverageHiGainSector(sector).DrawClone("fourierevents");
|
---|
641 | cam->GetAverageLoGainSector(sector).DrawClone("fourierevents");
|
---|
642 | }
|
---|
643 |
|
---|
644 | }
|
---|
645 |
|
---|
646 | return;
|
---|
647 | }
|
---|
648 | }
|
---|
649 |
|
---|
650 |
|
---|
651 |
|
---|
652 | // --------------------------------------------------------------------------
|
---|
653 | //
|
---|
654 | // Find the colour of the pulsing LED:
|
---|
655 | // - If the run number is smaller than gkIFAEBoxInaugurationRun, take MCalibrationCam::kCT1
|
---|
656 | // - Otherwise find the colour out of the run name
|
---|
657 | // - If no colour is found, return kFALSE
|
---|
658 | //
|
---|
659 | Bool_t MJCalibration::FindColor()
|
---|
660 | {
|
---|
661 |
|
---|
662 | const UInt_t nruns = fRuns->GetNumRuns();
|
---|
663 |
|
---|
664 | if (nruns == 0)
|
---|
665 | return kFALSE;
|
---|
666 |
|
---|
667 | TArrayI arr = fRuns->GetRuns();
|
---|
668 |
|
---|
669 | if (arr[nruns-1] < gkIFAEBoxInaugurationRun)
|
---|
670 | {
|
---|
671 | *fLog << "Found colour kCT1 in runs: " << fRuns->GetRunsAsString() << endl;
|
---|
672 | fColor = MCalibrationCam::kCT1;
|
---|
673 | return kTRUE;
|
---|
674 | }
|
---|
675 |
|
---|
676 | TString filenames;
|
---|
677 | ((MDirIter*)fRuns)->Reset();
|
---|
678 |
|
---|
679 | while (!(filenames=((MDirIter*)fRuns)->Next()).IsNull())
|
---|
680 | {
|
---|
681 |
|
---|
682 | filenames.ToLower();
|
---|
683 |
|
---|
684 | //
|
---|
685 | // Here starts the list of runs where the shifters did not put
|
---|
686 | // a colour, but which have been found out by other means
|
---|
687 | //
|
---|
688 | if (filenames.Contains("_27474_"))
|
---|
689 | if (fColor == MCalibrationCam::kNONE)
|
---|
690 | {
|
---|
691 | *fLog << "Sorry, run 27474 was taken with CLOSED LIDS. It should not be used! "
|
---|
692 | << "Selected runs were: " << filenames << endl;
|
---|
693 | fColor = MCalibrationCam::kNONE;
|
---|
694 | return kFALSE;
|
---|
695 | }
|
---|
696 | else if (fColor != MCalibrationCam::kNONE)
|
---|
697 | {
|
---|
698 | *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
|
---|
699 | return kFALSE;
|
---|
700 | }
|
---|
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 (fDataCheck)
|
---|
1026 | {
|
---|
1027 | fillcam.SetDrawOption("datacheck");
|
---|
1028 | fillbnd.SetDrawOption("datacheck");
|
---|
1029 | fillpin.SetDrawOption("datacheck");
|
---|
1030 | filltme.SetDrawOption("datacheck");
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | if (fDisplayType == kFullDisplay)
|
---|
1034 | {
|
---|
1035 | fillcam.SetDrawOption("all");
|
---|
1036 | filltme.SetDrawOption("all");
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 |
|
---|
1040 | //
|
---|
1041 | // Apply a filter against cosmics
|
---|
1042 | // (will have to be needed in the future
|
---|
1043 | // when the calibration hardware-trigger is working)
|
---|
1044 | //
|
---|
1045 | MFCosmics cosmics;
|
---|
1046 | MContinue cont(&cosmics);
|
---|
1047 |
|
---|
1048 | // tlist.AddToList(&merge);
|
---|
1049 | tlist.AddToList(&apply);
|
---|
1050 |
|
---|
1051 | if (fExtractor)
|
---|
1052 | tlist.AddToList(fExtractor);
|
---|
1053 | else
|
---|
1054 | {
|
---|
1055 | *fLog << warn << GetDescriptor()
|
---|
1056 | << ": No extractor has been chosen, take default MExtractSlidingWindow " << endl;
|
---|
1057 | tlist.AddToList(&extract2);
|
---|
1058 | }
|
---|
1059 |
|
---|
1060 |
|
---|
1061 | tlist.AddToList(&pinext);
|
---|
1062 | tlist.AddToList(&blindext);
|
---|
1063 |
|
---|
1064 | if (fRelTimes)
|
---|
1065 | {
|
---|
1066 | if (fTimeExtractor)
|
---|
1067 | tlist.AddToList(fTimeExtractor);
|
---|
1068 | else
|
---|
1069 | {
|
---|
1070 | *fLog << warn << GetDescriptor()
|
---|
1071 | << ": No extractor has been chosen, take default MTimeExtractSpline " << endl;
|
---|
1072 | tlist.AddToList(×pline);
|
---|
1073 | }
|
---|
1074 | }
|
---|
1075 |
|
---|
1076 | if (fColor == MCalibrationCam::kCT1)
|
---|
1077 | tlist.AddToList(&cont);
|
---|
1078 |
|
---|
1079 | tlist.AddToList(&fillcam);
|
---|
1080 |
|
---|
1081 | if (IsUsePINDiode())
|
---|
1082 | tlist.AddToList(&fillpin);
|
---|
1083 | if (IsUseBlindPixel())
|
---|
1084 | tlist.AddToList(&fillbnd);
|
---|
1085 |
|
---|
1086 | tlist.AddToList(&calcalc);
|
---|
1087 |
|
---|
1088 | if (fRelTimes)
|
---|
1089 | {
|
---|
1090 | tlist.AddToList(&filltme);
|
---|
1091 | tlist.AddToList(&timecalc);
|
---|
1092 | }
|
---|
1093 |
|
---|
1094 |
|
---|
1095 | // Create and setup the eventloop
|
---|
1096 | MEvtLoop evtloop(fName);
|
---|
1097 | evtloop.SetParList(&plist);
|
---|
1098 | evtloop.SetDisplay(fDisplay);
|
---|
1099 | evtloop.SetLogStream(fLog);
|
---|
1100 |
|
---|
1101 | // Execute first analysis
|
---|
1102 | if (!evtloop.Eventloop())
|
---|
1103 | {
|
---|
1104 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
---|
1105 | return kFALSE;
|
---|
1106 | }
|
---|
1107 |
|
---|
1108 | tlist.PrintStatistics();
|
---|
1109 |
|
---|
1110 | DisplayResult(plist);
|
---|
1111 |
|
---|
1112 | if (!WriteResult())
|
---|
1113 | return kFALSE;
|
---|
1114 |
|
---|
1115 | *fLog << inf << GetDescriptor() << ": Done." << endl;
|
---|
1116 |
|
---|
1117 | return kTRUE;
|
---|
1118 | }
|
---|
1119 |
|
---|
1120 | // --------------------------------------------------------------------------
|
---|
1121 | //
|
---|
1122 | // Read the following containers from GetOutputFile()
|
---|
1123 | // - MCalibrationChargeCam
|
---|
1124 | // - MCalibrationQECam
|
---|
1125 | // - MBadPixelsCam
|
---|
1126 | //
|
---|
1127 | Bool_t MJCalibration::ReadCalibrationCam()
|
---|
1128 | {
|
---|
1129 |
|
---|
1130 | const TString fname = GetOutputFile();
|
---|
1131 |
|
---|
1132 | if (gSystem->AccessPathName(fname, kFileExists))
|
---|
1133 | {
|
---|
1134 | *fLog << err << "Input file " << fname << " doesn't exist." << endl;
|
---|
1135 | return kFALSE;
|
---|
1136 | }
|
---|
1137 |
|
---|
1138 | *fLog << inf << "Reading from file: " << fname << endl;
|
---|
1139 |
|
---|
1140 | TFile file(fname, "READ");
|
---|
1141 | if (fCalibrationCam.Read()<=0)
|
---|
1142 | {
|
---|
1143 | *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
|
---|
1144 | return kFALSE;
|
---|
1145 | }
|
---|
1146 |
|
---|
1147 | if (fQECam.Read()<=0)
|
---|
1148 | {
|
---|
1149 | *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
|
---|
1150 | return kFALSE;
|
---|
1151 | }
|
---|
1152 |
|
---|
1153 |
|
---|
1154 | if (fRelTimes)
|
---|
1155 | if (fRelTimeCam.Read()<=0)
|
---|
1156 | {
|
---|
1157 | *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
|
---|
1158 | return kFALSE;
|
---|
1159 | }
|
---|
1160 |
|
---|
1161 | if (file.FindKey("MBadPixelsCam"))
|
---|
1162 | {
|
---|
1163 | MBadPixelsCam bad;
|
---|
1164 | if (bad.Read()<=0)
|
---|
1165 | {
|
---|
1166 | *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
|
---|
1167 | return kFALSE;
|
---|
1168 | }
|
---|
1169 | fBadPixels.Merge(bad);
|
---|
1170 | }
|
---|
1171 |
|
---|
1172 | if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
|
---|
1173 | fDisplay->Read();
|
---|
1174 |
|
---|
1175 | return kTRUE;
|
---|
1176 | }
|
---|
1177 |
|
---|
1178 |
|
---|
1179 | // --------------------------------------------------------------------------
|
---|
1180 | //
|
---|
1181 | // Set the path for output files, written by WriteResult()
|
---|
1182 | //
|
---|
1183 | void MJCalibration::SetOutputPath(const char *path)
|
---|
1184 | {
|
---|
1185 | fOutputPath = path;
|
---|
1186 | if (fOutputPath.EndsWith("/"))
|
---|
1187 | fOutputPath = fOutputPath(0, fOutputPath.Length()-1);
|
---|
1188 | }
|
---|
1189 |
|
---|
1190 | // --------------------------------------------------------------------------
|
---|
1191 | //
|
---|
1192 | // Set the useage of the Blind Pixel device
|
---|
1193 | //
|
---|
1194 | void MJCalibration::SetUseBlindPixel(const Bool_t b)
|
---|
1195 | {
|
---|
1196 | b ? SETBIT(fDevices,kUseBlindPixel) : CLRBIT(fDevices,kUseBlindPixel);
|
---|
1197 | }
|
---|
1198 |
|
---|
1199 | // --------------------------------------------------------------------------
|
---|
1200 | //
|
---|
1201 | // Set the useage of the PIN Diode device
|
---|
1202 | //
|
---|
1203 | void MJCalibration::SetUsePINDiode(const Bool_t b)
|
---|
1204 | {
|
---|
1205 | b ? SETBIT(fDevices,kUsePINDiode) : CLRBIT(fDevices,kUsePINDiode);
|
---|
1206 | }
|
---|
1207 |
|
---|
1208 | // --------------------------------------------------------------------------
|
---|
1209 | //
|
---|
1210 | // Write the result into the output file GetOutputFile(), if fOutputPath exists.
|
---|
1211 | //
|
---|
1212 | // The following containers are written:
|
---|
1213 | // - MStatusDisplay
|
---|
1214 | // - MCalibrationChargeCam
|
---|
1215 | // - MCalibrationChargeBlindPix
|
---|
1216 | // - MCalibrationQECam
|
---|
1217 | // - MBadPixelsCam
|
---|
1218 | //
|
---|
1219 | Bool_t MJCalibration::WriteResult()
|
---|
1220 | {
|
---|
1221 | if (fOutputPath.IsNull())
|
---|
1222 | return kTRUE;
|
---|
1223 |
|
---|
1224 | const TString oname(GetOutputFile());
|
---|
1225 |
|
---|
1226 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
1227 |
|
---|
1228 | TFile file(oname, "UPDATE");
|
---|
1229 |
|
---|
1230 | if (fDisplay && fDisplay->Write()<=0)
|
---|
1231 | {
|
---|
1232 | *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
|
---|
1233 | return kFALSE;
|
---|
1234 | }
|
---|
1235 |
|
---|
1236 | if (fCalibrationCam.Write()<=0)
|
---|
1237 | {
|
---|
1238 | *fLog << err << "Unable to write MCalibrationChargeCam to " << oname << endl;
|
---|
1239 | return kFALSE;
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 | if (fCalibrationBlindPix.Write()<=0)
|
---|
1243 | {
|
---|
1244 | *fLog << err << "Unable to write MCalibrationChargeBlindPix to " << oname << endl;
|
---|
1245 | return kFALSE;
|
---|
1246 | }
|
---|
1247 |
|
---|
1248 | if (fCalibrationPINDiode.Write()<=0)
|
---|
1249 | {
|
---|
1250 | *fLog << err << "Unable to write MCalibrationChargePINDiode to " << oname << endl;
|
---|
1251 | return kFALSE;
|
---|
1252 | }
|
---|
1253 |
|
---|
1254 | if (fQECam.Write()<=0)
|
---|
1255 | {
|
---|
1256 | *fLog << err << "Unable to write MCalibrationQECam to " << oname << endl;
|
---|
1257 | return kFALSE;
|
---|
1258 | }
|
---|
1259 |
|
---|
1260 | if (fRelTimes)
|
---|
1261 | if (fRelTimeCam.Write()<=0)
|
---|
1262 | {
|
---|
1263 | *fLog << err << "Unable to write MCalibrationQECam to " << oname << endl;
|
---|
1264 | return kFALSE;
|
---|
1265 | }
|
---|
1266 |
|
---|
1267 | if (fBadPixels.Write()<=0)
|
---|
1268 | {
|
---|
1269 | *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl;
|
---|
1270 | return kFALSE;
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | return kTRUE;
|
---|
1274 |
|
---|
1275 | }
|
---|
1276 |
|
---|