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