// // C/C++ headers // #include #include // // ROOT headers // #include #include #include #include #include // // Detector's package headers // #include #include #include #include #include #include #include #include #include #include // using namespace std; // // // #include // // Usage subroutine // void usage(){ printf("\nUsage:\n"); printf("\n DarthVader [ options ] -idRun ID_RUN [+-all] [+-detector [ detector options ] ] \n"); printf("\n Options are: \n"); printf("\n --version print informations about compilation and exit\n"); printf("\n -h | --help print this help and exit \n"); printf("\n -v | --verbose be verbose [default]\n"); printf("\n -s | --silent print nothing on STDOUT\n"); printf("\n -c | --clean remove file if exiting with errors\n"); printf("\n -b | --benchmark perform and print benchmark test\n"); printf("\n -auto | -AUTO exclude from processing detector which are NOT in the acquisition [default]\n"); printf("\n -zerofill if a detector is not in the acquisition the routine is called anyway \n"); printf("\n but all detector's data will be marked as bad\n"); printf("\n -tedious exit with error if a detector is not in the acquisition and \n"); printf("\n it has not been excluded from processing\n"); printf("\n -host name for the host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); printf("\n -user username for the DB [default = $PAM_DBUSER or \"anonymous\"] \n"); printf("\n -psw password for the DB [default = $PAM_DBPSW or \"\"]\n"); printf("\n -processFile file output filename [default ID_RUN.Level2.root]\n"); printf("\n -idRun ID_RUN: ID number of the run to be processed \n"); printf("\n +all | +ALL call all detectors software [default]\n"); printf("\n -all | -ALL call nothing\n"); printf("\n +detector process detector; detector can be: TOF,TRK,CAL,TRG,ORB,S4,ND,AC,RUN\n"); printf("\n -detector do not process detector (as above)\n"); printf("\n detector options must be included in square parenthesis with spaces, for example:\n"); printf("\n +CAL [ --verbose -g ] +TRK [ -v --level1 ] \n"); printf("\nExamples: \n"); printf("\nStandard call: DarthVader -idRun 1085 \n"); printf("\nProcess only RunInfo and Tracker (be verbose for tracker): DarthVader -idRun 1085 -all +RUN +TRK [ --verbose ] \n"); printf("\nProcess all and be verbose for calorimeter: DarthVader -idRun 1085 +CAL [ --verbose ] \n\n"); }; // // Here the main // int main(int numinp, char *inps[]){ // // Variables booking // // // benchmarck variables // TStopwatch timer; TStopwatch dvtimer; dvtimer.Start(kTRUE); UInt_t nevents = 0; UInt_t nruns = 0; Double_t runtime = 0.; Double_t cruntime = 0.; Double_t trktime = 0.; Double_t ctrktime = 0.; Double_t caltime = 0.; Double_t ccaltime = 0.; Double_t toftime = 0.; Double_t ctoftime = 0.; Double_t trgtime = 0.; Double_t ctrgtime = 0.; Double_t actime = 0.; Double_t cactime = 0.; Double_t s4time = 0.; Double_t cs4time = 0.; Double_t ndtime = 0.; Double_t cndtime = 0.; Double_t orbtime = 0.; Double_t corbtime = 0.; Double_t dvtime = 0.; Double_t cdvtime = 0.; // TString message; int nul = 0; Int_t error = 0; // Int_t CALSGN = 0; Int_t TRKSGN = 0; Int_t TRGSGN = 0; Int_t TOFSGN = 0; Int_t RUNSGN = 0; Int_t ORBSGN = 0; Int_t ACSGN = 0; Int_t S4SGN = 0; Int_t NDSGN = 0; Int_t DVSGN = 0; // Bool_t autom = true; Bool_t zerofill = false; Bool_t tedious = false; Bool_t remfile = false; Bool_t debug = false; Bool_t beverbose = true; Bool_t givenid = false; Bool_t bench = false; Bool_t CAL = true; Bool_t TRK = true; Bool_t TRG = true; Bool_t TOF = true; Bool_t S4 = true; Bool_t ND = true; Bool_t AC = true; Bool_t ORB = true; Bool_t RUN = true; // Int_t calargc = 0; char *calargv[50]; Int_t trkargc = 0; char *trkargv[50]; Int_t tofargc = 0; char *tofargv[50]; Int_t trgargc = 0; char *trgargv[50]; Int_t orbargc = 0; char *orbargv[50]; Int_t runargc = 0; char *runargv[50]; Int_t acargc = 0; char *acargv[50]; Int_t s4argc = 0; char *s4argv[50]; Int_t ndargc = 0; char *ndargv[50]; // // // UInt_t run = 0; // TString filename; TString outDir = gSystem->WorkingDirectory(); // TSQLServer *dbc = 0; TString host = "mysql://localhost/pamelaprod"; TString user = "anonymous"; TString psw = ""; // // const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); if ( !pamdbhost ) pamdbhost = ""; if ( !pamdbuser ) pamdbuser = ""; if ( !pamdbpsw ) pamdbpsw = ""; if ( strcmp(pamdbhost,"") ) host = pamdbhost; if ( strcmp(pamdbuser,"") ) user = pamdbuser; if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; // // TFile *processFile = 0; // // Checking input parameters // Int_t i = 0; try { if ( numinp > 1 ){ while ( i < numinp ){ Bool_t found = false; if ( !strcmp(inps[i],"--version") ){ DarthVaderInfo(true); exit(0); }; if ( !strcmp(inps[i],"-h") || !strcmp(inps[i],"--help") ){ usage(); exit(0); }; if ( !strcmp(inps[i],"-idRun") ) { if ( numinp-1 < i+1 ) { usage(); throw -3; }; i++; found = true; givenid = true; run = atoll(inps[i]); }; if ( !strcmp(inps[i],"-processFile") ) { if ( numinp-1 < i+1 ){ usage(); throw -3; }; i++; found = true; filename = (TString)inps[i]; }; if ( !strcmp(inps[i],"-outDir") ) { if ( numinp-1 < i+1 ){ usage(); throw -3; }; i++; found = true; outDir = (TString)inps[i]; }; if ( !strcmp(inps[i],"-host") ) { if ( numinp-1 < i+1 ){ usage(); throw -3; }; i++; found = true; host = (TString)inps[i]; }; if ( !strcmp(inps[i],"-user") ) { if ( numinp-1 < i+1 ){ usage(); throw -3; }; i++; found = true; user = (TString)inps[i]; }; if ( !strcmp(inps[i],"-psw") ) { if ( numinp-1 < i+1 ){ usage(); throw -3; }; i++; found = true; psw = (TString)inps[i]; }; if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ){ found = true; beverbose = true; }; if ( !strcmp(inps[i],"-c") || !strcmp(inps[i],"--clean")){ found = true; remfile = true; }; if ( !strcmp(inps[i],"-s") || !strcmp(inps[i],"--silent") ){ found = true; beverbose = false; }; if ( !strcmp(inps[i],"-g") || !strcmp(inps[i],"--debug") ){ debug = true; found = true; }; if ( !strcmp(inps[i],"-b") || !strcmp(inps[i],"--benchmark") ){ bench = true; found = true; }; if ( !strcmp(inps[i],"-auto") || !strcmp(inps[i],"-AUTO") ){ autom = true; tedious = false; zerofill = false; found = true; }; if ( !strcmp(inps[i],"-zerofill") ){ tedious = false; autom = false; zerofill = true; found = true; }; if ( !strcmp(inps[i],"-tedious") ){ tedious = true; zerofill = false; autom = false; found = true; }; // if ( !strcmp(inps[i],"-CAL") ) { found = true; CAL = false; }; if ( !strcmp(inps[i],"-TRK") ) { found = true; TRK = false; }; if ( !strcmp(inps[i],"-TOF") ) { found = true; TOF = false; }; if ( !strcmp(inps[i],"-TRG") ) { found = true; TRG = false; }; if ( !strcmp(inps[i],"-S4") ) { found = true; S4 = false; }; if ( !strcmp(inps[i],"-ND") ) { found = true; ND = false; }; if ( !strcmp(inps[i],"-AC") ) { found = true; AC = false; }; if ( !strcmp(inps[i],"-RUN") ) { found = true; RUN = false; }; if ( !strcmp(inps[i],"-ORB") ) { found = true; ORB = false; }; // if ( !strcmp(inps[i],"-all") || !strcmp(inps[i],"-ALL") ) { CAL = false; ORB = false; TRK = false; TRG = false; TOF = false; S4 = false; ND = false; AC = false; RUN = false; found = true; }; // if ( !strcmp(inps[i],"+all") || !strcmp(inps[i],"+ALL") ) { CAL = true; ORB = true; TRK = true; TRG = true; TOF = true; S4 = true; ND = true; AC = true; RUN = true; found = true; }; // if ( !strcmp(inps[i],"+CAL") ) { found = true; CAL = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ if ( numinp < i+2 ){ usage(); throw -3; }; i += 2; calargc = 0; while ( strcmp(inps[i],"]") ){ calargv[calargc] = inps[i]; calargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+TRK") ) { found = true; TRK = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ if ( numinp-1 < i+2 ){ usage(); throw -3; }; i += 2; trkargc = 0; while ( strcmp(inps[i],"]") ){ trkargv[trkargc] = inps[i]; trkargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+TOF") ) { found = true; TOF = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ i += 2; tofargc = 0; while ( strcmp(inps[i],"]") ){ tofargv[tofargc] = inps[i]; tofargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+TRG") ) { found = true; TRG = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ i += 2; trgargc = 0; while ( strcmp(inps[i],"]") ){ trgargv[trgargc] = inps[i]; trgargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+ORB") ) { found = true; ORB = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ i += 2; orbargc = 0; while ( strcmp(inps[i],"]") ){ orbargv[orbargc] = inps[i]; orbargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+RUN") ) { found = true; RUN = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ i += 2; runargc = 0; while ( strcmp(inps[i],"]") ){ runargv[runargc] = inps[i]; runargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+AC") ) { found = true; AC = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ i += 2; acargc = 0; while ( strcmp(inps[i],"]") ){ acargv[acargc] = inps[i]; acargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+S4") ) { found = true; S4 = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ i += 2; s4argc = 0; while ( strcmp(inps[i],"]") ){ s4argv[s4argc] = inps[i]; s4argc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; if ( !strcmp(inps[i],"+ND") ) { found = true; ND = true; if ( numinp >= i+2 && !strcmp(inps[i+1],"[") ){ i += 2; ndargc = 0; while ( strcmp(inps[i],"]") ){ ndargv[ndargc] = inps[i]; ndargc++; i++; if ( i > numinp-1 ){ usage(); throw -3; }; }; }; }; // if ( !found && i > 0 ){ usage(); printf(" Unknown input number %i, that is \"%s\" \n",i,inps[i]); throw -22; }; // i++; }; // } else { // // no input parameters exit with error, we need at least the run id. // throw -1; }; // // If not in verbose mode redirect to /dev/null the stdout and stderr // if ( !beverbose ){ nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE); dup2(nul,1); dup2(nul,2); }; // // Check that an input run number has been given // if ( !givenid ) throw -1; // TString version = DarthVaderInfo(false); // // Start: // printf("\n Welcome to the PAMELA LEVEL2 flight software, version %s \n\n",version.Data()); // // Connect to the DB // if ( debug ) printf("\nConnecting to database... \n"); // dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); if( !dbc ) throw -2; // Bool_t connect = dbc->IsConnected(); // if( !connect ) throw -2; // if ( debug ) printf("...connected! \n\n"); // 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()); // // Use UTC in the DB // stringstream myquery; myquery.str(""); myquery << "SET time_zone='+0:00'"; dbc->Query(myquery.str().c_str()); // // // Create LEVEL2 filename and open it in update mode // if ( filename.IsNull() ){ stringstream strun; strun.str(""); strun << run; filename += outDir; filename += "/"; filename += strun.str(); filename += ".Level2.root"; }; processFile = new TFile(filename.Data(),"UPDATE"); if ( !processFile->IsOpen() ) throw -15; // // Run the core program, put any output error in the "error" variable // if ( debug ) printf("\n\n Pre-processing:\n\n"); // timer.Start(kTRUE); if ( RUN ) { if ( debug ) printf(" Retrieve, if the case, the RUN informations from the DB...\n"); printf(" RunInfo called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); RUNSGN = RunInfoCore(run,processFile,dbc,version,runargc,runargv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end RunInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); if ( debug ) printf(" ...done\n"); }; timer.Stop(); runtime = timer.RealTime(); cruntime = timer.CpuTime(); // // From the Run Infos extract acq_var_info to determine if detectors are in the acquisition or not // if ( debug ) printf(" Checking if requested detectors are in the acquisition\n"); ItoRunInfo *runinfo = new ItoRunInfo(processFile); Int_t sgnl = runinfo->Read(run); if ( sgnl != 0 ) throw -17; nevents = runinfo->GetEntries(); nruns = runinfo->GetNoRun(); if ( debug ) printf(" => ACQ_VAR_INFO = %i \n",runinfo->ACQ_VAR_INFO); if ( TRK && !(runinfo->ACQ_VAR_INFO & (1 << 4)) ){ DVSGN += 1; if ( tedious ) throw -30; if ( autom ){ TRK = 0; if ( debug ) printf(" TRK excluded from processing \n"); }; if ( zerofill && debug ) printf(" TRK is not in the acquisition! \n"); }; if ( TOF && !(runinfo->ACQ_VAR_INFO & (1 << 0)) ){ DVSGN += 2; if ( tedious ) throw -31; if ( autom ){ TOF = 0; if ( debug ) printf(" TOF excluded from processing \n"); }; if ( zerofill && debug ) printf(" TOF is not in the acquisition! \n"); }; if ( CAL && !(runinfo->ACQ_VAR_INFO & (1 << 3)) ){ DVSGN += 4; if ( tedious ) throw -32; if ( autom ){ CAL = 0; if ( debug ) printf(" CAL excluded from processing \n"); }; if ( zerofill && debug ) printf(" CAL is not in the acquisition! \n"); }; if ( AC && (!(runinfo->ACQ_VAR_INFO & (1 << 1)) || !(runinfo->ACQ_VAR_INFO & (1 << 2))) ){ DVSGN += 8; if ( tedious ) throw -33; if ( autom ){ AC = 0; if ( debug ) printf(" AC excluded from processing \n"); }; if ( zerofill && debug ) printf(" AC is not in the acquisition! \n"); }; if ( S4 && !(runinfo->ACQ_VAR_INFO & (1 << 5)) ){ DVSGN += 16; if ( tedious ) throw -34; if ( autom ){ S4 = 0; if ( debug ) printf(" S4 excluded from processing \n"); }; if ( zerofill && debug ) printf(" S4 is not in the acquisition! \n"); }; if ( ND && !(runinfo->ACQ_VAR_INFO & (1 << 9)) ){ DVSGN += 32; if ( tedious ) throw -35; if ( autom ){ ND = 0; if ( debug ) printf(" ND excluded from processing \n"); }; if ( zerofill && debug ) printf(" ND is not in the acquisition! \n"); }; // if ( !DVSGN ){ if ( debug ) printf(" OK! Start processing detector's data. \n"); } else { if ( debug ) printf(" WARNING! missing detector(s)! Start anyway processing detector's data. \n"); }; if ( debug ) printf("\n End pre-processing \n\n"); // timer.Start(kTRUE); if ( TRK ) { printf(" TrackerLevel2 called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); TRKSGN = TrkCore(run,processFile,dbc,trkargc,trkargv); gSystem->Unlink("TrackerFolder"); //patch if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrkCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); trktime = timer.RealTime(); ctrktime = timer.CpuTime(); // timer.Start(kTRUE); if ( TOF ) { printf(" ToFLevel2 called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); TOFSGN = ToFCore(run,processFile,dbc,tofargc,tofargv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end ToFCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); toftime = timer.RealTime(); ctoftime = timer.CpuTime(); // timer.Start(kTRUE); if ( CAL ) { printf(" CalorimeterLevel2 called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); CALSGN = CaloCore(run,processFile,dbc,calargc,calargv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end CaloCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); caltime = timer.RealTime(); ccaltime = timer.CpuTime(); // timer.Start(kTRUE); if ( TRG ) { printf(" TriggerLevel2 called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); TRGSGN = TrigCore(run,processFile,dbc,trgargc,trgargv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end TrigCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); trgtime = timer.RealTime(); ctrgtime = timer.CpuTime(); // timer.Start(kTRUE); if ( AC ) { printf(" AnticounterLevel2 called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); ACSGN = AcCore(run,processFile,dbc,acargc,acargv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end AcCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); actime = timer.RealTime(); cactime = timer.CpuTime(); // timer.Start(kTRUE); if ( S4 ) { printf(" S4Level2 called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); S4SGN = S4Core(run,processFile,dbc,s4argc,s4argv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end S4Core STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); s4time = timer.RealTime(); cs4time = timer.CpuTime(); // timer.Start(kTRUE); if ( ND ) { printf(" NDLevel2 called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); NDSGN = NDCore(run,processFile,dbc,ndargc,ndargv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end NDCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); ndtime = timer.RealTime(); cndtime = timer.CpuTime(); // timer.Start(kTRUE); if ( ORB ) { printf(" OrbitalInfo called\n"); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| start OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); ORBSGN = OrbitalInfoCore(run,processFile,dbc,orbargc,orbargv); if ( debug ) printf(" >>>>>>>>>>>>>>>>>>>| end OrbitalInfoCore STDOUT |<<<<<<<<<<<<<<<<<<<\n"); }; timer.Stop(); orbtime = timer.RealTime(); corbtime = timer.CpuTime(); // } catch(Int_t signal) { error = signal; switch(signal){ case 51: message += " GLTABLES - TO_TIME < time when querying tables"; break; case -1: message += " Missing/wrong run ID input parameter"; break; case -2: message += " DB connection failure"; break; case -3: message += " Error in input parameters (check format)"; break; case -4: message += " Request reprocessing of all runs (idRun = 0) but processFile is missing"; break; case -6: message += " No LEVEL0 file "; break; case -7: message += " No Physics tree in LEVEL0 file"; break; case -8: message += " No Header branch in LEVEL0 Physics tree"; break; case -9: message += " No Registry branch in LEVEL0 Physics tree"; break; case -11: message += " LEVEL0 Physics tree is empty"; break; case -12: message += " Too few entries in the tree"; break; case -13: message += " Cannot create processFolder directory"; break; case -14: message += " Error querying the DB"; break; case -15: message += " Cannot open file for writing"; break; case -17: message += " Error during pre-processing"; break; case -22: message += " Unknown input or wrong syntax in input paramters!"; break; case -30: message += " No TRK in the acquisition"; break; case -31: message += " No TOF in the acquisition"; break; case -32: message += " No CAL in the acquisition"; break; case -33: message += " No AC in the acquisition"; break; case -34: message += " No S4 in the acquisition"; break; case -35: message += " No ND in the acquisition"; break; // case -50: message += " GLTABLES - No entries matching GL_RUN query"; break; case -51: message += " GLTABLES - No entries matching GL_ROOT query"; break; case -52: message += " GLTABLES - No entries matching GL_PARAM query"; break; case -53: message += " GLTABLES - No entries matching GL_TRK_CALIB query"; break; case -54: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; case -55: message += " GLTABLES - No entries matching GL_CALO_CALIB query"; break; // case -100: message += " CALORIMETERLEVEL2 - No Level2 input file"; break; case -101: message += " CALORIMETERLEVEL2 - Cannot open Level2 file"; break; case -102: message += " CALORIMETERLEVEL2 - No Tracker TTree in Level2 file"; break; case -103: message += " CALORIMETERLEVEL2 - No Calorimeter TBranch in Level0 file"; break; case -104: message += " CALORIMETERLEVEL2 - No Trigger TTree in Level0 file"; break; case -105: message += " CALORIMETERLEVEL2 - No Calorimeter ADC2MIP conversion file"; break; case -106: message += " CALORIMETERLEVEL2 - No Calorimeter alignement file"; break; case -107: message += " CALORIMETERLEVEL2 - Cannot find Level0 file needed for the calibration"; break; case -108: message += " CALORIMETERLEVEL2 - Cannot open Level0 file needed for the calibration"; break; case -109: message += " CALORIMETERLEVEL2 - No CalibCalPed TTree in Level0 file needed for the calibration"; break; case -110: message += " CALORIMETERLEVEL2 - No calibrations in Level0 file needed for the calibration"; break; case -111: message += " CALORIMETERLEVEL2 - Corrupted calibration"; break; case -112: message += " CALORIMETERLEVEL2 - No physics event related to registry entry in Level0 file"; break; case -113: message += " CALORIMETERLEVEL2 - No tracker event related to registry entry in Level2 file"; break; case -114: message += " CALORIMETERLEVEL2 - Help called"; break; case -115: message += " CALORIMETERLEVEL2 - No Calorimeter bad strip offline mask file"; break; case -116: message += " CALORIMETERLEVEL2 - DB connection problems"; break; // case -200: message += " TRACKERLEVEL2 - LEVEL1 framework unknown (HBOOK/ROOT)"; break; case -201: message += " TRACKERLEVEL2 - LEVEL2 framework unknown (HBOOK/ROOT)"; break; case -202: message += " TRACKERLEVEL2 - Neither LEVEL1 nor LEVEL2 output requested"; break; case -203: message += " TRACKERLEVEL2 - No Tracker branch in LEVEL0 Physics tree"; break; case -204: message += " TRACKERLEVEL2 - No reprocessing implemented for LEVEL1 output"; break; case -205: message += " TRACKERLEVEL2 - Error accessing RunInfo "; break; case -210: message += " TRACKERLEVEL2 - Error opening/reading trk mask GL_PARAM parameters "; break; case -211: message += " TRACKERLEVEL2 - Error opening/reading trk alignment GL_PARAM parameters"; break; case -212: message += " TRACKERLEVEL2 - Error opening/reading trk mip GL_PARAM parameters"; break; case -213: message += " TRACKERLEVEL2 - Error opening/reading trk charge GL_PARAM parameters"; break; case -214: message += " TRACKERLEVEL2 - Error opening/reading trk pfa GL_PARAM parameters"; break; case -215: message += " TRACKERLEVEL2 - Error opening/reading field GL_PARAM parameters"; break; case -216: message += " TRACKERLEVEL2 - Error opening/reading default calibration GL_PARAM parameters"; break; case -298: message += " TRACKERLEVEL2 - Reprocessing not implemented in standalone mode"; break; case -299: message += " TRACKERLEVEL2 - Not yet implemented"; break; // case -300: message += " TOFLEVEL2 - No Trigger branch in Level0 tree"; break; case -301: message += " TOFLEVEL2 - Cannot open file for writing"; break; case -302: message += " TOFLEVEL2 - No tracker tree in Level2 file"; break; case -303: message += " TOFLEVEL2 - No Tof branch in Level0 file"; break; case -313: message += " TOFLEVEL2 - No more tracker events in Level2 file"; break; case -314: message += " TOFLEVEL2 - DB connection problems"; break; // case -401: message += " TRIGGERLEVEL2 - Cannot open file for writing"; break; case -402: message += " TRIGGERLEVEL2 - No Trigger branch in Level0 tree"; break; case -403: message += " TRIGGERLEVEL2 - DB connection problems"; break; // case -500: message += " S4LEVEL2 - No level2 file"; break; case -501: message += " S4LEVEL2 - Cannot open file for writing"; break; case -502: message += " S4LEVEL2 - No result from GL_S4_CALIB"; break; case -503: message += " S4LEVEL2 - No S4 branch in Level0 tree"; break; case -504: message += " S4LEVEL2 - DB connection problems"; break; // case -600: message += " NDLEVEL2 - No level2 file"; break; case -601: message += " NDLEVEL2 - Cannot open file for writing"; break; case -603: message += " NDLEVEL2 - No S4Level2 branch in Level0 tree"; break; case -604: message += " NDLEVEL2 - DB connection problems"; break; // case -701: message += " ACLEVEL2 - Cannot open file for writing"; break; case -704: message += " ACLEVEL2 - No Anticounter branch in Level0 tree"; break; case -705: message += " ACLEVEL2 - DB connection problems"; break; // case -800: message += " RUNINFO - No such run in the RunInfo list"; break; case -801: message += " RUNINFO - No RunInfo tree in Level2 file"; break; case -802: message += " RUNINFO - Cannot open file for writing"; break; case -803: message += " RUNINFO - Updating but no RunInfo tree in Level2 file"; break; case -804: message += " RUNINFO - Unknown detector"; break; case -805: message += " RUNINFO - Reprocessing data but no RunInfo tree in Level2 file"; break; case -806: message += " RUNINFO - Can not handle more than 500 runs"; break; case -807: message += " RUNINFO - DB connection problems"; break; // default: message += "Unidentified error or warning"; break; }; printf("\n"); if ( signal < 0 ) cout << " ERROR ("<< signal << ") "<< message <Close(); if ( debug ) printf("...connection terminated!\n\n"); }; if ( processFile ){ processFile->cd(); processFile->Close(); }; // // print benchmark results (if the case) // dvtimer.Stop(); dvtime = dvtimer.RealTime(); cdvtime = dvtimer.CpuTime(); if ( bench ){ Float_t runrt = 0.; Float_t trkrt = 0.; Float_t calrt = 0.; Float_t tofrt = 0.; Float_t trgrt = 0.; Float_t acrt = 0.; Float_t s4rt = 0.; Float_t ndrt = 0.; Float_t orbrt = 0.; Float_t dvrt = nevents/dvtime; if ( RUN ) runrt = nruns/runtime; if ( TRK ) trkrt = nevents/trktime; if ( CAL ) calrt = nevents/caltime; if ( TOF ) tofrt = nevents/toftime; if ( TRG ) trgrt = nevents/trgtime; if ( AC ) acrt = nevents/actime; if ( S4 ) s4rt = nevents/s4time; if ( ND ) ndrt = nevents/ndtime; if ( ORB ) orbrt = nevents/orbtime; // printf("\n\n################################################################################\n"); printf("# Benchmark results: nevents = %10u runs = %3u #\n",nevents,nruns); printf("################################################################################\n"); printf("# Detector # Core routine called # Real Time # CPU time # Events/s #\n"); printf("################################################################################\n"); printf("# RUN # %i # %8.2f # %8.2f # %8.2f #\n",RUN,fabs(runtime),fabs(cruntime),runrt); printf("# TRK # %i # %8.2f # %8.2f # %8.2f #\n",TRK,fabs(trktime),fabs(ctrktime),trkrt); printf("# CAL # %i # %8.2f # %8.2f # %8.2f #\n",CAL,fabs(caltime),fabs(ccaltime),calrt); printf("# TOF # %i # %8.2f # %8.2f # %8.2f #\n",TOF,fabs(toftime),fabs(ctoftime),tofrt); printf("# TRG # %i # %8.2f # %8.2f # %8.2f #\n",TRG,fabs(trgtime),fabs(ctrgtime),trgrt); printf("# AC # %i # %8.2f # %8.2f # %8.2f #\n",AC,fabs(actime),fabs(cactime),acrt); printf("# S4 # %i # %8.2f # %8.2f # %8.2f #\n",S4,fabs(s4time),fabs(cs4time),s4rt); printf("# ND # %i # %8.2f # %8.2f # %8.2f #\n",ND,fabs(ndtime),fabs(cndtime),ndrt); printf("# ORB # %i # %8.2f # %8.2f # %8.2f #\n",ORB,fabs(orbtime),fabs(corbtime),orbrt); printf("################################################################################\n"); printf("# Total # # %8.2f # %8.2f # %8.2f #\n",fabs(dvtime),fabs(cdvtime),dvrt); printf("################################################################################\n"); }; // // if ( error != 0 ) printf("\n\n WARNING: exiting with signal %i \n\n",error); // // // if ( remfile && error < 0 ){ printf(" -c or --clean option used, deleting file %s \n\n",filename.Data()); gSystem->Unlink(filename.Data()); }; // printf("\n Finished, exiting...\n\n"); // // Close redirection if the case. // if ( !beverbose ) close(nul); // // exit(error); }