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 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2004
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // MJCalibrateSignal
|
---|
28 | //
|
---|
29 | // This class is reading the output written by callisto. It calibrates
|
---|
30 | // signal and time.
|
---|
31 | //
|
---|
32 | // The signal and time extractors are read from the callisto-output. In
|
---|
33 | // pricipal you could overwrite these default using the resource file,
|
---|
34 | // but this is NOT recommended!
|
---|
35 | //
|
---|
36 | /////////////////////////////////////////////////////////////////////////////
|
---|
37 | #include "MJCalibrateSignal.h"
|
---|
38 |
|
---|
39 | #include <TEnv.h>
|
---|
40 | #include <TFile.h>
|
---|
41 |
|
---|
42 | #include "MLog.h"
|
---|
43 | #include "MLogManip.h"
|
---|
44 |
|
---|
45 | #include "MDirIter.h"
|
---|
46 | #include "MParList.h"
|
---|
47 | #include "MTaskList.h"
|
---|
48 | #include "MEvtLoop.h"
|
---|
49 |
|
---|
50 | #include "MStatusDisplay.h"
|
---|
51 |
|
---|
52 | #include "MGeomCam.h"
|
---|
53 | #include "MHCamEvent.h"
|
---|
54 | #include "MPedestalCam.h"
|
---|
55 | #include "MBadPixelsCam.h"
|
---|
56 |
|
---|
57 | #include "MCalibrationQECam.h"
|
---|
58 | #include "MCalibrationBlindCam.h"
|
---|
59 | #include "MCalibrationChargeCam.h"
|
---|
60 | #include "MCalibrationRelTimeCam.h"
|
---|
61 | #include "MCalibrationChargePINDiode.h"
|
---|
62 |
|
---|
63 | #include "MReadReports.h"
|
---|
64 | #include "MReadMarsFile.h"
|
---|
65 | #include "MRawFileRead.h"
|
---|
66 | #include "MContinue.h"
|
---|
67 | #include "MTriggerPatternDecode.h"
|
---|
68 | #include "MFTriggerPattern.h"
|
---|
69 | #include "MGeomApply.h"
|
---|
70 | #include "MMcPedestalCopy.h"
|
---|
71 | #include "MPointingPosCalc.h"
|
---|
72 | #include "MPedCalcFromLoGain.h"
|
---|
73 | #include "MExtractor.h"
|
---|
74 | #include "MExtractTimeAndCharge.h"
|
---|
75 | #include "MFCosmics.h"
|
---|
76 | #include "MTaskEnv.h"
|
---|
77 | #include "MCalibrateData.h"
|
---|
78 | #include "MCalibrateRelTimes.h"
|
---|
79 | #include "MBadPixelsMerge.h"
|
---|
80 | #include "MBadPixelsCalc.h"
|
---|
81 | #include "MBadPixelsTreat.h"
|
---|
82 | #include "MFillH.h"
|
---|
83 | #include "MWriteRootFile.h"
|
---|
84 |
|
---|
85 | ClassImp(MJCalibrateSignal);
|
---|
86 |
|
---|
87 | using namespace std;
|
---|
88 |
|
---|
89 | // --------------------------------------------------------------------------
|
---|
90 | //
|
---|
91 | // Default constructor.
|
---|
92 | //
|
---|
93 | // Sets fRuns to 0, fExtractor to NULL, fDataCheck to kFALSE
|
---|
94 | //
|
---|
95 | MJCalibrateSignal::MJCalibrateSignal(const char *name, const char *title)
|
---|
96 | : fIsDataCheck(kFALSE)
|
---|
97 | {
|
---|
98 | fName = name ? name : "MJCalibrateSignal";
|
---|
99 | fTitle = title ? title : "Tool to calibrate data";
|
---|
100 | }
|
---|
101 |
|
---|
102 | Bool_t MJCalibrateSignal::WriteResult()
|
---|
103 | {
|
---|
104 | if (fPathOut.IsNull())
|
---|
105 | {
|
---|
106 | *fLog << inf << "No output path specified via SetPathOut - no output written." << endl;
|
---|
107 | return kTRUE;
|
---|
108 | }
|
---|
109 |
|
---|
110 | const TString oname = Form("%s/signal%08d.root", (const char*)fPathOut, fSequence.GetSequence());
|
---|
111 |
|
---|
112 | *fLog << inf << "Writing to file: " << oname << endl;
|
---|
113 |
|
---|
114 | TFile file(oname, "RECREATE");
|
---|
115 |
|
---|
116 | *fLog << inf << " - MStatusDisplay..." << flush;
|
---|
117 | if (fDisplay && fDisplay->Write()<=0)
|
---|
118 | {
|
---|
119 | *fLog << err << "Unable to write MStatusDisplay to " << oname << endl;
|
---|
120 | return kFALSE;
|
---|
121 | }
|
---|
122 | *fLog << inf << "ok." << endl;
|
---|
123 |
|
---|
124 | return kTRUE;
|
---|
125 | }
|
---|
126 |
|
---|
127 | Bool_t MJCalibrateSignal::ReadCalibration(TObjArray &l, MBadPixelsCam &cam, MExtractor* &ext1, MExtractor* &ext2, TString &geom) const
|
---|
128 | {
|
---|
129 | const TString fname = Form("%s/calib%08d.root", fPathIn.Data(), fSequence.GetSequence());
|
---|
130 |
|
---|
131 | *fLog << inf << "Reading from file: " << fname << endl;
|
---|
132 |
|
---|
133 | TFile file(fname, "READ");
|
---|
134 | if (!file.IsOpen())
|
---|
135 | {
|
---|
136 | *fLog << err << dbginf << "ERROR - Could not open file " << fname << endl;
|
---|
137 | return kFALSE;
|
---|
138 | }
|
---|
139 |
|
---|
140 | TObject *o = file.Get("ExtractSignal");
|
---|
141 | if (o && !o->InheritsFrom(MExtractor::Class()))
|
---|
142 | {
|
---|
143 | *fLog << err << dbginf << "ERROR - ExtractSignal read from " << fname << " doesn't inherit from MExtractor!" << endl;
|
---|
144 | return kFALSE;
|
---|
145 | }
|
---|
146 | ext1 = o ? (MExtractor*)o->Clone() : NULL;
|
---|
147 |
|
---|
148 | o = file.Get("ExtractTime");
|
---|
149 | if (o && !o->InheritsFrom(MExtractor::Class()))
|
---|
150 | {
|
---|
151 | *fLog << err << dbginf << "ERROR - ExtractTime read from " << fname << " doesn't inherit from MExtractor!" << endl;
|
---|
152 | return kFALSE;
|
---|
153 | }
|
---|
154 | ext2 = o ? (MExtractor*)o->Clone() : NULL;
|
---|
155 | if (!ext1 && !ext2)
|
---|
156 | {
|
---|
157 | *fLog << err << dbginf << "ERROR - Neither ExtractSignal nor ExrtractTime found in " << fname << "!" << endl;
|
---|
158 | return kFALSE;
|
---|
159 | }
|
---|
160 |
|
---|
161 | o = file.Get("MGeomCam");
|
---|
162 | if (o && !o->InheritsFrom(MGeomCam::Class()))
|
---|
163 | {
|
---|
164 | *fLog << err << dbginf << "ERROR - MGeomCam read from " << fname << " doesn't inherit from MGeomCam!" << endl;
|
---|
165 | return kFALSE;
|
---|
166 | }
|
---|
167 | geom = o ? o->ClassName() : "";
|
---|
168 |
|
---|
169 | TObjArray cont(l);
|
---|
170 | cont.Add(&cam);
|
---|
171 | return ReadContainer(cont);
|
---|
172 | }
|
---|
173 |
|
---|
174 | // --------------------------------------------------------------------------
|
---|
175 | //
|
---|
176 | // MJCalibration allows to setup several option by a resource file:
|
---|
177 | // MJCalibrateSignal.DataCheck: yes,no
|
---|
178 | //
|
---|
179 | // For more details see the class description and the corresponding Getters
|
---|
180 | //
|
---|
181 | Bool_t MJCalibrateSignal::CheckEnvLocal()
|
---|
182 | {
|
---|
183 | SetDataCheck(GetEnv("DataCheck", IsDataCheck()));
|
---|
184 | return kTRUE;
|
---|
185 | }
|
---|
186 |
|
---|
187 | Bool_t MJCalibrateSignal::ProcessFile(MPedestalCam &pedcamab, MPedestalCam &pedcam2, MPedestalCam &pedcam)
|
---|
188 | {
|
---|
189 | if (!fSequence.IsValid())
|
---|
190 | {
|
---|
191 | *fLog << err << "ERROR - Sequence invalid!" << endl;
|
---|
192 | return kFALSE;
|
---|
193 | }
|
---|
194 |
|
---|
195 | //if (!CheckEnv())
|
---|
196 | // return kFALSE;
|
---|
197 |
|
---|
198 | CheckEnv();
|
---|
199 |
|
---|
200 | // --------------------------------------------------------------------------------
|
---|
201 |
|
---|
202 | *fLog << inf;
|
---|
203 | fLog->Separator(GetDescriptor());
|
---|
204 | *fLog << "Calculate calibrated data from runs ";
|
---|
205 | *fLog << fSequence.GetName() << endl;
|
---|
206 | *fLog << endl;
|
---|
207 |
|
---|
208 | // --------------------------------------------------------------------------------
|
---|
209 |
|
---|
210 | MDirIter iter;
|
---|
211 | const Int_t n0 = fSequence.SetupDatRuns(iter, fPathData, "D", IsDataCheck());
|
---|
212 | const Int_t n1 = fSequence.GetNumDatRuns();
|
---|
213 | if (n0==0)
|
---|
214 | {
|
---|
215 | *fLog << err << "ERROR - No input files of sequence found!" << endl;
|
---|
216 | return kFALSE;
|
---|
217 | }
|
---|
218 | if (n0!=n1)
|
---|
219 | {
|
---|
220 | *fLog << err << "ERROR - Number of files found (" << n0 << ") doesn't match number of files in sequence (" << n1 << ")" << endl;
|
---|
221 | return kFALSE;
|
---|
222 | }
|
---|
223 |
|
---|
224 | // Read File
|
---|
225 | /*
|
---|
226 | MCalibrationIntensityChargeCam calcam;
|
---|
227 | MCalibrationIntensityQECam qecam;
|
---|
228 | MCalibrationIntensityBlindCam bndcam;
|
---|
229 | MCalibrationIntensityRelTimeCam tmcam;
|
---|
230 | */
|
---|
231 | MCalibrationChargeCam calcam;
|
---|
232 | MCalibrationQECam qecam;
|
---|
233 | MCalibrationBlindCam bndcam;
|
---|
234 | MCalibrationChargePINDiode pind;
|
---|
235 | MCalibrationRelTimeCam tmcam;
|
---|
236 | MBadPixelsCam badpix;
|
---|
237 |
|
---|
238 | MExtractor *extractor1=0;
|
---|
239 | MExtractor *extractor2=0;
|
---|
240 | TString geom;
|
---|
241 |
|
---|
242 | TObjArray calibcont;
|
---|
243 | calibcont.Add(&calcam);
|
---|
244 | calibcont.Add(&qecam);
|
---|
245 | calibcont.Add(&bndcam);
|
---|
246 | calibcont.Add(&pind);
|
---|
247 | calibcont.Add(&tmcam);
|
---|
248 |
|
---|
249 | if (!ReadCalibration(calibcont, badpix, extractor1, extractor2, geom))
|
---|
250 | return kFALSE;
|
---|
251 |
|
---|
252 | *fLog << all;
|
---|
253 | if (extractor1)
|
---|
254 | {
|
---|
255 | *fLog << underline << "Signal Extractor found in calibration file" << endl;
|
---|
256 | extractor1->Print();
|
---|
257 | *fLog << endl;
|
---|
258 | }
|
---|
259 | else
|
---|
260 | *fLog << inf << "No Signal Extractor: ExtractSignal in file." << endl;
|
---|
261 |
|
---|
262 | if (extractor2)
|
---|
263 | {
|
---|
264 | *fLog << underline << "Time Extractor found in calibration file" << endl;
|
---|
265 | extractor2->Print();
|
---|
266 | *fLog << endl;
|
---|
267 | }
|
---|
268 | else
|
---|
269 | *fLog << inf << "No Time Extractor: ExtractTime in file." << endl;
|
---|
270 |
|
---|
271 | if (!geom.IsNull())
|
---|
272 | *fLog << inf << "Camera geometry found in file: " << geom << endl;
|
---|
273 | else
|
---|
274 | *fLog << inf << "No Camera geometry found using default <MGeomCamMagic>" << endl;
|
---|
275 |
|
---|
276 | // This is necessary for the case in which it is not in the files
|
---|
277 | MBadPixelsCam badcam;
|
---|
278 |
|
---|
279 | // Setup Parlist
|
---|
280 | MParList plist;
|
---|
281 | plist.AddToList(this); // take care of fDisplay!
|
---|
282 | plist.AddToList(&badcam);
|
---|
283 | plist.AddToList(&calibcont);
|
---|
284 |
|
---|
285 | // Setup Tasklist
|
---|
286 | MTaskList tlist;
|
---|
287 | plist.AddToList(&tlist);
|
---|
288 |
|
---|
289 | // FIXME: Move this to an intermediate class MJMagic
|
---|
290 | Byte_t filetype = 2;
|
---|
291 | /*
|
---|
292 | TString name = iter.Next();
|
---|
293 | Byte_t filetype = MRawFileRead::IsFileValid(name);
|
---|
294 | if (!filetype)
|
---|
295 | filetype = MReadMarsFile::IsFileValid(name)+1;
|
---|
296 | if (filetype<1||filetype>3)
|
---|
297 | {
|
---|
298 | gLog << err << "ERROR - FileType #" << (int)filetype << " of first file " << name << " unknown..." << endl;
|
---|
299 | return kFALSE;
|
---|
300 | } */
|
---|
301 | // 1 = raw-file
|
---|
302 | // 2 = raw-root file
|
---|
303 | // 3 = mc-raw file
|
---|
304 |
|
---|
305 | MReadReports readreal;
|
---|
306 | readreal.AddTree("Events", "MTime.", kTRUE);
|
---|
307 | readreal.AddTree("Trigger");
|
---|
308 | readreal.AddTree("Camera");
|
---|
309 | readreal.AddTree("Drive");
|
---|
310 | readreal.AddTree("CC");
|
---|
311 | readreal.AddTree("Currents");
|
---|
312 |
|
---|
313 | //MReadMarsFile read("Events");
|
---|
314 | //read.DisableAutoScheme();
|
---|
315 | MRawFileRead rawread(NULL);
|
---|
316 | if (IsDataCheck())
|
---|
317 | rawread.AddFiles(iter);
|
---|
318 | else
|
---|
319 | readreal.AddFiles(iter);
|
---|
320 |
|
---|
321 | MGeomApply apply; // Only necessary to create geometry
|
---|
322 | if (!geom.IsNull())
|
---|
323 | apply.SetGeometry(geom);
|
---|
324 | MBadPixelsMerge merge(&badpix);
|
---|
325 |
|
---|
326 | // Make sure that pedcamab has the correct name
|
---|
327 | pedcamab.SetName("MPedestalFundamental");
|
---|
328 | pedcam.SetName("MPedestalFromExtractorRndm");
|
---|
329 | pedcam2.SetName("MPedestalFromExtractor");
|
---|
330 | plist.AddToList(&pedcam);
|
---|
331 | plist.AddToList(&pedcam2);
|
---|
332 | plist.AddToList(&pedcamab);
|
---|
333 |
|
---|
334 | // Check for interleaved events
|
---|
335 | MTriggerPatternDecode decode;
|
---|
336 |
|
---|
337 | MFTriggerPattern ftp;
|
---|
338 | ftp.RequireCalibration();
|
---|
339 |
|
---|
340 | MContinue conttp(&ftp, "ContTrigPattern");
|
---|
341 | // --> tlist2
|
---|
342 |
|
---|
343 | // Do signal and pedestal calculation
|
---|
344 | MPedCalcFromLoGain pedlo1("MPedCalcFundamental");
|
---|
345 | pedlo1.SetPedestalUpdate(kTRUE);
|
---|
346 | pedlo1.SetNamePedestalCamOut("MPedestalFundamental");
|
---|
347 |
|
---|
348 | MPedCalcFromLoGain pedlo2("MPedCalcWithExtractorRndm");
|
---|
349 | pedlo2.SetPedestalUpdate(kTRUE);
|
---|
350 | pedlo2.SetRandomCalculation(kTRUE);
|
---|
351 | pedlo2.SetNamePedestalCamIn("MPedestalFundamental");
|
---|
352 | pedlo2.SetNamePedestalCamOut("MPedestalFromExtractorRndm");
|
---|
353 |
|
---|
354 | MPedCalcFromLoGain pedlo3("MPedCalcWithExtractor");
|
---|
355 | pedlo3.SetPedestalUpdate(kTRUE);
|
---|
356 | pedlo3.SetRandomCalculation(kFALSE);
|
---|
357 | pedlo3.SetNamePedestalCamIn("MPedestalFundamental");
|
---|
358 | pedlo3.SetNamePedestalCamOut("MPedestalFromExtractor");
|
---|
359 |
|
---|
360 | if (extractor1)
|
---|
361 | {
|
---|
362 | extractor1->SetPedestals(&pedcamab);
|
---|
363 |
|
---|
364 | if (extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
---|
365 | {
|
---|
366 | pedlo2.SetExtractor((MExtractTimeAndCharge*)extractor1);
|
---|
367 | pedlo3.SetExtractor((MExtractTimeAndCharge*)extractor1);
|
---|
368 | const Int_t win = ((MExtractTimeAndCharge*)extractor1)->GetWindowSizeHiGain();
|
---|
369 | pedlo1.SetExtractWindow(15, win);
|
---|
370 | pedlo2.SetExtractWindow(15, win/*obsolete*/);
|
---|
371 | pedlo3.SetExtractWindow(15, win/*obsolete*/);
|
---|
372 | }
|
---|
373 | else
|
---|
374 | {
|
---|
375 | // FIXME: How to get the fixed value 15 automatically?
|
---|
376 | const Int_t f = (Int_t)(15.5+extractor1->GetHiGainFirst());
|
---|
377 | const Int_t n = (Int_t)(15.5+extractor1->GetNumHiGainSamples());
|
---|
378 | pedlo1.SetExtractWindow(f, n);
|
---|
379 | pedlo2.SetExtractWindow(f, n);
|
---|
380 | pedlo3.SetExtractWindow(f, n);
|
---|
381 | }
|
---|
382 | }
|
---|
383 | if (extractor2)
|
---|
384 | extractor2->SetPedestals(&pedcamab);
|
---|
385 |
|
---|
386 | MFCosmics fcosmics;
|
---|
387 | fcosmics.SetNamePedestalCam("MPedestalFundamental");
|
---|
388 | MContinue contcos(&fcosmics, "ContTrigEvts");
|
---|
389 | contcos.SetInverted();
|
---|
390 |
|
---|
391 | MMcPedestalCopy pcopy;
|
---|
392 | MTaskEnv taskenv1("ExtractSignal");
|
---|
393 | MTaskEnv taskenv2("ExtractTime");
|
---|
394 | taskenv1.SetDefault(extractor1);
|
---|
395 | taskenv2.SetDefault(extractor2);
|
---|
396 | MCalibrateData calib;
|
---|
397 | if (filetype==3) // MC file
|
---|
398 | {
|
---|
399 | calib.SetCalibrationMode(MCalibrateData::kFfactor);
|
---|
400 | calib.SetPedestalFlag(MCalibrateData::kRun);
|
---|
401 | // FIXME: What to do for MC files???
|
---|
402 | calib.AddPedestal("MPedestalCam", "MPedPhotFundamental");
|
---|
403 | calib.AddPedestal("MPedestalCam", "MPedPhotFromExtractor");
|
---|
404 | calib.AddPedestal("MPedestalCam", "MPedPhotFromExtractorRndm");
|
---|
405 | }
|
---|
406 | else
|
---|
407 | {
|
---|
408 | calib.AddPedestal("Fundamental");
|
---|
409 | calib.AddPedestal("FromExtractor");
|
---|
410 | calib.AddPedestal("FromExtractorRndm");
|
---|
411 | calib.SetPedestalFlag(MCalibrateData::kEvent);
|
---|
412 | }
|
---|
413 |
|
---|
414 | MCalibrateRelTimes caltm;
|
---|
415 | MBadPixelsCalc bpcal;
|
---|
416 | MBadPixelsTreat treat;
|
---|
417 |
|
---|
418 | bpcal.SetNamePedPhotCam("MPedPhotFromExtractor");
|
---|
419 | treat.AddNamePedPhotCam("MPedPhotFundamental");
|
---|
420 | treat.AddNamePedPhotCam("MPedPhotFromExtractor");
|
---|
421 | treat.AddNamePedPhotCam("MPedPhotFromExtractorRndm");
|
---|
422 | if (!extractor2 && !extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
---|
423 | treat.SetProcessTimes(kFALSE);
|
---|
424 |
|
---|
425 |
|
---|
426 | MHCamEvent evt0(0, "PedFLG", "Pedestal from Lo Gain;;P [fadc/sl]");
|
---|
427 | MHCamEvent evt1(2, "PedRmsFLG", "Pedestal RMS from Lo Gain;;\\sigma_{p} [fadc/sl]");
|
---|
428 | MHCamEvent evt2(0, "Extra'd", "Extracted Signal;;S [fadc/sl]");
|
---|
429 | MHCamEvent evt3(4, "PedPhot", "Calibrated Pedestal;;P [\\gamma]");
|
---|
430 | MHCamEvent evt4(5, "PedRMS", "Calibrated Pedestal RMS;;\\sigma_{p} [\\gamma]");
|
---|
431 | MHCamEvent evt5(0, "Interp'd", "Interpolated Signal;;S [\\gamma]");
|
---|
432 | MHCamEvent evt6(2, "Unsuitable", "Unsuitable event ratio;;%");
|
---|
433 | MHCamEvent evt7(0, "Times", "Arrival Time;;T [slice]");
|
---|
434 | evt0.EnableVariance();
|
---|
435 | evt1.EnableVariance();
|
---|
436 | evt2.EnableVariance();
|
---|
437 | evt3.EnableVariance();
|
---|
438 | evt4.EnableVariance();
|
---|
439 | evt5.EnableVariance();
|
---|
440 | evt7.EnableVariance();
|
---|
441 |
|
---|
442 | MFillH fill0(&evt0, "MPedestalFundamental", "FillPedFLG");
|
---|
443 | MFillH fill1(&evt1, "MPedestalFromExtractor", "FillPedRmsFLG");
|
---|
444 | MFillH fill2(&evt2, "MExtractedSignalCam", "FillExtracted");
|
---|
445 | MFillH fill3(&evt3, "MPedPhotFundamental", "FillPedPhot");
|
---|
446 | MFillH fill4(&evt4, "MPedPhotFromExtractor", "FillPedRMS");
|
---|
447 | MFillH fill5(&evt5, "MCerPhotEvt", "FillInterpolated");
|
---|
448 | MFillH fill6(&evt6, "MBadPixelsCam", "FillUnsuitable");
|
---|
449 | MFillH fill7(&evt7, "MArrivalTime", "FillTimes");
|
---|
450 |
|
---|
451 | // The second rule is for the case reading raw-files!
|
---|
452 | MWriteRootFile write(2, Form("%s{s/_D_/_Y_}{s/.raw$/.root}", fPathOut.Data()), fOverwrite);
|
---|
453 | // Run Header
|
---|
454 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
---|
455 | write.AddContainer("MBadPixelsCam", "RunHeaders");
|
---|
456 | write.AddContainer("MGeomCam", "RunHeaders");
|
---|
457 | // Monte Carlo Headers
|
---|
458 | write.AddContainer("MMcTrigHeader", "RunHeaders", kFALSE);
|
---|
459 | write.AddContainer("MMcConfigRunHeader", "RunHeaders", kFALSE);
|
---|
460 | write.AddContainer("MMcCorsikaRunHeader", "RunHeaders", kFALSE);
|
---|
461 | // Monte Carlo
|
---|
462 | write.AddContainer("MMcEvt", "Events", kFALSE);
|
---|
463 | write.AddContainer("MMcTrig", "Events", kFALSE);
|
---|
464 | // Data
|
---|
465 | write.AddContainer("MCerPhotEvt", "Events");
|
---|
466 | write.AddContainer("MPedPhotFundamental", "Events");
|
---|
467 | write.AddContainer("MPedPhotFromExtractor", "Events");
|
---|
468 | write.AddContainer("MPedPhotFromExtractorRndm", "Events");
|
---|
469 | write.AddContainer("MTime", "Events", kFALSE);
|
---|
470 | write.AddContainer("MRawEvtHeader", "Events");
|
---|
471 | write.AddContainer("MArrivalTime", "Events", kFALSE);
|
---|
472 | // Slow-Control: Current
|
---|
473 | write.AddContainer("MTimeCurrents", "Currents", kFALSE);
|
---|
474 | write.AddContainer("MCameraDC", "Currents", kFALSE);
|
---|
475 | write.AddContainer("MReportCurrents", "Currents", kFALSE);
|
---|
476 | // Slow-Control: Camera
|
---|
477 | write.AddContainer("MReportCamera", "Camera", kFALSE);
|
---|
478 | write.AddContainer("MTimeCamera", "Camera", kFALSE);
|
---|
479 | write.AddContainer("MCameraAUX", "Camera", kFALSE);
|
---|
480 | write.AddContainer("MCameraCalibration", "Camera", kFALSE);
|
---|
481 | write.AddContainer("MCameraCooling", "Camera", kFALSE);
|
---|
482 | write.AddContainer("MCameraHV", "Camera", kFALSE);
|
---|
483 | write.AddContainer("MCameraLV", "Camera", kFALSE);
|
---|
484 | write.AddContainer("MCameraLids", "Camera", kFALSE);
|
---|
485 | // Slow-Control: Trigger
|
---|
486 | write.AddContainer("MReportTrigger", "Trigger", kFALSE);
|
---|
487 | write.AddContainer("MTimeTrigger", "Trigger", kFALSE);
|
---|
488 | // Slow-Control: Drive
|
---|
489 | write.AddContainer("MPointingPos", "Drive", kFALSE);
|
---|
490 | write.AddContainer("MReportDrive", "Drive", kFALSE);
|
---|
491 | write.AddContainer("MTimeDrive", "Drive", kFALSE);
|
---|
492 | // Slow-Control: Central Control
|
---|
493 | write.AddContainer("MReportCC", "CC", kFALSE);
|
---|
494 | write.AddContainer("MTimeCC", "CC", kFALSE);
|
---|
495 |
|
---|
496 | // Now setup tasklist for events
|
---|
497 | MTaskList tlist2;
|
---|
498 | tlist2.AddToList(&decode);
|
---|
499 | tlist2.AddToList(&conttp);
|
---|
500 | tlist2.AddToList(&apply);
|
---|
501 | tlist2.AddToList(&merge);
|
---|
502 | if (filetype==3)
|
---|
503 | tlist2.AddToList(&pcopy);
|
---|
504 | else
|
---|
505 | {
|
---|
506 | tlist2.AddToList(&pedlo1);
|
---|
507 | tlist2.AddToList(&pedlo2);
|
---|
508 | tlist2.AddToList(&pedlo3);
|
---|
509 | }
|
---|
510 | tlist2.AddToList(&fill0);
|
---|
511 | tlist2.AddToList(&fill1);
|
---|
512 | if (extractor1)
|
---|
513 | tlist2.AddToList(&taskenv1);
|
---|
514 | if (extractor2)
|
---|
515 | tlist2.AddToList(&taskenv2);
|
---|
516 | tlist2.AddToList(&contcos);
|
---|
517 | tlist2.AddToList(&fill2);
|
---|
518 | tlist2.AddToList(&calib);
|
---|
519 | if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
---|
520 | tlist2.AddToList(&caltm);
|
---|
521 | tlist2.AddToList(&bpcal);
|
---|
522 | tlist2.AddToList(&treat);
|
---|
523 | tlist2.AddToList(&fill6);
|
---|
524 | tlist2.AddToList(&fill3);
|
---|
525 | tlist2.AddToList(&fill4);
|
---|
526 | tlist2.AddToList(&fill5);
|
---|
527 | if (extractor2 || extractor1->InheritsFrom("MExtractTimeAndCharge"))
|
---|
528 | tlist2.AddToList(&fill7);
|
---|
529 |
|
---|
530 | // Setup List for Drive-tree
|
---|
531 | MPointingPosCalc pcalc;
|
---|
532 |
|
---|
533 | // Now setup main tasklist
|
---|
534 | tlist.AddToList(IsDataCheck() ? (MTask*)&rawread : (MTask*)&readreal);
|
---|
535 | tlist.AddToList(&tlist2, IsDataCheck()?"All":"Events");
|
---|
536 | if (!IsDataCheck())
|
---|
537 | tlist.AddToList(&pcalc, "Drive");
|
---|
538 | tlist.AddToList(&write);
|
---|
539 |
|
---|
540 | // Create and setup the eventloop
|
---|
541 | MEvtLoop evtloop(fName);
|
---|
542 | evtloop.SetParList(&plist);
|
---|
543 | evtloop.SetDisplay(fDisplay);
|
---|
544 | evtloop.SetLogStream(fLog);
|
---|
545 | if (!SetupEnv(evtloop))
|
---|
546 | return kFALSE;
|
---|
547 |
|
---|
548 | // Execute first analysis
|
---|
549 | if (!evtloop.Eventloop(fMaxEvents))
|
---|
550 | {
|
---|
551 | *fLog << err << GetDescriptor() << ": Failed." << endl;
|
---|
552 | return kFALSE;
|
---|
553 | }
|
---|
554 |
|
---|
555 | tlist.PrintStatistics();
|
---|
556 |
|
---|
557 | if (!WriteResult())
|
---|
558 | return kFALSE;
|
---|
559 |
|
---|
560 | *fLog << all << GetDescriptor() << ": Done." << endl;
|
---|
561 | *fLog << endl << endl;
|
---|
562 |
|
---|
563 | return kTRUE;
|
---|
564 | }
|
---|