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