--- YodaProfiler/src/YodaProfiler.cpp 2006/12/04 11:32:07 1.15 +++ YodaProfiler/src/YodaProfiler.cpp 2007/04/17 12:07:09 1.20 @@ -5,6 +5,7 @@ // #include // +#include #include #include // @@ -29,6 +30,9 @@ printf(" -no-autoboot disable previous check\n"); printf(" -tsync number timesync (s) [default = taken from data]\n"); printf(" -obt0 number obt at timesync (ms) [default = taken from data]\n"); + printf(" -dworbit number number is the downlink orbit number (to be used with non-standard names)\n"); + printf(" -static use static path inside the DB instead of symbolic names\n"); + printf(" -gpamela shortcut to \"-clean 0 -obt0 1 -tsync 1 -no-autoboot -boot 1 -dworbit 1 -static\"\n"); printf(" -clean number number in seconds after which the fragment table\n"); printf(" can be cleaned and runs validated [default = -1 do not clean],\n"); printf(" if 0 force cleaning immediatly, if negative do not clean\n"); @@ -53,7 +57,7 @@ printf(" -tle ascii file containing TLE obtained from celestrak.org or space-track.org [default = no]\n"); printf("\n The order of input files and options does not matter. \n"); printf("\n Example: \n"); - printf(" YodaProfiler -yodaFile /path/to/raw/files/000_000_00000_cln2.pam -rawFile /path/to/filesfromyoda/000_000_00000_cln2.root -v \n\n"); + printf(" YodaProfiler -yodaFile /path/to/raw/files/000_000_00000_cln2.root -rawFile /path/to/filesfromyoda/000_000_00000_cln2.pam -v \n\n"); }; // int main(int numinp, char *inps[]){ @@ -65,6 +69,7 @@ UInt_t boot = 0; UInt_t tsync = 0; UInt_t obt0 = 0; + UInt_t dwinput = 0; Long64_t olderthan = -1LL; // // @@ -88,9 +93,11 @@ if ( strcmp(pamdbpsw,"") ) password = pamdbpsw; // // + Bool_t staticp = false; Bool_t beverbose = true; Bool_t debug = false; Bool_t autoboot = true; + Bool_t gpamela = false; // Bool_t remove = false; TString remfile = ""; @@ -158,6 +165,12 @@ validfile = (TString)inps[i+1]; validate = true; }; + if ( !strcmp(inps[i],"-gpamela") ) { + gpamela = true; + }; + if ( !strcmp(inps[i],"-static") ) { + staticp = true; + }; if ( !strcmp(inps[i],"-autoboot") ) { autoboot = true; }; @@ -185,6 +198,13 @@ }; obt0 = (UInt_t)atoll(inps[i+1]); }; + if ( !strcmp(inps[i],"-dworbit") ) { + if ( numinp-1 < i+1 ){ + usage(); + exit(1); + }; + dwinput = (UInt_t)atoll(inps[i+1]); + }; if ( !strcmp(inps[i],"-clean") ) { if ( numinp-1 < i+1 ){ usage(); @@ -276,9 +296,35 @@ remfile = fcleanfile; validfile = fcleanfile; }; + + const char *paml0 = gSystem->Getenv("PAM_L0"); + const char *paml2 = gSystem->Getenv("PAM_L2"); + const char *pamraw = gSystem->Getenv("PAM_RAW"); + if ( !paml0 || !paml2 || !pamraw ){ + printf(" WARNING: to use symbolic paths in DB you must set up PAM_L0, PAM_L2 and PAM_RAW env var!\n Using static paths\n"); + staticp = true; + }; + if ( gpamela ){ + // -clean 0 -obt0 1 -tsync 1 -boot 1 -dworbit 1 + if ( olderthan < 0LL ) olderthan = 0LL; + if ( !obt0 ) obt0 = 1; + if ( !tsync ) tsync = 1; + if ( !boot ) boot = 1; + if ( !dwinput ) dwinput = 1; + staticp = true; + autoboot = false; + }; + // + if ( filerawname == "" && filerootname != "" ){ + filerawname = "/not_given/"+(TString)gSystem->BaseName(filerootname.Data()); + filerawname = filerawname.ReplaceAll(".root",5,".pam",4); + // printf("filerawname %s \n",filerawname.Data()); + }; // // Start: // + GL_TABLES *glt = new GL_TABLES(host,user,password); + // TString message; char *version = YodaProfilerInfo(false); PamelaDBOperations *pamDB = 0; @@ -293,7 +339,7 @@ // Create pamDB object and open SQL connection //------------------------------------------------------------------------------------------- if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n"); - pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename); + pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename,dwinput,staticp); pamDB->CheckConnection(); //------------------------------------------------------------------------------------------- // @@ -616,6 +662,9 @@ if ( beverbose ) printf(" 13 => Free objects and close SQL connection \n"); pamDB->Close(); // + if ( debug ) printf(" Total number of queries through GLTABLES: %u \n",glt->GetNqueries()); + delete glt; + // printf("\n"); printf(" Finished, exiting...\n"); printf("\n");