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