/[PAMELA software]/DarthVader/RunInfo/src/RunInfoLevel2.cpp
ViewVC logotype

Diff of /DarthVader/RunInfo/src/RunInfoLevel2.cpp

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

revision 1.1.1.1 by mocchiut, Fri May 19 13:15:47 2006 UTC revision 1.4 by pam-fi, Tue Nov 29 13:52:24 2011 UTC
# Line 29  void usage(){ Line 29  void usage(){
29    printf("\n -idRun          ID_RUN: ID number of the run to be processed \n");    printf("\n -idRun          ID_RUN: ID number of the run to be processed \n");
30    printf("\n -processFile    filename : output filename [default ID_RUN.Level2.root]\n");    printf("\n -processFile    filename : output filename [default ID_RUN.Level2.root]\n");
31    printf("\n -processFolder  where to store temporary data [default \"runinfoFolder\"]\n");    printf("\n -processFolder  where to store temporary data [default \"runinfoFolder\"]\n");
32      printf("\n -host           name for the host [default = mysql://localhost/pamelaprod]\n");
33      printf("\n -user           username for the DB [default = anonymous] \n");
34      printf("\n -psw            password for the DB [default = \"\"]\n");
35    printf("\n Notice that parameter order does not matter. \n");    printf("\n Notice that parameter order does not matter. \n");
36    printf("\nExample: \n\nRunInfo -idRun 1085 -processFile nomefile.root\n\n");    printf("\nExample: \n\nRunInfo -idRun 1085 -processFile nomefile.root\n\n");
37  };  };
# Line 55  int main(int numinp, char *inps[]){ Line 58  int main(int numinp, char *inps[]){
58    int nul = 0;    int nul = 0;
59    Int_t error = 0;    Int_t error = 0;
60    Bool_t beverbose = false;    Bool_t beverbose = false;
61    ULong64_t run = 0;    UInt_t run = 0;
62    TString filename;    TString filename;
63    TString processFolder = "runinfoFolder";    TString processFolder = "runinfoFolder";
64    TSQLServer *dbc = 0;    TSQLServer *dbc = 0;
65    Bool_t givenid = false;    Bool_t givenid = false;
66      TString host = "mysql://localhost/pamelaprod";
67      TString user = "anonymous";
68      TString psw = "";
69    //    //
70    // Checking input parameters    // Checking input parameters
71    //    //
# Line 79  int main(int numinp, char *inps[]){ Line 85  int main(int numinp, char *inps[]){
85            exit(-3);            exit(-3);
86          };          };
87          givenid = true;          givenid = true;
88          char *pEnd;              run = (UInt_t)atoll(inps[i+1]);
         run = strtoull(inps[i+1],&pEnd,0);        
89        };        };
90        if ( !strcmp(inps[i],"-processFile") ) {        if ( !strcmp(inps[i],"-processFile") ) {
91          if ( numinp-1 < i+1 ){          if ( numinp-1 < i+1 ){
# Line 96  int main(int numinp, char *inps[]){ Line 101  int main(int numinp, char *inps[]){
101          };          };
102          processFolder = (TString)inps[i+1];              processFolder = (TString)inps[i+1];    
103        };        };
104          if ( !strcmp(inps[i],"-host") ) {
105            if ( numinp-1 < i+1 ){
106              usage();
107              exit(-3);
108            };
109            host = (TString)inps[i+1];      
110          };
111          if ( !strcmp(inps[i],"-user") ) {
112            if ( numinp-1 < i+1 ){
113              usage();
114              exit(-3);
115            };
116            user = (TString)inps[i+1];      
117          };
118          if ( !strcmp(inps[i],"-psw") ) {
119            if ( numinp-1 < i+1 ){
120              usage();
121              exit(-3);
122            };
123            psw = (TString)inps[i+1];      
124          };
125        if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;        if ( !strcmp(inps[i],"-v") || !strcmp(inps[i],"--verbose") ) beverbose = true;
126      };      };
127    } else {    } else {
# Line 131  int main(int numinp, char *inps[]){ Line 157  int main(int numinp, char *inps[]){
157    //    //
158    printf("\nConnecting to database... \n");    printf("\nConnecting to database... \n");
159    //    //
160    dbc = TSQLServer::Connect("mysql://localhost/pamelaprod","anonymous","");    //
161  //    dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
162      //
163    if( !dbc ) {    if( !dbc ) {
164      printf(" RunInfo - ERROR: problems connecting to the DB (check username and passwd), exiting...\n\n");      printf(" RunInfo - ERROR: problems connecting to the DB (check username and passwd), exiting...\n\n");
165      exit(-2);          exit(-2);    
# Line 149  int main(int numinp, char *inps[]){ Line 176  int main(int numinp, char *inps[]){
176    //    //
177    stringstream name;    stringstream name;
178    name.str("");    name.str("");
179    if ( run != 0ULL ){    if ( run != 0 ){
180      //      //
181      // Run is not 0, we must process only one run .      // Run is not 0, we must process only one run .
182      //      //
# Line 222  int main(int numinp, char *inps[]){ Line 249  int main(int numinp, char *inps[]){
249    //    //
250    printf("\nClose the connection to the database... \n");    printf("\nClose the connection to the database... \n");
251    dbc->Close();    dbc->Close();
252      delete dbc;
253      dbc = 0;
254    printf("...connection terminated!\n\n");      printf("...connection terminated!\n\n");  
255    //    //
256    // Close redirection if the case.    // Close redirection if the case.

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23