/[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.9 by mocchiut, Tue Sep 12 13:22:55 2006 UTC revision 1.10 by mocchiut, Tue Oct 17 15:20:05 2006 UTC
# Line 32  void usage(){ Line 32  void usage(){
32    printf("\n -host           name for the host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n");    printf("\n -host           name for the host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n");
33    printf("\n -user           username for the DB [default = $PAM_DBUSER or \"anonymous\"] \n");    printf("\n -user           username for the DB [default = $PAM_DBUSER or \"anonymous\"] \n");
34    printf("\n -psw            password for the DB [default = $PAM_DBPSW or \"\"]\n");    printf("\n -psw            password for the DB [default = $PAM_DBPSW or \"\"]\n");
35      printf("\n -tle <file>     ascii file containing TLE obtained from celestrak.org or space-track.org [default = no]\n");
36    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");
37    printf("\nExample: \n");    printf("\nExample: \n");
38    printf("\n YodaProfiler -yodaFile /path/to/raw/files/000_000_00000_cln2.pam -rawFile /path/to/filesfromyoda/000_000_00000_cln2.root -v \n\n");    printf("\n YodaProfiler -yodaFile /path/to/raw/files/000_000_00000_cln2.pam -rawFile /path/to/filesfromyoda/000_000_00000_cln2.root -v \n\n");
# Line 58  int main(int numinp, char *inps[]){ Line 59  int main(int numinp, char *inps[]){
59    TString user = "anonymous";    TString user = "anonymous";
60    TString password = "";    TString password = "";
61    //    //
62      TString tlefilename = "";
63    
64    const char *pamdbhost = gSystem->Getenv("PAM_DBHOST");    const char *pamdbhost = gSystem->Getenv("PAM_DBHOST");
65    const char *pamdbuser = gSystem->Getenv("PAM_DBUSER");    const char *pamdbuser = gSystem->Getenv("PAM_DBUSER");
66    const char *pamdbpsw = gSystem->Getenv("PAM_DBPSW");    const char *pamdbpsw = gSystem->Getenv("PAM_DBPSW");
# Line 71  int main(int numinp, char *inps[]){ Line 74  int main(int numinp, char *inps[]){
74    //        //    
75    Bool_t beverbose = true;    Bool_t beverbose = true;
76    Bool_t debug = false;    Bool_t debug = false;
77      //
78    Int_t i = 0;    Int_t i = 0;
79    //    //
80    if ( numinp > 1 ){    if ( numinp > 1 ){
# Line 147  int main(int numinp, char *inps[]){ Line 151  int main(int numinp, char *inps[]){
151          };          };
152          password = (TString)inps[i+1];            password = (TString)inps[i+1];  
153        };        };
154    
155          if ( !strcmp(inps[i],"-tle") ) {
156            if ( numinp-1 < i+1 ){
157              usage();
158              exit(1);
159            };
160            tlefilename = (TString)inps[i+1];
161          };
162    
163        //        //
164        if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;        if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
165        //        //
# Line 179  int main(int numinp, char *inps[]){ Line 192  int main(int numinp, char *inps[]){
192    TString message;    TString message;
193    char *version = YodaProfilerInfo(false);    char *version = YodaProfilerInfo(false);
194    PamelaDBOperations *pamDB = 0;    PamelaDBOperations *pamDB = 0;
195    UInt_t sizeofwar = 10;    UInt_t sizeofwar = 11;
196    UInt_t WAR[10];    UInt_t WAR[11];
197    memset(WAR, 0, 10*sizeof(UInt_t));    memset(WAR, 0, 11*sizeof(UInt_t));
198    //    //
199    printf("\n Welcome to the PAMELA YodaProfiler, version %s \n\n",version);    printf("\n Welcome to the PAMELA YodaProfiler, version %s \n\n",version);
200    try{    try{
# Line 190  int main(int numinp, char *inps[]){ Line 203  int main(int numinp, char *inps[]){
203      // Create pamDB object and open SQL connection      // Create pamDB object and open SQL connection
204      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
205      if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");      if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");
206      pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug);      pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug,tlefilename);
207      pamDB->CheckConnection();      pamDB->CheckConnection();
208      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
209      //      //
# Line 277  int main(int numinp, char *inps[]){ Line 290  int main(int numinp, char *inps[]){
290        WAR[9] = pamDB->ValidateRuns();        WAR[9] = pamDB->ValidateRuns();
291        //-------------------------------------------------------------------------------------------            //-------------------------------------------------------------------------------------------    
292      };      };
293    
294        if(! tlefilename.IsNull() ) {
295          //----------------------------------------------
296          //Populate GL_TLE table using the file provided
297          //----------------------------------------------
298          if ( beverbose ) printf(" 12 => Insert TLE elements in the GL_TLE table from file %s \n",tlefilename.Data());
299          WAR[10] = pamDB->populateTLE();
300        }
301                    
302    } catch (Int_t exc) {    } catch (Int_t exc) {
303      signal = exc;      signal = exc;
# Line 287  int main(int numinp, char *inps[]){ Line 308  int main(int numinp, char *inps[]){
308      case -4: message += " Error querying DB"; break;      case -4: message += " Error querying DB"; break;
309      case -5: message += " Inconsistent OBT/pkt_num"; break;      case -5: message += " Inconsistent OBT/pkt_num"; break;
310      case -6: message += " The file is not in the database"; break;      case -6: message += " The file is not in the database"; break;
311        case -7: message += " Cannot open TLE file"; break;
312      case -8: message += " Event file is empty"; break;      case -8: message += " Event file is empty"; break;
313      case -9: message += " No VarDump no BOOT number, use the -boot option to override"; break;      case -9: message += " No VarDump no BOOT number, use the -boot option to override"; break;
314      case -10: message += " No results from DB"; break;      case -10: message += " No results from DB"; break;
# Line 422  int main(int numinp, char *inps[]){ Line 444  int main(int numinp, char *inps[]){
444            };            };
445          };          };
446        };        };
447          //
448          if ( j == 10 ){ // populateTLE
449            for (UInt_t bit=0; bit<32; bit++){
450              if ( WAR[j] & (1 << bit) ){
451                if      ( bit == 0 ) message += "=> TLE insertion failed\n";
452                if      ( bit == 1 ) message += "=> No new TLE available\n";
453                else  message += "=> Unidentified populateTle warning\n";
454              };
455            };
456          };
457      };      };
458    };    };
459    //    //
# Line 435  int main(int numinp, char *inps[]){ Line 467  int main(int numinp, char *inps[]){
467    //---------------------------------------------------------------------------------------    //---------------------------------------------------------------------------------------
468    // Close and exit    // Close and exit
469    //---------------------------------------------------------------------------------------    //---------------------------------------------------------------------------------------
470    if ( beverbose ) printf(" 12 => Free objects and close SQL connection \n");    if ( beverbose ) printf(" 13 => Free objects and close SQL connection \n");
471    pamDB->Close();    pamDB->Close();
472    //    //
473    printf("\n");    printf("\n");

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.23