10 |
#include <TSQLServer.h> |
#include <TSQLServer.h> |
11 |
#include <TFile.h> |
#include <TFile.h> |
12 |
#include <TSystem.h> |
#include <TSystem.h> |
13 |
|
#include <TStopwatch.h> |
14 |
// |
// |
15 |
// Detector's package headers |
// Detector's package headers |
16 |
// |
// |
35 |
// |
// |
36 |
void usage(){ |
void usage(){ |
37 |
printf("\nUsage:\n"); |
printf("\nUsage:\n"); |
38 |
printf("\n DarthVader [-v | --verbose] [-h | --help] [--version] -idRun ID_RUN [-processFile filename]\n"); |
printf("\n DarthVader [ options ] -idRun ID_RUN [+-all] [+-detector [ detector options ] ] \n"); |
39 |
printf("\n [-host host] [-user username] [-psw password] [+-all] [+-detector [ detector options ] ]\n"); |
printf("\n Options are: \n\n"); |
40 |
printf("\n --version print informations about compilation and exit\n"); |
printf(" --version print informations about compilation and exit\n"); |
41 |
printf("\n -h | --help print this help and exit \n"); |
printf(" -h | --help print this help and exit \n"); |
42 |
printf("\n -v | --verbose be verbose [default]\n"); |
printf(" -v | --verbose be verbose [default]\n"); |
43 |
printf("\n -s | --silent print nothing on STDOUT]\n"); |
printf(" -s | --silent print nothing on STDOUT\n"); |
44 |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
printf(" -c | --clean remove file if exiting with errors\n"); |
45 |
printf("\n -processFile output filename [default ID_RUN.Level2.root]\n"); |
printf(" -b | --benchmark perform and print a benchmark test\n"); |
46 |
printf("\n -host name for the host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
printf(" -auto | -AUTO exclude from processing detector which are NOT in the acquisition [default]\n"); |
47 |
printf("\n -user username for the DB [default = $PAM_DBUSER or \"anonymous\"] \n"); |
printf(" -zerofill if a detector is not in the acquisition the routine is called anyway \n"); |
48 |
printf("\n -psw password for the DB [default = $PAM_DBPSW or \"\"]\n"); |
printf(" but all detector's data will be marked as bad\n"); |
49 |
printf("\n +all | +ALL call all detectors software [default]\n"); |
printf(" -tedious exit with error if a detector is not in the acquisition and \n"); |
50 |
printf("\n -all | -ALL call nothing\n"); |
printf(" it has not been excluded from processing\n"); |
51 |
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
printf(" -host name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
52 |
printf("\n -detector do not process detector (as above)\n"); |
printf(" -user username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n"); |
53 |
printf("\n detector options must be included in square parenthesis with spaces, for example:\n"); |
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
54 |
printf("\n +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); |
printf(" -idRun ID_RUN ID number (from the DB) of the run to be processed \n"); |
55 |
|
printf(" -processFile file output filename [default ID_RUN.Level2.root]\n"); |
56 |
printf("\nExamples: \n"); |
printf(" +all | +ALL call all detectors software [default]\n"); |
57 |
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
printf(" -all | -ALL call nothing\n"); |
58 |
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
printf(" +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
59 |
printf("\nProcess all and be verbose for calorimeter: DarthVader -idRun 1085 +CAL [ --verbose ] \n\n"); |
printf(" -detector do not process detector (as above)\n"); |
60 |
|
printf(" detector options must be included in square parenthesis with spaces, for example:\n"); |
61 |
|
printf(" +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); |
62 |
|
printf("\n Examples: \n"); |
63 |
|
printf(" Standard call:\n DarthVader -idRun 1085 \n"); |
64 |
|
printf(" Process only RunInfo and Tracker (be verbose for tracker):\n DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
65 |
|
printf(" Process all and be verbose for calorimeter:\n DarthVader -idRun 1085 +CAL [ --verbose ] \n\n"); |
66 |
}; |
}; |
67 |
// |
// |
68 |
// Here the main |
// Here the main |
71 |
// |
// |
72 |
// Variables booking |
// Variables booking |
73 |
// |
// |
74 |
|
// |
75 |
|
// benchmarck variables |
76 |
|
// |
77 |
|
TStopwatch timer; |
78 |
|
TStopwatch dvtimer; |
79 |
|
dvtimer.Start(kTRUE); |
80 |
|
UInt_t nevents = 0; |
81 |
|
UInt_t nruns = 0; |
82 |
|
Double_t runtime = 0.; |
83 |
|
Double_t cruntime = 0.; |
84 |
|
Double_t trktime = 0.; |
85 |
|
Double_t ctrktime = 0.; |
86 |
|
Double_t caltime = 0.; |
87 |
|
Double_t ccaltime = 0.; |
88 |
|
Double_t toftime = 0.; |
89 |
|
Double_t ctoftime = 0.; |
90 |
|
Double_t trgtime = 0.; |
91 |
|
Double_t ctrgtime = 0.; |
92 |
|
Double_t actime = 0.; |
93 |
|
Double_t cactime = 0.; |
94 |
|
Double_t s4time = 0.; |
95 |
|
Double_t cs4time = 0.; |
96 |
|
Double_t ndtime = 0.; |
97 |
|
Double_t cndtime = 0.; |
98 |
|
Double_t orbtime = 0.; |
99 |
|
Double_t corbtime = 0.; |
100 |
|
Double_t dvtime = 0.; |
101 |
|
Double_t cdvtime = 0.; |
102 |
|
// |
103 |
TString message; |
TString message; |
104 |
int nul = 0; |
int nul = 0; |
105 |
Int_t error = 0; |
Int_t error = 0; |
115 |
Int_t NDSGN = 0; |
Int_t NDSGN = 0; |
116 |
Int_t DVSGN = 0; |
Int_t DVSGN = 0; |
117 |
// |
// |
118 |
|
Bool_t autom = true; |
119 |
|
Bool_t zerofill = false; |
120 |
|
Bool_t tedious = false; |
121 |
|
Bool_t remfile = false; |
122 |
Bool_t debug = false; |
Bool_t debug = false; |
123 |
Bool_t beverbose = true; |
Bool_t beverbose = true; |
124 |
Bool_t givenid = false; |
Bool_t givenid = false; |
125 |
|
Bool_t bench = false; |
126 |
Bool_t CAL = true; |
Bool_t CAL = true; |
127 |
Bool_t TRK = true; |
Bool_t TRK = true; |
128 |
Bool_t TRG = true; |
Bool_t TRG = true; |
131 |
Bool_t ND = true; |
Bool_t ND = true; |
132 |
Bool_t AC = true; |
Bool_t AC = true; |
133 |
Bool_t ORB = true; |
Bool_t ORB = true; |
134 |
Bool_t RUN = true; |
Bool_t RUN = true; |
135 |
// |
// |
136 |
Int_t calargc = 0; |
Int_t calargc = 0; |
137 |
char *calargv[50]; |
char *calargv[50]; |
252 |
found = true; |
found = true; |
253 |
beverbose = true; |
beverbose = true; |
254 |
}; |
}; |
255 |
|
if ( !strcmp(inps[i],"-c") || !strcmp(inps[i],"--clean")){ |
256 |
|
found = true; |
257 |
|
remfile = true; |
258 |
|
}; |
259 |
if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ){ |
if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ){ |
260 |
found = true; |
found = true; |
261 |
beverbose = false; |
beverbose = false; |
262 |
}; |
}; |
|
// |
|
263 |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ){ |
if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ){ |
264 |
debug = true; |
debug = true; |
265 |
found = true; |
found = true; |
266 |
}; |
}; |
267 |
|
if ( !strcmp(inps[i],"-b") || !strcmp(inps[i],"--benchmark") ){ |
268 |
|
bench = true; |
269 |
|
found = true; |
270 |
|
}; |
271 |
|
if ( !strcmp(inps[i],"-auto") || !strcmp(inps[i],"-AUTO") ){ |
272 |
|
autom = true; |
273 |
|
tedious = false; |
274 |
|
zerofill = false; |
275 |
|
found = true; |
276 |
|
}; |
277 |
|
if ( !strcmp(inps[i],"-zerofill") ){ |
278 |
|
tedious = false; |
279 |
|
autom = false; |
280 |
|
zerofill = true; |
281 |
|
found = true; |
282 |
|
}; |
283 |
|
if ( !strcmp(inps[i],"-tedious") ){ |
284 |
|
tedious = true; |
285 |
|
zerofill = false; |
286 |
|
autom = false; |
287 |
|
found = true; |
288 |
|
}; |
289 |
// |
// |
290 |
if ( !strcmp(inps[i],"-CAL") ) { |
if ( !strcmp(inps[i],"-CAL") ) { |
291 |
found = true; |
found = true; |
540 |
// |
// |
541 |
if ( !givenid ) throw -1; |
if ( !givenid ) throw -1; |
542 |
// |
// |
543 |
char *version = DarthVaderInfo(false); |
TString version = DarthVaderInfo(false); |
544 |
// |
// |
545 |
// Start: |
// Start: |
546 |
// |
// |
547 |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version); |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version.Data()); |
548 |
|
if ( run ) printf("\n Processing run number %u \n\n",run); |
549 |
// |
// |
550 |
// Connect to the DB |
// Connect to the DB |
551 |
// |
// |
554 |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
555 |
if( !dbc ) throw -2; |
if( !dbc ) throw -2; |
556 |
// |
// |
557 |
bool connect = dbc->IsConnected(); |
Bool_t connect = dbc->IsConnected(); |
558 |
// |
// |
559 |
if( !connect ) throw -2; |
if( !connect ) throw -2; |
560 |
// |
// |
561 |
if ( debug ) printf("...connected! \n\n"); |
if ( debug ) printf("...connected! \n\n"); |
562 |
// |
// |
563 |
|
if ( debug ) printf("\n DB INFORMATIONS:\n SQL: %s Version: %s Host %s Port %i \n\n",dbc->GetDBMS(),dbc->ServerInfo(),dbc->GetHost(),dbc->GetPort()); |
564 |
|
// |
565 |
|
// Use UTC in the DB |
566 |
|
// |
567 |
|
stringstream myquery; |
568 |
|
myquery.str(""); |
569 |
|
myquery << "SET time_zone='+0:00'"; |
570 |
|
dbc->Query(myquery.str().c_str()); |
571 |
|
// |
572 |
|
// |
573 |
// Create LEVEL2 filename and open it in update mode |
// Create LEVEL2 filename and open it in update mode |
574 |
// |
// |
575 |
if ( filename.IsNull() ){ |
if ( filename.IsNull() ){ |
581 |
filename += strun.str(); |
filename += strun.str(); |
582 |
filename += ".Level2.root"; |
filename += ".Level2.root"; |
583 |
}; |
}; |
|
// filename = outDir + "/" + filename; |
|
584 |
processFile = new TFile(filename.Data(),"UPDATE"); |
processFile = new TFile(filename.Data(),"UPDATE"); |
585 |
if ( !processFile->IsOpen() ) throw -15; |
if ( !processFile->IsOpen() ) throw -15; |
586 |
// |
// |
587 |
|
Long64_t maxsize = 10000000000LL; |
588 |
|
TTree::SetMaxTreeSize(maxsize); |
589 |
|
processFile->SetCompressionLevel(1); |
590 |
|
// |
591 |
|
// |
592 |
// Run the core program, put any output error in the "error" variable |
// Run the core program, put any output error in the "error" variable |
593 |
// |
// |
594 |
|
if ( debug ) printf("\n\n Pre-processing:\n\n"); |
595 |
|
// |
596 |
|
timer.Start(kTRUE); |
597 |
if ( RUN ) { |
if ( RUN ) { |
598 |
printf(" Calling RunInfo... "); |
if ( debug ) printf(" Retrieve, if the case, the RUN informations from the DB...\n"); |
599 |
RUNSGN = RunInfoCore(run,processFile,dbc,runargc,runargv); |
printf(" RunInfo called\n"); |
600 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
601 |
}; |
RUNSGN = RunInfoCore(run,processFile,dbc,version,runargc,runargv); |
602 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
603 |
|
if ( debug ) printf(" ...done\n"); |
604 |
|
}; |
605 |
|
timer.Stop(); |
606 |
|
runtime = timer.RealTime(); |
607 |
|
cruntime = timer.CpuTime(); |
608 |
// |
// |
609 |
// From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not |
// From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not |
610 |
// |
// |
611 |
printf(" Checking if requested detectors are in the acquisition\n"); |
if ( debug ) printf(" Checking if requested detectors are in the acquisition\n"); |
612 |
ItoRunInfo *runinfo = new ItoRunInfo(processFile); |
ItoRunInfo *runinfo = new ItoRunInfo(processFile); |
613 |
runinfo->Read(run); |
Int_t sgnl = runinfo->Read(run); |
614 |
printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO); |
if ( sgnl != 0 ) throw -17; |
615 |
if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ) DVSGN = 16; |
nevents = runinfo->GetEntries(); |
616 |
if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ) DVSGN = 17; |
nruns = runinfo->GetNoRun(); |
617 |
if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ) DVSGN = 18; |
if ( debug ) printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO); |
618 |
if ( AC && !(runinfo->ACQ_VAR_INFO & (1 << 1)) && !(runinfo->ACQ_VAR_INFO & (1 << 2)) ) DVSGN = 19; |
if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ){ |
619 |
if ( S4 && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ) DVSGN = 20; |
DVSGN += 1; |
620 |
if ( ND && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ) DVSGN = 21; |
if ( tedious ) throw -30; |
621 |
printf(" OK! start processing detector's data. \n"); |
if ( autom ){ |
622 |
|
TRK = 0; |
623 |
|
if ( debug ) printf(" TRK excluded from processing \n"); |
624 |
|
}; |
625 |
|
if ( zerofill && debug ) printf(" TRK is not in the acquisition! \n"); |
626 |
|
}; |
627 |
|
if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ){ |
628 |
|
DVSGN += 2; |
629 |
|
if ( tedious ) throw -31; |
630 |
|
if ( autom ){ |
631 |
|
TOF = 0; |
632 |
|
if ( debug ) printf(" TOF excluded from processing \n"); |
633 |
|
}; |
634 |
|
if ( zerofill && debug ) printf(" TOF is not in the acquisition! \n"); |
635 |
|
}; |
636 |
|
if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ){ |
637 |
|
DVSGN += 4; |
638 |
|
if ( tedious ) throw -32; |
639 |
|
if ( autom ){ |
640 |
|
CAL = 0; |
641 |
|
if ( debug ) printf(" CAL excluded from processing \n"); |
642 |
|
}; |
643 |
|
if ( zerofill && debug ) printf(" CAL is not in the acquisition! \n"); |
644 |
|
}; |
645 |
|
if ( AC && (!(runinfo->ACQ_VAR_INFO & (1 << 1)) || !(runinfo->ACQ_VAR_INFO & (1 << 2))) ){ |
646 |
|
DVSGN += 8; |
647 |
|
if ( tedious ) throw -33; |
648 |
|
if ( autom ){ |
649 |
|
AC = 0; |
650 |
|
if ( debug ) printf(" AC excluded from processing \n"); |
651 |
|
}; |
652 |
|
if ( zerofill && debug ) printf(" AC is not in the acquisition! \n"); |
653 |
|
}; |
654 |
|
if ( S4 && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ){ |
655 |
|
DVSGN += 16; |
656 |
|
if ( tedious ) throw -34; |
657 |
|
if ( autom ){ |
658 |
|
S4 = 0; |
659 |
|
if ( debug ) printf(" S4 excluded from processing \n"); |
660 |
|
}; |
661 |
|
if ( zerofill && debug ) printf(" S4 is not in the acquisition! \n"); |
662 |
|
}; |
663 |
|
if ( ND && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ){ |
664 |
|
DVSGN += 32; |
665 |
|
if ( tedious ) throw -35; |
666 |
|
if ( autom ){ |
667 |
|
ND = 0; |
668 |
|
if ( debug ) printf(" ND excluded from processing \n"); |
669 |
|
}; |
670 |
|
if ( zerofill && debug ) printf(" ND is not in the acquisition! \n"); |
671 |
|
}; |
672 |
// |
// |
673 |
|
if ( !DVSGN ){ |
674 |
|
if ( debug ) printf(" OK! Start processing detector's data. \n"); |
675 |
|
} else { |
676 |
|
if ( debug ) printf(" WARNING! missing detector(s)! Start anyway processing detector's data. \n"); |
677 |
|
}; |
678 |
|
if ( debug ) printf("\n End pre-processing \n\n"); |
679 |
|
// |
680 |
|
timer.Start(kTRUE); |
681 |
if ( TRK ) { |
if ( TRK ) { |
682 |
printf(" Calling TrackerLevel2... "); |
printf(" TrackerLevel2 called\n"); |
683 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
684 |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
685 |
gSystem->Unlink("TrackerFolder"); //patch |
gSystem->Unlink("TrackerFolder"); //patch |
686 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
687 |
}; |
}; |
688 |
|
timer.Stop(); |
689 |
|
trktime = timer.RealTime(); |
690 |
|
ctrktime = timer.CpuTime(); |
691 |
|
// |
692 |
|
timer.Start(kTRUE); |
693 |
if ( TOF ) { |
if ( TOF ) { |
694 |
printf(" Calling ToFLevel2... "); |
printf(" ToFLevel2 called\n"); |
695 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
696 |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
697 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
698 |
}; |
}; |
699 |
|
timer.Stop(); |
700 |
|
toftime = timer.RealTime(); |
701 |
|
ctoftime = timer.CpuTime(); |
702 |
|
// |
703 |
|
timer.Start(kTRUE); |
704 |
if ( CAL ) { |
if ( CAL ) { |
705 |
printf(" Calling CalorimeterLevel2... "); |
printf(" CalorimeterLevel2 called\n"); |
706 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
707 |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
708 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
709 |
}; |
}; |
710 |
|
timer.Stop(); |
711 |
|
caltime = timer.RealTime(); |
712 |
|
ccaltime = timer.CpuTime(); |
713 |
|
// |
714 |
|
timer.Start(kTRUE); |
715 |
if ( TRG ) { |
if ( TRG ) { |
716 |
printf(" Calling TriggerLevel2... "); |
printf(" TriggerLevel2 called\n"); |
717 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
718 |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
719 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
720 |
}; |
}; |
721 |
|
timer.Stop(); |
722 |
|
trgtime = timer.RealTime(); |
723 |
|
ctrgtime = timer.CpuTime(); |
724 |
|
// |
725 |
|
timer.Start(kTRUE); |
726 |
if ( AC ) { |
if ( AC ) { |
727 |
printf(" Calling AnticounterLevel2... "); |
printf(" AnticounterLevel2 called\n"); |
728 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
729 |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
730 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
731 |
}; |
}; |
732 |
|
timer.Stop(); |
733 |
|
actime = timer.RealTime(); |
734 |
|
cactime = timer.CpuTime(); |
735 |
|
// |
736 |
|
timer.Start(kTRUE); |
737 |
if ( S4 ) { |
if ( S4 ) { |
738 |
printf(" Calling S4Level2 ... "); |
printf(" S4Level2 called\n"); |
739 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
740 |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
741 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
742 |
}; |
}; |
743 |
|
timer.Stop(); |
744 |
|
s4time = timer.RealTime(); |
745 |
|
cs4time = timer.CpuTime(); |
746 |
|
// |
747 |
|
timer.Start(kTRUE); |
748 |
if ( ND ) { |
if ( ND ) { |
749 |
printf(" Calling NDLevel2... "); |
printf(" NDLevel2 called\n"); |
750 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
751 |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
752 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
753 |
}; |
}; |
754 |
|
timer.Stop(); |
755 |
|
ndtime = timer.RealTime(); |
756 |
|
cndtime = timer.CpuTime(); |
757 |
|
// |
758 |
|
timer.Start(kTRUE); |
759 |
if ( ORB ) { |
if ( ORB ) { |
760 |
printf(" Calling OrbitalInfo... "); |
printf(" OrbitalInfo called\n"); |
761 |
|
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
762 |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
763 |
printf("done\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
764 |
}; |
}; |
765 |
|
timer.Stop(); |
766 |
|
orbtime = timer.RealTime(); |
767 |
|
corbtime = timer.CpuTime(); |
768 |
// |
// |
769 |
} catch(Int_t signal) { |
} catch(Int_t signal) { |
770 |
error = signal; |
error = signal; |
783 |
case -13: message += " Cannot create processFolder directory"; break; |
case -13: message += " Cannot create processFolder directory"; break; |
784 |
case -14: message += " Error querying the DB"; break; |
case -14: message += " Error querying the DB"; break; |
785 |
case -15: message += " Cannot open file for writing"; break; |
case -15: message += " Cannot open file for writing"; break; |
786 |
|
case -17: message += " Error during pre-processing"; break; |
787 |
case -22: message += " Unknown input or wrong syntax in input paramters!"; break; |
case -22: message += " Unknown input or wrong syntax in input paramters!"; break; |
788 |
|
case -30: message += " No TRK in the acquisition"; break; |
789 |
|
case -31: message += " No TOF in the acquisition"; break; |
790 |
|
case -32: message += " No CAL in the acquisition"; break; |
791 |
|
case -33: message += " No AC in the acquisition"; break; |
792 |
|
case -34: message += " No S4 in the acquisition"; break; |
793 |
|
case -35: message += " No ND in the acquisition"; break; |
794 |
// |
// |
795 |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; |
796 |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; |
813 |
case -111: message += " CALORIMETERLEVEL2 - Corrupted calibration"; break; |
case -111: message += " CALORIMETERLEVEL2 - Corrupted calibration"; break; |
814 |
case -112: message += " CALORIMETERLEVEL2 - No physics event related to registry entry in Level0 file"; break; |
case -112: message += " CALORIMETERLEVEL2 - No physics event related to registry entry in Level0 file"; break; |
815 |
case -113: message += " CALORIMETERLEVEL2 - No tracker event related to registry entry in Level2 file"; break; |
case -113: message += " CALORIMETERLEVEL2 - No tracker event related to registry entry in Level2 file"; break; |
816 |
|
case -114: message += " CALORIMETERLEVEL2 - Help called"; break; |
817 |
|
case -115: message += " CALORIMETERLEVEL2 - No Calorimeter bad strip offline mask file"; break; |
818 |
|
case -116: message += " CALORIMETERLEVEL2 - DB connection problems"; break; |
819 |
|
case -117: message += " CALORIMETERLEVEL2 - Cannot reprocess file with Level1 data without calling Level1 routine"; break; |
820 |
|
case -118: message += " CALORIMETERLEVEL2 - Cannot reprocess file without Level1 data calling Level1 routine"; break; |
821 |
// |
// |
822 |
case -200: message += " TRACKERLEVEL2 - LEVEL1 framework unknown (HBOOK/ROOT)"; break; |
case -200: message += " TRACKERLEVEL2 - LEVEL1 framework unknown (HBOOK/ROOT)"; break; |
823 |
case -201: message += " TRACKERLEVEL2 - LEVEL2 framework unknown (HBOOK/ROOT)"; break; |
case -201: message += " TRACKERLEVEL2 - LEVEL2 framework unknown (HBOOK/ROOT)"; break; |
840 |
case -302: message += " TOFLEVEL2 - No tracker tree in Level2 file"; break; |
case -302: message += " TOFLEVEL2 - No tracker tree in Level2 file"; break; |
841 |
case -303: message += " TOFLEVEL2 - No Tof branch in Level0 file"; break; |
case -303: message += " TOFLEVEL2 - No Tof branch in Level0 file"; break; |
842 |
case -313: message += " TOFLEVEL2 - No more tracker events in Level2 file"; break; |
case -313: message += " TOFLEVEL2 - No more tracker events in Level2 file"; break; |
843 |
|
case -314: message += " TOFLEVEL2 - DB connection problems"; break; |
844 |
// |
// |
845 |
case -401: message += " TRIGGERLEVEL2 - Cannot open file for writing"; break; |
case -401: message += " TRIGGERLEVEL2 - Cannot open file for writing"; break; |
846 |
case -402: message += " TRIGGERLEVEL2 - No Trigger branch in Level0 tree"; break; |
case -402: message += " TRIGGERLEVEL2 - No Trigger branch in Level0 tree"; break; |
847 |
|
case -403: message += " TRIGGERLEVEL2 - DB connection problems"; break; |
848 |
// |
// |
849 |
case -500: message += " S4LEVEL2 - No level2 file"; break; |
case -500: message += " S4LEVEL2 - No level2 file"; break; |
850 |
case -501: message += " S4LEVEL2 - Cannot open file for writing"; break; |
case -501: message += " S4LEVEL2 - Cannot open file for writing"; break; |
851 |
case -502: message += " S4LEVEL2 - No result from GL_S4_CALIB"; break; |
case -502: message += " S4LEVEL2 - No result from GL_S4_CALIB"; break; |
852 |
case -503: message += " S4LEVEL2 - No S4 branch in Level0 tree"; break; |
case -503: message += " S4LEVEL2 - No S4 branch in Level0 tree"; break; |
853 |
|
case -504: message += " S4LEVEL2 - DB connection problems"; break; |
854 |
// |
// |
855 |
case -600: message += " NDLEVEL2 - No level2 file"; break; |
case -600: message += " NDLEVEL2 - No level2 file"; break; |
856 |
case -601: message += " NDLEVEL2 - Cannot open file for writing"; break; |
case -601: message += " NDLEVEL2 - Cannot open file for writing"; break; |
857 |
case -603: message += " NDLEVEL2 - No S4Level2 branch in Level0 tree"; break; |
case -603: message += " NDLEVEL2 - No S4Level2 branch in Level0 tree"; break; |
858 |
|
case -604: message += " NDLEVEL2 - DB connection problems"; break; |
859 |
// |
// |
860 |
case -701: message += " NDLEVEL2 - Cannot open file for writing"; break; |
case -701: message += " ACLEVEL2 - Cannot open file for writing"; break; |
861 |
case -704: message += " NDLEVEL2 - No Anticounter branch in Level0 tree"; break; |
case -704: message += " ACLEVEL2 - No Anticounter branch in Level0 tree"; break; |
862 |
|
case -705: message += " ACLEVEL2 - DB connection problems"; break; |
863 |
// |
// |
864 |
case -800: message += " RUNINFO - No such run in the RunInfo list"; break; |
case -800: message += " RUNINFO - No such run in the RunInfo list"; break; |
865 |
case -801: message += " RUNINFO - No RunInfo tree in Level2 file"; break; |
case -801: message += " RUNINFO - No RunInfo tree in Level2 file"; break; |
868 |
case -804: message += " RUNINFO - Unknown detector"; break; |
case -804: message += " RUNINFO - Unknown detector"; break; |
869 |
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; |
870 |
case -806: message += " RUNINFO - Can not handle more than 500 runs"; break; |
case -806: message += " RUNINFO - Can not handle more than 500 runs"; break; |
871 |
// |
case -807: message += " RUNINFO - DB connection problems"; break; |
872 |
|
// |
873 |
default: message += "Unidentified error or warning"; break; |
default: message += "Unidentified error or warning"; break; |
874 |
}; |
}; |
875 |
printf("\n"); |
printf("\n"); |
876 |
if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl; |
if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <<endl; |
877 |
} |
} |
878 |
// |
// |
879 |
switch(DVSGN){ // change message with printf!! |
// Warnings from XCore routines and from DV: |
880 |
case 16: printf(" No tracker in the acquisition\n"); |
// |
881 |
case 17: printf(" No ToF in the acquisition\n"); |
if ( debug && DVSGN ) printf(" DVSGN = %i \n",DVSGN); |
882 |
case 18: printf(" No calorimeter in the acquisition\n"); |
if ( DVSGN ) printf("\n WARNING DarthVader: \n"); |
883 |
case 19: printf(" No anticounters in the acquisition\n"); |
if ( DVSGN & (1 << 0) ) printf(" - No tracker in the acquisition\n"); |
884 |
case 20: printf(" No S4 in the acquisition\n"); |
if ( DVSGN & (1 << 1) ) printf(" - No ToF in the acquisition\n"); |
885 |
case 21: printf(" No neutron detector in the acquisition\n"); |
if ( DVSGN & (1 << 2) ) printf(" - No calorimeter in the acquisition\n"); |
886 |
}; |
if ( DVSGN & (1 << 3) ) printf(" - No anticounters in the acquisition\n"); |
887 |
|
if ( DVSGN & (1 << 4) ) printf(" - No S4 in the acquisition\n"); |
888 |
|
if ( DVSGN & (1 << 5) ) printf(" - No neutron detector in the acquisition\n"); |
889 |
|
// |
890 |
|
// CaloCore: |
891 |
// |
// |
|
// switch(RUNSGN){ |
|
|
// }; |
|
892 |
switch(CALSGN){ |
switch(CALSGN){ |
893 |
case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n"); |
case 100: printf("\n WARNING CALORIMETER - Data with no associated calibration\n"); |
894 |
case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n"); |
case 101: printf("\n WARNING CALORIMETER - No tracks or good events in this run\n"); |
895 |
}; |
}; |
896 |
// |
// |
897 |
|
// no other at the moment |
898 |
|
// |
899 |
|
// |
900 |
// Close the DB connection |
// Close the DB connection |
901 |
// |
// |
902 |
if ( dbc ){ |
if ( dbc ){ |
906 |
}; |
}; |
907 |
if ( processFile ){ |
if ( processFile ){ |
908 |
processFile->cd(); |
processFile->cd(); |
909 |
|
processFile->WriteStreamerInfo(); |
910 |
processFile->Close(); |
processFile->Close(); |
911 |
}; |
}; |
912 |
// |
// |
913 |
|
// print benchmark results (if the case) |
914 |
|
// |
915 |
|
dvtimer.Stop(); |
916 |
|
dvtime = dvtimer.RealTime(); |
917 |
|
cdvtime = dvtimer.CpuTime(); |
918 |
|
if ( bench ){ |
919 |
|
Float_t runrt = 0.; |
920 |
|
Float_t trkrt = 0.; |
921 |
|
Float_t calrt = 0.; |
922 |
|
Float_t tofrt = 0.; |
923 |
|
Float_t trgrt = 0.; |
924 |
|
Float_t acrt = 0.; |
925 |
|
Float_t s4rt = 0.; |
926 |
|
Float_t ndrt = 0.; |
927 |
|
Float_t orbrt = 0.; |
928 |
|
Float_t dvrt = nevents/dvtime; |
929 |
|
if ( RUN ) runrt = nruns/runtime; |
930 |
|
if ( TRK ) trkrt = nevents/trktime; |
931 |
|
if ( CAL ) calrt = nevents/caltime; |
932 |
|
if ( TOF ) tofrt = nevents/toftime; |
933 |
|
if ( TRG ) trgrt = nevents/trgtime; |
934 |
|
if ( AC ) acrt = nevents/actime; |
935 |
|
if ( S4 ) s4rt = nevents/s4time; |
936 |
|
if ( ND ) ndrt = nevents/ndtime; |
937 |
|
if ( ORB ) orbrt = nevents/orbtime; |
938 |
|
// |
939 |
|
printf("\n\n################################################################################\n"); |
940 |
|
printf("# Benchmark results: nevents = %10u runs = %3u #\n",nevents,nruns); |
941 |
|
printf("################################################################################\n"); |
942 |
|
printf("# Detector # Core routine called # Real Time # CPU time # Events/s #\n"); |
943 |
|
printf("################################################################################\n"); |
944 |
|
printf("# RUN # %i # %8.2f # %8.2f # %8.2f #\n",RUN,fabs(runtime),fabs(cruntime),runrt); |
945 |
|
printf("# TRK # %i # %8.2f # %8.2f # %8.2f #\n",TRK,fabs(trktime),fabs(ctrktime),trkrt); |
946 |
|
printf("# CAL # %i # %8.2f # %8.2f # %8.2f #\n",CAL,fabs(caltime),fabs(ccaltime),calrt); |
947 |
|
printf("# TOF # %i # %8.2f # %8.2f # %8.2f #\n",TOF,fabs(toftime),fabs(ctoftime),tofrt); |
948 |
|
printf("# TRG # %i # %8.2f # %8.2f # %8.2f #\n",TRG,fabs(trgtime),fabs(ctrgtime),trgrt); |
949 |
|
printf("# AC # %i # %8.2f # %8.2f # %8.2f #\n",AC,fabs(actime),fabs(cactime),acrt); |
950 |
|
printf("# S4 # %i # %8.2f # %8.2f # %8.2f #\n",S4,fabs(s4time),fabs(cs4time),s4rt); |
951 |
|
printf("# ND # %i # %8.2f # %8.2f # %8.2f #\n",ND,fabs(ndtime),fabs(cndtime),ndrt); |
952 |
|
printf("# ORB # %i # %8.2f # %8.2f # %8.2f #\n",ORB,fabs(orbtime),fabs(corbtime),orbrt); |
953 |
|
printf("################################################################################\n"); |
954 |
|
printf("# Total # # %8.2f # %8.2f # %8.2f #\n",fabs(dvtime),fabs(cdvtime),dvrt); |
955 |
|
printf("################################################################################\n"); |
956 |
|
}; |
957 |
|
// |
958 |
|
// |
959 |
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); |
960 |
printf("\n"); |
// |
961 |
printf("Finished, exiting...\n"); |
// |
962 |
printf("\n"); |
// |
963 |
|
if ( remfile && error < 0 ){ |
964 |
|
printf(" -c or --clean option used, deleting file %s \n\n",filename.Data()); |
965 |
|
gSystem->Unlink(filename.Data()); |
966 |
|
}; |
967 |
|
// |
968 |
|
printf("\n Finished, exiting...\n\n"); |
969 |
// |
// |
970 |
// Close redirection if the case. |
// Close redirection if the case. |
971 |
// |
// |