1 | #include <TFile.h>
|
---|
2 | #include <TTree.h>
|
---|
3 |
|
---|
4 | #include "MParList.h"
|
---|
5 | #include "MTaskList.h"
|
---|
6 | #include "MEvtLoop.h"
|
---|
7 |
|
---|
8 | #include "MRawFileRead.h"
|
---|
9 | #include "MReportFileReadCC.h"
|
---|
10 | #include "MWriteRootFile.h"
|
---|
11 |
|
---|
12 | #include "MLog.h"
|
---|
13 | #include "MLogManip.h"
|
---|
14 |
|
---|
15 | #include "MArgs.h"
|
---|
16 | #include "MTime.h"
|
---|
17 | #include "MArray.h"
|
---|
18 | #include "MRawRunHeader.h"
|
---|
19 |
|
---|
20 | #include "MFDataPhrase.h"
|
---|
21 |
|
---|
22 | using namespace std;
|
---|
23 |
|
---|
24 | //////////////////////////////////////////////////////////////////////////////
|
---|
25 | // //
|
---|
26 | // This is an easy implementation of the Merging process //
|
---|
27 | // (as compilable prog) //
|
---|
28 | // //
|
---|
29 | // at the moment it reads a binary file ("rawtest.bin") which was written //
|
---|
30 | // in the DAQ raw format. //
|
---|
31 | // //
|
---|
32 | // The data are stored in root container objects (classes derived from //
|
---|
33 | // TObject like MRawRunHeader) //
|
---|
34 | // //
|
---|
35 | // This containers are written to a root file ("rawtest.root") //
|
---|
36 | // //
|
---|
37 | //////////////////////////////////////////////////////////////////////////////
|
---|
38 |
|
---|
39 | static void StartUpMessage()
|
---|
40 | {
|
---|
41 | gLog << all << endl;
|
---|
42 |
|
---|
43 | // 1 2 3 4 5
|
---|
44 | // 12345678901234567890123456789012345678901234567890
|
---|
45 | gLog << "==================================================" << endl;
|
---|
46 | gLog << " MERPP - MARS V" << MARSVER << endl;
|
---|
47 | gLog << " MARS - Merging and Preprocessing Program" << endl;
|
---|
48 | gLog << " Compiled with ROOT v" << ROOT_RELEASE << " on <" << __DATE__ << ">" << endl;
|
---|
49 | gLog << "==================================================" << endl;
|
---|
50 | gLog << endl;
|
---|
51 | }
|
---|
52 |
|
---|
53 | static void Usage()
|
---|
54 | {
|
---|
55 | // 1 2 3 4 5 6 7 8
|
---|
56 | // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
---|
57 | gLog << all << endl;
|
---|
58 | gLog << "Sorry the usage is:" << endl;
|
---|
59 | gLog << " merpp [options] inputfile[.rep,[.raw.gz],[.txt]] [outputfile[.root]]" << endl << endl;
|
---|
60 | gLog << " Arguments:" << endl;
|
---|
61 | gLog << " inputfile.raw[.gz] Magic DAQ binary file." << endl;
|
---|
62 | gLog << " inputfile.rep Magic Central Control report file." << endl;
|
---|
63 | gLog << " inputfile.txt Magic DC currents file." << endl;
|
---|
64 | gLog << " ouputfile.root Merpped root file." << endl << endl;
|
---|
65 | gLog << " Options:" << endl;
|
---|
66 | gLog.Usage();
|
---|
67 | gLog << " --version, -V Show startup message with version number" << endl;
|
---|
68 | gLog << " -?, -h, --help This help" << endl << endl;
|
---|
69 | gLog << " File Options:" << endl;
|
---|
70 | gLog << " -c# Compression level #=1..9 [default=2]" << endl;
|
---|
71 | gLog << " -f Force overwrite of an existing file" << endl;
|
---|
72 | gLog << " -u, --update Update an existing file." << endl;
|
---|
73 | gLog << " --only=Name Read only reports described by MReportName. See the" << endl;
|
---|
74 | gLog << " mreport-directory for available classes." << endl << endl;
|
---|
75 | gLog << " Raw Data Options:" << endl;
|
---|
76 | gLog << " -ff Force merpp to ignore broken events and don't stop" << endl;
|
---|
77 | gLog << " --interleave=# Process only each i-th event [default=1]" << endl << endl;
|
---|
78 | // gLog << " --sql=mysql://user:password@url Insert run into database" << endl << endl;
|
---|
79 | gLog << " Report File Options:" << endl;
|
---|
80 | gLog << " --auto-time-start Take time automatically from MRawRunHeader" << endl;
|
---|
81 | gLog << " (overwrites --start=)" << endl;
|
---|
82 | gLog << " --auto-time-stop Take time automatically from MRawRunHeader" << endl;
|
---|
83 | gLog << " (overwrites --stop=)" << endl;
|
---|
84 | gLog << " --auto-time Abbrev. for --auto-time-start and auto-time-stop" << endl;
|
---|
85 | gLog << " --start=date/time Start event time" << endl;
|
---|
86 | gLog << " --stop=date/time Stop event time" << endl;
|
---|
87 | gLog << " --rep-run=# Only data corresponding to this run number as" << endl;
|
---|
88 | gLog << " taken from the RUN-REPORT is extracted" << endl;
|
---|
89 | gLog << " --rep-file=# Only data corresponding to this file number as" << endl;
|
---|
90 | gLog << " taken from the RUN-REPORT is extracted" << endl;
|
---|
91 | gLog << " --header-run=# Allow only run-control .rep-files with this" << endl;
|
---|
92 | gLog << " run number in there header" << endl;
|
---|
93 | gLog << " --header-file=# Allow only run-control .rep-files with this" << endl;
|
---|
94 | gLog << " file number in there header" << endl;
|
---|
95 | gLog << " --telescope=# Allow only run-control .rep-files with this" << endl;
|
---|
96 | gLog << " telescope number in there header" << endl;
|
---|
97 | gLog << " --sumfile Check for an all night summary file" << endl;
|
---|
98 | gLog << " (from .rep header)" << endl;
|
---|
99 | gLog << " --allfiles Don't check file type <default>" << endl << endl;
|
---|
100 | gLog << " Compatibility (deprecated):" << endl;
|
---|
101 | gLog << " --run=# See --rep-run (overwritten by --rep-run)" << endl;
|
---|
102 | gLog << " --runfile=# See --header-run (overwritten by --header-run)" << endl << endl;
|
---|
103 | gLog << " REMARK: - At the moment you can process a .raw _or_ a .rep file, only!" << endl;
|
---|
104 | gLog << " - 'date/time' has the format 'yyyy-mm-dd/hh:mm:ss.mmm'" << endl << endl;
|
---|
105 | }
|
---|
106 |
|
---|
107 | // FIXME: Move to MTime (maybe 'InterpreteCmdline')
|
---|
108 | MTime AnalyseTime(TString str)
|
---|
109 | {
|
---|
110 | Int_t y=0, ms=0, mon=0, d=0, h=0, m=0, s=0;
|
---|
111 |
|
---|
112 | const Int_t n = sscanf(str.Data(), "%d-%d-%d/%d:%d:%d.%d", &y, &mon, &d, &h, &m, &s, &ms);
|
---|
113 |
|
---|
114 | if (n<6 || n>7)
|
---|
115 | {
|
---|
116 | gLog << warn << "'" << str << "' no valid Time... ignored." << endl;
|
---|
117 | return MTime();
|
---|
118 | }
|
---|
119 |
|
---|
120 | MTime t;
|
---|
121 | t.Set(y, mon, d, h, m, s, ms);
|
---|
122 | return t;
|
---|
123 | }
|
---|
124 |
|
---|
125 | void GetTimeFromFile(const char *fname, MTime *start, MTime *stop)
|
---|
126 | {
|
---|
127 | TFile f(fname, "READ");
|
---|
128 |
|
---|
129 | TTree *t = (TTree*)f.Get("RunHeaders");
|
---|
130 | if (t->GetEntries()!=1)
|
---|
131 | {
|
---|
132 | gLog << warn << "WARNING - File " << fname << " contains no or more than one entry in RunHeaders... Times unchanged." << endl;
|
---|
133 | return;
|
---|
134 | }
|
---|
135 |
|
---|
136 | MRawRunHeader *h = 0;
|
---|
137 | t->SetBranchAddress("MRawRunHeader.", &h);
|
---|
138 | t->GetEntry(0);
|
---|
139 | if (!h)
|
---|
140 | {
|
---|
141 | gLog << warn << "WARNING - File " << fname << " did not contain RunHeaders.MRawRunHeader... Times unchanged." << endl;
|
---|
142 | return;
|
---|
143 | }
|
---|
144 |
|
---|
145 | if (start && !*start)
|
---|
146 | *start = h->GetRunStart();
|
---|
147 | if (stop && !*stop)
|
---|
148 | *stop = h->GetRunEnd();
|
---|
149 | }
|
---|
150 |
|
---|
151 | void Add(MReportFileReadCC *r, const TString &rep, const TString &only)
|
---|
152 | {
|
---|
153 | if (!only.IsNull() && rep!=only)
|
---|
154 | return;
|
---|
155 |
|
---|
156 | r->AddToList(Form("MReport%s", rep.Data()));
|
---|
157 | }
|
---|
158 |
|
---|
159 | int main(const int argc, char **argv)
|
---|
160 | {
|
---|
161 | if (!MARS::CheckRootVer())
|
---|
162 | return 0xff;
|
---|
163 |
|
---|
164 | MLog::RedirectErrorHandler(MLog::kColor);
|
---|
165 |
|
---|
166 | //
|
---|
167 | // Evaluate arguments
|
---|
168 | //
|
---|
169 | MArgs arg(argc, argv);
|
---|
170 | gLog.Setup(arg);
|
---|
171 |
|
---|
172 | StartUpMessage();
|
---|
173 |
|
---|
174 | if (arg.HasOnly("-V") || arg.HasOnly("--version"))
|
---|
175 | return 0;
|
---|
176 |
|
---|
177 | if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help"))
|
---|
178 | {
|
---|
179 | Usage();
|
---|
180 | return 2;
|
---|
181 | }
|
---|
182 |
|
---|
183 | const Int_t kComprlvl = arg.GetIntAndRemove("-c", 2);
|
---|
184 | const Bool_t kInterleave = arg.GetIntAndRemove("--interleave=", 1);
|
---|
185 | const Bool_t kForce = arg.HasOnlyAndRemove("-f");
|
---|
186 | const Bool_t kForceProc = arg.HasOnlyAndRemove("-ff");
|
---|
187 | const Int_t run = arg.GetIntAndRemove("--run=", -1);
|
---|
188 | const Int_t kRunNumber = arg.GetIntAndRemove("--rep-run=", run);
|
---|
189 | const Int_t kFileNumber = arg.GetIntAndRemove("--rep-file=", -1);
|
---|
190 | const Bool_t kAutoTime = arg.HasOnlyAndRemove("--auto-time");
|
---|
191 | const Bool_t kAutoTimeStart = arg.HasOnlyAndRemove("--auto-time-start") || kAutoTime;
|
---|
192 | const Bool_t kAutoTimeStop = arg.HasOnlyAndRemove("--auto-time-stop") || kAutoTime;
|
---|
193 | const Int_t runfile = arg.GetIntAndRemove("--runfile=", -1);
|
---|
194 | Int_t kHeaderRun = arg.GetIntAndRemove("--header-run=", runfile);
|
---|
195 | const Int_t kHeaderFile = arg.GetIntAndRemove("--header-file=", -1);
|
---|
196 | const Int_t kTelescope = arg.GetIntAndRemove("--telescope=", -1);
|
---|
197 | Bool_t kUpdate = arg.HasOnlyAndRemove("--update") || arg.HasOnlyAndRemove("-u");
|
---|
198 | const TString kOnly = arg.GetStringAndRemove("--only=", "");
|
---|
199 |
|
---|
200 | MTime kTimeStart;
|
---|
201 | MTime kTimeStop;
|
---|
202 | if (arg.HasOption("--star="))
|
---|
203 | kTimeStart = AnalyseTime(arg.GetStringAndRemove("--start="));
|
---|
204 | if (arg.HasOption("--stop="))
|
---|
205 | kTimeStop = AnalyseTime(arg.GetStringAndRemove("--stop="));
|
---|
206 |
|
---|
207 | // const TString kSqlDataBase(arg.GetStringAndRemove("--sql="));
|
---|
208 |
|
---|
209 | if (arg.HasOnlyAndRemove("--sumfile"))
|
---|
210 | kHeaderRun = 0;
|
---|
211 |
|
---|
212 | if (arg.GetNumOptions()>0)
|
---|
213 | {
|
---|
214 | gLog << warn << "WARNING - Unknown commandline options..." << endl;
|
---|
215 | arg.Print("options");
|
---|
216 | gLog << endl;
|
---|
217 | return 2;
|
---|
218 | }
|
---|
219 |
|
---|
220 | //
|
---|
221 | // check for the right usage of the program
|
---|
222 | //
|
---|
223 | if (arg.GetNumArguments()<1 || arg.GetNumArguments()>2)
|
---|
224 | {
|
---|
225 | Usage();
|
---|
226 | return 2;
|
---|
227 | }
|
---|
228 |
|
---|
229 | //
|
---|
230 | // This is to make argv[i] more readable insidethe code
|
---|
231 | //
|
---|
232 | TString kNamein = arg.GetArgumentStr(0);
|
---|
233 | TString kNameout = arg.GetArgumentStr(1);
|
---|
234 |
|
---|
235 | const Bool_t isreport = kNamein.EndsWith(".rep");
|
---|
236 | const Bool_t isdc = kNamein.EndsWith(".txt");
|
---|
237 | const Bool_t israw = !isreport && !isdc;
|
---|
238 |
|
---|
239 | if (!kNamein.EndsWith(".raw") && !kNamein.EndsWith(".raw.gz") && israw)
|
---|
240 | kNamein += ".raw.gz";
|
---|
241 |
|
---|
242 | if (kNameout.IsNull())
|
---|
243 | kNameout = kNamein(0, kNamein.Last('.'));
|
---|
244 |
|
---|
245 | if (!kNameout.EndsWith(".root"))
|
---|
246 | kNameout += ".root";
|
---|
247 |
|
---|
248 | // if (!kSqlDataBase.IsNull() && !israw)
|
---|
249 | // gLog << warn << "WARNING - Option '--sql=' only valid for raw-files... ignored." << endl;
|
---|
250 |
|
---|
251 | //
|
---|
252 | // Initialize Non-GUI (batch) mode
|
---|
253 | //
|
---|
254 | gROOT->SetBatch();
|
---|
255 |
|
---|
256 | //
|
---|
257 | // check whether the given files are OK.
|
---|
258 | //
|
---|
259 | if (gSystem->AccessPathName(kNamein, kFileExists))
|
---|
260 | {
|
---|
261 | gLog << err << "Sorry, the input file '" << kNamein << "' doesn't exist." << endl;
|
---|
262 | return 2;
|
---|
263 | }
|
---|
264 |
|
---|
265 | const Bool_t fileexist = !gSystem->AccessPathName(kNameout, kFileExists);
|
---|
266 | const Bool_t writeperm = !gSystem->AccessPathName(kNameout, kWritePermission);
|
---|
267 |
|
---|
268 | if (fileexist && !writeperm)
|
---|
269 | {
|
---|
270 | gLog << err << "Sorry, you don't have write permission for '" << kNameout << "'." << endl;
|
---|
271 | return 2;
|
---|
272 | }
|
---|
273 |
|
---|
274 | if (fileexist && !kUpdate && !kForce)
|
---|
275 | {
|
---|
276 | gLog << err << "Sorry, file '" << kNameout << "' already existing." << endl;
|
---|
277 | return 2;
|
---|
278 | }
|
---|
279 |
|
---|
280 | if (!fileexist && kUpdate)
|
---|
281 | {
|
---|
282 | gLog << warn << "File '" << kNameout << "' doesn't yet exist." << endl;
|
---|
283 | kUpdate=kFALSE;
|
---|
284 | }
|
---|
285 |
|
---|
286 | //
|
---|
287 | // Evaluate possible start-/stop-time
|
---|
288 | //
|
---|
289 | if ((kAutoTimeStart || kAutoTimeStop) && kUpdate && (isreport || isdc))
|
---|
290 | GetTimeFromFile(kNameout, kAutoTimeStart?&kTimeStart:0, kAutoTimeStop?&kTimeStop:0);
|
---|
291 |
|
---|
292 | if (kTimeStart)
|
---|
293 | gLog << inf << "Start Time: " << kTimeStart << endl;
|
---|
294 | if (kTimeStop)
|
---|
295 | gLog << inf << "Stop Time: " << kTimeStop << endl;
|
---|
296 |
|
---|
297 | //
|
---|
298 | // Ignore TObject Streamer (bits, uniqueid) for MArray and MParContainer
|
---|
299 | //
|
---|
300 | MArray::Class()->IgnoreTObjectStreamer();
|
---|
301 | MParContainer::Class()->IgnoreTObjectStreamer();
|
---|
302 |
|
---|
303 | //
|
---|
304 | // create a (empty) list of parameters which can be used by the tasks
|
---|
305 | // and an (empty) list of tasks which should be executed
|
---|
306 | //
|
---|
307 | MParList plist;
|
---|
308 |
|
---|
309 | MTaskList tasks;
|
---|
310 | tasks.SetOwner();
|
---|
311 | plist.AddToList(&tasks);
|
---|
312 |
|
---|
313 | //
|
---|
314 | // ---- The following is only necessary to supress some output ----
|
---|
315 | /*
|
---|
316 | MRawRunHeader runheader;
|
---|
317 | plist.AddToList(&runheader);
|
---|
318 |
|
---|
319 | MRawEvtHeader evtheader;
|
---|
320 | plist.AddToList(&evtheader);
|
---|
321 |
|
---|
322 | MRawEvtData evtdata;
|
---|
323 | plist.AddToList(&evtdata);
|
---|
324 |
|
---|
325 | MRawCrateArray cratearray;
|
---|
326 | plist.AddToList(&cratearray);
|
---|
327 |
|
---|
328 | MTime evttime;
|
---|
329 | plist.AddToList(&evttime);
|
---|
330 | */
|
---|
331 |
|
---|
332 | //
|
---|
333 | // create the tasks which should be executed and add them to the list
|
---|
334 | // in the case you don't need parameter containers, all of them can
|
---|
335 | // be created by MRawFileRead::PreProcess
|
---|
336 | //
|
---|
337 | const TString option(kUpdate ? "UPDATE" : "RECREATE");
|
---|
338 |
|
---|
339 | MTask *read = 0;
|
---|
340 | MFilter *filter = 0;
|
---|
341 | MWriteRootFile *write = new MWriteRootFile(kNameout, option, "Magic root-file", kComprlvl);
|
---|
342 |
|
---|
343 | if (isreport || isdc)
|
---|
344 | {
|
---|
345 | if (isdc)
|
---|
346 | {
|
---|
347 | write->AddContainer("MTimeCurrents", "Currents");
|
---|
348 | write->AddContainer("MCameraDC", "Currents");
|
---|
349 | write->AddContainer("MReportCurrents", "Currents");
|
---|
350 | }
|
---|
351 | else
|
---|
352 | {
|
---|
353 | const Bool_t required = kOnly.IsNull();
|
---|
354 | write->AddContainer("MReportCamera", "Camera", required);
|
---|
355 | write->AddContainer("MTimeCamera", "Camera", required);
|
---|
356 | write->AddContainer("MCameraAUX", "Camera", required);
|
---|
357 | write->AddContainer("MCameraCalibration", "Camera", required);
|
---|
358 | write->AddContainer("MCameraCooling", "Camera", required);
|
---|
359 | write->AddContainer("MCameraActiveLoad", "Camera", required);
|
---|
360 | write->AddContainer("MCameraHV", "Camera", required);
|
---|
361 | write->AddContainer("MCameraLV", "Camera", required);
|
---|
362 | write->AddContainer("MCameraLids", "Camera", required);
|
---|
363 | write->AddContainer("MReportTrigger", "Trigger", required);
|
---|
364 | write->AddContainer("MTimeTrigger", "Trigger", required);
|
---|
365 | write->AddContainer("MTriggerBit", "Trigger", required);
|
---|
366 | write->AddContainer("MTriggerIPR", "Trigger", required);
|
---|
367 | write->AddContainer("MTriggerCell", "Trigger", required);
|
---|
368 | write->AddContainer("MTriggerPrescFact", "Trigger", required);
|
---|
369 | write->AddContainer("MTriggerLiveTime", "Trigger", required);
|
---|
370 | write->AddContainer("MReportDrive", "Drive", required);
|
---|
371 | write->AddContainer("MTimeDrive", "Drive", required);
|
---|
372 | write->AddContainer("MCameraTH", "Rec", required);
|
---|
373 | write->AddContainer("MCameraTD", "Rec", required);
|
---|
374 | write->AddContainer("MCameraRecTemp", "Rec", required);
|
---|
375 | write->AddContainer("MReportRec", "Rec", required);
|
---|
376 | write->AddContainer("MTimeRec", "Rec", required);
|
---|
377 | write->AddContainer("MReportCC", "CC", required);
|
---|
378 | write->AddContainer("MTimeCC", "CC", required);
|
---|
379 | write->AddContainer("MReportStarguider", "Starguider", required);
|
---|
380 | write->AddContainer("MTimeStarguider", "Starguider", required);
|
---|
381 | write->AddContainer("MReportPyrometer", "Pyrometer", required);
|
---|
382 | write->AddContainer("MTimePyrometer", "Pyrometer", required);
|
---|
383 | // write->AddContainer("MReportDAQ", "DAQ");
|
---|
384 | // write->AddContainer("MTimeDAQ", "DAQ");
|
---|
385 | }
|
---|
386 |
|
---|
387 | MReportFileReadCC *r = new MReportFileReadCC(kNamein);
|
---|
388 | r->SetTimeStart(kTimeStart);
|
---|
389 | r->SetTimeStop(kTimeStop);
|
---|
390 | if (isdc)
|
---|
391 | {
|
---|
392 | r->SetHasNoHeader();
|
---|
393 | r->AddToList("MReportCurrents");
|
---|
394 | }
|
---|
395 | else
|
---|
396 | {
|
---|
397 | r->SetTelescope(kTelescope);
|
---|
398 | r->SetRunNumber(kHeaderRun);
|
---|
399 | r->SetFileNumber(kHeaderFile);
|
---|
400 | Add(r, "CC", kOnly);
|
---|
401 | Add(r, "Rec", kOnly);
|
---|
402 | Add(r, "Drive", kOnly);
|
---|
403 | Add(r, "Camera", kOnly);
|
---|
404 | Add(r, "Trigger", kOnly);
|
---|
405 | Add(r, "Starguider", kOnly);
|
---|
406 | Add(r, "Pyrometer", kOnly);
|
---|
407 | // Add(r, "DAQ", kUpdateOnly);
|
---|
408 | if (kRunNumber>0)
|
---|
409 | {
|
---|
410 | const TString f1 = kRunNumber>0 ? Form("MReportRun.fRunNumber==%d", kRunNumber) : "";
|
---|
411 | const TString f2 = kFileNumber>0 ? Form("MReportRun.fFileNumber==%d", kFileNumber) : "";
|
---|
412 |
|
---|
413 | const TString f = Form(kRunNumber>0 && kFileNumber>0 ? "%s && %s" : "%s%s",
|
---|
414 | f1.Data(), f2.Data());
|
---|
415 |
|
---|
416 | r->AddToList("MReportRun");
|
---|
417 | filter = new MFDataPhrase(f.Data());
|
---|
418 | write->SetFilter(filter);
|
---|
419 | }
|
---|
420 | }
|
---|
421 | read = r;
|
---|
422 | }
|
---|
423 | else
|
---|
424 | {
|
---|
425 | read = new MRawFileRead(kNamein);
|
---|
426 | static_cast<MRawFileRead*>(read)->SetInterleave(kInterleave);
|
---|
427 | static_cast<MRawFileRead*>(read)->SetForceMode(kForceProc);
|
---|
428 |
|
---|
429 | write->AddContainer("MRawRunHeader", "RunHeader");
|
---|
430 | write->AddContainer("MTime", "Events");
|
---|
431 | write->AddContainer("MRawEvtHeader", "Events");
|
---|
432 | write->AddContainer("MRawEvtData", "Events");
|
---|
433 | write->AddContainer("MRawEvtData2", "Events");
|
---|
434 | write->AddContainer("MRawCrateArray", "Events");
|
---|
435 | }
|
---|
436 |
|
---|
437 | tasks.AddToList(read);
|
---|
438 | if (filter)
|
---|
439 | tasks.AddToList(filter);
|
---|
440 | /*
|
---|
441 | if (israw && !kSqlDataBase.IsNull())
|
---|
442 | {
|
---|
443 | MSqlInsertRun *ins = new MSqlInsertRun(kSqlDataBase);
|
---|
444 | ins->SetUpdate();
|
---|
445 | tasks.AddToList(ins);
|
---|
446 | }*/
|
---|
447 | tasks.AddToList(write);
|
---|
448 |
|
---|
449 | //
|
---|
450 | // create the looping object and tell it about the parameters to use
|
---|
451 | // and the tasks to execute
|
---|
452 | //
|
---|
453 | MEvtLoop magic;
|
---|
454 | magic.SetParList(&plist);
|
---|
455 |
|
---|
456 | //
|
---|
457 | // Start the eventloop which reads the raw file (MRawFileRead) and
|
---|
458 | // write all the information into a root file (MRawFileWrite)
|
---|
459 | //
|
---|
460 | // between reading and writing we can do, transformations, checks, etc.
|
---|
461 | // (I'm think of a task like MRawDataCheck)
|
---|
462 | //
|
---|
463 | if (!magic.Eventloop())
|
---|
464 | {
|
---|
465 | gLog << err << "ERROR: Merging and preprocessing failed!" << endl;
|
---|
466 | return 2;
|
---|
467 | }
|
---|
468 |
|
---|
469 | tasks.PrintStatistics();
|
---|
470 |
|
---|
471 | gLog << all << "Merpp finished successfull!" << endl;
|
---|
472 | return 0;
|
---|
473 | }
|
---|