/[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.1 by mocchiut, Wed Aug 30 11:18:13 2006 UTC revision 1.2 by mocchiut, Fri Sep 1 12:47:13 2006 UTC
# Line 14  using namespace std; Line 14  using namespace std;
14  //  //
15  void usage(){  void usage(){
16    printf("\nUsage:\n");    printf("\nUsage:\n");
17    printf("\n YodaProfiler [-v | --verbose] [-h | --help] [--version] -rawFile raw_filename -yodaFile yoda_filename \n");    printf("\n YodaProfiler [options] -rawFile raw_filename -yodaFile yoda_filename \n");
18    printf("\n            [-host host] [-user username] [-psw password] \n");    printf("\n -rawFile        full path to the raw file\n");
19      printf("\n -yodaFile       full path to the YODA file\n");
20      printf("\n Options can be: \n");
21    printf("\n --version       print informations about compilation and exit\n");    printf("\n --version       print informations about compilation and exit\n");
22    printf("\n -h | --help     print this help and exit \n");    printf("\n -h | --help     print this help and exit \n");
23    printf("\n -v | --verbose  be verbose [default: print nothing on STDOUT]\n");    printf("\n -v | --verbose  be verbose [default: print nothing on STDOUT]\n");
24    printf("\n -g | --debug    be very verbose [default: no]\n");    printf("\n -g | --debug    be very verbose [default: no]\n");
   printf("\n -rawFile        full path to the raw file\n");  
   printf("\n -yodaFile       full path to the YODA file\n");  
25    printf("\n -boot number    CPU boot number [default = taken from VarDump]\n");    printf("\n -boot number    CPU boot number [default = taken from VarDump]\n");
26    printf("\n -tsync number   timesync (s) [default = taken from data]\n");    printf("\n -tsync number   timesync (s) [default = taken from data]\n");
27    printf("\n -obt0 number    obt at timesync (ms) [default = taken from data]\n");    printf("\n -obt0 number    obt at timesync (ms) [default = taken from data]\n");
28      printf("\n -clean number   number in seconds after which the fragment table\n");
29      printf("\n                 can be cleaned and runs validated [default = 864000 (10 days)],\n");
30      printf("\n                 if 0 force cleaning immediatly, if negative do not clean\n");
31    printf("\n -host           name for the host [default = mysql://localhost/pamelaprod]\n");    printf("\n -host           name for the host [default = mysql://localhost/pamelaprod]\n");
32    printf("\n -user           username for the DB [default = anonymous] \n");    printf("\n -user           username for the DB [default = anonymous] \n");
33    printf("\n -psw            password for the DB [default = \"\"]\n");    printf("\n -psw            password for the DB [default = \"\"]\n");
34    printf("\nExamples: \n");    printf("\n The order of input files and options does not matter. \n");
35    printf("\n YodaProfiler -rawFile /path/to/raw/files/000_000_00000_cln2.pam -yodaFile /path/to/filesfromyoda/000_000_00000_cln2.root \n\n");    printf("\nExample: \n");
36      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");
37  };  };
38  //  //
39  int main(int numinp, char *inps[]){  int main(int numinp, char *inps[]){
# Line 41  int main(int numinp, char *inps[]){ Line 45  int main(int numinp, char *inps[]){
45    UInt_t boot = 0;    UInt_t boot = 0;
46    UInt_t tsync = 0;    UInt_t tsync = 0;
47    UInt_t obt0 = 0;    UInt_t obt0 = 0;
48      Long64_t olderthan = 864000LL;
49    //    //
50    //    //
51    TString filerawname;    TString filerawname;
# Line 91  int main(int numinp, char *inps[]){ Line 96  int main(int numinp, char *inps[]){
96            usage();            usage();
97            exit(1);            exit(1);
98          };          };
99          tsync = atoi(inps[i+1]);                  tsync = (UInt_t)atoll(inps[i+1]);      
100        };        };
101        if ( !strcmp(inps[i],"-obt0") ) {        if ( !strcmp(inps[i],"-obt0") ) {
102          if ( numinp-1 < i+1 ){          if ( numinp-1 < i+1 ){
103            usage();            usage();
104            exit(1);            exit(1);
105          };          };
106          obt0 = atoi(inps[i+1]);          obt0 = (UInt_t)atoll(inps[i+1]);        
107          };
108          if ( !strcmp(inps[i],"-clean") ) {
109            if ( numinp-1 < i+1 ){
110              usage();
111              exit(1);
112            };
113            olderthan = (Long64_t)atoll(inps[i+1]);
114        };        };
115        if ( !strcmp(inps[i],"-host") ) {        if ( !strcmp(inps[i],"-host") ) {
116          if ( numinp-1 < i+1 ){          if ( numinp-1 < i+1 ){
# Line 155  int main(int numinp, char *inps[]){ Line 167  int main(int numinp, char *inps[]){
167    UInt_t WAR[10];    UInt_t WAR[10];
168    memset(WAR, 0, 10*sizeof(UInt_t));    memset(WAR, 0, 10*sizeof(UInt_t));
169    //    //
170    printf("\n Welcome to the PAMELA SuperYodaProfiler, version %s \n\n",version);    printf("\n Welcome to the PAMELA YodaProfiler, version %s \n\n",version);
171    try{    try{
172      //      //
173      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
174      // Create pamDB object and open SQL connection      // Create pamDB object and open SQL connection
175      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
176      if ( beverbose ) printf(" 1 => Create pamDB object and open SQL connection \n");      if ( beverbose ) printf(" 1 => Initialize and open SQL connection \n");
177      pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug);      pamDB = new PamelaDBOperations(host,user,password,filerawname,filerootname,boot,tsync,obt0,debug);
178      pamDB->CheckFile();      pamDB->CheckFile();
179        pamDB->SetOlderThan(olderthan);
180      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
181      //      //
182      //-------------------------------------------------------------------------------------------      //-------------------------------------------------------------------------------------------
# Line 224  int main(int numinp, char *inps[]){ Line 237  int main(int numinp, char *inps[]){
237      WAR[7] = pamDB->insertS4_CALIB();      WAR[7] = pamDB->insertS4_CALIB();
238      //-------------------------------------------------------------------------------------------          //-------------------------------------------------------------------------------------------    
239    
240        //-------------------------------------------------------------------------------------------
241        //Clean the GL_RUN_FRAGMENTS
242        //-------------------------------------------------------------------------------------------
243        if ( beverbose ) printf(" 10 => Clean the GL_RUN_FRAGMENTS table\n");
244        WAR[8] = pamDB->CleanGL_RUN_FRAGMENTS();
245        //-------------------------------------------------------------------------------------------    
246    
247        //-------------------------------------------------------------------------------------------
248        //Validate runs
249        //-------------------------------------------------------------------------------------------
250        if ( beverbose ) printf(" 11 => Validate runs\n");
251        WAR[9] = pamDB->ValidateRuns();
252        //-------------------------------------------------------------------------------------------    
253        
254    } catch (Int_t exc) {    } catch (Int_t exc) {
255      signal = exc;      signal = exc;
256      switch(exc){      switch(exc){
# Line 250  int main(int numinp, char *inps[]){ Line 277  int main(int numinp, char *inps[]){
277      case -22: message += " No CalibTrk1 tree in Level0 file"; break;      case -22: message += " No CalibTrk1 tree in Level0 file"; break;
278      case -23: message += " No CalibTrk2 tree in Level0 file"; break;      case -23: message += " No CalibTrk2 tree in Level0 file"; break;
279      case -24: message += " No CalibS4 tree in Level0 file"; break;      case -24: message += " No CalibS4 tree in Level0 file"; break;
280      case -97: message += " Missing runheader not recognized by HandleRun method"; break;      case -25: message += " Cannot find the run just inserted"; break;
281      case -99: message += " THIS CASE HAS NOT YET BEEN IMPLEMENTED"; break;      case -26: message += " Raw file not found looking for VarDump"; break;
282      default: message += " Unidentified error"; break;      default: message += " Unidentified error"; break;
283      };      };
284      printf("\n");      printf("\n");
# Line 271  int main(int numinp, char *inps[]){ Line 298  int main(int numinp, char *inps[]){
298          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
299            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
300              if ( bit == 0 ) message += "=> RAW file already inserted\n";              if ( bit == 0 ) message += "=> RAW file already inserted\n";
301              else message += "=> Unidentified warning\n";              else message += "=> Unidentified insertPamelaRaw warning\n";
302            };            };
303          };          };
304        };        };
# Line 280  int main(int numinp, char *inps[]){ Line 307  int main(int numinp, char *inps[]){
307          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
308            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
309              if ( bit == 0 ) message += "=> TIMESYNC already inserted\n";              if ( bit == 0 ) message += "=> TIMESYNC already inserted\n";
310              if ( bit == 1 ) message += "=> No mcmd timesync in the file\n";              else if ( bit == 1 ) message += "=> No mcmd timesync in the file\n";
311              else  message += "=> Unidentified warning\n";              else if ( bit == 2 ) message += "=> No runheaders in the file\n";
312                else if ( bit == 3 ) message += "=> No runtrailers in the file\n";
313                else if ( bit == 4 ) message += "=> No mcmd inclination in the file\n";
314                else  message += "=> Unidentified insertTimeSync warning\n";
315            };            };
316          };          };
317        };        };
# Line 290  int main(int numinp, char *inps[]){ Line 320  int main(int numinp, char *inps[]){
320          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
321            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
322              if ( bit == 0 ) message += "=> ROOT file already inserted\n";              if ( bit == 0 ) message += "=> ROOT file already inserted\n";
323              else message += "=> Unidentified warning\n";              else message += "=> Unidentified insertPamelaRoot warning\n";
324            };            };
325          };          };
326        };        };
# Line 298  int main(int numinp, char *inps[]){ Line 328  int main(int numinp, char *inps[]){
328        if ( j == 3 ){ // assignBOOTnumber warnings        if ( j == 3 ){ // assignBOOTnumber warnings
329          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
330            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
331              if ( bit == 0 ) message += "=> BOOT number already inserted\n";              if ( bit == 0 ) message += "=> BOOT number already inserted\n";//
332              if ( bit == 1 ) message += "=> VarDump event tree is empty, use the -boot option to override\n";              else if ( bit == 1 ) message += "=> VarDump event tree is empty, use the -boot option to override\n";//
333              if ( bit == 2 ) message += "=> No BOOT number in VarDump(!), use the -boot option to override\n";              else if ( bit == 2 ) message += "=> No BOOT number in VarDump(!), use the -boot option to override\n";//
334              if ( bit == 3 ) message += "=> Raw file not found looking for VarDump, use the -boot option to override\n";              else if ( bit == 4 ) message += "=> The file is not in the database looking for VarDump, use the -boot option to override\n";//
335              if ( bit == 4 ) message += "=> The file is not in the database looking for VarDump, use the -boot option to override\n";              else message += "=> Unidentified assignBOOTnumber warning\n";
             else message += "=> Unidentified warning\n";  
336            };            };
337          };          };
338        };        };
# Line 311  int main(int numinp, char *inps[]){ Line 340  int main(int numinp, char *inps[]){
340        if ( j == 4 ){ // insertPamelaRUN        if ( j == 4 ){ // insertPamelaRUN
341          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
342            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
343              if      ( bit == 0 ) message += "=> bah already inserted\n";              if      ( bit == 0 ) message += "=> Inconsistent PKT/OBT sequence\n";
344              else if ( bit == 1 ) message += "=> boh already inserted\n";              else if ( bit == 1 ) message += "=> No physics events in the file\n";
345              else  message += "=> Unidentified warning\n";              else if ( bit == 2 ) message += "=> Less than 2 physics events in the file\n";
346                else  message += "=> Unidentified insertPamelaRun warning\n";
347            };            };
348          };          };
349        };        };
# Line 321  int main(int numinp, char *inps[]){ Line 351  int main(int numinp, char *inps[]){
351        if ( j == 5 ){ // insertCALO_CALIB        if ( j == 5 ){ // insertCALO_CALIB
352          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
353            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
354              if      ( bit == 0 ) message += "=> bah already inserted\n";              if      ( bit == 0 ) message += "=> No calorimeter calibrations in the file\n";
355              else if ( bit == 1 ) message += "=> boh already inserted\n";              else  message += "=> Unidentified insertCaloCalib warning\n";
             else  message += "=> Unidentified warning\n";  
356            };            };
357          };          };
358        };        };
# Line 332  int main(int numinp, char *inps[]){ Line 361  int main(int numinp, char *inps[]){
361        if ( j == 6 ){ // insertTRACKER_CALIB        if ( j == 6 ){ // insertTRACKER_CALIB
362          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
363            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
364              if      ( bit == 0 ) message += "=> bah already inserted\n";              if      ( bit == 0 ) message += "=> No tracker calibrations in the file\n";
365              else if ( bit == 1 ) message += "=> boh already inserted\n";              else  message += "=> Unidentified insertTrkCalib warning\n";
             else  message += "=> Unidentified warning\n";  
366            };            };
367          };          };
368        };        };
# Line 343  int main(int numinp, char *inps[]){ Line 371  int main(int numinp, char *inps[]){
371        if ( j == 7 ){ // insertS4_CALIB        if ( j == 7 ){ // insertS4_CALIB
372          for (UInt_t bit=0; bit<32; bit++){          for (UInt_t bit=0; bit<32; bit++){
373            if ( WAR[j] & (1 << bit) ){            if ( WAR[j] & (1 << bit) ){
374              if      ( bit == 0 ) message += "=> bah already inserted\n";              if      ( bit == 0 ) message += "=> No s4 calibrations in the file\n";
375              else if ( bit == 1 ) message += "=> boh already inserted\n";              else  message += "=> Unidentified insertS4calib warning\n";
376              else  message += "=> Unidentified warning\n";            };
377            };
378          };
379          //
380          //
381          if ( j == 8 ){ // CleanGL_RUN_FRAGMENTS
382            for (UInt_t bit=0; bit<32; bit++){
383              if ( WAR[j] & (1 << bit) ){
384                if      ( bit == 0 ) message += "=> Skip the GL_RUN_FRAGMENTS table cleaning\n";
385                else  message += "=> Unidentified CleanGL_RUN_FRAGMENTS warning\n";
386            };            };
387          };          };
388        };        };
389        //        //
390          if ( j == 9 ){ // ValidateRuns
391            for (UInt_t bit=0; bit<32; bit++){
392              if ( WAR[j] & (1 << bit) ){
393                if      ( bit == 0 ) message += "=> Skip the run validation \n";
394                else  message += "=> Unidentified ValidateRuns warning\n";
395              };
396            };
397          };
398      };      };
399    };    };
400    //    //
# Line 363  int main(int numinp, char *inps[]){ Line 408  int main(int numinp, char *inps[]){
408    //---------------------------------------------------------------------------------------    //---------------------------------------------------------------------------------------
409    // Close and exit    // Close and exit
410    //---------------------------------------------------------------------------------------    //---------------------------------------------------------------------------------------
411      if ( beverbose ) printf(" 12 => Free objects and close SQL connection \n");
412    pamDB->Close();    pamDB->Close();
413    //    //
414    printf("\n");    printf("\n");

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.23