source: trunk/MagicSoft/Mars/mjobs/MJCalibration.cc@ 4234

Last change on this file since 4234 was 4219, checked in by rico, 20 years ago
*** empty log message ***
File size: 40.3 KB
Line 
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 <TFile.h>
90#include <TStyle.h>
91#include <TCanvas.h>
92#include <TSystem.h>
93
94#include "MLog.h"
95#include "MLogManip.h"
96
97#include "MRunIter.h"
98#include "MParList.h"
99#include "MTaskList.h"
100#include "MEvtLoop.h"
101
102#include "MHCamera.h"
103#include "MGeomCam.h"
104
105#include "MPedestalCam.h"
106#include "MCalibrationCam.h"
107#include "MCalibrationQECam.h"
108#include "MCalibrationChargeCam.h"
109#include "MCalibrationChargePINDiode.h"
110#include "MCalibrationChargeBlindPix.h"
111#include "MCalibrationChargeCalc.h"
112
113#include "MHGausEvents.h"
114#include "MHCalibrationCam.h"
115#include "MHCalibrationChargeCam.h"
116#include "MHCalibrationChargeBlindPix.h"
117#include "MHCalibrationRelTimeCam.h"
118#include "MCalibrationRelTimeCam.h"
119#include "MCalibrationRelTimeCalc.h"
120
121#include "MReadMarsFile.h"
122#include "MRawFileRead.h"
123#include "MGeomApply.h"
124#include "MBadPixelsMerge.h"
125#include "MBadPixelsCam.h"
126#include "MExtractTime.h"
127#include "MExtractor.h"
128#include "MExtractPINDiode.h"
129#include "MExtractBlindPixel.h"
130#include "MExtractSlidingWindow.h"
131#include "MExtractTimeSpline.h"
132#include "MFCosmics.h"
133#include "MContinue.h"
134#include "MFillH.h"
135
136#include "MArrivalTimeCam.h"
137
138#include "MStatusDisplay.h"
139
140ClassImp(MJCalibration);
141
142using namespace std;
143
144const Int_t MJCalibration::gkIFAEBoxInaugurationRun = 20113;
145// --------------------------------------------------------------------------
146//
147// Default constructor.
148//
149// - Sets fRuns to 0, fExtractor to NULL, fTimeExtractor to NULL, fColor to kNONE,
150// fDisplay to kNormalDisplay, fRelTime to kFALSE, fDataCheck to kFALSE,
151// - SetUseBlindPixel()
152// - SetUsePINDiode()
153//
154MJCalibration::MJCalibration(const char *name, const char *title)
155 : fRuns(0), fExtractor(NULL), fTimeExtractor(NULL),
156 fColor(MCalibrationCam::kNONE), fDisplayType(kNormalDisplay),
157 fRelTimes(kFALSE), fDataCheck(kFALSE)
158{
159
160 fName = name ? name : "MJCalibration";
161 fTitle = title ? title : "Tool to create the calibration constants for one calibration run";
162
163 SetUseBlindPixel();
164 SetUsePINDiode();
165
166}
167
168
169// --------------------------------------------------------------------------
170//
171// Display the results in MStatusDisplay:
172//
173// - Add "Calibration" to the MStatusDisplay title
174// - Retrieve the MGeomCam from MParList
175// - Initialize the following MHCamera's:
176// 1) MCalibrationPix::GetMean()
177// 2) MCalibrationPix::Sigma()
178// 3) MCalibrationChargePix::GetRSigma()
179// 4) MCalibrationChargePix::GetRSigmaPerCharge()
180// 5) MCalibrationChargePix::GetPheFFactorMethod()
181// 6) MCalibrationChargePix::GetMeanConvFADC2Phe()
182// 7) MCalibrationChargePix::GetMeanFFactorFADC2Phot()
183// 8) MCalibrationQEPix::GetQECascadesFFactor()
184// 9) MCalibrationQEPix::GetQECascadesBlindPixel()
185// 10) MCalibrationQEPix::GetQECascadesPINDiode()
186// 11) MCalibrationQEPix::GetQECascadesCombined()
187// 12) MCalibrationQEPix::IsAverageQEFFactorAvailable()
188// 13) MCalibrationQEPix::IsAverageQEBlindPixelAvailable()
189// 14) MCalibrationQEPix::IsAverageQEPINDiodeAvailable()
190// 15) MCalibrationQEPix::IsAverageQECombinedAvailable()
191// 16) MCalibrationChargePix::IsHiGainSaturation()
192// 17) MCalibrationPix::GetHiLoMeansDivided()
193// 18) MCalibrationPix::GetHiLoSigmasDivided()
194// 19) MCalibrationChargePix::GetHiGainPickup()
195// 20) MCalibrationChargePix::GetLoGainPickup()
196// 21) MCalibrationChargePix::GetHiGainBlackout()
197// 22) MCalibrationChargePix::GetLoGainBlackout()
198// 23) MCalibrationPix::IsExcluded()
199// 24) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnsuitableRun)
200// 25) MBadPixelsPix::IsUnsuitable(MBadPixelsPix::kUnreliableRun)
201// 26) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainOscillating)
202// 27) MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kLoGainOscillating)
203// 28) MCalibrationChargePix::GetAbsTimeMean()
204// 29) MCalibrationChargePix::GetAbsTimeRms()
205//
206// If the flag SetFullDisplay() is set, all MHCameras will be displayed.
207// if the flag SetDataCheckDisplay() is set, only the most important ones are displayed
208// and otherwise, (default: SetNormalDisplay()), a good selection of plots is given
209//
210void MJCalibration::DisplayResult(MParList &plist)
211{
212 if (!fDisplay)
213 return;
214
215 //
216 // Update display
217 //
218 TString title = fDisplay->GetTitle();
219 title += "-- Calibration ";
220 title += fRuns->GetRunsAsString();
221 title += " --";
222 fDisplay->SetTitle(title);
223
224 //
225 // Get container from list
226 //
227 MGeomCam &geomcam = *(MGeomCam*)plist.FindObject("MGeomCam");
228
229 // Create histograms to display
230 MHCamera disp1 (geomcam, Form("%s%s","Charge",(fRuns->GetRunsAsFileName()).Data()),
231 "Fitted Mean Charges");
232 MHCamera disp2 (geomcam, Form("%s%s","SigmaCharge",(fRuns->GetRunsAsFileName()).Data()),
233 "Sigma of Fitted Charges");
234 MHCamera disp3 (geomcam, Form("%s%s","RSigma",(fRuns->GetRunsAsFileName()).Data()),
235 "Reduced Sigmas");
236 MHCamera disp4 (geomcam, Form("%s%s","RSigmaPerCharge",(fRuns->GetRunsAsFileName()).Data()),
237 "Reduced Sigma per Charge");
238 MHCamera disp5 (geomcam, Form("%s%s","NumPhes",(fRuns->GetRunsAsFileName()).Data()),
239 "Nr. of Phe's (F-Factor Method)");
240 MHCamera disp6 (geomcam, Form("%s%s","ConvFADC2Phes",(fRuns->GetRunsAsFileName()).Data()),
241 "Conversion Factor (F-Factor Method)");
242 MHCamera disp7 (geomcam, Form("%s%s","TotalFFactor",(fRuns->GetRunsAsFileName()).Data()),
243 "Total F-Factor (F-Factor Method)");
244 MHCamera disp8 (geomcam, Form("%s%s","CascadesQEFFactor",(fRuns->GetRunsAsFileName()).Data()),
245 "Cascades QE (F-Factor Method)");
246 MHCamera disp9 (geomcam, Form("%s%s","CascadesQEBlindPix",(fRuns->GetRunsAsFileName()).Data()),
247 "Cascades QE (Blind Pixel Method)");
248 MHCamera disp10(geomcam, Form("%s%s","CascadesQEPINDiode",(fRuns->GetRunsAsFileName()).Data()),
249 "Cascades QE (PIN Diode Method)");
250 MHCamera disp11(geomcam, Form("%s%s","CascadesQECombined",(fRuns->GetRunsAsFileName()).Data()),
251 "Cascades QE (Combined Method)");
252 MHCamera disp12(geomcam, Form("%s%s","FFactorValid",(fRuns->GetRunsAsFileName()).Data()),
253 "Pixels with valid F-Factor calibration");
254 MHCamera disp13(geomcam, Form("%s%s","BlindPixelValid",(fRuns->GetRunsAsFileName()).Data()),
255 "Pixels with valid BlindPixel calibration");
256 MHCamera disp14(geomcam, Form("%s%s","PINdiodeValid",(fRuns->GetRunsAsFileName()).Data()),
257 "Pixels with valid PINDiode calibration");
258 MHCamera disp15(geomcam, Form("%s%s","CombinedValid",(fRuns->GetRunsAsFileName()).Data()),
259 "Pixels with valid Combined calibration");
260 MHCamera disp16(geomcam, Form("%s%s","Saturation",(fRuns->GetRunsAsFileName()).Data()),
261 "Pixels with saturated Hi Gain");
262 MHCamera disp17(geomcam, Form("%s%s","ConversionMeans",(fRuns->GetRunsAsFileName()).Data()),
263 "Conversion HiGain.vs.LoGain Means");
264 MHCamera disp18(geomcam, Form("%s%s","ConversionSigmas",(fRuns->GetRunsAsFileName()).Data()),
265 "Conversion HiGain.vs.LoGain Sigmas");
266 MHCamera disp19(geomcam, Form("%s%s","HiGainPickup",(fRuns->GetRunsAsFileName()).Data()),
267 "Number Pickup events Hi Gain");
268 MHCamera disp20(geomcam, Form("%s%s","LoGainPickup",(fRuns->GetRunsAsFileName()).Data()),
269 "Number Pickup events Lo Gain");
270 MHCamera disp21(geomcam, Form("%s%s","HiGainBlackout",(fRuns->GetRunsAsFileName()).Data()),
271 "Number Blackout events Hi Gain");
272 MHCamera disp22(geomcam, Form("%s%s","LoGainBlackout",(fRuns->GetRunsAsFileName()).Data()),
273 "Number Blackout events Lo Gain");
274 MHCamera disp23(geomcam, Form("%s%s","Excluded",(fRuns->GetRunsAsFileName()).Data()),
275 "Pixels previously excluded");
276 MHCamera disp24(geomcam, Form("%s%s","UnSuitable",(fRuns->GetRunsAsFileName()).Data()),
277 "Pixels not suited for further analysis");
278 MHCamera disp25(geomcam, Form("%s%s","UnReliable",(fRuns->GetRunsAsFileName()).Data()),
279 "Pixels not reliable for further analysis");
280 MHCamera disp26(geomcam, Form("%s%s","HiGainOscillating",(fRuns->GetRunsAsFileName()).Data()),
281 "Oscillating Pixels High Gain");
282 MHCamera disp27(geomcam, Form("%s%s","LoGainOscillating",(fRuns->GetRunsAsFileName()).Data()),
283 "Oscillating Pixels Low Gain");
284 MHCamera disp28(geomcam, Form("%s%s","AbsTimeMean",(fRuns->GetRunsAsFileName()).Data()),
285 "Abs. Arrival Times");
286 MHCamera disp29(geomcam, Form("%s%s","AbsTimeRms",(fRuns->GetRunsAsFileName()).Data()),
287 "RMS of Arrival Times");
288 MHCamera disp30(geomcam, Form("%s%s","MeanTime",(fRuns->GetRunsAsFileName()).Data()),
289 "Mean Rel. Arrival Times");
290 MHCamera disp31(geomcam, Form("%s%s","SigmaTime",(fRuns->GetRunsAsFileName()).Data()),
291 "Sigma Rel. Arrival Times");
292 MHCamera disp32(geomcam, Form("%s%s","TimeProb",(fRuns->GetRunsAsFileName()).Data()),
293 "Probability of Time Fit");
294 MHCamera disp33(geomcam, Form("%s%s","TimeNotFitValid",(fRuns->GetRunsAsFileName()).Data()),
295 "Pixels with not valid fit results");
296 MHCamera disp34(geomcam, Form("%s%s","TimeOscillating",(fRuns->GetRunsAsFileName()).Data()),
297 "Oscillating Pixels");
298
299 // Fitted charge means and sigmas
300 disp1.SetCamContent(fCalibrationCam, 0);
301 disp1.SetCamError( fCalibrationCam, 1);
302 disp2.SetCamContent(fCalibrationCam, 2);
303 disp2.SetCamError( fCalibrationCam, 3);
304
305 // Reduced Sigmas and reduced sigmas per charge
306 disp3.SetCamContent(fCalibrationCam, 5);
307 disp3.SetCamError( fCalibrationCam, 6);
308 disp4.SetCamContent(fCalibrationCam, 7);
309 disp4.SetCamError( fCalibrationCam, 8);
310
311 // F-Factor Method
312 disp5.SetCamContent(fCalibrationCam, 9);
313 disp5.SetCamError( fCalibrationCam, 10);
314 disp6.SetCamContent(fCalibrationCam, 11);
315 disp6.SetCamError( fCalibrationCam, 12);
316 disp7.SetCamContent(fCalibrationCam, 13);
317 disp7.SetCamError( fCalibrationCam, 14);
318
319 // Quantum Efficiencies
320 disp8.SetCamContent (fQECam, 0 );
321 disp8.SetCamError (fQECam, 1 );
322 disp9.SetCamContent (fQECam, 2 );
323 disp9.SetCamError (fQECam, 3 );
324 disp10.SetCamContent(fQECam, 4 );
325 disp10.SetCamError (fQECam, 5 );
326 disp11.SetCamContent(fQECam, 6 );
327 disp11.SetCamError (fQECam, 7 );
328
329 // Valid flags
330 disp12.SetCamContent(fQECam, 8 );
331 disp13.SetCamContent(fQECam, 9 );
332 disp14.SetCamContent(fQECam, 10);
333 disp15.SetCamContent(fQECam, 11);
334
335 // Conversion Hi-Lo
336 disp16.SetCamContent(fCalibrationCam, 25);
337 disp17.SetCamContent(fCalibrationCam, 16);
338 disp17.SetCamError (fCalibrationCam, 17);
339 disp18.SetCamContent(fCalibrationCam, 18);
340 disp18.SetCamError (fCalibrationCam, 19);
341
342 // Pickup and Blackout
343 disp19.SetCamContent(fCalibrationCam, 21);
344 disp20.SetCamContent(fCalibrationCam, 22);
345 disp21.SetCamContent(fCalibrationCam, 23);
346 disp22.SetCamContent(fCalibrationCam, 24);
347
348 // Pixels with defects
349 disp23.SetCamContent(fCalibrationCam, 20);
350 disp24.SetCamContent(fBadPixels, 1);
351 disp25.SetCamContent(fBadPixels, 3);
352
353 // Oscillations
354 disp26.SetCamContent(fBadPixels, 10);
355 disp27.SetCamContent(fBadPixels, 11);
356
357 // Arrival Times
358 disp28.SetCamContent(fCalibrationCam, 26);
359 disp28.SetCamError( fCalibrationCam, 27);
360 disp29.SetCamContent(fCalibrationCam, 27);
361
362 disp1.SetYTitle("Q [FADC counts]");
363 disp2.SetYTitle("\\sigma_{Q} [FADC counts]");
364
365 disp3.SetYTitle("\\sqrt{\\sigma^{2}_{Q} - RMS^{2}_{Ped}} [FADC Counts]");
366 disp4.SetYTitle("Red.Sigma/<Q> [1]");
367
368 disp5.SetYTitle("Nr. Phe's [1]");
369 disp6.SetYTitle("Conv.Factor [PhE/FADC counts]");
370 disp7.SetYTitle("Total F-Factor [1]");
371
372 disp8.SetYTitle("QE [1]");
373 disp9.SetYTitle("QE [1]");
374 disp10.SetYTitle("QE [1]");
375 disp11.SetYTitle("QE [1]");
376
377 disp12.SetYTitle("[1]");
378 disp13.SetYTitle("[1]");
379 disp14.SetYTitle("[1]");
380 disp15.SetYTitle("[1]");
381 disp16.SetYTitle("[1]");
382
383 disp17.SetYTitle("<Q>(High)/<Q>(Low) [1]");
384 disp18.SetYTitle("\\sigma_{Q}(High)/\\sigma_{Q}(Low) [1]");
385
386 disp19.SetYTitle("[1]");
387 disp20.SetYTitle("[1]");
388 disp21.SetYTitle("[1]");
389 disp22.SetYTitle("[1]");
390 disp23.SetYTitle("[1]");
391 disp24.SetYTitle("[1]");
392 disp25.SetYTitle("[1]");
393 disp26.SetYTitle("[1]");
394 disp27.SetYTitle("[1]");
395
396 disp28.SetYTitle("Mean Abs. Time [FADC slice]");
397 disp29.SetYTitle("RMS Abs. Time [FADC slices]");
398
399 if (fRelTimes)
400 {
401
402 disp30.SetCamContent(fRelTimeCam,0);
403 disp30.SetCamError( fRelTimeCam,1);
404 disp31.SetCamContent(fRelTimeCam,2);
405 disp31.SetCamError( fRelTimeCam,3);
406 disp32.SetCamContent(fRelTimeCam,4);
407 disp33.SetCamContent(fBadPixels,20);
408 disp34.SetCamContent(fBadPixels,21);
409
410 disp30.SetYTitle("Time Offset [FADC units]");
411 disp31.SetYTitle("Timing resolution [FADC units]");
412 disp32.SetYTitle("P_{Time} [1]");
413 disp33.SetYTitle("[1]");
414 disp34.SetYTitle("[1]");
415 }
416
417 if (fDisplayType == kDataCheckDisplay)
418 {
419 TCanvas &c1 = fDisplay->AddTab("Fit.Charge");
420 c1.Divide(3, 3);
421
422 disp1.CamDraw(c1, 1, 3, 2);
423 disp4.CamDraw(c1, 2, 3, 2);
424 disp28.CamDraw(c1, 3, 3, 2);
425
426 // F-Factor
427 TCanvas &c2 = fDisplay->AddTab("Phe's");
428 c2.Divide(3,4);
429
430 disp6.CamDraw(c2, 1, 3, 2, 1);
431 disp7.CamDraw(c2, 2, 3, 2, 1);
432 disp8.CamDraw(c2, 3, 3, 2, 1);
433
434 // QE's
435 TCanvas &c3 = fDisplay->AddTab("QE's");
436 c3.Divide(3,4);
437
438 disp8.CamDraw(c3, 1, 3, 2, 1);
439 disp9.CamDraw(c3, 2, 3, 2, 1);
440 disp10.CamDraw(c3, 3, 3, 2, 1);
441
442 // Defects
443 TCanvas &c4 = fDisplay->AddTab("Defect");
444 // c4.Divide(3,2);
445 c4.Divide(2,2);
446
447 // CamDraw(c4, 1, 3, disp23, 0);
448 // CamDraw(c4, 2, 3, disp24, 0);
449 // CamDraw(c4, 3, 3, disp25, 0);
450 disp24.CamDraw(c4, 1, 2, 0);
451 disp25.CamDraw(c4, 2, 2, 0);
452
453 if (fRelTimes)
454 {
455 // Rel. Times
456 TCanvas &c5 = fDisplay->AddTab("Rel. Times");
457 c5.Divide(2,4);
458
459 disp30.CamDraw(c5, 1, 2, 2);
460 disp31.CamDraw(c5, 2, 2, 2);
461 }
462
463
464 return;
465 }
466
467 if (fDisplayType == kNormalDisplay)
468 {
469
470 // Charges
471 TCanvas &c11 = fDisplay->AddTab("Fit.Charge");
472 c11.Divide(2, 4);
473
474 disp1.CamDraw(c11, 1, 2, 5, 1);
475 disp2.CamDraw(c11, 2, 2, 5, 1);
476
477 // Reduced Sigmas
478 TCanvas &c12 = fDisplay->AddTab("Red.Sigma");
479 c12.Divide(2,4);
480
481 disp3.CamDraw(c12, 1, 2, 5, 1);
482 disp4.CamDraw(c12, 2, 2, 5, 1);
483
484 // F-Factor
485 TCanvas &c13 = fDisplay->AddTab("Phe's");
486 c13.Divide(3,4);
487
488 disp5.CamDraw(c13, 1, 3, 5, 1);
489 disp6.CamDraw(c13, 2, 3, 5, 1);
490 disp7.CamDraw(c13, 3, 3, 5, 1);
491
492 // QE's
493 TCanvas &c14 = fDisplay->AddTab("QE's");
494 c14.Divide(4,4);
495
496 disp8.CamDraw(c14, 1, 4, 5, 1);
497 disp9.CamDraw(c14, 2, 4, 5, 1);
498 disp10.CamDraw(c14, 3, 4, 5, 1);
499 disp11.CamDraw(c14, 4, 4, 5, 1);
500
501 // Defects
502 TCanvas &c15 = fDisplay->AddTab("Defect");
503 // c15.Divide(5,2);
504 c15.Divide(4,2);
505
506 /*
507 disp23.CamDraw(c15, 1, 5, 0);
508 disp24.CamDraw(c15, 2, 5, 0);
509 disp25.CamDraw(c15, 3, 5, 0);
510 disp26.CamDraw(c15, 4, 5, 0);
511 disp27.CamDraw(c15, 5, 5, 0);
512 */
513 disp24.CamDraw(c15, 1, 4, 0);
514 disp25.CamDraw(c15, 2, 4, 0);
515 disp26.CamDraw(c15, 3, 4, 0);
516 disp27.CamDraw(c15, 4, 4, 0);
517
518 // Abs. Times
519 TCanvas &c16 = fDisplay->AddTab("Abs. Times");
520 c16.Divide(2,3);
521
522 disp28.CamDraw(c16, 1, 2, 5);
523 disp29.CamDraw(c16, 2, 2, 5);
524
525 if (fRelTimes)
526 {
527 // Rel. Times
528 TCanvas &c17 = fDisplay->AddTab("Rel. Times");
529 c17.Divide(2,4);
530
531 disp30.CamDraw(c17, 1, 2, 5, 1);
532 disp31.CamDraw(c17, 2, 2, 5, 1);
533 }
534
535 return;
536 }
537
538 if (fDisplayType == kFullDisplay)
539 {
540
541 MHCalibrationChargeBlindPix *blind = (MHCalibrationChargeBlindPix*)plist.FindObject("MHCalibrationChargeBlindPix");
542 blind->DrawClone();
543 gPad->GetCanvas()->SaveAs(Form("%s%s%s",blind->GetName(),(fRuns->GetRunsAsString()).Data(),".root"));
544
545 MHCalibrationChargeCam *ccm = (MHCalibrationChargeCam*)plist.FindObject("MHCalibrationChargeCam");
546 ccm->DrawClone();
547 gPad->GetCanvas()->SaveAs(Form("%s%s%s",ccm->GetName(),(fRuns->GetRunsAsString()).Data(),".root"));
548
549 MHCalibrationRelTimeCam *rel = (MHCalibrationRelTimeCam*)plist.FindObject("MHCalibrationRelTimeCam");
550 rel->DrawClone();
551 gPad->GetCanvas()->SaveAs(Form("%s%s%s",rel->GetName(),(fRuns->GetRunsAsString()).Data(),".root"));
552
553 MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationChargeCam");
554
555 for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++)
556 {
557 cam->GetAverageHiGainArea(aidx).DrawClone("all");
558 cam->GetAverageLoGainArea(aidx).DrawClone("all");
559 }
560
561 for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
562 {
563 cam->GetAverageHiGainSector(sector).DrawClone("all");
564 cam->GetAverageLoGainSector(sector).DrawClone("all");
565 }
566
567 // Charges
568 TCanvas &c21 = fDisplay->AddTab("Fit.Charge");
569 c21.Divide(2, 4);
570
571 disp1.CamDraw(c21, 1, 2, 2, 1);
572 disp2.CamDraw(c21, 2, 2, 2, 1);
573
574 // Reduced Sigmas
575 TCanvas &c23 = fDisplay->AddTab("Red.Sigma");
576 c23.Divide(2,4);
577
578 disp3.CamDraw(c23, 1, 2, 2, 1);
579 disp4.CamDraw(c23, 2, 2, 2, 1);
580
581 // F-Factor
582 TCanvas &c24 = fDisplay->AddTab("Phe's");
583 c24.Divide(3,4);
584
585 disp5.CamDraw(c24, 1, 3, 2, 1);
586 disp6.CamDraw(c24, 2, 3, 2, 1);
587 disp7.CamDraw(c24, 3, 3, 2, 1);
588
589 // QE's
590 TCanvas &c25 = fDisplay->AddTab("QE's");
591 c25.Divide(4,4);
592
593 disp8.CamDraw(c25, 1, 4, 2, 1);
594 disp9.CamDraw(c25, 2, 4, 2, 1);
595 disp10.CamDraw(c25, 3, 4, 2, 1);
596 disp11.CamDraw(c25, 4, 4, 2, 1);
597
598 // Validity
599 TCanvas &c26 = fDisplay->AddTab("Valid");
600 c26.Divide(4,2);
601
602 disp12.CamDraw(c26, 1, 4, 0);
603 disp13.CamDraw(c26, 2, 4, 0);
604 disp14.CamDraw(c26, 3, 4, 0);
605 disp15.CamDraw(c26, 4, 4, 0);
606
607 // Other info
608 TCanvas &c27 = fDisplay->AddTab("HiLoGain");
609 c27.Divide(3,3);
610
611 disp16.CamDraw(c27, 1, 3, 0);
612 disp17.CamDraw(c27, 2, 3, 1);
613 disp18.CamDraw(c27, 3, 3, 1);
614
615 // Pickup
616 TCanvas &c28 = fDisplay->AddTab("Pickup");
617 c28.Divide(4,2);
618
619 disp19.CamDraw(c28, 1, 4, 0);
620 disp20.CamDraw(c28, 2, 4, 0);
621 disp21.CamDraw(c28, 3, 4, 0);
622 disp22.CamDraw(c28, 4, 4, 0);
623
624 // Defects
625 TCanvas &c29 = fDisplay->AddTab("Defect");
626 // c29.Divide(5,2);
627 c29.Divide(4,2);
628
629 disp24.CamDraw(c29, 1, 4, 0);
630 disp25.CamDraw(c29, 2, 4, 0);
631 disp26.CamDraw(c29, 3, 4, 0);
632 disp27.CamDraw(c29, 4, 4, 0);
633
634 // Abs. Times
635 TCanvas &c30 = fDisplay->AddTab("Abs. Times");
636 c30.Divide(2,3);
637
638 disp28.CamDraw(c30, 1, 2, 2);
639 disp29.CamDraw(c30, 2, 2, 1);
640
641 if (fRelTimes)
642 {
643 // Rel. Times
644 TCanvas &c31 = fDisplay->AddTab("Rel. Times");
645 c31.Divide(3,4);
646
647 disp30.CamDraw(c31, 1, 3, 2, 1);
648 disp31.CamDraw(c31, 2, 3, 2, 1);
649 disp32.CamDraw(c31, 3, 3, 4, 1);
650
651 // Time Defects
652 TCanvas &c32 = fDisplay->AddTab("Time Def.");
653 c32.Divide(2,2);
654
655 disp33.CamDraw(c32, 1, 2, 0);
656 disp34.CamDraw(c32, 2, 2, 0);
657
658 MHCalibrationCam *cam = (MHCalibrationCam*)plist.FindObject("MHCalibrationRelTimeCam");
659
660 for (Int_t aidx=0;aidx<cam->GetAverageAreas();aidx++)
661 {
662 cam->GetAverageHiGainArea(aidx).DrawClone("fourierevents");
663 cam->GetAverageLoGainArea(aidx).DrawClone("fourierevents");
664 }
665
666 for (Int_t sector=1;sector<cam->GetAverageSectors();sector++)
667 {
668 cam->GetAverageHiGainSector(sector).DrawClone("fourierevents");
669 cam->GetAverageLoGainSector(sector).DrawClone("fourierevents");
670 }
671
672 }
673
674 return;
675 }
676}
677
678
679
680// --------------------------------------------------------------------------
681//
682// Find the colour of the pulsing LED:
683// - If the run number is smaller than gkIFAEBoxInaugurationRun, take MCalibrationCam::kCT1
684// - Otherwise find the colour out of the run name
685// - If no colour is found, return kFALSE
686//
687Bool_t MJCalibration::FindColor()
688{
689
690 const UInt_t nruns = fRuns->GetNumRuns();
691
692 if (nruns == 0)
693 return kFALSE;
694
695 TArrayI arr = fRuns->GetRuns();
696
697 if (arr[nruns-1] < gkIFAEBoxInaugurationRun)
698 {
699 *fLog << "Found colour kCT1 in runs: " << fRuns->GetRunsAsString() << endl;
700 fColor = MCalibrationCam::kCT1;
701 return kTRUE;
702 }
703
704 TString filenames;
705 ((MDirIter*)fRuns)->Reset();
706
707 while (!(filenames=((MDirIter*)fRuns)->Next()).IsNull())
708 {
709
710 filenames.ToLower();
711
712 //
713 // Here starts the list of runs where the shifters did not put
714 // a colour, but which have been found out by other means
715 //
716 if (filenames.Contains("_20660_"))
717 if (fColor == MCalibrationCam::kNONE)
718 {
719 *fLog << "Found colour: kGREEN in " << filenames << endl;
720 fColor = MCalibrationCam::kGREEN;
721 }
722 else if (fColor != MCalibrationCam::kGREEN)
723 {
724 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
725 return kFALSE;
726 }
727
728 if (filenames.Contains("_20661_"))
729 if (fColor == MCalibrationCam::kNONE)
730 {
731 *fLog << "Found colour: kGREEN in " << filenames << endl;
732 fColor = MCalibrationCam::kGREEN;
733 }
734 else if (fColor != MCalibrationCam::kGREEN)
735 {
736 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
737 return kFALSE;
738 }
739
740 if (filenames.Contains("_26402_"))
741 if (fColor == MCalibrationCam::kNONE)
742 {
743 *fLog << "Found colour: kBLUE in " << filenames << endl;
744 fColor = MCalibrationCam::kBLUE;
745 }
746 else if (fColor != MCalibrationCam::kBLUE)
747 {
748 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
749 return kFALSE;
750 }
751
752 if (filenames.Contains("_26408_"))
753 if (fColor == MCalibrationCam::kNONE)
754 {
755 *fLog << "Found colour: kGREEN in " << filenames << endl;
756 fColor = MCalibrationCam::kGREEN;
757 }
758 else if (fColor != MCalibrationCam::kGREEN)
759 {
760 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
761 return kFALSE;
762 }
763
764 if (filenames.Contains("_26409_"))
765 if (fColor == MCalibrationCam::kNONE)
766 {
767 *fLog << "Found colour: kGREEN in " << filenames << endl;
768 fColor = MCalibrationCam::kGREEN;
769 }
770 else if (fColor != MCalibrationCam::kGREEN)
771 {
772 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
773 return kFALSE;
774 }
775
776 if (filenames.Contains("_26412_"))
777 if (fColor == MCalibrationCam::kNONE)
778 {
779 *fLog << "Found colour: kGREEN in " << filenames << endl;
780 fColor = MCalibrationCam::kGREEN;
781 }
782 else if (fColor != MCalibrationCam::kGREEN)
783 {
784 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
785 return kFALSE;
786 }
787
788
789 if (filenames.Contains("_26568_"))
790 if (fColor == MCalibrationCam::kNONE)
791 {
792 *fLog << "Found colour: kGREEN in " << filenames << endl;
793 fColor = MCalibrationCam::kGREEN;
794 }
795 else if (fColor != MCalibrationCam::kGREEN)
796 {
797 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
798 return kFALSE;
799 }
800 //
801 // Here start the runs where the shifter put
802 // the colour
803 //
804 if (filenames.Contains("green"))
805 if (fColor == MCalibrationCam::kNONE)
806 {
807 *fLog << "Found colour: kGREEN in " << filenames << endl;
808 fColor = MCalibrationCam::kGREEN;
809 }
810 else if (fColor != MCalibrationCam::kGREEN)
811 {
812 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
813 return kFALSE;
814 }
815
816 if (filenames.Contains("blue"))
817 if (fColor == MCalibrationCam::kNONE)
818 {
819 *fLog << "Found colour: kBLUE in " << filenames << endl;
820 fColor = MCalibrationCam::kBLUE;
821 }
822 else if (fColor != MCalibrationCam::kBLUE)
823 {
824 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
825 return kFALSE;
826 }
827
828 if (filenames.Contains("uv"))
829 if (fColor == MCalibrationCam::kNONE)
830 {
831 *fLog << "Found colour: kUV in " << filenames << endl;
832 fColor = MCalibrationCam::kUV;
833 }
834 else if (fColor != MCalibrationCam::kUV)
835 {
836 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
837 return kFALSE;
838 }
839
840 if (filenames.Contains("ct1"))
841 if (fColor == MCalibrationCam::kNONE)
842 {
843 *fLog << "Found colour: kCT1 in " << filenames << endl;
844 fColor = MCalibrationCam::kCT1;
845 }
846 else if (fColor != MCalibrationCam::kCT1)
847 {
848 *fLog << err << "Different colour found in " << filenames << "... abort" << endl;
849 return kFALSE;
850 }
851
852 }
853
854 if (fColor == MCalibrationCam::kNONE)
855 {
856 *fLog << "No colour found in filenames of runs: " << fRuns->GetRunsAsString()
857 << "... abort" << endl;
858 return kFALSE;
859 }
860
861 return kTRUE;
862}
863
864
865
866
867// --------------------------------------------------------------------------
868//
869// Retrieve the output file written by WriteResult()
870//
871const char* MJCalibration::GetOutputFile() const
872{
873
874 if (!fRuns)
875 return "";
876
877 return Form("%s/%s-F1.root", (const char*)fOutputPath, (const char*)fRuns->GetRunsAsFileName());
878}
879
880
881Bool_t MJCalibration::IsUseBlindPixel() const
882{
883 return TESTBIT(fDevices,kUseBlindPixel);
884}
885
886
887Bool_t MJCalibration::IsUsePINDiode() const
888{
889 return TESTBIT(fDevices,kUsePINDiode);
890}
891
892
893
894
895
896// --------------------------------------------------------------------------
897//
898// Call the ProcessFile(MPedestalCam)
899//
900Bool_t MJCalibration::Process(MPedestalCam &pedcam)
901{
902 if (!ReadCalibrationCam())
903 return ProcessFile(pedcam);
904
905 return kTRUE;
906}
907
908// --------------------------------------------------------------------------
909//
910// Execute the task list and the eventloop:
911//
912// - Check if there are fRuns, otherwise return
913// - Check the colour of the files in fRuns (FindColor()), otherwise return
914// - Check for consistency between run numbers and number of files
915// - Add fRuns to MReadMarsFile
916// - Put into MParList:
917// 1) MPedestalCam (pedcam)
918// 2) MCalibrationQECam (fQECam)
919// 3) MCalibrationChargeCam (fCalibrationCam)
920// 4) MCalibrationRelTimeCam (fRelTimeCam) (only if flag fRelTimes is chosen)
921// 5) MBadPixelsCam (fBadPixels)
922// 6) MCalibrationChargePINDiode
923// 7) MCalibrationChargeBlindPix
924// - Put into the MTaskList:
925// 1) MReadMarsFile
926// 2) MBadPixelsMerge
927// 3) MGeomApply
928// 4) MExtractor
929// 5) MExtractPINDiode
930// 6) MExtractBlindPixel
931// 7) MExtractTime (only if flag fRelTimes is chosen)
932// 8) MContinue(MFCosmics)
933// 9) MFillH("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode")
934// 10) MFillH("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel")
935// 11) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam")
936// 12) MFillH("MHCalibrationChargeCam", "MExtractedSignalCam")
937// 13) MCalibrationChargeCalc
938// 14) MFillH("MHCalibrationRelTimeCam", "MArrivalTimeCam") (only if flag fRelTimes is chosen)
939// 15) MCalibrationRelTimeCalc
940// - Execute MEvtLoop
941// - DisplayResult()
942// - WriteResult()
943//
944Bool_t MJCalibration::ProcessFile(MPedestalCam &pedcam)
945{
946 if (!fRuns)
947 {
948 *fLog << err << "No Runs choosen... abort." << endl;
949 return kFALSE;
950 }
951
952 if (fRuns->GetNumRuns() != fRuns->GetNumEntries())
953 {
954 *fLog << err << "Number of files found doesn't match number of runs... abort."
955 << fRuns->GetNumRuns() << " vs. " << fRuns->GetNumEntries() << endl;
956 return kFALSE;
957 }
958
959 *fLog << inf;
960 fLog->Separator(GetDescriptor());
961
962 if (!FindColor())
963 return kFALSE;
964
965 *fLog << "Calculate MCalibrationCam from Runs " << fRuns->GetRunsAsString() << endl;
966 *fLog << endl;
967
968 // Setup Tasklist
969 MParList plist;
970 MTaskList tlist;
971 plist.AddToList(&tlist);
972
973 MReadMarsFile read("Events");
974 MRawFileRead rawread(NULL);
975
976 if (fDataCheck)
977 {
978 rawread.AddFiles(*fRuns);
979 tlist.AddToList(&rawread);
980 }
981 else
982 {
983 read.DisableAutoScheme();
984 static_cast<MRead&>(read).AddFiles(*fRuns);
985 tlist.AddToList(&read);
986 }
987
988 plist.AddToList(&pedcam);
989 plist.AddToList(&fBadPixels);
990 plist.AddToList(&fQECam);
991 plist.AddToList(&fCalibrationCam);
992 plist.AddToList(&fCalibrationBlindPix);
993 plist.AddToList(&fCalibrationPINDiode);
994 plist.AddToList(&fRelTimeCam);
995
996 MGeomApply apply;
997 // MBadPixelsMerge merge(&fBadPixels);
998 MExtractPINDiode pinext;
999 MExtractBlindPixel blindext;
1000 MExtractSlidingWindow extract2;
1001 MExtractTimeSpline timespline;
1002 MCalibrationChargeCalc calcalc;
1003 calcalc.SetOutputPath(fOutputPath);
1004 calcalc.SetOutputFile(Form("%s-ChargeCalibStat.txt",(const char*)fRuns->GetRunsAsFileName()));
1005
1006 MCalibrationRelTimeCalc timecalc;
1007 timecalc.SetOutputPath(fOutputPath);
1008 timecalc.SetOutputFile(Form("%s-TimeCalibStat.txt",(const char*)fRuns->GetRunsAsFileName()));
1009
1010 //
1011 // As long as there are no DM's, have to colour by hand
1012 //
1013 calcalc.SetPulserColor(fColor);
1014
1015 MFillH fillpin("MHCalibrationChargePINDiode", "MExtractedSignalPINDiode");
1016 MFillH fillbnd("MHCalibrationChargeBlindPix", "MExtractedSignalBlindPixel");
1017 MFillH fillcam("MHCalibrationChargeCam", "MExtractedSignalCam");
1018 MFillH filltme("MHCalibrationRelTimeCam", "MArrivalTimeCam");
1019 fillpin.SetNameTab("PINDiode");
1020 fillbnd.SetNameTab("BlindPix");
1021 fillcam.SetNameTab("Charge");
1022 filltme.SetNameTab("RelTimes");
1023
1024
1025 //
1026 // Apply a filter against cosmics
1027 // (will have to be needed in the future
1028 // when the calibration hardware-trigger is working)
1029 //
1030 MFCosmics cosmics;
1031 MContinue cont(&cosmics);
1032
1033 // tlist.AddToList(&merge);
1034 tlist.AddToList(&apply);
1035
1036 if (fExtractor)
1037 tlist.AddToList(fExtractor);
1038 else
1039 {
1040 *fLog << warn << GetDescriptor()
1041 << ": No extractor has been chosen, take default MExtractSlidingWindow " << endl;
1042 tlist.AddToList(&extract2);
1043 }
1044
1045
1046 tlist.AddToList(&pinext);
1047 tlist.AddToList(&blindext);
1048
1049 if (fRelTimes)
1050 {
1051 if (fTimeExtractor)
1052 tlist.AddToList(fTimeExtractor);
1053 else
1054 {
1055 *fLog << warn << GetDescriptor()
1056 << ": No extractor has been chosen, take default MTimeExtractSpline " << endl;
1057 tlist.AddToList(&timespline);
1058 }
1059 }
1060
1061 if (fColor == MCalibrationCam::kCT1)
1062 tlist.AddToList(&cont);
1063
1064 tlist.AddToList(&fillcam);
1065
1066 if (IsUsePINDiode())
1067 tlist.AddToList(&fillpin);
1068 if (IsUseBlindPixel())
1069 tlist.AddToList(&fillbnd);
1070
1071 tlist.AddToList(&calcalc);
1072
1073 if (fRelTimes)
1074 {
1075 tlist.AddToList(&filltme);
1076 tlist.AddToList(&timecalc);
1077 }
1078
1079
1080 // Create and setup the eventloop
1081 MEvtLoop evtloop(fName);
1082 evtloop.SetParList(&plist);
1083 evtloop.SetDisplay(fDisplay);
1084 evtloop.SetLogStream(fLog);
1085
1086 // Execute first analysis
1087 if (!evtloop.Eventloop())
1088 {
1089 *fLog << err << GetDescriptor() << ": Failed." << endl;
1090 return kFALSE;
1091 }
1092
1093 tlist.PrintStatistics();
1094
1095 DisplayResult(plist);
1096
1097
1098 if (!WriteResult())
1099 return kFALSE;
1100
1101 *fLog << inf << GetDescriptor() << ": Done." << endl;
1102
1103 return kTRUE;
1104}
1105
1106// --------------------------------------------------------------------------
1107//
1108// Read the following containers from GetOutputFile()
1109// - MCalibrationChargeCam
1110// - MCalibrationQECam
1111// - MBadPixelsCam
1112//
1113Bool_t MJCalibration::ReadCalibrationCam()
1114{
1115
1116 const TString fname = GetOutputFile();
1117
1118 if (gSystem->AccessPathName(fname, kFileExists))
1119 {
1120 *fLog << err << "Input file " << fname << " doesn't exist." << endl;
1121 return kFALSE;
1122 }
1123
1124 *fLog << inf << "Reading from file: " << fname << endl;
1125
1126 TFile file(fname, "READ");
1127 if (fCalibrationCam.Read()<=0)
1128 {
1129 *fLog << err << "Unable to read MCalibrationChargeCam from " << fname << endl;
1130 return kFALSE;
1131 }
1132
1133 if (fQECam.Read()<=0)
1134 {
1135 *fLog << err << "Unable to read MCalibrationQECam from " << fname << endl;
1136 return kFALSE;
1137 }
1138
1139
1140 if (fRelTimes)
1141 if (fRelTimeCam.Read()<=0)
1142 {
1143 *fLog << err << "Unable to read MCalibrationRelTimeCam from " << fname << endl;
1144 return kFALSE;
1145 }
1146
1147 if (file.FindKey("MBadPixelsCam"))
1148 {
1149 MBadPixelsCam bad;
1150 if (bad.Read()<=0)
1151 {
1152 *fLog << err << "Unable to read MBadPixelsCam from " << fname << endl;
1153 return kFALSE;
1154 }
1155 fBadPixels.Merge(bad);
1156 }
1157
1158 if (fDisplay /*&& !fDisplay->GetCanvas("Pedestals")*/) // FIXME!
1159 fDisplay->Read();
1160
1161 return kTRUE;
1162}
1163
1164
1165// --------------------------------------------------------------------------
1166//
1167// Set the path for output files, written by WriteResult()
1168//
1169void MJCalibration::SetOutputPath(const char *path)
1170{
1171 fOutputPath = path;
1172 if (fOutputPath.EndsWith("/"))
1173 fOutputPath = fOutputPath(0, fOutputPath.Length()-1);
1174}
1175
1176// --------------------------------------------------------------------------
1177//
1178// Set the useage of the Blind Pixel device
1179//
1180void MJCalibration::SetUseBlindPixel(const Bool_t b)
1181{
1182 b ? SETBIT(fDevices,kUseBlindPixel) : CLRBIT(fDevices,kUseBlindPixel);
1183}
1184
1185// --------------------------------------------------------------------------
1186//
1187// Set the useage of the PIN Diode device
1188//
1189void MJCalibration::SetUsePINDiode(const Bool_t b)
1190{
1191 b ? SETBIT(fDevices,kUsePINDiode) : CLRBIT(fDevices,kUsePINDiode);
1192}
1193
1194// --------------------------------------------------------------------------
1195//
1196// Write the result into the output file GetOutputFile(), if fOutputPath exists.
1197//
1198// The following containers are written:
1199// - MStatusDisplay
1200// - MCalibrationChargeCam
1201// - MCalibrationChargeBlindPix
1202// - MCalibrationQECam
1203// - MBadPixelsCam
1204//
1205Bool_t MJCalibration::WriteResult()
1206{
1207 if (fOutputPath.IsNull())
1208 return kTRUE;
1209
1210 const TString oname(GetOutputFile());
1211
1212 *fLog << inf << "Writing to file: " << oname << endl;
1213
1214 TFile file(oname, "UPDATE");
1215
1216 if (fDisplay && fDisplay->Write()<=0)
1217 {
1218 *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
1219 return kFALSE;
1220 }
1221
1222 if (fCalibrationCam.Write()<=0)
1223 {
1224 *fLog << err << "Unable to write MCalibrationChargeCam to " << oname << endl;
1225 return kFALSE;
1226 }
1227
1228 if (fCalibrationBlindPix.Write()<=0)
1229 {
1230 *fLog << err << "Unable to write MCalibrationChargeBlindPix to " << oname << endl;
1231 return kFALSE;
1232 }
1233
1234 if (fCalibrationPINDiode.Write()<=0)
1235 {
1236 *fLog << err << "Unable to write MCalibrationChargePINDiode to " << oname << endl;
1237 return kFALSE;
1238 }
1239
1240 if (fQECam.Write()<=0)
1241 {
1242 *fLog << err << "Unable to write MCalibrationQECam to " << oname << endl;
1243 return kFALSE;
1244 }
1245
1246 if (fRelTimes)
1247 if (fRelTimeCam.Write()<=0)
1248 {
1249 *fLog << err << "Unable to write MCalibrationQECam to " << oname << endl;
1250 return kFALSE;
1251 }
1252
1253 if (fBadPixels.Write()<=0)
1254 {
1255 *fLog << err << "Unable to write MBadPixelsCam to " << oname << endl;
1256 return kFALSE;
1257 }
1258
1259 return kTRUE;
1260
1261}
1262
Note: See TracBrowser for help on using the repository browser.