| 36 |
void usage(){ |
void usage(){ |
| 37 |
printf("\nUsage:\n"); |
printf("\nUsage:\n"); |
| 38 |
printf("\n DarthVader [ options ] -idRun ID_RUN [+-all] [+-detector [ detector options ] ] \n"); |
printf("\n DarthVader [ options ] -idRun ID_RUN [+-all] [+-detector [ detector options ] ] \n"); |
| 39 |
printf("\n Options are: \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 -c | --clean remove file if exiting with errors\n"); |
printf(" -c | --clean remove file if exiting with errors\n"); |
| 45 |
printf("\n -b | --benchmark perform and print benchmark test\n"); |
printf(" -b | --benchmark perform and print a benchmark test\n"); |
| 46 |
printf("\n -auto | -AUTO exclude from processing detector which are NOT in the acquisition [default]\n"); |
printf(" -auto | -AUTO exclude from processing detector which are NOT in the acquisition [default]\n"); |
| 47 |
printf("\n -zerofill if a detector is not in the acquisition the routine is called anyway \n"); |
printf(" -zerofill if a detector is not in the acquisition the routine is called anyway \n"); |
| 48 |
printf("\n but all detector's data will be marked as bad\n"); |
printf(" but all detector's data will be marked as bad\n"); |
| 49 |
printf("\n -tedious exit with error if a detector is not in the acquisition and \n"); |
printf(" -tedious exit with error if a detector is not in the acquisition and \n"); |
| 50 |
printf("\n it has not been excluded from processing\n"); |
printf(" it has not been excluded from processing\n"); |
| 51 |
printf("\n -host name for the host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
printf(" -host name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
| 52 |
printf("\n -user username for the DB [default = $PAM_DBUSER or \"anonymous\"] \n"); |
printf(" -user username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n"); |
| 53 |
printf("\n -psw password for the DB [default = $PAM_DBPSW or \"\"]\n"); |
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
| 54 |
printf("\n -processFile file output filename [default ID_RUN.Level2.root]\n"); |
printf(" -idRun ID_RUN ID number (from the DB) of the run to be processed \n"); |
| 55 |
printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); |
printf(" -processFile file output filename [default ID_RUN.Level2.root]\n"); |
| 56 |
printf("\n +all | +ALL call all detectors software [default]\n"); |
printf(" +all | +ALL call all detectors software [default]\n"); |
| 57 |
printf("\n -all | -ALL call nothing\n"); |
printf(" -all | -ALL call nothing\n"); |
| 58 |
printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
printf(" +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); |
| 59 |
printf("\n -detector do not process detector (as above)\n"); |
printf(" -detector do not process detector (as above)\n"); |
| 60 |
printf("\n detector options must be included in square parenthesis with spaces, for example:\n"); |
printf(" detector options must be included in square parenthesis with spaces, for example:\n"); |
| 61 |
printf("\n +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); |
printf(" +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); |
| 62 |
printf("\nExamples: \n"); |
printf("\n Examples: \n"); |
| 63 |
printf("\nStandard call: DarthVader -idRun 1085 \n"); |
printf(" Standard call:\n DarthVader -idRun 1085 \n"); |
| 64 |
printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
printf(" Process only RunInfo and Tracker (be verbose for tracker):\n DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); |
| 65 |
printf("\nProcess all and be verbose for calorimeter: DarthVader -idRun 1085 +CAL [ --verbose ] \n\n"); |
printf(" Process all and be verbose for calorimeter:\n DarthVader -idRun 1085 +CAL [ --verbose ] \n\n"); |
| 66 |
|
}; |
| 67 |
|
|
| 68 |
|
Bool_t CheckDBC(TSQLServer *dbc, TString host, TString user, TString psw){ |
| 69 |
|
// |
| 70 |
|
Bool_t connect = dbc->IsConnected(); |
| 71 |
|
// |
| 72 |
|
if( !dbc || !connect ){ |
| 73 |
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
| 74 |
|
}; |
| 75 |
|
// |
| 76 |
|
connect = dbc->IsConnected(); |
| 77 |
|
// |
| 78 |
|
return(connect); |
| 79 |
|
// |
| 80 |
}; |
}; |
| 81 |
// |
// |
| 82 |
// Here the main |
// Here the main |
| 559 |
// Start: |
// Start: |
| 560 |
// |
// |
| 561 |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version.Data()); |
printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version.Data()); |
| 562 |
|
if ( run ) printf("\n Processing run number %u \n\n",run); |
| 563 |
// |
// |
| 564 |
// Connect to the DB |
// Connect to the DB |
| 565 |
// |
// |
| 598 |
processFile = new TFile(filename.Data(),"UPDATE"); |
processFile = new TFile(filename.Data(),"UPDATE"); |
| 599 |
if ( !processFile->IsOpen() ) throw -15; |
if ( !processFile->IsOpen() ) throw -15; |
| 600 |
// |
// |
| 601 |
|
Long64_t maxsize = 10000000000LL; |
| 602 |
|
TTree::SetMaxTreeSize(maxsize); |
| 603 |
|
processFile->SetCompressionLevel(1); |
| 604 |
|
// |
| 605 |
|
// |
| 606 |
// Run the core program, put any output error in the "error" variable |
// Run the core program, put any output error in the "error" variable |
| 607 |
// |
// |
| 608 |
if ( debug ) printf("\n\n Pre-processing:\n\n"); |
if ( debug ) printf("\n\n Pre-processing:\n\n"); |
| 693 |
// |
// |
| 694 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 695 |
if ( TRK ) { |
if ( TRK ) { |
| 696 |
|
CheckDBC(dbc,host,user,psw); |
| 697 |
printf(" TrackerLevel2 called\n"); |
printf(" TrackerLevel2 called\n"); |
| 698 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 699 |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); |
| 706 |
// |
// |
| 707 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 708 |
if ( TOF ) { |
if ( TOF ) { |
| 709 |
|
CheckDBC(dbc,host,user,psw); |
| 710 |
printf(" ToFLevel2 called\n"); |
printf(" ToFLevel2 called\n"); |
| 711 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 712 |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); |
| 718 |
// |
// |
| 719 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 720 |
if ( CAL ) { |
if ( CAL ) { |
| 721 |
|
CheckDBC(dbc,host,user,psw); |
| 722 |
printf(" CalorimeterLevel2 called\n"); |
printf(" CalorimeterLevel2 called\n"); |
| 723 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 724 |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); |
| 730 |
// |
// |
| 731 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 732 |
if ( TRG ) { |
if ( TRG ) { |
| 733 |
|
CheckDBC(dbc,host,user,psw); |
| 734 |
printf(" TriggerLevel2 called\n"); |
printf(" TriggerLevel2 called\n"); |
| 735 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 736 |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); |
| 742 |
// |
// |
| 743 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 744 |
if ( AC ) { |
if ( AC ) { |
| 745 |
|
CheckDBC(dbc,host,user,psw); |
| 746 |
printf(" AnticounterLevel2 called\n"); |
printf(" AnticounterLevel2 called\n"); |
| 747 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 748 |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
ACSGN = AcCore(run,processFile,dbc,acargc,acargv); |
| 754 |
// |
// |
| 755 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 756 |
if ( S4 ) { |
if ( S4 ) { |
| 757 |
|
CheckDBC(dbc,host,user,psw); |
| 758 |
printf(" S4Level2 called\n"); |
printf(" S4Level2 called\n"); |
| 759 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 760 |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); |
| 766 |
// |
// |
| 767 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 768 |
if ( ND ) { |
if ( ND ) { |
| 769 |
|
CheckDBC(dbc,host,user,psw); |
| 770 |
printf(" NDLevel2 called\n"); |
printf(" NDLevel2 called\n"); |
| 771 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 772 |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); |
| 778 |
// |
// |
| 779 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
| 780 |
if ( ORB ) { |
if ( ORB ) { |
| 781 |
|
CheckDBC(dbc,host,user,psw); |
| 782 |
printf(" OrbitalInfo called\n"); |
printf(" OrbitalInfo called\n"); |
| 783 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
| 784 |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); |
| 820 |
case -53: message += " GLTABLES - No entries matching GL_TRK_CALIB query"; break; |
case -53: message += " GLTABLES - No entries matching GL_TRK_CALIB query"; break; |
| 821 |
case -54: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
case -54: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
| 822 |
case -55: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
case -55: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; |
| 823 |
|
case -56: message += " GLTABLES - No entries matching GL_TLE query"; break; |
| 824 |
// |
// |
| 825 |
case -100: message += " CALORIMETERLEVEL2 - No Level2 input file"; break; |
case -100: message += " CALORIMETERLEVEL2 - No Level2 input file"; break; |
| 826 |
case -101: message += " CALORIMETERLEVEL2 - Cannot open Level2 file"; break; |
case -101: message += " CALORIMETERLEVEL2 - Cannot open Level2 file"; break; |
| 929 |
}; |
}; |
| 930 |
if ( processFile ){ |
if ( processFile ){ |
| 931 |
processFile->cd(); |
processFile->cd(); |
| 932 |
|
processFile->WriteStreamerInfo(); |
| 933 |
processFile->Close(); |
processFile->Close(); |
| 934 |
}; |
}; |
| 935 |
// |
// |