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