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