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