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): Markus Gaug, 04/2004 <mailto:markus@ifae.es>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2005
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MJCalibTest
|
---|
28 | //
|
---|
29 | // If the flag SetDataCheckDisplay() is set, only the most important distributions
|
---|
30 | // are displayed.
|
---|
31 | // Otherwise, (default: SetNormalDisplay()), a good selection of plots is given
|
---|
32 | //
|
---|
33 | /////////////////////////////////////////////////////////////////////////////
|
---|
34 | #include "MJCalibTest.h"
|
---|
35 |
|
---|
36 | #include <TFile.h>
|
---|
37 | #include <TStyle.h>
|
---|
38 | #include <TCanvas.h>
|
---|
39 | #include <TSystem.h>
|
---|
40 |
|
---|
41 | #include "MLog.h"
|
---|
42 | #include "MLogManip.h"
|
---|
43 |
|
---|
44 | #include "MRunIter.h"
|
---|
45 | #include "MParList.h"
|
---|
46 | #include "MTaskList.h"
|
---|
47 | #include "MTaskEnv.h"
|
---|
48 | #include "MEvtLoop.h"
|
---|
49 |
|
---|
50 | #include "MHCamera.h"
|
---|
51 |
|
---|
52 | #include "MSignalCam.h"
|
---|
53 | #include "MPedestalCam.h"
|
---|
54 | #include "MPedPhotCam.h"
|
---|
55 | #include "MBadPixelsCam.h"
|
---|
56 | #include "MBadPixelsTreat.h"
|
---|
57 | #include "MBadPixelsCalc.h"
|
---|
58 | #include "MBadPixelsMerge.h"
|
---|
59 | #include "MCalibrationChargeCam.h"
|
---|
60 | #include "MCalibrationRelTimeCam.h"
|
---|
61 | #include "MCalibrationQECam.h"
|
---|
62 | #include "MCalibrationTestCam.h"
|
---|
63 | #include "MCalibrationTestCalc.h"
|
---|
64 | #include "MHCamEvent.h"
|
---|
65 | #include "MHCalibrationTestCam.h"
|
---|
66 | #include "MHCalibrationTestTimeCam.h"
|
---|
67 | #include "MHCalibrationPix.h"
|
---|
68 |
|
---|
69 | #include "MReadMarsFile.h"
|
---|
70 | #include "MRawFileRead.h"
|
---|
71 | #include "MGeomApply.h"
|
---|
72 | #include "MGeomCam.h"
|
---|
73 | #include "MExtractTimeAndChargeSpline.h"
|
---|
74 | #include "MExtractor.h"
|
---|
75 | #include "MExtractTime.h"
|
---|
76 | //#include "MExtractTimeFastSpline.h"
|
---|
77 | #include "MFCosmics.h"
|
---|
78 | #include "MContinue.h"
|
---|
79 | #include "MFillH.h"
|
---|
80 | #include "MCalibrateData.h"
|
---|
81 | #include "MCalibrateRelTimes.h"
|
---|
82 |
|
---|
83 | #include "MTriggerPattern.h"
|
---|
84 | #include "MTriggerPatternDecode.h"
|
---|
85 | #include "MFTriggerPattern.h"
|
---|
86 |
|
---|
87 | #include "MStatusDisplay.h"
|
---|
88 |
|
---|
89 | ClassImp(MJCalibTest);
|
---|
90 |
|
---|
91 | using namespace std;
|
---|
92 |
|
---|
93 | // --------------------------------------------------------------------------
|
---|
94 | //
|
---|
95 | // Default constructor.
|
---|
96 | //
|
---|
97 | // Sets fUseCosmicsFilter to kTRUE, fExtractor to NULL, fTimeExtractor to NULL
|
---|
98 | // fDisplay to kNormalDisplay
|
---|
99 | //
|
---|
100 | MJCalibTest::MJCalibTest(const char *name, const char *title)
|
---|
101 | : fUseCosmicsFilter(kTRUE), fExtractor(NULL), fTimeExtractor(NULL),
|
---|
102 | fDisplayType(kNormalDisplay), fGeometry("MGeomCamMagic")
|
---|
103 | {
|
---|
104 | fName = name ? name : "MJCalibTest";
|
---|
105 | fTitle = title ? title : "Tool to extract, calibrate and test signals from a file";
|
---|
106 | }
|
---|
107 |
|
---|
108 |
|
---|
109 | void MJCalibTest::DisplayResult(MParList &plist)
|
---|
110 | {
|
---|
111 | if (!fDisplay)
|
---|
112 | return;
|
---|
113 |
|
---|
114 | //
|
---|
115 | // Get container from list
|
---|
116 | //
|
---|
117 | MGeomCam &geomcam = *(MGeomCam*) plist.FindObject("MGeomCam");
|
---|
118 | MHCalibrationTestCam &testcam = *(MHCalibrationTestCam*)plist.FindObject("MHCalibrationTestCam");
|
---|
119 |
|
---|
120 | // Create histograms to display
|
---|
121 | MHCamera disp1 (geomcam, "Test;PhotoElectrons", "Mean equiv. phes");
|
---|
122 | MHCamera disp2 (geomcam, "Test;SigmaPhes", "Sigma equiv.phes");
|
---|
123 | MHCamera disp3 (geomcam, "Test;PhesPerArea", "Equiv. Phes per Area");
|
---|
124 | MHCamera disp4 (geomcam, "Test;SigmaPhotPerArea", "Sigma equiv. Phes per Area");
|
---|
125 | MHCamera disp5 (geomcam, "Test;Phot", "Calibrated Phes from Fit");
|
---|
126 | MHCamera disp6 (geomcam, "Test;PhotPerArea", "Calibrated Phes per Area from Fit");
|
---|
127 | MHCamera disp7 (geomcam, "Test;NotInterpolate", "Not interpolated pixels");
|
---|
128 | MHCamera disp8 (geomcam, "Test;DeviatingPhots", "Deviating Number Phes");
|
---|
129 | MHCamera disp9 (geomcam, "Test;Arr.Times", "Mean of calibrated Arr.Times");
|
---|
130 | MHCamera disp10(geomcam, "Test;SigmaArr.Times", "Sigma of calibrated Arr.Times");
|
---|
131 |
|
---|
132 | // Fitted charge means and sigmas
|
---|
133 | disp1.SetCamContent(testcam, 0);
|
---|
134 | disp1.SetCamError( testcam, 1);
|
---|
135 | disp2.SetCamContent(testcam, 2);
|
---|
136 | disp2.SetCamError( testcam, 3);
|
---|
137 | disp3.SetCamContent(testcam, 7);
|
---|
138 | disp3.SetCamError( testcam, 8);
|
---|
139 | disp4.SetCamContent(testcam, 9);
|
---|
140 | disp4.SetCamError( testcam, 10);
|
---|
141 |
|
---|
142 | disp5.SetCamContent(fTestCam, 0);
|
---|
143 | disp5.SetCamError( fTestCam, 1);
|
---|
144 | disp6.SetCamContent(fTestCam, 2);
|
---|
145 | disp6.SetCamError( fTestCam, 3);
|
---|
146 | disp7.SetCamError( fTestCam, 4);
|
---|
147 |
|
---|
148 | disp8.SetCamError( fBadPixels, 22);
|
---|
149 |
|
---|
150 | disp9.SetCamContent(fTestTimeCam, 0);
|
---|
151 | disp9.SetCamError( fTestTimeCam, 1);
|
---|
152 | disp10.SetCamContent(fTestTimeCam, 2);
|
---|
153 | disp10.SetCamError( fTestTimeCam, 3);
|
---|
154 |
|
---|
155 |
|
---|
156 | disp1.SetYTitle("Phes");
|
---|
157 | disp2.SetYTitle("\\sigma_{phe}");
|
---|
158 | disp3.SetYTitle("Phes per area [mm^{-2}]");
|
---|
159 | disp4.SetYTitle("\\sigma_{phe} per area [mm^{-2}]");
|
---|
160 |
|
---|
161 | disp5.SetYTitle("Phes");
|
---|
162 | disp6.SetYTitle("Phes per area [mm^{-2}]");
|
---|
163 | disp7.SetYTitle("[1]");
|
---|
164 | disp8.SetYTitle("[1]");
|
---|
165 |
|
---|
166 | disp9.SetYTitle("Mean Arr.Times [FADC units]");
|
---|
167 | disp10.SetYTitle("\\sigma_{t} [FADC units]");
|
---|
168 |
|
---|
169 | TCanvas &c = fDisplay->AddTab("TestPhes");
|
---|
170 | c.Divide(4,4);
|
---|
171 |
|
---|
172 | disp1.CamDraw(c, 1, 4, 2, 1);
|
---|
173 | disp2.CamDraw(c, 2, 4, 2, 1);
|
---|
174 | disp3.CamDraw(c, 3, 4, 1, 1);
|
---|
175 | disp4.CamDraw(c, 4, 4, 2, 1);
|
---|
176 |
|
---|
177 | /*
|
---|
178 |
|
---|
179 | TCanvas &c2 = fDisplay->AddTab("TestResult");
|
---|
180 | c2.Divide(2,4);
|
---|
181 |
|
---|
182 | disp5.CamDraw(c2, 1, 2, 2, 1);
|
---|
183 | disp6.CamDraw(c2, 2, 2, 2, 1);
|
---|
184 |
|
---|
185 | */
|
---|
186 |
|
---|
187 | TCanvas &c3 = fDisplay->AddTab("TestDefects");
|
---|
188 | c3.Divide(2,2);
|
---|
189 |
|
---|
190 | disp7.CamDraw(c3, 1, 2, 0);
|
---|
191 | disp8.CamDraw(c3, 2, 2, 0);
|
---|
192 |
|
---|
193 | //
|
---|
194 | // Display times
|
---|
195 | //
|
---|
196 | TCanvas &c4 = fDisplay->AddTab("TestTimes");
|
---|
197 | c4.Divide(2,4);
|
---|
198 |
|
---|
199 | disp9.CamDraw(c4, 1, 2, 5, 1);
|
---|
200 | disp10.CamDraw(c4, 2, 2, 5, 1);
|
---|
201 |
|
---|
202 | return;
|
---|
203 |
|
---|
204 | }
|
---|
205 |
|
---|
206 | // --------------------------------------------------------------------------
|
---|
207 | //
|
---|
208 | // Retrieve the output file written by WriteResult()
|
---|
209 | //
|
---|
210 | const char* MJCalibTest::GetOutputFile() const
|
---|
211 | {
|
---|
212 | return Form("%s/calib%08d.root", fPathOut.Data(), fSequence.GetSequence());
|
---|
213 | }
|
---|
214 |
|
---|
215 | Bool_t MJCalibTest::ReadCalibration(TObjArray &l, MBadPixelsCam &cam, MExtractor* &ext1, MExtractor* &ext2, TString &geom) const
|
---|
216 | {
|
---|
217 |
|
---|
218 | const TString fname = GetOutputFile();
|
---|
219 |
|
---|
220 | *fLog << inf << "Reading from file: " << fname << endl;
|
---|
221 |
|
---|
222 | TFile file(fname, "READ");
|
---|
223 | if (!file.IsOpen())
|
---|
224 | {
|
---|
225 | *fLog << err << dbginf << "ERROR - Could not open file " << fname << endl;
|
---|
226 | return kFALSE;
|
---|
227 | }
|
---|
228 |
|
---|
229 | TObject *o = file.Get("ExtractSignal");
|
---|
230 | if (o && !o->InheritsFrom(MExtractor::Class()))
|
---|
231 | {
|
---|
232 | *fLog << err << dbginf << "ERROR - ExtractSignal read from " << fname << " doesn't inherit from MExtractor!" << endl;
|
---|
233 | return kFALSE;
|
---|
234 | }
|
---|
235 | ext1 = o ? (MExtractor*)o->Clone() : NULL;
|
---|
236 |
|
---|
237 | o = file.Get("ExtractTime");
|
---|
238 | if (o && !o->InheritsFrom(MExtractor::Class()))
|
---|
239 | {
|
---|
240 | *fLog << err << dbginf << "ERROR - ExtractTime read from " << fname << " doesn't inherit from MExtractor!" << endl;
|
---|
241 | return kFALSE;
|
---|
242 | }
|
---|
243 | ext2 = o ? (MExtractor*)o->Clone() : NULL;
|
---|
244 | if (!ext1 && !ext2)
|
---|
245 | {
|
---|
246 | *fLog << err << dbginf << "ERROR - Neither ExtractSignal nor ExrtractTime found in " << fname << "!" << endl;
|
---|
247 | return kFALSE;
|
---|
248 | }
|
---|
249 |
|
---|
250 | o = file.Get("MGeomCam");
|
---|
251 | if (o && !o->InheritsFrom(MGeomCam::Class()))
|
---|
252 | {
|
---|
253 | *fLog << err << dbginf << "ERROR - MGeomCam read from " << fname << " doesn't inherit from MGeomCam!" << endl;
|
---|
254 | return kFALSE;
|
---|
255 | }
|
---|
256 | geom = o ? o->ClassName() : "";
|
---|
257 |
|
---|
258 | TObjArray cont(l);
|
---|
259 | cont.Add(&cam);
|
---|
260 | return ReadContainer(cont);
|
---|
261 | }
|
---|
262 |
|
---|
263 | Bool_t MJCalibTest::Process(MPedestalCam &pedcam)
|
---|
264 | {
|
---|
265 | if (!fSequence.IsValid())
|
---|
266 | {
|
---|
267 | *fLog << err << "ERROR - Sequence invalid..." << endl;
|
---|
268 | return kFALSE;
|
---|
269 | }
|
---|
270 |
|
---|
271 | *fLog << inf;
|
---|
272 | fLog->Separator(GetDescriptor());
|
---|
273 | *fLog << "Calculate calibration test from Sequence #";
|
---|
274 | *fLog << fSequence.GetSequence() << endl << endl;
|
---|
275 |
|
---|
276 | CheckEnv();
|
---|
277 |
|
---|
278 | *fLog << inf;
|
---|
279 | fLog->Separator(GetDescriptor());
|
---|
280 |
|
---|
281 | *fLog << "Calibrate Calibration data from ";
|
---|
282 | *fLog << "Sequence #" << fSequence.GetSequence() << endl;
|
---|
283 | *fLog << endl;
|
---|
284 |
|
---|
285 | MDirIter iter;
|
---|
286 |
|
---|
287 | if (fSequence.IsValid())
|
---|
288 | {
|
---|
289 | if (fSequence.SetupCalRuns(iter, fPathData, IsUseRawData())<=0)
|
---|
290 | return kFALSE;
|
---|
291 | }
|
---|
292 |
|
---|
293 | MCalibrationChargeCam calcam;
|
---|
294 | MCalibrationQECam qecam;
|
---|
295 | MCalibrationRelTimeCam tmcam;
|
---|
296 | MBadPixelsCam badpix;
|
---|
297 |
|
---|
298 | TObjArray calibcont;
|
---|
299 | calibcont.Add(&calcam);
|
---|
300 | calibcont.Add(&qecam);
|
---|
301 | calibcont.Add(&tmcam);
|
---|
302 |
|
---|
303 | MExtractor *extractor1=0;
|
---|
304 | MExtractor *extractor2=0;
|
---|
305 | TString geom;
|
---|
306 |
|
---|
307 | if (!ReadCalibration(calibcont, badpix, extractor1, extractor2, geom))
|
---|
308 | {
|
---|
309 | *fLog << err << "Could not read calibration constants " << endl;
|
---|
310 | return kFALSE;
|
---|
311 | }
|
---|
312 |
|
---|
313 | *fLog << all;
|
---|
314 | if (extractor1)
|
---|
315 | {
|
---|
316 | *fLog << underline << "Signal Extractor found in calibration file" << endl;
|
---|
317 | extractor1->Print();
|
---|
318 | *fLog << endl;
|
---|
319 | }
|
---|
320 | else
|
---|
321 | *fLog << inf << "No Signal Extractor: ExtractSignal in file." << endl;
|
---|
322 |
|
---|
323 | if (extractor2)
|
---|
324 | {
|
---|
325 | *fLog << underline << "Time Extractor found in calibration file" << endl;
|
---|
326 | extractor2->Print();
|
---|
327 | *fLog << endl;
|
---|
328 | }
|
---|
329 | else
|
---|
330 | *fLog << inf << "No Time Extractor: ExtractTime in file." << endl;
|
---|
331 |
|
---|
332 | if (!geom.IsNull())
|
---|
333 | *fLog << inf << "Camera geometry found in file: " << geom << endl;
|
---|
334 | else
|
---|
335 | *fLog << inf << "No Camera geometry found using default <MGeomCamMagic>" << endl;
|
---|
336 |
|
---|
337 | if (fExtractor)
|
---|
338 | extractor1 = fExtractor;
|
---|
339 | if (fTimeExtractor)
|
---|
340 | extractor2 = fTimeExtractor;
|
---|
341 |
|
---|
342 | // Setup Lists
|
---|
343 | MParList plist;
|
---|
344 | plist.AddToList(this); // take care of fDisplay!
|
---|
345 | plist.AddToList(&fTestCam);
|
---|
346 | plist.AddToList(&fTestTimeCam);
|
---|
347 | plist.AddToList(&badpix);
|
---|
348 | plist.AddToList(&pedcam);
|
---|
349 | plist.AddToList(&calcam);
|
---|
350 | plist.AddToList(&qecam);
|
---|
351 | plist.AddToList(&tmcam);
|
---|
352 |
|
---|
353 | MSignalCam cerphot;
|
---|
354 | MPedPhotCam pedphot;
|
---|
355 | MHCalibrationTestCam testcam;
|
---|
356 |
|
---|
357 | plist.AddToList(&cerphot);
|
---|
358 | plist.AddToList(&pedphot);
|
---|
359 | plist.AddToList(&testcam);
|
---|
360 |
|
---|
361 | pedcam.SetName("MPedestalFundamental");
|
---|
362 |
|
---|
363 | MTaskList tlist;
|
---|
364 | plist.AddToList(&tlist);
|
---|
365 |
|
---|
366 | // Setup Task-lists
|
---|
367 | MRawFileRead rawread(NULL);
|
---|
368 | MReadMarsFile read("Events");
|
---|
369 | read.DisableAutoScheme();
|
---|
370 |
|
---|
371 | if (IsUseRawData())
|
---|
372 | rawread.AddFiles(iter);
|
---|
373 | else
|
---|
374 | static_cast<MRead&>(read).AddFiles(iter);
|
---|
375 |
|
---|
376 | // Check for interleaved events
|
---|
377 | // This will make that for data with version less than 5, where trigger
|
---|
378 | // patterns were not yet correct, all the events in the file will be
|
---|
379 | // processed. For those data there are no interleaved calibration events,
|
---|
380 | // so it makes no sense to run this test on a _D_ file. So we assume it
|
---|
381 | // will be a _C_ file, and accept all events.
|
---|
382 | MTriggerPatternDecode decode;
|
---|
383 | MFTriggerPattern fcalib;
|
---|
384 | fcalib.DenyCalibration();
|
---|
385 | fcalib.SetDefault(kFALSE);
|
---|
386 | MContinue conttp(&fcalib, "ContTrigPattern");
|
---|
387 |
|
---|
388 | MGeomApply apply; // Only necessary to craete geometry
|
---|
389 | if (!geom.IsNull())
|
---|
390 | apply.SetGeometry(geom);
|
---|
391 | MBadPixelsMerge merge(&badpix);
|
---|
392 |
|
---|
393 | // MExtractTimeAndChargeSlidingWindow extrsw;
|
---|
394 | // MExtractTimeFastSpline extime;
|
---|
395 |
|
---|
396 | MExtractTimeAndChargeSpline spline;
|
---|
397 |
|
---|
398 | spline.SetPedestals(&pedcam);
|
---|
399 |
|
---|
400 | MTaskEnv taskenv1("ExtractSignal");
|
---|
401 | MTaskEnv taskenv2("ExtractTime");
|
---|
402 |
|
---|
403 | if (extractor1)
|
---|
404 | {
|
---|
405 | extractor1->SetPedestals(&pedcam);
|
---|
406 | taskenv1.SetDefault(extractor1);
|
---|
407 | }
|
---|
408 |
|
---|
409 | if (extractor2)
|
---|
410 | {
|
---|
411 | fTimeExtractor->SetPedestals(&pedcam);
|
---|
412 | taskenv2.SetDefault(fTimeExtractor);
|
---|
413 | }
|
---|
414 | else if (!(extractor1->InheritsFrom("MExtractTimeAndCharge")))
|
---|
415 | {
|
---|
416 | spline.SetPedestals(&pedcam);
|
---|
417 | spline.SetWindowSize(8,8);
|
---|
418 | taskenv2.SetDefault(&spline);
|
---|
419 | *fLog << warn << GetDescriptor()
|
---|
420 | << ": No extractor has been chosen, take default MExtractTimeAndChargeSlidingWindow " << endl;
|
---|
421 | }
|
---|
422 |
|
---|
423 |
|
---|
424 | MCalibrateData photcalc;
|
---|
425 | photcalc.AddPedestal("Fundamental");
|
---|
426 | photcalc.SetCalibrationMode(MCalibrateData::kFfactor);
|
---|
427 | photcalc.SetPedestalFlag(MCalibrateData::kEvent);
|
---|
428 | photcalc.SetSignalType(MCalibrateData::kPhe);
|
---|
429 |
|
---|
430 | MCalibrateRelTimes caltimes;
|
---|
431 | MBadPixelsCalc badcalc;
|
---|
432 | MBadPixelsTreat badtreat;
|
---|
433 | badtreat.SetProcessTimes(kFALSE);
|
---|
434 |
|
---|
435 | badcalc.SetNamePedPhotCam("MPedPhotFundamental");
|
---|
436 | badtreat.SetUseInterpolation();
|
---|
437 | badtreat.AddNamePedPhotCam("MPedPhotFundamental");
|
---|
438 |
|
---|
439 | MCalibrationTestCalc testcalc;
|
---|
440 |
|
---|
441 | MHCamEvent evt0(0,"Signal", "Un-Calibrated Signal;;S [FADC cnts]" );
|
---|
442 | MHCamEvent evt1(0,"CalSig", "Cal. and Interp. Sig. by Pixel Size Ratio;;S [phe]");
|
---|
443 | MHCamEvent evt2(6,"Times" , "Arrival Time;;T [slice]");
|
---|
444 |
|
---|
445 | MFillH fill0(&evt0, "MExtractedSignalCam", "FillUncalibrated");
|
---|
446 | MFillH fill1(&evt1, "MSignalCam", "FillCalibrated");
|
---|
447 | MFillH fill2(&evt2, "MSignalCam", "FillTimes");
|
---|
448 |
|
---|
449 | MFillH fillcam("MHCalibrationTestCam", "MSignalCam" ,"FillTest");
|
---|
450 | MFillH filltme("MHCalibrationTestTimeCam", "MSignalCam", "FillTestTime");
|
---|
451 | fillcam.SetBit(MFillH::kDoNotDisplay);
|
---|
452 | filltme.SetBit(MFillH::kDoNotDisplay);
|
---|
453 |
|
---|
454 | MFCosmics cosmics;
|
---|
455 | cosmics.SetNamePedestalCam("MPedestalFundamental");
|
---|
456 | MContinue contcos(&cosmics,"ContCosmics");
|
---|
457 |
|
---|
458 | tlist.AddToList(&read);
|
---|
459 | tlist.AddToList(&decode);
|
---|
460 | tlist.AddToList(&apply);
|
---|
461 | tlist.AddToList(&merge);
|
---|
462 | // tlist.AddToList(&conttp);
|
---|
463 | tlist.AddToList(&taskenv1);
|
---|
464 | if (!extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
---|
465 | tlist.AddToList(&taskenv2);
|
---|
466 |
|
---|
467 | tlist.AddToList(&contcos);
|
---|
468 | tlist.AddToList(&fill0);
|
---|
469 | tlist.AddToList(&photcalc);
|
---|
470 | tlist.AddToList(&caltimes);
|
---|
471 | tlist.AddToList(&badcalc);
|
---|
472 | tlist.AddToList(&badtreat);
|
---|
473 | tlist.AddToList(&fill1);
|
---|
474 | tlist.AddToList(&fill2);
|
---|
475 | tlist.AddToList(&fillcam);
|
---|
476 | tlist.AddToList(&filltme);
|
---|
477 | tlist.AddToList(&testcalc);
|
---|
478 |
|
---|
479 | // Create and setup the eventloop
|
---|
480 | MEvtLoop evtloop(fName);
|
---|
481 | evtloop.SetParList(&plist);
|
---|
482 | evtloop.SetDisplay(fDisplay);
|
---|
483 | evtloop.SetLogStream(fLog);
|
---|
484 |
|
---|
485 | // Execute first analysis
|
---|
486 | if (!evtloop.Eventloop())
|
---|
487 | {
|
---|
488 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
---|
489 | return kFALSE;
|
---|
490 | }
|
---|
491 |
|
---|
492 | if (fIsPixelCheck)
|
---|
493 | {
|
---|
494 | MHCalibrationTestCam *hcam = (MHCalibrationTestCam*)plist.FindObject("MHCalibrationTestCam");
|
---|
495 | MHCalibrationPix &pix1 = (*hcam)[fCheckedPixId];
|
---|
496 | pix1.DrawClone("");
|
---|
497 |
|
---|
498 | MHCalibrationTestTimeCam *hccam = (MHCalibrationTestTimeCam*)plist.FindObject("MHCalibrationTestTimeCam");
|
---|
499 | MHCalibrationPix &pix11 = (*hccam)[fCheckedPixId];
|
---|
500 | pix11.DrawClone("");
|
---|
501 | }
|
---|
502 |
|
---|
503 | DisplayResult(plist);
|
---|
504 |
|
---|
505 | if (!WriteResult())
|
---|
506 | return kFALSE;
|
---|
507 |
|
---|
508 | *fLog << inf << GetDescriptor() << ": Done." << endl;
|
---|
509 |
|
---|
510 | return kTRUE;
|
---|
511 | }
|
---|
512 |
|
---|
513 | Bool_t MJCalibTest::WriteResult()
|
---|
514 | {
|
---|
515 |
|
---|
516 | if (fPathOut.IsNull())
|
---|
517 | return kTRUE;
|
---|
518 |
|
---|
519 | const TString oname(GetOutputFile());
|
---|
520 |
|
---|
521 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
522 |
|
---|
523 | TFile file(oname, "UPDATE");
|
---|
524 |
|
---|
525 | if (fDisplay && fDisplay->Write()<=0)
|
---|
526 | {
|
---|
527 | *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
|
---|
528 | return kFALSE;
|
---|
529 | }
|
---|
530 |
|
---|
531 | if (fTestCam.Write()<=0)
|
---|
532 | {
|
---|
533 | *fLog << err << "Unable to write MCalibrationTestCam to " << oname << endl;
|
---|
534 | return kFALSE;
|
---|
535 | }
|
---|
536 |
|
---|
537 | if (fTestTimeCam.Write()<=0)
|
---|
538 | {
|
---|
539 | *fLog << err << "Unable to write MCalibrationTestCam to " << oname << endl;
|
---|
540 | return kFALSE;
|
---|
541 | }
|
---|
542 |
|
---|
543 | return kTRUE;
|
---|
544 |
|
---|
545 | }
|
---|
546 |
|
---|