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 | #include <TLine.h>
|
---|
94 | #include <TLatex.h>
|
---|
95 | #include <TLegend.h>
|
---|
96 | #include <TRegexp.h>
|
---|
97 | #include <TPaveText.h>
|
---|
98 | #include <TPaveStats.h>
|
---|
99 |
|
---|
100 | #include "MLog.h"
|
---|
101 | #include "MLogManip.h"
|
---|
102 |
|
---|
103 | #include "MRunIter.h"
|
---|
104 | #include "MSequence.h"
|
---|
105 | #include "MParList.h"
|
---|
106 | #include "MTaskList.h"
|
---|
107 | #include "MEvtLoop.h"
|
---|
108 |
|
---|
109 | #include "MHCamera.h"
|
---|
110 | #include "MGeomCam.h"
|
---|
111 |
|
---|
112 | #include "MPedestalCam.h"
|
---|
113 | #include "MCalibrationCam.h"
|
---|
114 | #include "MCalibrationQECam.h"
|
---|
115 | #include "MCalibrationQEPix.h"
|
---|
116 | #include "MCalibrationChargeCam.h"
|
---|
117 | #include "MCalibrationChargePix.h"
|
---|
118 | #include "MCalibrationChargePINDiode.h"
|
---|
119 | #include "MCalibrationChargeBlindPix.h"
|
---|
120 | #include "MCalibrationChargeBlindCam.h"
|
---|
121 | #include "MCalibrationChargeBlindCamOneOldStyle.h"
|
---|
122 | #include "MCalibrationChargeBlindCamTwoNewStyle.h"
|
---|
123 | #include "MCalibrationChargeCalc.h"
|
---|
124 |
|
---|
125 | #include "MHGausEvents.h"
|
---|
126 | #include "MHCalibrationCam.h"
|
---|
127 | #include "MHCalibrationChargeCam.h"
|
---|
128 | #include "MHCalibrationChargeBlindCam.h"
|
---|
129 | #include "MHCalibrationChargePINDiode.h"
|
---|
130 | #include "MHCalibrationRelTimeCam.h"
|
---|
131 | #include "MCalibrationRelTimeCam.h"
|
---|
132 | #include "MCalibrationRelTimeCalc.h"
|
---|
133 |
|
---|
134 | #include "MReadMarsFile.h"
|
---|
135 | #include "MRawFileRead.h"
|
---|
136 | #include "MGeomApply.h"
|
---|
137 | #include "MTaskEnv.h"
|
---|
138 | #include "MBadPixelsMerge.h"
|
---|
139 | #include "MBadPixelsCam.h"
|
---|
140 | #include "MExtractTime.h"
|
---|
141 | #include "MExtractor.h"
|
---|
142 | #include "MExtractPINDiode.h"
|
---|
143 | #include "MExtractBlindPixel.h"
|
---|
144 | #include "MExtractSlidingWindow.h"
|
---|
145 | #include "MExtractTimeFastSpline.h"
|
---|
146 | #include "MFCosmics.h"
|
---|
147 | #include "MContinue.h"
|
---|
148 | #include "MFillH.h"
|
---|
149 |
|
---|
150 | #include "MArrivalTimeCam.h"
|
---|
151 |
|
---|
152 | #include "MStatusDisplay.h"
|
---|
153 |
|
---|
154 | ClassImp(MJCalibration);
|
---|
155 |
|
---|
156 | using namespace std;
|
---|
157 |
|
---|
158 | const Int_t MJCalibration::gkIFAEBoxInaugurationRun = 20113;
|
---|
159 | const Int_t MJCalibration::gkSecondBlindPixelInstallation = 31693;
|
---|
160 | const Int_t MJCalibration::gkThirdBlindPixelInstallation = 99999;
|
---|
161 |
|
---|
162 | const Double_t MJCalibration::fgConvFADC2PheMin = 0.;
|
---|
163 | const Double_t MJCalibration::fgConvFADC2PheMax = 1.5;
|
---|
164 | const Double_t MJCalibration::fgConvFADC2PhotMin = 0.;
|
---|
165 | const Double_t MJCalibration::fgConvFADC2PhotMax = 10.;
|
---|
166 | const Double_t MJCalibration::fgQEMin = 0.;
|
---|
167 | const Double_t MJCalibration::fgQEMax = 0.3;
|
---|
168 |
|
---|
169 | const Float_t MJCalibration::fgRefConvFADC2PheInner = 0.14;
|
---|
170 | const Float_t MJCalibration::fgRefConvFADC2PheOuter = 0.45;
|
---|
171 | const Float_t MJCalibration::fgRefConvFADC2PhotInner = 0.8;
|
---|
172 | const Float_t MJCalibration::fgRefConvFADC2PhotOuter = 3.8;
|
---|
173 | const Float_t MJCalibration::fgRefQEInner = 0.18;
|
---|
174 | const Float_t MJCalibration::fgRefQEOuter = 0.12;
|
---|
175 |
|
---|
176 |
|
---|
177 | // --------------------------------------------------------------------------
|
---|
178 | //
|
---|
179 | // Default constructor.
|
---|
180 | //
|
---|
181 | // - Sets fRuns to 0, fExtractor to NULL, fTimeExtractor to NULL, fColor to kNONE,
|
---|
182 | // fDisplay to kNormalDisplay, fRelTime to kFALSE, fDataCheck to kFALSE,
|
---|
183 | // - SetUseBlindPixel()
|
---|
184 | // - SetUsePINDiode()
|
---|
185 | //
|
---|
186 | MJCalibration::MJCalibration(const char *name, const char *title)
|
---|
187 | : fRuns(0), fExtractor(NULL), fTimeExtractor(NULL),
|
---|
188 | fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay),
|
---|
189 | fRelTimes(kFALSE), fDataCheck(kFALSE), fDebug(kFALSE)
|
---|
190 | {
|
---|
191 | fName = name ? name : "MJCalibration";
|
---|
192 | fTitle = title ? title : "Tool to create the calibration constants for one calibration run";
|
---|
193 |
|
---|
194 | SetUseBlindPixel();
|
---|
195 | SetUsePINDiode();
|
---|
196 | }
|
---|
197 |
|
---|
198 | // --------------------------------------------------------------------------
|
---|
199 | //
|
---|
200 | // Display the results in MStatusDisplay:
|
---|
201 | //
|
---|
202 | // - Add "Calibration" to the MStatusDisplay title
|
---|
203 | // - Retrieve the MGeomCam from MParList
|
---|
204 | // - Initialize the following MHCamera's:
|
---|
205 | // 1) MCalibrationPix::GetMean()
|
---|
206 | // 2) MCalibrationPix::Sigma()
|
---|
207 | // 3) MCalibrationChargePix::GetRSigma()
|
---|
208 | // 4) MCalibrationChargePix::GetRSigmaPerCharge()
|
---|
209 | // 5) MCalibrationChargePix::GetPheFFactorMethod()
|
---|
210 | // 6) MCalibrationChargePix::GetMeanConvFADC2Phe()
|
---|
211 | // 7) MCalibrationChargePix::GetMeanFFactorFADC2Phot()
|
---|
212 | // 8) MCalibrationQEPix::GetQECascadesFFactor()
|
---|
213 | // 9) MCalibrationQEPix::GetQECascadesBlindPixel()
|
---|
214 | // 10) MCalibrationQEPix::GetQECascadesPINDiode()
|
---|
215 | // 11) MCalibrationQEPix::GetQECascadesCombined()
|
---|
216 | // 12) MCalibrationQEPix::IsAverageQEFFactorAvailable()
|
---|
217 | // 13) MCalibrationQEPix::IsAverageQEBlindPixelAvailable()
|
---|
218 | // 14) MCalibrationQEPix::IsAverageQEPINDiodeAvailable()
|
---|
219 | // 15) MCalibrationQEPix::IsAverageQECombinedAvailable()
|
---|
220 | // 16) MCalibrationChargePix::IsHiGainSaturation()
|
---|
221 | // 17) MCalibrationPix::GetHiLoMeansDivided()
|
---|
222 | // 18) MCalibrationPix::GetHiLoSigmasDivided()
|
---|
223 | // 19) MCalibrationChargePix::GetHiGainPickup()
|
---|
224 | // 20) MCalibrationChargePix::GetLoGainPickup()
|
---|
225 | // 21) MCalibrationChargePix::GetHiGainBlackout()
|
---|
226 | // 22) MCalibrationChargePix::GetLoGainBlackout()
|
---|
227 | // 23) MCalibrationPix::IsExcluded()
|
---|
228 | // 24) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableRun)
|
---|
229 | // 25) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnreliableRun)
|
---|
230 | // 26) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOscillating)
|
---|
231 | // 27) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOscillating)
|
---|
232 | // 28) MCalibrationChargePix::GetAbsTimeMean()
|
---|
233 | // 29) MCalibrationChargePix::GetAbsTimeRms()
|
---|
234 | //
|
---|
235 | // If the flag SetFullDisplay() is set, all MHCameras will be displayed.
|
---|
236 | // if the flag SetDataCheckDisplay() is set, only the most important ones are displayed
|
---|
237 | // and otherwise, (default: SetNormalDisplay()), a good selection of plots is given
|
---|
238 | //
|
---|
239 | void MJCalibration::DisplayResult(MParList &plist)
|
---|
240 | {
|
---|
241 |
|
---|
242 | if (!fDisplay)
|
---|
243 | return;
|
---|
244 |
|
---|
245 | //
|
---|
246 | // Update display
|
---|
247 | //
|
---|
248 | TString title = fDisplay->GetTitle();
|
---|
249 | title += "-- Calibration ";
|
---|
250 | title += fSequence.IsValid() ? Form("calib%06d", fSequence.GetSequence()) : (const char*)fRuns->GetRunsAsString();
|
---|
251 | title += " --";
|
---|
252 | fDisplay->SetTitle(title);
|
---|
253 |
|
---|
254 | //
|
---|
255 | // Get container from list
|
---|
256 | //
|
---|
257 | MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam");
|
---|
258 |
|
---|
259 | // Create histograms to display
|
---|
260 | MHCamera disp1 (geomcam, "Charge", "Fitted Mean Signal (Charges)");
|
---|
261 | MHCamera disp2 (geomcam, "SigmaCharge", "Sigma of Fitted Signal");
|
---|
262 | MHCamera disp3 (geomcam, "RSigma", "Reduced Sigmas");
|
---|
263 | MHCamera disp4 (geomcam, "RSigmaPerCharge", "Reduced Sigma per Charge");
|
---|
264 | MHCamera disp5 (geomcam, "NumPhes", "Number Photo-electrons");
|
---|
265 | MHCamera disp6 (geomcam, "ConvFADC2Phes", "Conversion Factor to Phes");
|
---|
266 | MHCamera disp7 (geomcam, "TotalFFactor", "Total F-Factor(F-Factor Method)");
|
---|
267 | MHCamera disp8 (geomcam, "CascadesQEFFactor", "Cascades QE (F-Factor Method)");
|
---|
268 | MHCamera disp9 (geomcam, "CascadesQEBlindPix","Cascades QE (Blind Pixel Method)");
|
---|
269 | MHCamera disp10(geomcam, "CascadesQEPINDiode","Cascades QE (PIN Diode Method)");
|
---|
270 | MHCamera disp11(geomcam, "CascadesQECombined","Cascades QE (Combined Method)");
|
---|
271 | MHCamera disp12(geomcam, "FFactorValid", "Pixels with valid F-Factor calibration");
|
---|
272 | MHCamera disp13(geomcam, "BlindPixelValid", "Pixels with valid BlindPixel calibration");
|
---|
273 | MHCamera disp14(geomcam, "PINdiodeValid", "Pixels with valid PINDiode calibration");
|
---|
274 | MHCamera disp15(geomcam, "CombinedValid", "Pixels with valid Combined calibration");
|
---|
275 | MHCamera disp16(geomcam, "Saturation", "Pixels with saturated Hi Gain");
|
---|
276 | MHCamera disp17(geomcam, "ConversionMeans", "Conversion HiGain.vs.LoGain Means");
|
---|
277 | MHCamera disp18(geomcam, "ConversionSigmas", "Conversion HiGain.vs.LoGain Sigmas");
|
---|
278 | MHCamera disp19(geomcam, "HiGainPickup", "Number Pickup events Hi Gain");
|
---|
279 | MHCamera disp20(geomcam, "LoGainPickup", "Number Pickup events Lo Gain");
|
---|
280 | MHCamera disp21(geomcam, "HiGainBlackout", "Number Blackout events Hi Gain");
|
---|
281 | MHCamera disp22(geomcam, "LoGainBlackout", "Number Blackout events Lo Gain");
|
---|
282 | MHCamera disp23(geomcam, "Excluded", "Pixels previously excluded");
|
---|
283 | MHCamera disp24(geomcam, "UnSuitable", "Pixels not suited for further analysis");
|
---|
284 | MHCamera disp25(geomcam, "UnReliable", "Pixels not reliable for further analysis");
|
---|
285 | MHCamera disp26(geomcam, "HiGainOscillating", "Oscillating Pixels High Gain");
|
---|
286 | MHCamera disp27(geomcam, "LoGainOscillating", "Oscillating Pixels Low Gain");
|
---|
287 | MHCamera disp28(geomcam, "AbsTimeMean", "Abs. Arrival Times");
|
---|
288 | MHCamera disp29(geomcam, "AbsTimeRms", "RMS of Arrival Times");
|
---|
289 | MHCamera disp30(geomcam, "MeanTime", "Mean Rel. Arrival Times");
|
---|
290 | MHCamera disp31(geomcam, "SigmaTime", "Sigma Rel. Arrival Times");
|
---|
291 | MHCamera disp32(geomcam, "TimeProb", "Probability of Time Fit");
|
---|
292 | MHCamera disp33(geomcam, "TimeNotFitValid", "Pixels with not valid fit results");
|
---|
293 | MHCamera disp34(geomcam, "TimeOscillating", "Oscillating Pixels");
|
---|
294 | MHCamera disp35(geomcam, "TotalConv", "Conversion Factor to photons");
|
---|
295 |
|
---|
296 | // Fitted charge means and sigmas
|
---|
297 | disp1.SetCamContent(fCalibrationCam, 0);
|
---|
298 | disp1.SetCamError( fCalibrationCam, 1);
|
---|
299 | disp2.SetCamContent(fCalibrationCam, 2);
|
---|
300 | disp2.SetCamError( fCalibrationCam, 3);
|
---|
301 |
|
---|
302 | // Reduced Sigmas and reduced sigmas per charge
|
---|
303 | disp3.SetCamContent(fCalibrationCam, 5);
|
---|
304 | disp3.SetCamError( fCalibrationCam, 6);
|
---|
305 | disp4.SetCamContent(fCalibrationCam, 7);
|
---|
306 | disp4.SetCamError( fCalibrationCam, 8);
|
---|
307 |
|
---|
308 | // F-Factor Method
|
---|
309 | disp5.SetCamContent(fCalibrationCam, 9);
|
---|
310 | disp5.SetCamError( fCalibrationCam, 10);
|
---|
311 | disp6.SetCamContent(fCalibrationCam, 11);
|
---|
312 | disp6.SetCamError( fCalibrationCam, 12);
|
---|
313 | disp7.SetCamContent(fCalibrationCam, 13);
|
---|
314 | disp7.SetCamError( fCalibrationCam, 14);
|
---|
315 |
|
---|
316 | // Quantum Efficiencies
|
---|
317 | disp8.SetCamContent (fQECam, 0 );
|
---|
318 | disp8.SetCamError (fQECam, 1 );
|
---|
319 | disp9.SetCamContent (fQECam, 2 );
|
---|
320 | disp9.SetCamError (fQECam, 3 );
|
---|
321 | disp10.SetCamContent(fQECam, 4 );
|
---|
322 | disp10.SetCamError (fQECam, 5 );
|
---|
323 | disp11.SetCamContent(fQECam, 6 );
|
---|
324 | disp11.SetCamError (fQECam, 7 );
|
---|
325 |
|
---|
326 | // Valid flags
|
---|
327 | disp12.SetCamContent(fQECam, 8 );
|
---|
328 | disp13.SetCamContent(fQECam, 9 );
|
---|
329 | disp14.SetCamContent(fQECam, 10);
|
---|
330 | disp15.SetCamContent(fQECam, 11);
|
---|
331 |
|
---|
332 | // Conversion Hi-Lo
|
---|
333 | disp16.SetCamContent(fCalibrationCam, 25);
|
---|
334 | disp17.SetCamContent(fCalibrationCam, 16);
|
---|
335 | disp17.SetCamError (fCalibrationCam, 17);
|
---|
336 | disp18.SetCamContent(fCalibrationCam, 18);
|
---|
337 | disp18.SetCamError (fCalibrationCam, 19);
|
---|
338 |
|
---|
339 | // Pickup and Blackout
|
---|
340 | disp19.SetCamContent(fCalibrationCam, 21);
|
---|
341 | disp20.SetCamContent(fCalibrationCam, 22);
|
---|
342 | disp21.SetCamContent(fCalibrationCam, 23);
|
---|
343 | disp22.SetCamContent(fCalibrationCam, 24);
|
---|
344 |
|
---|
345 | // Pixels with defects
|
---|
346 | disp23.SetCamContent(fCalibrationCam, 20);
|
---|
347 | disp24.SetCamContent(fBadPixels, 6);
|
---|
348 | disp25.SetCamContent(fBadPixels, 7);
|
---|
349 |
|
---|
350 | // Oscillations
|
---|
351 | disp26.SetCamContent(fBadPixels, 10);
|
---|
352 | disp27.SetCamContent(fBadPixels, 11);
|
---|
353 |
|
---|
354 | // Arrival Times
|
---|
355 | disp28.SetCamContent(fCalibrationCam, 26);
|
---|
356 | disp28.SetCamError( fCalibrationCam, 27);
|
---|
357 | disp29.SetCamContent(fCalibrationCam, 27);
|
---|
358 |
|
---|
359 | disp1.SetYTitle("Q [FADC counts]");
|
---|
360 | disp2.SetYTitle("\\sigma_{Q} [FADC counts]");
|
---|
361 |
|
---|
362 | disp3.SetYTitle("\\sqrt{\\sigma^{2}_{Q} - RMS^{2}_{Ped}} [FADC Counts]");
|
---|
363 | disp4.SetYTitle("Red.Sigma/<Q> [1]");
|
---|
364 |
|
---|
365 | disp5.SetYTitle("Photo-electons [1]");
|
---|
366 | disp6.SetYTitle("Conv.Factor [PhE/FADC counts]");
|
---|
367 | disp7.SetYTitle("Total F-Factor [1]");
|
---|
368 |
|
---|
369 | disp8.SetYTitle("QE [1]");
|
---|
370 | disp9.SetYTitle("QE [1]");
|
---|
371 | disp10.SetYTitle("QE [1]");
|
---|
372 | disp11.SetYTitle("QE [1]");
|
---|
373 |
|
---|
374 | disp12.SetYTitle("[1]");
|
---|
375 | disp13.SetYTitle("[1]");
|
---|
376 | disp14.SetYTitle("[1]");
|
---|
377 | disp15.SetYTitle("[1]");
|
---|
378 | disp16.SetYTitle("[1]");
|
---|
379 |
|
---|
380 | disp17.SetYTitle("<Q>(High)/<Q>(Low) [1]");
|
---|
381 | disp18.SetYTitle("\\sigma_{Q}(High)/\\sigma_{Q}(Low) [1]");
|
---|
382 |
|
---|
383 | disp19.SetYTitle("[1]");
|
---|
384 | disp20.SetYTitle("[1]");
|
---|
385 | disp21.SetYTitle("[1]");
|
---|
386 | disp22.SetYTitle("[1]");
|
---|
387 | // disp23.SetYTitle("[1]");
|
---|
388 | // disp24.SetYTitle("[1]");
|
---|
389 | // disp25.SetYTitle("[1]");
|
---|
390 | disp26.SetYTitle("[1]");
|
---|
391 | disp27.SetYTitle("[1]");
|
---|
392 |
|
---|
393 | disp28.SetYTitle("Mean Abs. Time [FADC slice]");
|
---|
394 | disp29.SetYTitle("RMS Abs. Time [FADC slices]");
|
---|
395 |
|
---|
396 | disp35.SetYTitle("Conv.Factor [Ph/FADC counts]");
|
---|
397 |
|
---|
398 | for (UInt_t i=0;i<geomcam.GetNumPixels();i++)
|
---|
399 | {
|
---|
400 |
|
---|
401 | MCalibrationChargePix &pix = (MCalibrationChargePix&)fCalibrationCam[i];
|
---|
402 | MCalibrationQEPix &qe = (MCalibrationQEPix&) fQECam [i];
|
---|
403 |
|
---|
404 | if (!pix.IsFFactorMethodValid())
|
---|
405 | continue;
|
---|
406 |
|
---|
407 | const Float_t convphe = pix.GetMeanConvFADC2Phe();
|
---|
408 | const Float_t quaeff = qe.GetQECascadesFFactor(0.);
|
---|
409 |
|
---|
410 | disp35.Fill(i,convphe/quaeff);
|
---|
411 | disp35.SetUsed(i);
|
---|
412 | }
|
---|
413 |
|
---|
414 |
|
---|
415 | if (fRelTimes)
|
---|
416 | {
|
---|
417 | disp30.SetCamContent(fRelTimeCam,0);
|
---|
418 | disp30.SetCamError( fRelTimeCam,1);
|
---|
419 | disp31.SetCamContent(fRelTimeCam,2);
|
---|
420 | disp31.SetCamError( fRelTimeCam,3);
|
---|
421 | disp32.SetCamContent(fRelTimeCam,4);
|
---|
422 | disp33.SetCamContent(fBadPixels,20);
|
---|
423 | disp34.SetCamContent(fBadPixels,21);
|
---|
424 |
|
---|
425 | disp30.SetYTitle("Time Offset [FADC units]");
|
---|
426 | disp31.SetYTitle("Timing resolution [FADC units]");
|
---|
427 | disp32.SetYTitle("P_{Time} [1]");
|
---|
428 | disp33.SetYTitle("[1]");
|
---|
429 | disp34.SetYTitle("[1]");
|
---|
430 | }
|
---|
431 |
|
---|
432 |
|
---|
433 |
|
---|
434 | if (fDisplayType == kDataCheckDisplay)
|
---|
435 | {
|
---|
436 |
|
---|
437 | TCanvas &c1 = fDisplay->AddTab("Fit.Charge");
|
---|
438 | c1.Divide(3, 3);
|
---|
439 |
|
---|
440 | //
|
---|
441 | // MEAN CHARGES
|
---|
442 | //
|
---|
443 |
|
---|
444 | c1.cd(1);
|
---|
445 | gPad->SetBorderMode(0);
|
---|
446 | gPad->SetTicks();
|
---|
447 | MHCamera *obj1=(MHCamera*)disp1.DrawCopy("hist");
|
---|
448 | //
|
---|
449 | // for the datacheck, fix the ranges!!
|
---|
450 | //
|
---|
451 | // obj1->SetMinimum(fgChargeMin);
|
---|
452 | // obj1->SetMaximum(fgChargeMax);
|
---|
453 | //
|
---|
454 | // Set the datacheck sizes:
|
---|
455 | //
|
---|
456 | FixDataCheckHist((TH1D*)obj1);
|
---|
457 | obj1->SetStats(kFALSE);
|
---|
458 | //
|
---|
459 | // set reference lines
|
---|
460 | //
|
---|
461 | // DisplayReferenceLines(obj1,0);
|
---|
462 |
|
---|
463 | c1.cd(4);
|
---|
464 | gPad->SetBorderMode(0);
|
---|
465 | obj1->SetPrettyPalette();
|
---|
466 | obj1->Draw();
|
---|
467 |
|
---|
468 | c1.cd(7);
|
---|
469 | gPad->SetBorderMode(0);
|
---|
470 | gPad->SetTicks();
|
---|
471 | TH1D *obj2 = (TH1D*)obj1->Projection(obj1->GetName());
|
---|
472 | obj2->Draw();
|
---|
473 | obj2->SetBit(kCanDelete);
|
---|
474 | obj2->Fit("gaus","Q");
|
---|
475 | TF1 *fun2 = obj2->GetFunction("gaus");
|
---|
476 | fun2->SetLineColor(kYellow);
|
---|
477 | gPad->Modified();
|
---|
478 | gPad->Update();
|
---|
479 | TPaveStats *st = (TPaveStats*)obj2->GetListOfFunctions()->FindObject("stats");
|
---|
480 | st->SetY1NDC(0.55);
|
---|
481 | st->SetY2NDC(0.89);
|
---|
482 | st->SetX1NDC(0.65);
|
---|
483 | st->SetX2NDC(0.99);
|
---|
484 | gPad->Modified();
|
---|
485 | gPad->Update();
|
---|
486 | //
|
---|
487 | // Set the datacheck sizes:
|
---|
488 | //
|
---|
489 | FixDataCheckHist(obj2);
|
---|
490 | obj2->SetStats(1);
|
---|
491 |
|
---|
492 | //
|
---|
493 | // Display the outliers as dead and noisy pixels
|
---|
494 | //
|
---|
495 | DisplayOutliers(obj2,"low-ampl.","high-ampl.");
|
---|
496 | TLatex flattex;
|
---|
497 | flattex.SetTextSize(0.07);
|
---|
498 | const Double_t minl = obj2->GetBinCenter(obj2->GetXaxis()->GetFirst());
|
---|
499 | const Double_t maxl = obj2->GetBinCenter(obj2->GetXaxis()->GetLast());
|
---|
500 | flattex.DrawLatex(minl+0.015*(maxl-minl),obj2->GetBinContent(obj2->GetMaximumBin())/1.35,
|
---|
501 | Form("Flatfield precision: %4.2f%%",
|
---|
502 | fun2->GetParameter(2)/fun2->GetParameter(1)*100.));
|
---|
503 |
|
---|
504 | //
|
---|
505 | // REDUCED SIGMAS
|
---|
506 | //
|
---|
507 |
|
---|
508 | c1.cd(2);
|
---|
509 | gPad->SetBorderMode(0);
|
---|
510 | gPad->SetTicks();
|
---|
511 | MHCamera *obj3=(MHCamera*)disp4.DrawCopy("hist");
|
---|
512 | //
|
---|
513 | // for the datacheck, fix the ranges!!
|
---|
514 | //
|
---|
515 | // obj3->SetMinimum(fgChargeMin);
|
---|
516 | // obj3->SetMaximum(fgChargeMax);
|
---|
517 | //
|
---|
518 | // Set the datacheck sizes:
|
---|
519 | //
|
---|
520 | FixDataCheckHist((TH1D*)obj3);
|
---|
521 | obj3->SetStats(kFALSE);
|
---|
522 | //
|
---|
523 | // set reference lines
|
---|
524 | //
|
---|
525 | // DisplayReferenceLines(obj3,0);
|
---|
526 |
|
---|
527 | c1.cd(5);
|
---|
528 | gPad->SetBorderMode(0);
|
---|
529 | obj3->SetPrettyPalette();
|
---|
530 | obj3->Draw();
|
---|
531 |
|
---|
532 | c1.cd(8);
|
---|
533 | gPad->SetBorderMode(0);
|
---|
534 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
---|
535 | DisplayDoubleProject(&disp4, "dead", "noisy");
|
---|
536 |
|
---|
537 | //
|
---|
538 | // PHOTO ELECTRONS
|
---|
539 | //
|
---|
540 |
|
---|
541 | c1.cd(3);
|
---|
542 | gPad->SetBorderMode(0);
|
---|
543 | gPad->SetTicks();
|
---|
544 | MHCamera *obj4=(MHCamera*)disp5.DrawCopy("hist");
|
---|
545 | //
|
---|
546 | // for the datacheck, fix the ranges!!
|
---|
547 | //
|
---|
548 | // obj3->SetMinimum(fgChargeMin);
|
---|
549 | // obj3->SetMaximum(fgChargeMax);
|
---|
550 | //
|
---|
551 | // Set the datacheck sizes:
|
---|
552 | //
|
---|
553 | FixDataCheckHist((TH1D*)obj4);
|
---|
554 | obj4->SetStats(kFALSE);
|
---|
555 | //
|
---|
556 | // set reference lines
|
---|
557 | //
|
---|
558 | // DisplayReferenceLines(obj3,0);
|
---|
559 |
|
---|
560 | c1.cd(6);
|
---|
561 | gPad->SetBorderMode(0);
|
---|
562 | obj4->SetPrettyPalette();
|
---|
563 | obj4->Draw();
|
---|
564 |
|
---|
565 | c1.cd(9);
|
---|
566 | gPad->SetBorderMode(0);
|
---|
567 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
---|
568 | DisplayDoubleProject(&disp5, "dead", "noisy");
|
---|
569 |
|
---|
570 | //
|
---|
571 | // CONVERSION FACTORS
|
---|
572 | //
|
---|
573 |
|
---|
574 | TCanvas &c2 = fDisplay->AddTab("Conversion");
|
---|
575 | c2.Divide(3,3);
|
---|
576 |
|
---|
577 | c2.cd(1);
|
---|
578 | gPad->SetBorderMode(0);
|
---|
579 | gPad->SetTicks();
|
---|
580 | MHCamera *obj5=(MHCamera*)disp6.DrawCopy("hist");
|
---|
581 | //
|
---|
582 | // for the datacheck, fix the ranges!!
|
---|
583 | //
|
---|
584 | obj5->SetMinimum(fgConvFADC2PheMin);
|
---|
585 | obj5->SetMaximum(fgConvFADC2PheMax);
|
---|
586 | //
|
---|
587 | // Set the datacheck sizes:
|
---|
588 | //
|
---|
589 | FixDataCheckHist((TH1D*)obj5);
|
---|
590 | obj5->SetStats(kFALSE);
|
---|
591 | //
|
---|
592 | // set reference lines
|
---|
593 | //
|
---|
594 | DisplayReferenceLines(obj5,2);
|
---|
595 |
|
---|
596 | c2.cd(4);
|
---|
597 | gPad->SetBorderMode(0);
|
---|
598 | obj5->SetPrettyPalette();
|
---|
599 | obj5->Draw();
|
---|
600 |
|
---|
601 | c2.cd(7);
|
---|
602 | gPad->SetBorderMode(0);
|
---|
603 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
---|
604 | DisplayDoubleProject(&disp6, "noisy", "dead");
|
---|
605 |
|
---|
606 | //
|
---|
607 | // QUANTUM EFFICIENCY
|
---|
608 | //
|
---|
609 |
|
---|
610 | c2.cd(2);
|
---|
611 | gPad->SetBorderMode(0);
|
---|
612 | gPad->SetTicks();
|
---|
613 | MHCamera *obj6=(MHCamera*)disp8.DrawCopy("hist");
|
---|
614 | //
|
---|
615 | // for the datacheck, fix the ranges!!
|
---|
616 | //
|
---|
617 | obj6->SetMinimum(fgQEMin);
|
---|
618 | obj6->SetMaximum(fgQEMax);
|
---|
619 | //
|
---|
620 | // Set the datacheck sizes:
|
---|
621 | //
|
---|
622 | FixDataCheckHist((TH1D*)obj6);
|
---|
623 | obj6->SetStats(kFALSE);
|
---|
624 | //
|
---|
625 | // set reference lines
|
---|
626 | //
|
---|
627 | DisplayReferenceLines(obj6,0);
|
---|
628 |
|
---|
629 | c2.cd(5);
|
---|
630 | gPad->SetBorderMode(0);
|
---|
631 | obj6->SetPrettyPalette();
|
---|
632 | obj6->Draw();
|
---|
633 |
|
---|
634 | c2.cd(8);
|
---|
635 | gPad->SetBorderMode(0);
|
---|
636 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
---|
637 | DisplayDoubleProject(&disp8, "noisy", "dead");
|
---|
638 |
|
---|
639 | //
|
---|
640 | // CONVERSION FADC TO PHOTONS
|
---|
641 | //
|
---|
642 |
|
---|
643 | c2.cd(3);
|
---|
644 | gPad->SetBorderMode(0);
|
---|
645 | gPad->SetTicks();
|
---|
646 | MHCamera *obj7=(MHCamera*)disp35.DrawCopy("hist");
|
---|
647 | //
|
---|
648 | // for the datacheck, fix the ranges!!
|
---|
649 | //
|
---|
650 | obj7->SetMinimum(fgConvFADC2PhotMin);
|
---|
651 | obj7->SetMaximum(fgConvFADC2PhotMax);
|
---|
652 | //
|
---|
653 | // Set the datacheck sizes:
|
---|
654 | //
|
---|
655 | FixDataCheckHist((TH1D*)obj7);
|
---|
656 | obj7->SetStats(kFALSE);
|
---|
657 | //
|
---|
658 | // set reference lines
|
---|
659 | //
|
---|
660 | DisplayReferenceLines(obj7,1);
|
---|
661 |
|
---|
662 | c2.cd(6);
|
---|
663 | gPad->SetBorderMode(0);
|
---|
664 | obj7->SetPrettyPalette();
|
---|
665 | obj7->Draw();
|
---|
666 | c2.cd(9);
|
---|
667 | gPad->SetBorderMode(0);
|
---|
668 | if (geomcam.InheritsFrom("MGeomCamMagic"))
|
---|
669 | DisplayDoubleProject(&disp35, "noisy", "dead");
|
---|
670 |
|
---|
671 | //
|
---|
672 | // UNSUITABLE PIXELS
|
---|
673 | //
|
---|
674 | TCanvas &c4 = fDisplay->AddTab("Defect");
|
---|
675 | c4.Divide(2,2);
|
---|
676 |
|
---|
677 | c4.cd(1);
|
---|
678 | gPad->SetBorderMode(0);
|
---|
679 | gPad->SetTicks();
|
---|
680 | MHCamera *obj8=(MHCamera*)disp24.DrawCopy("hist");
|
---|
681 | //
|
---|
682 | // for the datacheck, fix the ranges!!
|
---|
683 | //
|
---|
684 | const Double_t max = 11.;
|
---|
685 | obj8->SetMinimum(0.);
|
---|
686 | obj8->SetMaximum(11.);
|
---|
687 | //
|
---|
688 | // Set the datacheck sizes:
|
---|
689 | //
|
---|
690 | FixDataCheckHist((TH1D*)obj8);
|
---|
691 | obj8->SetStats(kFALSE);
|
---|
692 |
|
---|
693 | gStyle->SetPalette(1);
|
---|
694 | const Int_t numcol = gStyle->GetNumberOfColors()-3;
|
---|
695 |
|
---|
696 | TPaveText *pave = new TPaveText(0.0,0.0,0.99,0.99);
|
---|
697 | pave->SetBit(kCanDelete);
|
---|
698 | pave->ConvertNDCtoPad();
|
---|
699 | pave->SetTextSize(0.05);
|
---|
700 | pave->AddText(" ");
|
---|
701 | TText *t1 = pave->AddText(Form("Signal smaller 3 Pedestal RMS: %3i pixels",
|
---|
702 | CountBadPixels(&disp24,1)));
|
---|
703 | t1->SetTextColor(gStyle->GetColorPalette(Int_t(1./max*numcol + 1.)));
|
---|
704 | t1->SetTextAlign(12);
|
---|
705 | TText *t2 = pave->AddText(Form("%s%3i%s","Signal Rel. error too large: ",
|
---|
706 | CountBadPixels(&disp24,2)," pixels"));
|
---|
707 | t2->SetTextColor(gStyle->GetColorPalette(Int_t(2./max*numcol + 1.)));
|
---|
708 | t2->SetTextAlign(12);
|
---|
709 | TText *t3 = pave->AddText(Form("Signal Sigma smaller than Pedestal RMS: %3i pixels",
|
---|
710 | CountBadPixels(&disp24,3)));
|
---|
711 | t3->SetTextColor(gStyle->GetColorPalette(Int_t(3./max*numcol + 1.)));
|
---|
712 | t3->SetTextAlign(12);
|
---|
713 | TText *t4 = pave->AddText(Form("Low Gain Saturation: %3i pixels",
|
---|
714 | CountBadPixels(&disp24,4)));
|
---|
715 | t4->SetTextColor(gStyle->GetColorPalette(Int_t(4./max*numcol + 1.)));
|
---|
716 | t4->SetTextAlign(12);
|
---|
717 | TText *t5 = pave->AddText(Form("Mean Arr. Time In First Extraction Bin: %3i pixels",
|
---|
718 | CountBadPixels(&disp24,5)));
|
---|
719 | t5->SetTextColor(gStyle->GetColorPalette(Int_t(5./max*numcol + 1.)));
|
---|
720 | t5->SetTextAlign(12);
|
---|
721 | TText *t6 = pave->AddText(Form("Mean Arr. Time In Last 2 Extraction Bins: %3i pixels",
|
---|
722 | CountBadPixels(&disp24,6)));
|
---|
723 | t6->SetTextColor(gStyle->GetColorPalette(Int_t(6./max*numcol + 1.)));
|
---|
724 | t6->SetTextAlign(12);
|
---|
725 | TText *t7 = pave->AddText(Form("Deviating Number of Photo-electrons: %3i pixels",
|
---|
726 | CountBadPixels(&disp24,7)));
|
---|
727 | t7->SetTextColor(gStyle->GetColorPalette(Int_t(7./max*numcol + 1.)));
|
---|
728 | t7->SetTextAlign(12);
|
---|
729 | TText *t8 = pave->AddText(Form("Deviating global F-Factor: %3i pixels",
|
---|
730 | CountBadPixels(&disp24,8)));
|
---|
731 | t8->SetTextColor(gStyle->GetColorPalette(Int_t(8./max*numcol + 1.)));
|
---|
732 | t8->SetTextAlign(12);
|
---|
733 | TText *t9 = pave->AddText(Form("Deviating Number of Photons: %3i pixels",
|
---|
734 | CountBadPixels(&disp24,9)));
|
---|
735 | t9->SetTextColor(gStyle->GetColorPalette(Int_t(9./max*numcol + 1.)));
|
---|
736 | t9->SetTextAlign(12);
|
---|
737 | TText *t10= pave->AddText(Form("Previously Excluded: %3i pixels",
|
---|
738 | CountBadPixels(&disp24,10)));
|
---|
739 | t10->SetTextColor(gStyle->GetColorPalette(Int_t(10./max*numcol + 1.)));
|
---|
740 | t10->SetTextAlign(12);
|
---|
741 | pave->Draw();
|
---|
742 |
|
---|
743 | c4.cd(3);
|
---|
744 | gPad->SetBorderMode(0);
|
---|
745 | obj8->Draw();
|
---|
746 | obj8->SetPrettyPalette();
|
---|
747 |
|
---|
748 | //
|
---|
749 | // UNRELIABLE PIXELS
|
---|
750 | //
|
---|
751 |
|
---|
752 | c4.cd(2);
|
---|
753 | gPad->SetBorderMode(0);
|
---|
754 | gPad->SetTicks();
|
---|
755 | MHCamera *obj9=(MHCamera*)disp25.DrawCopy("hist");
|
---|
756 | //
|
---|
757 | // for the datacheck, fix the ranges!!
|
---|
758 | //
|
---|
759 | const Double_t max2 = 8.;
|
---|
760 | obj9->SetMinimum(0.);
|
---|
761 | obj9->SetMaximum(max2);
|
---|
762 | //
|
---|
763 | // Set the datacheck sizes:
|
---|
764 | //
|
---|
765 | FixDataCheckHist((TH1D*)obj9);
|
---|
766 | obj9->SetStats(kFALSE);
|
---|
767 |
|
---|
768 | gStyle->SetPalette(1);
|
---|
769 |
|
---|
770 | TPaveText *pave2 = new TPaveText(0.0,0.0,0.99,0.99);
|
---|
771 | pave2->SetBit(kCanDelete);
|
---|
772 | pave2->ConvertNDCtoPad();
|
---|
773 | pave2->SetTextSize(0.05);
|
---|
774 | pave2->AddText(" ");
|
---|
775 | TText *tt1 = pave2->AddText(Form("High Gain Signals could not be fitted: %3i pixels",
|
---|
776 | CountBadPixels(&disp25,1)));
|
---|
777 | tt1->SetTextColor(gStyle->GetColorPalette(Int_t(1./max2*numcol + 1.)));
|
---|
778 | tt1->SetTextAlign(12);
|
---|
779 | TText *tt2 = pave2->AddText(Form("Low Gain Signals could not be fitted: %3i pixels",
|
---|
780 | CountBadPixels(&disp25,2)));
|
---|
781 | tt2->SetTextColor(gStyle->GetColorPalette(Int_t(2./max2*numcol + 1.)));
|
---|
782 | tt2->SetTextAlign(12);
|
---|
783 | TText *tt3 = pave2->AddText(Form("Relative Arr. Times could not be fitted: %3i pixels",
|
---|
784 | CountBadPixels(&disp25,3)));
|
---|
785 | tt3->SetTextColor(gStyle->GetColorPalette(Int_t(3./max2*numcol + 1.)));
|
---|
786 | tt3->SetTextAlign(12);
|
---|
787 | TText *tt4 = pave2->AddText(Form("High Gain Signals Oscillation: %3i pixels",
|
---|
788 | CountBadPixels(&disp25,4)));
|
---|
789 | tt4->SetTextColor(gStyle->GetColorPalette(Int_t(4./max2*numcol + 1.)));
|
---|
790 | tt4->SetTextAlign(12);
|
---|
791 | TText *tt5 = pave2->AddText(Form("Low Gain Signals Oscillation: %3i pixels",
|
---|
792 | CountBadPixels(&disp25,5)));
|
---|
793 | tt5->SetTextColor(gStyle->GetColorPalette(Int_t(5./max2*numcol + 1.)));
|
---|
794 | tt5->SetTextAlign(12);
|
---|
795 | TText *tt6 = pave2->AddText(Form("Relative Arr. Times Oscillation: %3i pixels",
|
---|
796 | CountBadPixels(&disp25,6)));
|
---|
797 | tt6->SetTextColor(gStyle->GetColorPalette(Int_t(6./max2*numcol + 1.)));
|
---|
798 | tt6->SetTextAlign(12);
|
---|
799 | pave2->Draw();
|
---|
800 |
|
---|
801 | c4.cd(4);
|
---|
802 | gPad->SetBorderMode(0);
|
---|
803 | obj9->SetPrettyPalette();
|
---|
804 | obj9->Draw();
|
---|
805 |
|
---|
806 | if (fRelTimes)
|
---|
807 | {
|
---|
808 | // Rel. Times
|
---|
809 | TCanvas &c5 = fDisplay->AddTab("Rel. Times");
|
---|
810 | c5.Divide(2,4);
|
---|
811 |
|
---|
812 | disp30.CamDraw(c5, 1, 2, 2);
|
---|
813 | disp31.CamDraw(c5, 2, 2, 2);
|
---|
814 | }
|
---|
815 |
|
---|
816 | return;
|
---|
817 | }
|
---|
818 |
|
---|
819 | if (fDisplayType == kNormalDisplay)
|
---|
820 | {
|
---|
821 |
|
---|
822 | // Charges
|
---|
823 | TCanvas &c11 = fDisplay->AddTab("Fit.Charge");
|
---|
824 | c11.Divide(2, 4);
|
---|
825 |
|
---|
826 | disp1.CamDraw(c11, 1, 2, 5, 1);
|
---|
827 | disp2.CamDraw(c11, 2, 2, 5, 1);
|
---|
828 |
|
---|
829 | // Reduced Sigmas
|
---|
830 | TCanvas &c12 = fDisplay->AddTab("Red.Sigma");
|
---|
831 | c12.Divide(2,4);
|
---|
832 |
|
---|
833 | disp3.CamDraw(c12, 1, 2, 5, 1);
|
---|
834 | disp4.CamDraw(c12, 2, 2, 5, 1);
|
---|
835 |
|
---|
836 | // F-Factor
|
---|
837 | TCanvas &c13 = fDisplay->AddTab("Phe's");
|
---|
838 | c13.Divide(3,4);
|
---|
839 |
|
---|
840 | disp5.CamDraw(c13, 1, 3, 5, 1);
|
---|
841 | disp6.CamDraw(c13, 2, 3, 5, 1);
|
---|
842 | disp7.CamDraw(c13, 3, 3, 5, 1);
|
---|
843 |
|
---|
844 | // QE's
|
---|
845 | TCanvas &c14 = fDisplay->AddTab("QE's");
|
---|
846 | c14.Divide(4,4);
|
---|
847 |
|
---|
848 | disp8.CamDraw(c14, 1, 4, 5, 1);
|
---|
849 | disp9.CamDraw(c14, 2, 4, 5, 1);
|
---|
850 | disp10.CamDraw(c14, 3, 4, 5, 1);
|
---|
851 | disp11.CamDraw(c14, 4, 4, 5, 1);
|
---|
852 |
|
---|
853 | // Defects
|
---|
854 | TCanvas &c15 = fDisplay->AddTab("Defect");
|
---|
855 | // c15.Divide(5,2);
|
---|
856 | c15.Divide(4,2);
|
---|
857 |
|
---|
858 | /*
|
---|
859 | disp23.CamDraw(c15, 1, 5, 0);
|
---|
860 | disp24.CamDraw(c15, 2, 5, 0);
|
---|
861 | disp25.CamDraw(c15, 3, 5, 0);
|
---|
862 | disp26.CamDraw(c15, 4, 5, 0);
|
---|
863 | disp27.CamDraw(c15, 5, 5, 0);
|
---|
864 | */
|
---|
865 | disp24.CamDraw(c15, 1, 4, 0);
|
---|
866 | disp25.CamDraw(c15, 2, 4, 0);
|
---|
867 | disp26.CamDraw(c15, 3, 4, 0);
|
---|
868 | disp27.CamDraw(c15, 4, 4, 0);
|
---|
869 |
|
---|
870 | // Abs. Times
|
---|
871 | TCanvas &c16 = fDisplay->AddTab("Abs. Times");
|
---|
872 | c16.Divide(2,3);
|
---|
873 |
|
---|
874 | disp28.CamDraw(c16, 1, 2, 5);
|
---|
875 | disp29.CamDraw(c16, 2, 2, 5);
|
---|
876 |
|
---|
877 | if (fRelTimes)
|
---|
878 | {
|
---|
879 | // Rel. Times
|
---|
880 | TCanvas &c17 = fDisplay->AddTab("Rel. Times");
|
---|
881 | c17.Divide(2,4);
|
---|
882 |
|
---|
883 | disp30.CamDraw(c17, 1, 2, 5, 1);
|
---|
884 | disp31.CamDraw(c17, 2, 2, 5, 1);
|
---|
885 | }
|
---|
886 |
|
---|
887 | return;
|
---|
888 | }
|
---|
889 |
|
---|
890 | if (fDisplayType == kFullDisplay)
|
---|
891 | {
|
---|
892 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationChargeCam");
|
---|
893 |
|
---|
894 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
---|
895 | {
|
---|
896 | cam->GetAverageHiGainSector(sector).DrawClone("all");
|
---|
897 | cam->GetAverageLoGainSector(sector).DrawClone("all");
|
---|
898 | }
|
---|
899 |
|
---|
900 | // Charges
|
---|
901 | TCanvas &c21 = fDisplay->AddTab("Fit.Charge");
|
---|
902 | c21.Divide(2, 4);
|
---|
903 |
|
---|
904 | disp1.CamDraw(c21, 1, 2, 2, 1);
|
---|
905 | disp2.CamDraw(c21, 2, 2, 2, 1);
|
---|
906 |
|
---|
907 | // Reduced Sigmas
|
---|
908 | TCanvas &c23 = fDisplay->AddTab("Red.Sigma");
|
---|
909 | c23.Divide(2,4);
|
---|
910 |
|
---|
911 | disp3.CamDraw(c23, 1, 2, 2, 1);
|
---|
912 | disp4.CamDraw(c23, 2, 2, 2, 1);
|
---|
913 |
|
---|
914 | // F-Factor
|
---|
915 | TCanvas &c24 = fDisplay->AddTab("Phe's");
|
---|
916 | c24.Divide(3,5);
|
---|
917 |
|
---|
918 | disp5.CamDraw(c24, 1, 3, 2, 1, 1);
|
---|
919 | disp6.CamDraw(c24, 2, 3, 2, 1, 1);
|
---|
920 | disp7.CamDraw(c24, 3, 3, 2, 1, 1);
|
---|
921 |
|
---|
922 | // QE's
|
---|
923 | TCanvas &c25 = fDisplay->AddTab("QE's");
|
---|
924 | c25.Divide(4,5);
|
---|
925 |
|
---|
926 | disp8.CamDraw(c25, 1, 4, 2, 1, 1);
|
---|
927 | disp9.CamDraw(c25, 2, 4, 2, 1, 1);
|
---|
928 | disp10.CamDraw(c25, 3, 4, 2, 1, 1);
|
---|
929 | disp11.CamDraw(c25, 4, 4, 2, 1, 1);
|
---|
930 |
|
---|
931 | // Validity
|
---|
932 | TCanvas &c26 = fDisplay->AddTab("Valid");
|
---|
933 | c26.Divide(4,2);
|
---|
934 |
|
---|
935 | disp12.CamDraw(c26, 1, 4, 0);
|
---|
936 | disp13.CamDraw(c26, 2, 4, 0);
|
---|
937 | disp14.CamDraw(c26, 3, 4, 0);
|
---|
938 | disp15.CamDraw(c26, 4, 4, 0);
|
---|
939 |
|
---|
940 | // Other info
|
---|
941 | TCanvas &c27 = fDisplay->AddTab("HiLoGain");
|
---|
942 | c27.Divide(3,3);
|
---|
943 |
|
---|
944 | disp16.CamDraw(c27, 1, 3, 0);
|
---|
945 | disp17.CamDraw(c27, 2, 3, 1);
|
---|
946 | disp18.CamDraw(c27, 3, 3, 1);
|
---|
947 |
|
---|
948 | // Pickup
|
---|
949 | TCanvas &c28 = fDisplay->AddTab("Pickup");
|
---|
950 | c28.Divide(4,2);
|
---|
951 |
|
---|
952 | disp19.CamDraw(c28, 1, 4, 0);
|
---|
953 | disp20.CamDraw(c28, 2, 4, 0);
|
---|
954 | disp21.CamDraw(c28, 3, 4, 0);
|
---|
955 | disp22.CamDraw(c28, 4, 4, 0);
|
---|
956 |
|
---|
957 | // Defects
|
---|
958 | TCanvas &c29 = fDisplay->AddTab("Defect");
|
---|
959 | // c29.Divide(5,2);
|
---|
960 | c29.Divide(4,2);
|
---|
961 |
|
---|
962 | disp24.CamDraw(c29, 1, 4, 0);
|
---|
963 | disp25.CamDraw(c29, 2, 4, 0);
|
---|
964 | disp26.CamDraw(c29, 3, 4, 0);
|
---|
965 | disp27.CamDraw(c29, 4, 4, 0);
|
---|
966 |
|
---|
967 | // Abs. Times
|
---|
968 | TCanvas &c30 = fDisplay->AddTab("Abs. Times");
|
---|
969 | c30.Divide(2,3);
|
---|
970 |
|
---|
971 | disp28.CamDraw(c30, 1, 2, 2);
|
---|
972 | disp29.CamDraw(c30, 2, 2, 1);
|
---|
973 |
|
---|
974 | if (fRelTimes)
|
---|
975 | {
|
---|
976 | // Rel. Times
|
---|
977 | TCanvas &c31 = fDisplay->AddTab("Rel. Times");
|
---|
978 | c31.Divide(3,5);
|
---|
979 |
|
---|
980 | disp30.CamDraw(c31, 1, 3, 2, 1, 1);
|
---|
981 | disp31.CamDraw(c31, 2, 3, 2, 1, 1);
|
---|
982 | disp32.CamDraw(c31, 3, 3, 4, 1, 1);
|
---|
983 |
|
---|
984 | // Time Defects
|
---|
985 | TCanvas &c32 = fDisplay->AddTab("Time Def.");
|
---|
986 | c32.Divide(2,2);
|
---|
987 |
|
---|
988 | disp33.CamDraw(c32, 1, 2, 0);
|
---|
989 | disp34.CamDraw(c32, 2, 2, 0);
|
---|
990 |
|
---|
991 | MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationRelTimeCam");
|
---|
992 |
|
---|
993 | for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
|
---|
994 | {
|
---|
995 | cam->GetAverageHiGainSector(sector).DrawClone("fourierevents");
|
---|
996 | cam->GetAverageLoGainSector(sector).DrawClone("fourierevents");
|
---|
997 | }
|
---|
998 |
|
---|
999 | }
|
---|
1000 |
|
---|
1001 | return;
|
---|
1002 | }
|
---|
1003 | }
|
---|
1004 |
|
---|
1005 |
|
---|
1006 | void MJCalibration::DisplayReferenceLines(MHCamera *cam, const Int_t what) const
|
---|
1007 | {
|
---|
1008 |
|
---|
1009 | const MGeomCam *geom = cam->GetGeometry();
|
---|
1010 |
|
---|
1011 | Double_t x = geom->InheritsFrom("MGeomCamMagic") ? 397 : cam->GetNbinsX() ;
|
---|
1012 |
|
---|
1013 | TLine line;
|
---|
1014 | line.SetLineStyle(kDashed);
|
---|
1015 | line.SetLineWidth(3);
|
---|
1016 | line.SetLineColor(kBlue);
|
---|
1017 |
|
---|
1018 | TLine *l1 = NULL;
|
---|
1019 |
|
---|
1020 | if (what == 0)
|
---|
1021 | l1 = line.DrawLine(0, fgRefQEInner, x, fgRefQEInner);
|
---|
1022 | else if (what == 1)
|
---|
1023 | l1 = line.DrawLine(0, fgRefConvFADC2PhotInner, x, fgRefConvFADC2PhotInner);
|
---|
1024 | else if (what == 2)
|
---|
1025 | l1 = line.DrawLine(0, fgRefConvFADC2PheInner, x, fgRefConvFADC2PheInner );
|
---|
1026 |
|
---|
1027 | if (geom->InheritsFrom("MGeomCamMagic"))
|
---|
1028 | {
|
---|
1029 | const Double_t x2 = cam->GetNbinsX();
|
---|
1030 |
|
---|
1031 | switch (what)
|
---|
1032 | {
|
---|
1033 | case 0:
|
---|
1034 | line.DrawLine(x2, fgRefQEOuter, 398, fgRefQEOuter);
|
---|
1035 | break;
|
---|
1036 | case 1:
|
---|
1037 | line.DrawLine(x2, fgRefConvFADC2PhotOuter, 398, fgRefConvFADC2PhotOuter );
|
---|
1038 | break;
|
---|
1039 | case 2:
|
---|
1040 | line.DrawLine(x2, fgRefConvFADC2PheOuter, 398, fgRefConvFADC2PheOuter);
|
---|
1041 | break;
|
---|
1042 | }
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 | TLegend *leg = new TLegend(what ? 0.2 : 0.6,0.75,what ? 0.5 : 0.9 ,0.85);
|
---|
1046 | leg->SetBit(kCanDelete);
|
---|
1047 | leg->AddEntry(l1, "Reference","l");
|
---|
1048 | leg->Draw();
|
---|
1049 | }
|
---|
1050 |
|
---|
1051 | void MJCalibration::DisplayOutliers(TH1D *hist, const char* whatsmall, const char* whatbig) const
|
---|
1052 | {
|
---|
1053 |
|
---|
1054 | const Float_t mean = hist->GetFunction("gaus")->GetParameter(1);
|
---|
1055 | const Float_t lolim = mean - 4.0*hist->GetFunction("gaus")->GetParameter(2);
|
---|
1056 | const Float_t uplim = mean + 4.0*hist->GetFunction("gaus")->GetParameter(2);
|
---|
1057 | const Stat_t dead = hist->Integral(0,hist->FindBin(lolim)-1);
|
---|
1058 | const Stat_t noisy = hist->Integral(hist->FindBin(uplim)+1,hist->GetNbinsX()+1);
|
---|
1059 |
|
---|
1060 | const Double_t max = hist->GetBinContent(hist->GetMaximumBin());
|
---|
1061 |
|
---|
1062 | const Double_t minl = hist->GetBinCenter(hist->GetXaxis()->GetFirst());
|
---|
1063 | const Double_t maxl = hist->GetBinCenter(hist->GetXaxis()->GetLast());
|
---|
1064 |
|
---|
1065 | TLatex deadtex;
|
---|
1066 | deadtex.SetTextSize(0.07);
|
---|
1067 | deadtex.DrawLatex(minl+0.015*(maxl-minl),max/1.1,
|
---|
1068 | Form("%3i %s pixels",(Int_t)dead,whatsmall));
|
---|
1069 |
|
---|
1070 | TLatex noisytex;
|
---|
1071 | noisytex.SetTextSize(0.07);
|
---|
1072 | noisytex.DrawLatex(minl+0.015*(maxl-minl),max/1.2,
|
---|
1073 | Form("%3i %s pixels",(Int_t)noisy,whatbig));
|
---|
1074 |
|
---|
1075 | }
|
---|
1076 |
|
---|
1077 | void MJCalibration::FixDataCheckHist(TH1D *hist) const
|
---|
1078 | {
|
---|
1079 |
|
---|
1080 | hist->SetDirectory(NULL);
|
---|
1081 |
|
---|
1082 | //
|
---|
1083 | // set the labels bigger
|
---|
1084 | //
|
---|
1085 | TAxis *xaxe = hist->GetXaxis();
|
---|
1086 | TAxis *yaxe = hist->GetYaxis();
|
---|
1087 |
|
---|
1088 | xaxe->CenterTitle();
|
---|
1089 | yaxe->CenterTitle();
|
---|
1090 | xaxe->SetTitleSize(0.06);
|
---|
1091 | yaxe->SetTitleSize(0.06);
|
---|
1092 | xaxe->SetTitleOffset(0.8);
|
---|
1093 | yaxe->SetTitleOffset(0.85);
|
---|
1094 | xaxe->SetLabelSize(0.05);
|
---|
1095 | yaxe->SetLabelSize(0.05);
|
---|
1096 |
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | const Int_t MJCalibration::CountBadPixels ( MHCamera *cam , const Int_t what ) const
|
---|
1100 | {
|
---|
1101 |
|
---|
1102 | Int_t cnt = 0;
|
---|
1103 |
|
---|
1104 | for (UInt_t pix=0; pix<cam->GetNumPixels();pix++)
|
---|
1105 | if ((Int_t)cam->GetPixContent(pix) == what)
|
---|
1106 | cnt++;
|
---|
1107 |
|
---|
1108 | return cnt;
|
---|
1109 | }
|
---|
1110 |
|
---|
1111 |
|
---|
1112 | // --------------------------------------------------------------------------
|
---|
1113 | //
|
---|
1114 | // Find the colour of the pulsing LED:
|
---|
1115 | // - If the run number is smaller than gkIFAEBoxInaugurationRun, take MCalibrationCam::kCT1
|
---|
1116 | // - Otherwise find the colour out of the run name
|
---|
1117 | // - If no colour is found, return kFALSE
|
---|
1118 | //
|
---|
1119 | Bool_t MJCalibration::FindColor()
|
---|
1120 | {
|
---|
1121 | if (fColor != MCalibrationCam::kNONE)
|
---|
1122 | return kTRUE;
|
---|
1123 |
|
---|
1124 | if (fSequence.IsValid())
|
---|
1125 | {
|
---|
1126 | fColor = MCalibrationCam::kCT1;
|
---|
1127 | return kTRUE;
|
---|
1128 | }
|
---|
1129 |
|
---|
1130 | const UInt_t nruns = fRuns->GetNumRuns();
|
---|
1131 | if (nruns == 0)
|
---|
1132 | return kFALSE;
|
---|
1133 |
|
---|
1134 | fRuns->Reset();
|
---|
1135 |
|
---|
1136 | TString filenames;
|
---|
1137 | while (!(filenames=((MDirIter*)fRuns)->Next()).IsNull())
|
---|
1138 | {
|
---|
1139 | MCalibrationCam::PulserColor_t newcolor = MCalibrationCam::kNONE;
|
---|
1140 |
|
---|
1141 | TString number = filenames(TRegexp("[0-9]+_._.+[.]root$"));
|
---|
1142 | Int_t num = atoi(number.Data());
|
---|
1143 |
|
---|
1144 | if (num<gkIFAEBoxInaugurationRun)
|
---|
1145 | newcolor = MCalibrationCam::kCT1;
|
---|
1146 |
|
---|
1147 | switch (num)
|
---|
1148 | {
|
---|
1149 | case 26402:
|
---|
1150 | newcolor = MCalibrationCam::kBLUE;
|
---|
1151 | break;
|
---|
1152 |
|
---|
1153 | case 30090:
|
---|
1154 | case 20660:
|
---|
1155 | case 20661:
|
---|
1156 | case 26408:
|
---|
1157 | case 26409:
|
---|
1158 | case 26412:
|
---|
1159 | case 26568:
|
---|
1160 | case 26924:
|
---|
1161 | newcolor = MCalibrationCam::kGREEN;
|
---|
1162 | break;
|
---|
1163 |
|
---|
1164 | case 27474:
|
---|
1165 | newcolor = MCalibrationCam::kNONE;
|
---|
1166 | *fLog << "Sorry, run 27474 was taken with CLOSED LIDS. It should not be used! " << endl;
|
---|
1167 | return kFALSE;
|
---|
1168 |
|
---|
1169 | default:
|
---|
1170 | if (filenames.Contains("green",TString::kIgnoreCase))
|
---|
1171 | newcolor = MCalibrationCam::kGREEN;
|
---|
1172 | if (filenames.Contains("blue",TString::kIgnoreCase))
|
---|
1173 | newcolor = MCalibrationCam::kBLUE;
|
---|
1174 | if (filenames.Contains("uv",TString::kIgnoreCase))
|
---|
1175 | newcolor = MCalibrationCam::kUV;
|
---|
1176 | if (filenames.Contains("ct1",TString::kIgnoreCase))
|
---|
1177 | newcolor = MCalibrationCam::kCT1;
|
---|
1178 | }
|
---|
1179 |
|
---|
1180 | if (newcolor==MCalibrationCam::kNONE)
|
---|
1181 | {
|
---|
1182 | *fLog << err << "No color found for " << filenames << "... abort." << endl;
|
---|
1183 | return kFALSE;
|
---|
1184 | }
|
---|
1185 |
|
---|
1186 | if (fColor == MCalibrationCam::kNONE)
|
---|
1187 | fColor = newcolor;
|
---|
1188 |
|
---|
1189 | if (fColor != newcolor)
|
---|
1190 | {
|
---|
1191 | *fLog << err << "Color mismatch found in " << filenames << "... abort." << endl;
|
---|
1192 | return kFALSE;
|
---|
1193 | }
|
---|
1194 | }
|
---|
1195 |
|
---|
1196 | *fLog << inf << "Found color: ";
|
---|
1197 | switch (fColor)
|
---|
1198 | {
|
---|
1199 | case MCalibrationCam::kBLUE: *fLog << "kBLUE"; break;
|
---|
1200 | case MCalibrationCam::kGREEN: *fLog << "kGREEN"; break;
|
---|
1201 | case MCalibrationCam::kUV: *fLog << "kUV"; break;
|
---|
1202 | case MCalibrationCam::kCT1: *fLog << "kCT1"; break;
|
---|
1203 | default: *fLog << "<none>"; break;
|
---|
1204 | }
|
---|
1205 | *fLog << endl;
|
---|
1206 |
|
---|
1207 | if (fColor!=MCalibrationCam::kNONE)
|
---|
1208 | return kTRUE;
|
---|
1209 |
|
---|
1210 | *fLog << "No colour found in: " << fRuns->GetRunsAsString() << "... abort." << endl;
|
---|
1211 | return kFALSE;
|
---|
1212 | }
|
---|
1213 |
|
---|
1214 | // --------------------------------------------------------------------------
|
---|
1215 | //
|
---|
1216 | // Retrieve the output file written by WriteResult()
|
---|
1217 | //
|
---|
1218 | const char* MJCalibration::GetOutputFile() const
|
---|
1219 | {
|
---|
1220 | if (fSequence.IsValid())
|
---|
1221 | return Form("%s/calib%06d.root", (const char*)fPathOut, fSequence.GetSequence());
|
---|
1222 | if (!fRuns)
|
---|
1223 | return "";
|
---|
1224 |
|
---|
1225 | return Form("%s/%s-F1.root", (const char*)fPathOut, (const char*)fRuns->GetRunsAsFileName());
|
---|
1226 | }
|
---|
1227 |
|
---|
1228 | Bool_t MJCalibration::IsUseBlindPixel() const
|
---|
1229 | {
|
---|
1230 | return TESTBIT(fDevices,kUseBlindPixel);
|
---|
1231 | }
|
---|
1232 |
|
---|
1233 | Bool_t MJCalibration::IsUsePINDiode() const
|
---|
1234 | {
|
---|
1235 | return TESTBIT(fDevices,kUsePINDiode);
|
---|
1236 | }
|
---|
1237 |
|
---|
1238 | // --------------------------------------------------------------------------
|
---|
1239 | //
|
---|
1240 | // MJCalibration allows to setup several option by a resource file:
|
---|
1241 | // MJCalibration.Display: full, datacheck, normal
|
---|
1242 | // MJCalibration.RelTimeCalibration: yes,no
|
---|
1243 | // MJCalibration.Datacheck: yes,no
|
---|
1244 | // MJCalibration.Debug: yes,no
|
---|
1245 | // MJCalibration.UseBlindPixel: yes,no
|
---|
1246 | // MJCalibration.UsePINDiode: yes,no
|
---|
1247 | //
|
---|
1248 | // For more details see the class description and the corresponding Getters
|
---|
1249 | //
|
---|
1250 | Bool_t MJCalibration::CheckEnvLocal()
|
---|
1251 | {
|
---|
1252 | TString col = GetEnv("Color", "");
|
---|
1253 | if (!col.IsNull())
|
---|
1254 | {
|
---|
1255 | }
|
---|
1256 |
|
---|
1257 | TString dis = GetEnv("Display", "");
|
---|
1258 | if (dis.BeginsWith("Full", TString::kIgnoreCase))
|
---|
1259 | SetFullDisplay();
|
---|
1260 | if (dis.BeginsWith("DataCheck", TString::kIgnoreCase))
|
---|
1261 | SetDataCheckDisplay();
|
---|
1262 | if (dis.BeginsWith("Normal", TString::kIgnoreCase))
|
---|
1263 | SetNormalDisplay();
|
---|
1264 |
|
---|
1265 | SetRelTimeCalibration(GetEnv("RelTimeCalibration", fRelTimes));
|
---|
1266 | SetDataCheck(GetEnv("Datacheck", fDataCheck));
|
---|
1267 | SetDebug(GetEnv("Debug", fDebug));
|
---|
1268 | SetUseBlindPixel(GetEnv("UseBlindPixel", IsUseBlindPixel()));
|
---|
1269 | SetUsePINDiode(GetEnv("UsePINDiode", IsUsePINDiode()));
|
---|
1270 |
|
---|
1271 | return kTRUE;
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | // --------------------------------------------------------------------------
|
---|
1275 | //
|
---|
1276 | // Call the ProcessFile(MPedestalCam)
|
---|
1277 | //
|
---|
1278 | Bool_t MJCalibration::Process(MPedestalCam &pedcam)
|
---|
1279 | {
|
---|
1280 | if (!ReadCalibrationCam())
|
---|
1281 | return ProcessFile(pedcam);
|
---|
1282 |
|
---|
1283 | return kTRUE;
|
---|
1284 | }
|
---|
1285 |
|
---|
1286 | void MJCalibration::InitBlindPixel(MExtractBlindPixel &blindext,
|
---|
1287 | MHCalibrationChargeBlindCam &blindcam)
|
---|
1288 | {
|
---|
1289 |
|
---|
1290 | Int_t run = fSequence.IsValid() ? fSequence.GetLastRun() : fRuns->GetRuns()[fRuns->GetNumRuns()-1];
|
---|
1291 |
|
---|
1292 | //
|
---|
1293 | // Initialize the blind pixel. Unfortunately, there is a hardware difference
|
---|
1294 | // in the first blind pixel until run "gkSecondBlindPixelInstallation" and the
|
---|
1295 | // later setup. The first needs to use a filter because of the length of
|
---|
1296 | // spurious NSB photon signals. The latter get better along extracting the amplitude
|
---|
1297 | // from a small window.
|
---|
1298 | //
|
---|
1299 | if (run < gkSecondBlindPixelInstallation)
|
---|
1300 | {
|
---|
1301 |
|
---|
1302 | MCalibrationChargeBlindCamOneOldStyle blindresults;
|
---|
1303 | blindresults.Copy(fCalibrationBlindCam);
|
---|
1304 |
|
---|
1305 | blindext.SetExtractionType(MExtractBlindPixel::kIntegral);
|
---|
1306 | blindext.SetExtractionType(MExtractBlindPixel::kFilter);
|
---|
1307 | blindext.SetRange(10,19,0,6);
|
---|
1308 | blindext.SetNSBFilterLimit(70);
|
---|
1309 | blindcam.SetFitFunc( MHCalibrationChargeBlindPix::kEPoisson5 );
|
---|
1310 | }
|
---|
1311 | else if (run < gkThirdBlindPixelInstallation)
|
---|
1312 | {
|
---|
1313 |
|
---|
1314 | MCalibrationChargeBlindCamTwoNewStyle blindresults;
|
---|
1315 | blindresults.Copy(fCalibrationBlindCam);
|
---|
1316 |
|
---|
1317 | blindext.SetNumBlindPixels(blindresults.GetNumBlindPixels());
|
---|
1318 | for (UInt_t i=0;i<blindresults.GetNumBlindPixels();i++)
|
---|
1319 | blindext.SetBlindPixelIdx(blindresults[i].GetPixId(),i);
|
---|
1320 |
|
---|
1321 | blindext.SetExtractionType(MExtractBlindPixel::kAmplitude);
|
---|
1322 | blindext.SetExtractionType(MExtractBlindPixel::kFilter);
|
---|
1323 | blindext.SetRange(5,8,0,2);
|
---|
1324 | blindext.SetNSBFilterLimit(38);
|
---|
1325 |
|
---|
1326 | }
|
---|
1327 | else
|
---|
1328 | {
|
---|
1329 | *fLog << err << "Third blind pixel installation not yet completed, check your run number!!! " << endl;
|
---|
1330 | }
|
---|
1331 |
|
---|
1332 | }
|
---|
1333 |
|
---|
1334 | // --------------------------------------------------------------------------
|
---|
1335 | //
|
---|
1336 | // Execute the task list and the eventloop:
|
---|
1337 | //
|
---|
1338 | // - Check if there are fRuns, otherwise return
|
---|
1339 | // - Check the colour of the files in fRuns (FindColor()), otherwise return
|
---|
1340 | // - Check for consistency between run numbers and number of files
|
---|
1341 | // - Add fRuns to MReadMarsFile
|
---|
1342 | // - Put into MParList:
|
---|
1343 | // 1) MPedestalCam (pedcam)
|
---|
1344 | // 2) MCalibrationQECam (fQECam)
|
---|
1345 | // 3) MCalibrationChargeCam (fCalibrationCam)
|
---|
1346 | // 4) MCalibrationRelTimeCam (fRelTimeCam) (only if flag fRelTimes is chosen)
|
---|
1347 | // 5) MBadPixelsCam (fBadPixels)
|
---|
1348 | // 6) MCalibrationChargePINDiode
|
---|
1349 | // 7) MCalibrationChargeBlindPix
|
---|
1350 | // - Put into the MTaskList:
|
---|
1351 | // 1) MReadMarsFile
|
---|
1352 | // 2) MBadPixelsMerge
|
---|
1353 | // 3) MGeomApply
|
---|
1354 | // 4) MExtractor
|
---|
1355 | // 5) MExtractPINDiode
|
---|
1356 | // 6) MExtractBlindPixel
|
---|
1357 | // 7) MExtractTime (only if flag fRelTimes is chosen)
|
---|
1358 | // 8) MContinue(MFCosmics)
|
---|
1359 | // 9) MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode")
|
---|
1360 | // 10) MFillH("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel")
|
---|
1361 | // 11) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam")
|
---|
1362 | // 12) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam")
|
---|
1363 | // 13) MCalibrationChargeCalc
|
---|
1364 | // 14) MFillH("MHCalibrationRelTimeCam", "MArrivalTimeCam") (only if flag fRelTimes is chosen)
|
---|
1365 | // 15) MCalibrationRelTimeCalc
|
---|
1366 | // - Execute MEvtLoop
|
---|
1367 | // - DisplayResult()
|
---|
1368 | // - WriteResult()
|
---|
1369 | //
|
---|
1370 | Bool_t MJCalibration::ProcessFile(MPedestalCam &pedcam)
|
---|
1371 | {
|
---|
1372 | if (!fSequence.IsValid())
|
---|
1373 | {
|
---|
1374 | if (!fRuns)
|
---|
1375 | {
|
---|
1376 | *fLog << err << "No Runs choosen... abort." << endl;
|
---|
1377 | return kFALSE;
|
---|
1378 | }
|
---|
1379 |
|
---|
1380 | if (fRuns->GetNumRuns() != fRuns->GetNumEntries())
|
---|
1381 | {
|
---|
1382 | *fLog << err << "Number of files found doesn't match number of runs... abort."
|
---|
1383 | << fRuns->GetNumRuns() << " vs. " << fRuns->GetNumEntries() << endl;
|
---|
1384 | return kFALSE;
|
---|
1385 | }
|
---|
1386 | }
|
---|
1387 |
|
---|
1388 | //if (!CheckEnv())
|
---|
1389 | // return kFALSE;
|
---|
1390 |
|
---|
1391 | CheckEnv();
|
---|
1392 |
|
---|
1393 | // --------------------------------------------------------------------------------
|
---|
1394 |
|
---|
1395 | *fLog << inf;
|
---|
1396 | fLog->Separator(GetDescriptor());
|
---|
1397 |
|
---|
1398 | if (!FindColor())
|
---|
1399 | return kFALSE;
|
---|
1400 |
|
---|
1401 | *fLog << "Calculate MCalibrationCam from ";
|
---|
1402 | if (fSequence.IsValid())
|
---|
1403 | *fLog << "Sequence #" << fSequence.GetSequence() << endl;
|
---|
1404 | else
|
---|
1405 | *fLog << "Runs " << fRuns->GetRunsAsString() << endl;
|
---|
1406 | *fLog << endl;
|
---|
1407 |
|
---|
1408 | // --------------------------------------------------------------------------------
|
---|
1409 |
|
---|
1410 | // Setup Tasklist
|
---|
1411 | MParList plist;
|
---|
1412 | MTaskList tlist;
|
---|
1413 | plist.AddToList(&tlist);
|
---|
1414 | plist.AddToList(this); // take care of fDisplay!
|
---|
1415 |
|
---|
1416 | MReadMarsFile read("Events");
|
---|
1417 | MRawFileRead rawread(NULL);
|
---|
1418 |
|
---|
1419 | MDirIter iter;
|
---|
1420 | if (fSequence.IsValid())
|
---|
1421 | {
|
---|
1422 | const Int_t n0 = fSequence.SetupCalRuns(iter, fPathData);
|
---|
1423 | const Int_t n1 = fSequence.GetNumCalRuns();
|
---|
1424 | if (n0==0)
|
---|
1425 | {
|
---|
1426 | *fLog << err << "ERROR - No input files of sequence found!" << endl;
|
---|
1427 | return kFALSE;
|
---|
1428 | }
|
---|
1429 | if (n0!=n1)
|
---|
1430 | {
|
---|
1431 | *fLog << err << "ERROR - Number of files found (" << n0 << ") doesn't match number of files in sequence (" << n1 << ")" << endl;
|
---|
1432 | return kFALSE;
|
---|
1433 | }
|
---|
1434 | }
|
---|
1435 |
|
---|
1436 | if (fDataCheck)
|
---|
1437 | {
|
---|
1438 | rawread.AddFiles(fSequence.IsValid() ? iter : *fRuns);
|
---|
1439 | tlist.AddToList(&rawread);
|
---|
1440 | }
|
---|
1441 | else
|
---|
1442 | {
|
---|
1443 | read.DisableAutoScheme();
|
---|
1444 | read.AddFiles(fSequence.IsValid() ? iter : *fRuns);
|
---|
1445 | tlist.AddToList(&read);
|
---|
1446 | }
|
---|
1447 |
|
---|
1448 | MHCalibrationChargeCam chargecam;
|
---|
1449 | MHCalibrationChargeBlindCam blindcam;
|
---|
1450 |
|
---|
1451 | plist.AddToList(&pedcam);
|
---|
1452 | plist.AddToList(&chargecam);
|
---|
1453 | plist.AddToList(&blindcam);
|
---|
1454 | plist.AddToList(&fBadPixels);
|
---|
1455 | plist.AddToList(&fQECam);
|
---|
1456 | plist.AddToList(&fCalibrationCam);
|
---|
1457 | plist.AddToList(&fCalibrationBlindCam);
|
---|
1458 | plist.AddToList(&fCalibrationPINDiode);
|
---|
1459 | plist.AddToList(&fRelTimeCam);
|
---|
1460 |
|
---|
1461 | MGeomApply apply;
|
---|
1462 | MBadPixelsMerge merge(&fBadPixels);
|
---|
1463 | MExtractPINDiode pinext;
|
---|
1464 | MExtractBlindPixel blindext;
|
---|
1465 |
|
---|
1466 | InitBlindPixel(blindext, blindcam);
|
---|
1467 |
|
---|
1468 | MExtractSlidingWindow extract2;
|
---|
1469 | MExtractTimeFastSpline timespline;
|
---|
1470 | MCalibrationChargeCalc calcalc;
|
---|
1471 | MCalibrationRelTimeCalc timecalc;
|
---|
1472 |
|
---|
1473 | if (!fSequence.IsValid())
|
---|
1474 | {
|
---|
1475 | calcalc.SetOutputPath(fPathOut);
|
---|
1476 | calcalc.SetOutputFile(Form("%s-ChargeCalibStat.txt",(const char*)fRuns->GetRunsAsFileName()));
|
---|
1477 | }
|
---|
1478 |
|
---|
1479 | if (fDebug)
|
---|
1480 | {
|
---|
1481 | chargecam.SetDebug();
|
---|
1482 | calcalc.SetDebug();
|
---|
1483 | }
|
---|
1484 |
|
---|
1485 | //
|
---|
1486 | // As long as there are no DM's, have to colour by hand
|
---|
1487 | //
|
---|
1488 | chargecam.SetColor (fColor);
|
---|
1489 | calcalc.SetPulserColor(fColor);
|
---|
1490 |
|
---|
1491 | MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode", "FillPINDiode");
|
---|
1492 | MFillH fillbnd("MHCalibrationChargeBlindCam", "MExtractedSignalBlindPixel", "FillBlindCam");
|
---|
1493 | MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam", "FillChargeCam");
|
---|
1494 | MFillH filltme("MHCalibrationRelTimeCam", "MArrivalTimeCam", "FillRelTime");
|
---|
1495 | fillpin.SetNameTab("PINDiode");
|
---|
1496 | fillbnd.SetNameTab("BlindPix");
|
---|
1497 | fillcam.SetNameTab("Charge");
|
---|
1498 | filltme.SetNameTab("RelTimes");
|
---|
1499 |
|
---|
1500 | TString drawoption;
|
---|
1501 |
|
---|
1502 | if (fDisplayType == kDataCheckDisplay)
|
---|
1503 | drawoption += "datacheck";
|
---|
1504 | if (fDisplayType == kFullDisplay)
|
---|
1505 | drawoption += " all";
|
---|
1506 |
|
---|
1507 | fillcam.SetDrawOption(drawoption.Data());
|
---|
1508 | fillbnd.SetDrawOption(drawoption.Data());
|
---|
1509 | fillpin.SetDrawOption(drawoption.Data());
|
---|
1510 | filltme.SetDrawOption(drawoption.Data());
|
---|
1511 |
|
---|
1512 | //
|
---|
1513 | // Apply a filter against cosmics
|
---|
1514 | // (will have to be needed in the future
|
---|
1515 | // when the calibration hardware-trigger is working)
|
---|
1516 | //
|
---|
1517 | MFCosmics cosmics;
|
---|
1518 | MContinue cont(&cosmics);
|
---|
1519 |
|
---|
1520 | tlist.AddToList(&merge);
|
---|
1521 | tlist.AddToList(&apply);
|
---|
1522 |
|
---|
1523 | MTaskEnv taskenv("ExtractSignal");
|
---|
1524 | taskenv.SetDefault(fExtractor ? fExtractor : &extract2);
|
---|
1525 |
|
---|
1526 | tlist.AddToList(&taskenv);
|
---|
1527 | tlist.AddToList(&pinext);
|
---|
1528 | tlist.AddToList(&blindext);
|
---|
1529 |
|
---|
1530 | MTaskEnv taskenv2("ExtractTime");
|
---|
1531 | taskenv2.SetDefault(fTimeExtractor ? fTimeExtractor : ×pline);
|
---|
1532 |
|
---|
1533 | if (fRelTimes)
|
---|
1534 | tlist.AddToList(&taskenv2);
|
---|
1535 |
|
---|
1536 | if (fColor == MCalibrationCam::kCT1)
|
---|
1537 | tlist.AddToList(&cont);
|
---|
1538 |
|
---|
1539 | tlist.AddToList(&fillcam);
|
---|
1540 |
|
---|
1541 | if (fRelTimes)
|
---|
1542 | {
|
---|
1543 | tlist.AddToList(&filltme);
|
---|
1544 | tlist.AddToList(&timecalc);
|
---|
1545 | }
|
---|
1546 |
|
---|
1547 | if (IsUseBlindPixel())
|
---|
1548 | tlist.AddToList(&fillbnd);
|
---|
1549 | if (IsUsePINDiode())
|
---|
1550 | tlist.AddToList(&fillpin);
|
---|
1551 |
|
---|
1552 | tlist.AddToList(&calcalc);
|
---|
1553 |
|
---|
1554 | // Create and setup the eventloop
|
---|
1555 | MEvtLoop evtloop(fName);
|
---|
1556 | evtloop.SetParList(&plist);
|
---|
1557 | evtloop.SetDisplay(fDisplay);
|
---|
1558 | evtloop.SetLogStream(fLog);
|
---|
1559 | if (!SetupEnv(evtloop))
|
---|
1560 | return kFALSE;
|
---|
1561 |
|
---|
1562 | if (!taskenv.GetTask() && !taskenv2.GetTask())
|
---|
1563 | {
|
---|
1564 | *fLog << err << "ERROR - Neither ExtractSignal nor ExtractTime initialized or both '<dummy>'." << endl;
|
---|
1565 | return kFALSE;
|
---|
1566 | }
|
---|
1567 |
|
---|
1568 | if (!WriteTasks(taskenv.GetTask(), taskenv2.GetTask()))
|
---|
1569 | return kFALSE;
|
---|
1570 |
|
---|
1571 | // Execute first analysis
|
---|
1572 | if (!evtloop.Eventloop())
|
---|
1573 | {
|
---|
1574 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
---|
1575 | return kFALSE;
|
---|
1576 | }
|
---|
1577 |
|
---|
1578 | tlist.PrintStatistics();
|
---|
1579 |
|
---|
1580 | //
|
---|
1581 | // The next lines are necessary in order to avoid that
|
---|
1582 | // the last entry drawn by MFillH gets deleted again from
|
---|
1583 | // the display. No idea where this comes from...
|
---|
1584 | //
|
---|
1585 | // FIND THE REASON! THE NEXT CHANGE SOMEBODY DOES MIGHT RESULT
|
---|
1586 | // IN __YOUR__ WORKAROUN NOT WORKING IF IT IS NOT CLEANLY DONE!
|
---|
1587 | //
|
---|
1588 | // THE AUTHOR OF MFILLH SHOULD FIND THE REASON INSTEAD OF DELETING
|
---|
1589 | // CODE WITHOUT INFORMING THE DATACHECK PEOPLE - SORRY, I SPENT
|
---|
1590 | // TOO MANY DAYS TRYING TO FIND THIS REASON!
|
---|
1591 | //
|
---|
1592 | if (fDisplay)
|
---|
1593 | {
|
---|
1594 | if (IsUsePINDiode())
|
---|
1595 | {
|
---|
1596 | MHCalibrationChargePINDiode *pin =
|
---|
1597 | (MHCalibrationChargePINDiode*)plist.FindObject("MHCalibrationChargePINDiode");
|
---|
1598 | pin->DrawClone(Form("nonew %s",drawoption.Data()));
|
---|
1599 | }
|
---|
1600 | else if (IsUseBlindPixel())
|
---|
1601 | {
|
---|
1602 | MHCalibrationChargeBlindCam *cam =
|
---|
1603 | (MHCalibrationChargeBlindCam*)plist.FindObject("MHCalibrationChargeBlindCam");
|
---|
1604 | cam->DrawClone(Form("nonew %s",drawoption.Data()));
|
---|
1605 | }
|
---|
1606 | else if (fRelTimes)
|
---|
1607 | {
|
---|
1608 | MHCalibrationRelTimeCam *cam =
|
---|
1609 | (MHCalibrationRelTimeCam*)plist.FindObject("MHCalibrationRelTimeCam");
|
---|
1610 | cam->DrawClone(Form("nonew %s",drawoption.Data()));
|
---|
1611 | }
|
---|
1612 | else
|
---|
1613 | {
|
---|
1614 | MHCalibrationChargeCam *cam =
|
---|
1615 | (MHCalibrationChargeCam*)plist.FindObject("MHCalibrationChargeCam");
|
---|
1616 | cam->DrawClone(Form("nonew %s",drawoption.Data()));
|
---|
1617 | }
|
---|
1618 | }
|
---|
1619 |
|
---|
1620 | DisplayResult(plist);
|
---|
1621 |
|
---|
1622 | if (!WriteResult())
|
---|
1623 | return kFALSE;
|
---|
1624 |
|
---|
1625 | *fLog << all << GetDescriptor() << ": Done." << endl;
|
---|
1626 |
|
---|
1627 | return kTRUE;
|
---|
1628 | }
|
---|
1629 |
|
---|
1630 | // --------------------------------------------------------------------------
|
---|
1631 | //
|
---|
1632 | // Read the following containers from GetOutputFile()
|
---|
1633 | // - MCalibrationChargeCam
|
---|
1634 | // - MCalibrationQECam
|
---|
1635 | // - MBadPixelsCam
|
---|
1636 | //
|
---|
1637 | Bool_t MJCalibration::ReadCalibrationCam()
|
---|
1638 | {
|
---|
1639 | const TString fname = GetOutputFile();
|
---|
1640 |
|
---|
1641 | if (gSystem->AccessPathName(fname, kFileExists))
|
---|
1642 | {
|
---|
1643 | *fLog << err << "Input file " << fname << " doesn't exist." << endl;
|
---|
1644 | return kFALSE;
|
---|
1645 | }
|
---|
1646 |
|
---|
1647 | *fLog << inf << "Reading from file: " << fname << endl;
|
---|
1648 |
|
---|
1649 | TFile file(fname, "READ");
|
---|
1650 | if (fCalibrationCam.Read()<=0)
|
---|
1651 | {
|
---|
1652 | *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
|
---|
1653 | return kFALSE;
|
---|
1654 | }
|
---|
1655 |
|
---|
1656 | if (fQECam.Read()<=0)
|
---|
1657 | {
|
---|
1658 | *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
|
---|
1659 | return kFALSE;
|
---|
1660 | }
|
---|
1661 |
|
---|
1662 |
|
---|
1663 | if (file.FindKey("MCalibrationRelTimeCam"))
|
---|
1664 | if (fRelTimeCam.Read()<=0)
|
---|
1665 | {
|
---|
1666 | *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
|
---|
1667 | return kFALSE;
|
---|
1668 | }
|
---|
1669 |
|
---|
1670 | if (file.FindKey("MBadPixelsCam"))
|
---|
1671 | {
|
---|
1672 | MBadPixelsCam bad;
|
---|
1673 | if (bad.Read()<=0)
|
---|
1674 | {
|
---|
1675 | *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
|
---|
1676 | return kFALSE;
|
---|
1677 | }
|
---|
1678 | fBadPixels.Merge(bad);
|
---|
1679 | }
|
---|
1680 |
|
---|
1681 | if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
|
---|
1682 | fDisplay->Read();
|
---|
1683 |
|
---|
1684 | return kTRUE;
|
---|
1685 | }
|
---|
1686 |
|
---|
1687 |
|
---|
1688 | // --------------------------------------------------------------------------
|
---|
1689 | //
|
---|
1690 | // Set the useage of the Blind Pixel device
|
---|
1691 | //
|
---|
1692 | void MJCalibration::SetUseBlindPixel(const Bool_t b)
|
---|
1693 | {
|
---|
1694 | b ? SETBIT(fDevices,kUseBlindPixel) : CLRBIT(fDevices,kUseBlindPixel);
|
---|
1695 | }
|
---|
1696 |
|
---|
1697 | // --------------------------------------------------------------------------
|
---|
1698 | //
|
---|
1699 | // Set the useage of the PIN Diode device
|
---|
1700 | //
|
---|
1701 | void MJCalibration::SetUsePINDiode(const Bool_t b)
|
---|
1702 | {
|
---|
1703 | b ? SETBIT(fDevices,kUsePINDiode) : CLRBIT(fDevices,kUsePINDiode);
|
---|
1704 | }
|
---|
1705 |
|
---|
1706 | Bool_t MJCalibration::WriteEventloop(MEvtLoop &evtloop) const
|
---|
1707 | {
|
---|
1708 | if (fPathOut.IsNull())
|
---|
1709 | return kTRUE;
|
---|
1710 |
|
---|
1711 | const TString oname(GetOutputFile());
|
---|
1712 |
|
---|
1713 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
1714 |
|
---|
1715 | TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
|
---|
1716 | if (!file.IsOpen())
|
---|
1717 | {
|
---|
1718 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
---|
1719 | return kFALSE;
|
---|
1720 | }
|
---|
1721 |
|
---|
1722 | if (evtloop.Write(fName)<=0)
|
---|
1723 | {
|
---|
1724 | *fLog << err << "Unable to write MEvtloop to " << oname << endl;
|
---|
1725 | return kFALSE;
|
---|
1726 | }
|
---|
1727 |
|
---|
1728 | return kTRUE;
|
---|
1729 | }
|
---|
1730 |
|
---|
1731 | Bool_t MJCalibration::WriteTasks(MTask *t1, MTask *t2) const
|
---|
1732 | {
|
---|
1733 | if (fPathOut.IsNull())
|
---|
1734 | return kTRUE;
|
---|
1735 |
|
---|
1736 | const TString oname(GetOutputFile());
|
---|
1737 |
|
---|
1738 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
1739 |
|
---|
1740 | TFile file(oname, fOverwrite?"RECREATE":"NEW", "File created by MJCalibration", 9);
|
---|
1741 | if (!file.IsOpen())
|
---|
1742 | {
|
---|
1743 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
---|
1744 | return kFALSE;
|
---|
1745 | }
|
---|
1746 |
|
---|
1747 | if (t1 && t1->Write()<=0)
|
---|
1748 | {
|
---|
1749 | *fLog << err << "Unable to write " << t1->GetName() << " to " << oname << endl;
|
---|
1750 | return kFALSE;
|
---|
1751 | }
|
---|
1752 | if (t2 && t2->Write()<=0)
|
---|
1753 | {
|
---|
1754 | *fLog << err << "Unable to write " << t2->GetName() << " to " << oname << endl;
|
---|
1755 | return kFALSE;
|
---|
1756 | }
|
---|
1757 |
|
---|
1758 | return kTRUE;
|
---|
1759 | }
|
---|
1760 |
|
---|
1761 | // --------------------------------------------------------------------------
|
---|
1762 | //
|
---|
1763 | // Write the result into the output file GetOutputFile(), if fOutputPath exists.
|
---|
1764 | //
|
---|
1765 | // The following containers are written:
|
---|
1766 | // - MStatusDisplay
|
---|
1767 | // - MCalibrationChargeCam
|
---|
1768 | // - MCalibrationChargeBlindPix
|
---|
1769 | // - MCalibrationQECam
|
---|
1770 | // - MBadPixelsCam
|
---|
1771 | //
|
---|
1772 | Bool_t MJCalibration::WriteResult()
|
---|
1773 | {
|
---|
1774 | if (fPathOut.IsNull())
|
---|
1775 | return kTRUE;
|
---|
1776 |
|
---|
1777 | const TString oname(GetOutputFile());
|
---|
1778 |
|
---|
1779 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
1780 |
|
---|
1781 | TFile file(oname, "UPDATE", "File created by MJCalibration", 9);
|
---|
1782 | if (!file.IsOpen())
|
---|
1783 | {
|
---|
1784 | *fLog << err << "ERROR - Couldn't open file " << oname << " for writing..." << endl;
|
---|
1785 | return kFALSE;
|
---|
1786 | }
|
---|
1787 |
|
---|
1788 | *fLog << inf << " - MStatusDisplay..." << flush;
|
---|
1789 | if (fDisplay && fDisplay->Write()<=0)
|
---|
1790 | {
|
---|
1791 | *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
|
---|
1792 | return kFALSE;
|
---|
1793 | }
|
---|
1794 | *fLog << inf << "ok." << endl;
|
---|
1795 |
|
---|
1796 | *fLog << inf << " - MCalibrationChargeCam..." << flush;
|
---|
1797 | if (fCalibrationCam.Write()<=0)
|
---|
1798 | {
|
---|
1799 | *fLog << err << "Unable to write MCalibrationChargeCam to " << oname << endl;
|
---|
1800 | return kFALSE;
|
---|
1801 | }
|
---|
1802 | *fLog << inf << "ok." << endl;
|
---|
1803 |
|
---|
1804 | *fLog << inf << " - MCalibrationChargeBlindCam..." << flush;
|
---|
1805 | if (fCalibrationBlindCam.Write()<=0)
|
---|
1806 | {
|
---|
1807 | *fLog << err << "Unable to write MCalibrationChargeBlindCam to " << oname << endl;
|
---|
1808 | return kFALSE;
|
---|
1809 | }
|
---|
1810 | *fLog << inf << "ok." << endl;
|
---|
1811 |
|
---|
1812 | *fLog << inf << " - MCalibrationChargePINDiode..." << flush;
|
---|
1813 | if (fCalibrationPINDiode.Write()<=0)
|
---|
1814 | {
|
---|
1815 | *fLog << err << "Unable to write MCalibrationChargePINDiode to " << oname << endl;
|
---|
1816 | return kFALSE;
|
---|
1817 | }
|
---|
1818 | *fLog << inf << "ok." << endl;
|
---|
1819 |
|
---|
1820 | *fLog << inf << " - MCalibrationQECam..." << flush;
|
---|
1821 | if (fQECam.Write()<=0)
|
---|
1822 | {
|
---|
1823 | *fLog << err << "Unable to write MCalibrationQECam to " << oname << endl;
|
---|
1824 | return kFALSE;
|
---|
1825 | }
|
---|
1826 | *fLog << inf << "ok." << endl;
|
---|
1827 |
|
---|
1828 | *fLog << inf << " - MBadPixelsCam..." << flush;
|
---|
1829 | if (fBadPixels.Write()<=0)
|
---|
1830 | {
|
---|
1831 | *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl;
|
---|
1832 | return kFALSE;
|
---|
1833 | }
|
---|
1834 | *fLog << inf << "ok." << endl;
|
---|
1835 |
|
---|
1836 | if (fRelTimes)
|
---|
1837 | {
|
---|
1838 | *fLog << inf << " - MCalibrationRelTimeCam..." << flush;
|
---|
1839 | if (fRelTimeCam.Write()<=0)
|
---|
1840 | {
|
---|
1841 | *fLog << err << "Unable to write MCalibrationRelTimeCam to " << oname << endl;
|
---|
1842 | return kFALSE;
|
---|
1843 | }
|
---|
1844 | *fLog << inf << "ok." << endl;
|
---|
1845 | }
|
---|
1846 |
|
---|
1847 | return kTRUE;
|
---|
1848 |
|
---|
1849 | }
|
---|
1850 |
|
---|
1851 | void MJCalibration::DisplayDoubleProject(MHCamera *cam, const char* whatsmall, const char* whatbig) const
|
---|
1852 | {
|
---|
1853 |
|
---|
1854 | TArrayI inner(1);
|
---|
1855 | inner[0] = 0;
|
---|
1856 |
|
---|
1857 | TArrayI outer(1);
|
---|
1858 | outer[0] = 1;
|
---|
1859 |
|
---|
1860 | TArrayI s0(6);
|
---|
1861 | s0[0] = 6;
|
---|
1862 | s0[1] = 1;
|
---|
1863 | s0[2] = 2;
|
---|
1864 | s0[3] = 3;
|
---|
1865 | s0[4] = 4;
|
---|
1866 | s0[5] = 5;
|
---|
1867 |
|
---|
1868 | TArrayI s1(3);
|
---|
1869 | s1[0] = 6;
|
---|
1870 | s1[1] = 1;
|
---|
1871 | s1[2] = 2;
|
---|
1872 |
|
---|
1873 | TArrayI s2(3);
|
---|
1874 | s2[0] = 3;
|
---|
1875 | s2[1] = 4;
|
---|
1876 | s2[2] = 5;
|
---|
1877 |
|
---|
1878 | TVirtualPad *pad = gPad;
|
---|
1879 | pad->Divide(2,1);
|
---|
1880 |
|
---|
1881 | TH1D *inout[2];
|
---|
1882 | inout[0] = cam->ProjectionS(s0, inner, "Inner");
|
---|
1883 | inout[1] = cam->ProjectionS(s0, outer, "Outer");
|
---|
1884 | FixDataCheckHist(inout[0]);
|
---|
1885 | FixDataCheckHist(inout[1]);
|
---|
1886 |
|
---|
1887 | inout[0]->SetTitle(Form("%s %s",cam->GetTitle(),"Inner"));
|
---|
1888 | inout[1]->SetTitle(Form("%s %s",cam->GetTitle(),"Outer"));
|
---|
1889 |
|
---|
1890 | for (int i=0; i<2; i++)
|
---|
1891 | {
|
---|
1892 | pad->cd(i+1);
|
---|
1893 | gPad->SetBorderMode(0);
|
---|
1894 | gPad->SetTicks();
|
---|
1895 |
|
---|
1896 | inout[i]->SetDirectory(NULL);
|
---|
1897 | inout[i]->SetLineColor(kRed+i);
|
---|
1898 | inout[i]->SetBit(kCanDelete);
|
---|
1899 | inout[i]->Draw();
|
---|
1900 | inout[i]->Fit("gaus", "Q");
|
---|
1901 | gPad->Modified();
|
---|
1902 | gPad->Update();
|
---|
1903 | TPaveStats *st = (TPaveStats*)inout[i]->GetListOfFunctions()->FindObject("stats");
|
---|
1904 | st->SetY1NDC(0.6);
|
---|
1905 | st->SetY2NDC(0.9);
|
---|
1906 | st->SetX1NDC(0.55);
|
---|
1907 | st->SetX2NDC(0.99);
|
---|
1908 | gPad->Modified();
|
---|
1909 | gPad->Update();
|
---|
1910 |
|
---|
1911 | TLegend *leg2 = new TLegend(0.55,0.4,0.99,0.6);
|
---|
1912 | //
|
---|
1913 | // Display the outliers as dead and noisy pixels
|
---|
1914 | //
|
---|
1915 | DisplayOutliers(inout[i],whatsmall,whatbig);
|
---|
1916 |
|
---|
1917 | //
|
---|
1918 | // Display the two half of the camera separately
|
---|
1919 | //
|
---|
1920 | TH1D *half[2];
|
---|
1921 | half[0] = cam->ProjectionS(s1, i==0 ? inner : outer , "Sector 6-1-2");
|
---|
1922 | half[1] = cam->ProjectionS(s2, i==0 ? inner : outer , "Sector 3-4-5");
|
---|
1923 |
|
---|
1924 | for (int j=0; j<2; j++)
|
---|
1925 | {
|
---|
1926 | half[j]->SetLineColor(kRed+i+2*j+1);
|
---|
1927 | half[j]->SetDirectory(NULL);
|
---|
1928 | half[j]->SetBit(kCanDelete);
|
---|
1929 | half[j]->Draw("same");
|
---|
1930 | leg2->AddEntry(half[j], half[j]->GetName(), "l");
|
---|
1931 | }
|
---|
1932 | leg2->Draw();
|
---|
1933 | }
|
---|
1934 | }
|
---|