22 |
#include <S4Core.h> |
#include <S4Core.h> |
23 |
#include <NDCore.h> |
#include <NDCore.h> |
24 |
#include <OrbitalInfoCore.h> |
#include <OrbitalInfoCore.h> |
25 |
|
#include <RunInfo.h> |
26 |
// |
// |
27 |
using namespace std; |
using namespace std; |
28 |
// |
// |
41 |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
42 |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
43 |
printf("\n -processFile output filename [default ID_RUN.Level2.root]\n"); |
printf("\n -processFile output filename [default ID_RUN.Level2.root]\n"); |
|
printf("\n -processFolder folder for output data but the processFile [default \"calorimeterFolder\"]\n"); |
|
44 |
printf("\n -host name for the host [default = mysql://localhost/pamelaprod]\n"); |
printf("\n -host name for the host [default = mysql://localhost/pamelaprod]\n"); |
45 |
printf("\n -user username for the DB [default = anonymous] \n"); |
printf("\n -user username for the DB [default = anonymous] \n"); |
46 |
printf("\n -psw password for the DB [default = \"\"]\n"); |
printf("\n -psw password for the DB [default = \"\"]\n"); |
434 |
stringstream strun; |
stringstream strun; |
435 |
strun.str(""); |
strun.str(""); |
436 |
strun << run; |
strun << run; |
437 |
|
filename += outDir; |
438 |
|
filename += "/"; |
439 |
filename += strun.str(); |
filename += strun.str(); |
440 |
filename += ".Level2.root"; |
filename += ".Level2.root"; |
441 |
}; |
}; |
442 |
filename = outDir + "/" + filename; |
// filename = outDir + "/" + filename; |
443 |
processFile = new TFile(filename.Data(),"UPDATE"); |
processFile = new TFile(filename.Data(),"UPDATE"); |
444 |
if ( !processFile->IsOpen() ) throw -15; |
if ( !processFile->IsOpen() ) throw -15; |
445 |
// |
// |
450 |
RUNSGN = RunInfoCore(run,processFile,dbc,runargc,runargv); |
RUNSGN = RunInfoCore(run,processFile,dbc,runargc,runargv); |
451 |
printf("done\n"); |
printf("done\n"); |
452 |
}; |
}; |
453 |
|
// |
454 |
|
// From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not |
455 |
|
// |
456 |
|
printf(" Checking if requested detectors are in the acquisition\n"); |
457 |
|
ItoRunInfo *runinfo = new ItoRunInfo(processFile); |
458 |
|
runinfo->Read(run); |
459 |
|
printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO); |
460 |
|
if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ) throw -16; |
461 |
|
if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ) throw -17; |
462 |
|
if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ) throw -18; |
463 |
|
if ( AC && !(runinfo->ACQ_VAR_INFO & (1 << 1)) && !(runinfo->ACQ_VAR_INFO & (1 << 2)) ) throw -19; |
464 |
|
if ( S4 && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ) throw -20; |
465 |
|
if ( ND && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ) throw -21; |
466 |
|
printf(" OK! start processing detector's data. \n"); |
467 |
|
// |
468 |
if ( TRK ) { |
if ( TRK ) { |
469 |
printf(" Calling TrackerLevel2... "); |
printf(" Calling TrackerLevel2... "); |
470 |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
519 |
case -8: message += " No Header branch in LEVEL0 Physics tree"; break; |
case -8: message += " No Header branch in LEVEL0 Physics tree"; break; |
520 |
case -9: message += " No Registry branch in LEVEL0 Physics tree"; break; |
case -9: message += " No Registry branch in LEVEL0 Physics tree"; break; |
521 |
case -11: message += " LEVEL0 Physics tree is empty"; break; |
case -11: message += " LEVEL0 Physics tree is empty"; break; |
522 |
case -12: message += " LEVEL2 output directory does not exists"; break; |
case -12: message += " Too few entries in the registry tree"; break; |
523 |
case -13: message += " Cannot create processFolder directory"; break; |
case -13: message += " Cannot create processFolder directory"; break; |
524 |
case -14: message += " Error querying the DB"; break; |
case -14: message += " Error querying the DB"; break; |
525 |
case -15: message += " Cannot open file for writing"; break; |
case -15: message += " Cannot open file for writing"; break; |
526 |
|
case -16: message += " No tracker in the acquisition (use -TRK to process anyway)"; break; |
527 |
|
case -17: message += " No ToF in the acquisition (use -TOF to process anyway)"; break; |
528 |
|
case -18: message += " No calorimeter in the acquisition (use -CAL to process anyway)"; break; |
529 |
|
case -19: message += " No anticounters in the acquisition (use -AC to process anyway)"; break; |
530 |
|
case -20: message += " No S4 in the acquisition (use -S4 to process anyway)"; break; |
531 |
|
case -21: message += " No neutron detector in the acquisition (use -ND to process anyway)"; break; |
532 |
// |
// |
533 |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
534 |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
594 |
case -802: message += " RUNINFO - Cannot open file for writing"; break; |
case -802: message += " RUNINFO - Cannot open file for writing"; break; |
595 |
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; |
596 |
case -804: message += " RUNINFO - Unknown detector"; break; |
case -804: message += " RUNINFO - Unknown detector"; break; |
597 |
|
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
598 |
// |
// |
599 |
default: message += "Unidentified error or warning"; break; |
default: message += "Unidentified error or warning"; break; |
600 |
}; |
}; |
622 |
// |
// |
623 |
if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error); |
if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error); |
624 |
printf("\n"); |
printf("\n"); |
625 |
|
printf("Finished, exiting...\n"); |
626 |
|
printf("\n"); |
627 |
// |
// |
628 |
// Close redirection if the case. |
// Close redirection if the case. |
629 |
// |
// |