/[PAMELA software]/YodaProfiler/src/YodaProfiler.cpp
ViewVC logotype

Diff of /YodaProfiler/src/YodaProfiler.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by mocchiut, Mon Dec 4 11:32:07 2006 UTC revision 1.25 by mocchiut, Wed Sep 5 15:34:49 2007 UTC
# Line 5  Line 5 
5  //  //
6  #include <TSystem.h>  #include <TSystem.h>
7  //  //
8    #include <GLTables.h>
9  #include <PamelaDBOperations.h>  #include <PamelaDBOperations.h>
10  #include <YodaProfilerVerl2.h>  #include <YodaProfilerVerl2.h>
11  //  //
# Line 29  void usage(){ Line 30  void usage(){
30    printf(" -no-autoboot    disable previous check\n");    printf(" -no-autoboot    disable previous check\n");
31    printf(" -tsync number   timesync (s) [default = taken from data]\n");    printf(" -tsync number   timesync (s) [default = taken from data]\n");
32    printf(" -obt0 number    obt at timesync (ms) [default = taken from data]\n");    printf(" -obt0 number    obt at timesync (ms) [default = taken from data]\n");
33      printf(" -dworbit number number is the downlink orbit number (to be used with non-standard names)\n");
34      printf(" -static         use static path inside the DB instead of symbolic names\n");
35      //  printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -tsync 1 -no-autoboot -boot 1 -dworbit 1 -static\"\n");
36      printf(" -gpamela        shortcut to \"-clean 0 -obt0 1 -no-autoboot -dworbit 1 -static\"\n");
37    printf(" -clean number   number in seconds after which the fragment table\n");    printf(" -clean number   number in seconds after which the fragment table\n");
38    printf("                 can be cleaned and runs validated [default = -1 do not clean],\n");    printf("                 can be cleaned and runs validated [default = -1 do not clean],\n");
39    printf("                 if 0 force cleaning immediatly, if negative do not clean\n");    printf("                 if 0 force cleaning immediatly, if negative do not clean\n");
# Line 53  void usage(){ Line 58  void usage(){
58    printf(" -tle <file>     ascii file containing TLE obtained from celestrak.org or space-track.org [default = no]\n");    printf(" -tle <file>     ascii file containing TLE obtained from celestrak.org or space-track.org [default = no]\n");
59    printf("\n The order of input files and options does not matter. \n");    printf("\n The order of input files and options does not matter. \n");
60    printf("\n Example: \n");    printf("\n Example: \n");
61    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");
62  };  };
63  //  //
64  int main(int numinp, char *inps[]){  int main(int numinp, char *inps[]){
# Line 65  int main(int numinp, char *inps[]){ Line 70  int main(int numinp, char *inps[]){
70    UInt_t boot = 0;    UInt_t boot = 0;
71    UInt_t tsync = 0;    UInt_t tsync = 0;
72    UInt_t obt0 = 0;    UInt_t obt0 = 0;
73      UInt_t dwinput = 0;
74    Long64_t olderthan = -1LL;      Long64_t olderthan = -1LL;  
75    //    //
76    //    //
# Line 88  int main(int numinp, char *inps[]){ Line 94  int main(int numinp, char *inps[]){
94    if ( strcmp(pamdbpsw,"") ) password = pamdbpsw;    if ( strcmp(pamdbpsw,"") ) password = pamdbpsw;
95    //    //
96    //        //    
97      Bool_t staticp = false;
98    Bool_t beverbose = true;    Bool_t beverbose = true;
99    Bool_t debug = false;    Bool_t debug = false;
100    Bool_t autoboot = true;    Bool_t autoboot = true;
101      Bool_t gpamela = false;
102    //    //
103    Bool_t remove = false;    Bool_t remove = false;
104    TString remfile = "";    TString remfile = "";
# Line 158  int main(int numinp, char *inps[]){ Line 166  int main(int numinp, char *inps[]){
166          validfile = (TString)inps[i+1];          validfile = (TString)inps[i+1];
167          validate = true;          validate = true;
168        };        };
169          if ( !strcmp(inps[i],"-gpamela") ) {
170            gpamela = true;
171          };
172          if ( !strcmp(inps[i],"-static") ) {
173            staticp = true;
174          };
175        if ( !strcmp(inps[i],"-autoboot") ) {        if ( !strcmp(inps[i],"-autoboot") ) {
176          autoboot = true;          autoboot = true;
177        };        };
# Line 185  int main(int numinp, char *inps[]){ Line 199  int main(int numinp, char *inps[]){
199          };          };
200          obt0 = (UInt_t)atoll(inps[i+1]);                  obt0 = (UInt_t)atoll(inps[i+1]);        
201        };        };
202          if ( !strcmp(inps[i],"-dworbit") ) {
203            if ( numinp-1 < i+1 ){
204              usage();
205              exit(1);
206            };
207            dwinput = (UInt_t)atoll(inps[i+1]);    
208          };
209        if ( !strcmp(inps[i],"-clean") ) {        if ( !strcmp(inps[i],"-clean") ) {
210          if ( numinp-1 < i+1 ){          if ( numinp-1 < i+1 ){
211            usage();            usage();
# Line 277  int main(int numinp, char *inps[]){ Line 298  int main(int numinp, char *inps[]){
298      validfile = fcleanfile;      validfile = fcleanfile;
299    };    };
300    //    //
301    // Start:    const char *paml0 = gSystem->Getenv("PAM_L0");
302      const char *paml2 = gSystem->Getenv("PAM_L2");
303      const char *pamraw = gSystem->Getenv("PAM_RAW");
304      if ( !paml0 || !paml2 || !pamraw ){
305        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");
306        staticp = true;
307      };
308    //    //
309      //
310      GL_TABLES *glt = new GL_TABLES(host,user,password);
311      //
312      if ( gpamela ){
313        //    //    -clean 0 -obt0 1 -tsync 1 -boot 1 -dworbit 1
314        //    -clean 0 -obt0 1 -dworbit 1
315        if ( olderthan < 0LL ) olderthan = 0LL;
316        if ( !obt0 ) obt0 = 1;
317        //    if ( !tsync ) tsync = 1;    
318        //    if ( !boot ) boot = 1;
319        if ( !dwinput ) dwinput = 1;
320        staticp = true;
321        autoboot = false;
322      };
323      //
324      if ( filerawname == "" && filerootname != "" ){
325        filerawname = "/not_given/"+(TString)gSystem->BaseName(filerootname.Data());
326        filerawname = filerawname.ReplaceAll(".root",5,".pam",4);
327        //    printf("filerawname %s \n",filerawname.Data());
328      };
329      //
330      // Start:
331    TString message;    TString message;
332    char *version = YodaProfilerInfo(false);    char *version = YodaProfilerInfo(false);
333    PamelaDBOperations *pamDB = 0;    PamelaDBOperations *pamDB = 0;
# Line 293  int main(int numinp, char *inps[]){ Line 342  int main(int numinp, char *inps[]){
342      // Create pamDB object and open SQL connection      // Create pamDB object and open SQL connection
343      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
344      if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");      if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");
345      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,gpamela);
346      pamDB->CheckConnection();      pamDB->CheckConnection();
347      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
348      //      //
# Line 494  int main(int numinp, char *inps[]){ Line 543  int main(int numinp, char *inps[]){
543              else if ( bit == 2 ) message += "=> No runheaders in the file\n";              else if ( bit == 2 ) message += "=> No runheaders in the file\n";
544              else if ( bit == 3 ) message += "=> No runtrailers in the file\n";              else if ( bit == 3 ) message += "=> No runtrailers in the file\n";
545              else if ( bit == 4 ) message += "=> No mcmd inclination in the file\n";              else if ( bit == 4 ) message += "=> No mcmd inclination in the file\n";
546                else if ( bit == 5 ) message += "=> Inconsistent PKT/OBT sequence\n";
547                else if ( bit == 6 ) message += "=> No physics events in the file\n";
548                else if ( bit == 7 ) message += "=> Less than 2 physics events in the file\n";
549              else  message += "=> Unidentified insertTimeSync warning\n";              else  message += "=> Unidentified insertTimeSync warning\n";
550            };            };
551          };          };
# Line 527  int main(int numinp, char *inps[]){ Line 579  int main(int numinp, char *inps[]){
579              if      ( bit == 0 ) message += "=> Inconsistent PKT/OBT sequence\n";              if      ( bit == 0 ) message += "=> Inconsistent PKT/OBT sequence\n";
580              else if ( bit == 1 ) message += "=> No physics events in the file\n";              else if ( bit == 1 ) message += "=> No physics events in the file\n";
581              else if ( bit == 2 ) message += "=> Less than 2 physics events in the file\n";              else if ( bit == 2 ) message += "=> Less than 2 physics events in the file\n";
582                else if ( bit == 3 ) message += "=> Not supported yet: run with no events, no runtrailer, no runheader\n";
583                else if ( bit == 4 ) message += "=> File with no events, no runtrailers, no runheaders\n";
584              else  message += "=> Unidentified insertPamelaRun warning\n";              else  message += "=> Unidentified insertPamelaRun warning\n";
585            };            };
586          };          };
# Line 616  int main(int numinp, char *inps[]){ Line 670  int main(int numinp, char *inps[]){
670    if ( beverbose ) printf(" 13 => Free objects and close SQL connection \n");    if ( beverbose ) printf(" 13 => Free objects and close SQL connection \n");
671    pamDB->Close();    pamDB->Close();
672    //    //
673      if ( debug ) printf(" Total number of queries through GLTABLES: %u \n",glt->GetNqueries());
674      delete glt;
675      //
676    printf("\n");    printf("\n");
677    printf(" Finished, exiting...\n");    printf(" Finished, exiting...\n");
678    printf("\n");    printf("\n");

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.23