6 |
// |
// |
7 |
// ROOT headers |
// ROOT headers |
8 |
// |
// |
9 |
|
#include <TTimeStamp.h> |
10 |
#include <TString.h> |
#include <TString.h> |
11 |
#include <TSQLServer.h> |
#include <TSQLServer.h> |
12 |
#include <TFile.h> |
#include <TFile.h> |
587 |
// |
// |
588 |
// Start: |
// Start: |
589 |
// |
// |
590 |
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 (The Ultimate Warrior)\n\n",version.Data()); |
591 |
if ( run ) printf("\n Processing run number %u \n\n",run); |
if ( run ){ |
592 |
|
printf("\n Processing run number %u \n",run); |
593 |
|
} else { |
594 |
|
printf("\n Re-processing all runs?\n"); |
595 |
|
} |
596 |
// |
// |
597 |
// Connect to the DB |
// Connect to the DB |
598 |
// |
// |
610 |
glt = new GL_TABLES(host,user,psw); |
glt = new GL_TABLES(host,user,psw); |
611 |
//GL_TABLES *glt = new GL_TABLES(host,user,psw); |
//GL_TABLES *glt = new GL_TABLES(host,user,psw); |
612 |
// |
// |
613 |
|
printf("\n DB settings:\n SQL: %s Version: %s Host %s Port %i \n",dbc->GetDBMS(),dbc->ServerInfo(),dbc->GetHost(),dbc->GetPort()); |
614 |
|
printf(" DB %s --- User %s \n\n",host.Data(),user.Data()); |
615 |
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()); |
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()); |
616 |
// |
// |
617 |
// Use UTC in the DB |
// Use UTC in the DB |
653 |
TTree::SetMaxTreeSize(maxsize); |
TTree::SetMaxTreeSize(maxsize); |
654 |
processFile->SetCompressionLevel(1); |
processFile->SetCompressionLevel(1); |
655 |
// |
// |
656 |
|
// ok, we are going to do some kinf of processing, the file is opened and ready. Save processing infos first |
657 |
|
// |
658 |
|
ProcInfo *procinfo = new ProcInfo(); |
659 |
|
procinfo->runID = run; |
660 |
|
TTimeStamp *dt = new TTimeStamp(); |
661 |
|
procinfo->date = dt->AsString(); |
662 |
|
delete dt; |
663 |
|
for ( Int_t icl = 0; icl<numinp; icl++){ |
664 |
|
procinfo->commandLine += Form("%s ",inps[icl]); |
665 |
|
} |
666 |
|
procinfo->outputFilename = filename; |
667 |
|
procinfo->localDir = gSystem->WorkingDirectory(); |
668 |
|
procinfo->uname = gSystem->GetFromPipe("uname -a"); |
669 |
|
procinfo->DB = host; |
670 |
|
|
671 |
|
TTree *pinfo = 0; |
672 |
|
pinfo = (TTree*)processFile->Get("ProcessingInfo"); |
673 |
|
// ProcessingInfo tree does not exist, crating proc info |
674 |
|
if ( !pinfo ){ |
675 |
|
if ( debug ) printf("ProcessingInfo tree does not exist, crating proc info\n"); |
676 |
|
pinfo = new TTree("ProcessingInfo","Log of data processing"); |
677 |
|
pinfo->Branch("ProcInfo","ProcInfo",&procinfo); |
678 |
|
} else { |
679 |
|
pinfo->SetBranchAddress("ProcInfo",&procinfo); |
680 |
|
} |
681 |
|
pinfo->Fill(); |
682 |
|
processFile->cd(); |
683 |
|
pinfo->Write("ProcessingInfo",TObject::kOverwrite); |
684 |
|
if ( procinfo ) delete procinfo; |
685 |
|
if ( pinfo ) pinfo->Delete(); |
686 |
// |
// |
687 |
// Run the core program, put any output error in the "error" variable |
// Run the core program, put any output error in the "error" variable |
688 |
// |
// |
795 |
// |
// |
796 |
if ( newfit ) { |
if ( newfit ) { |
797 |
timer.Start(kTRUE); |
timer.Start(kTRUE); |
798 |
if ( TOF && false) { |
if ( TOF ) { |
799 |
glt->ResetCounters(); |
glt->ResetCounters(); |
800 |
printf(" ToFLevel2 called, 1st call\n"); |
printf(" ToFLevel2 called, 1st call\n"); |
801 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
802 |
|
string tstring = "--level1-only"; |
803 |
|
tofargv[tofargc] = (char *)tstring.c_str(); |
804 |
|
tofargc++; |
805 |
TOFSGN1 = ToFCore(run,processFile,glt,tofargc,tofargv); |
TOFSGN1 = ToFCore(run,processFile,glt,tofargc,tofargv); |
806 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
807 |
NQTOF1 = glt->GetNqueries(); |
NQTOF1 = glt->GetNqueries(); |
847 |
glt->ResetCounters(); |
glt->ResetCounters(); |
848 |
printf(" ToFLevel2 called\n"); |
printf(" ToFLevel2 called\n"); |
849 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
850 |
|
if ( !reprocess ){ |
851 |
|
string tstring = "--delete-tree"; |
852 |
|
tofargv[tofargc] = (char *)tstring.c_str(); |
853 |
|
} else { |
854 |
|
tofargc--; |
855 |
|
} |
856 |
TOFSGN = ToFCore(run,processFile,glt,tofargc,tofargv); |
TOFSGN = ToFCore(run,processFile,glt,tofargc,tofargv); |
857 |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); |
858 |
NQTOF = glt->GetNqueries(); |
NQTOF = glt->GetNqueries(); |
1009 |
case -203: message += " TRACKERLEVEL2 - No Tracker branch in LEVEL0 Physics tree"; break; |
case -203: message += " TRACKERLEVEL2 - No Tracker branch in LEVEL0 Physics tree"; break; |
1010 |
case -204: message += " TRACKERLEVEL2 - No reprocessing implemented for LEVEL1 output"; break; |
case -204: message += " TRACKERLEVEL2 - No reprocessing implemented for LEVEL1 output"; break; |
1011 |
case -205: message += " TRACKERLEVEL2 - Error accessing RunInfo "; break; |
case -205: message += " TRACKERLEVEL2 - Error accessing RunInfo "; break; |
1012 |
|
case -206: message += " TRACKERLEVEL2 - Extended-tracking mode - no Calorimeter and/or ToF trees found"; break; |
1013 |
case -210: message += " TRACKERLEVEL2 - Error opening/reading trk mask GL_PARAM parameters "; break; |
case -210: message += " TRACKERLEVEL2 - Error opening/reading trk mask GL_PARAM parameters "; break; |
1014 |
case -211: message += " TRACKERLEVEL2 - Error opening/reading trk alignment GL_PARAM parameters"; break; |
case -211: message += " TRACKERLEVEL2 - Error opening/reading trk alignment GL_PARAM parameters"; break; |
1015 |
case -212: message += " TRACKERLEVEL2 - Error opening/reading trk mip GL_PARAM parameters"; break; |
case -212: message += " TRACKERLEVEL2 - Error opening/reading trk mip GL_PARAM parameters"; break; |
1062 |
case -807: message += " RUNINFO - DB connection problems"; break; |
case -807: message += " RUNINFO - DB connection problems"; break; |
1063 |
// |
// |
1064 |
case -900: message += " OrbitalInfo - no ToF tree"; break; |
case -900: message += " OrbitalInfo - no ToF tree"; break; |
1065 |
|
case -901: message += " OrbitalInfo - Mismatch between tracker and tof tree branches concerning extended tracking algorithm(s)"; break; |
1066 |
// |
// |
1067 |
default: message += "Unidentified error or warning"; break; |
default: message += "Unidentified error or warning"; break; |
1068 |
}; |
}; |