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