28 |
// |
// |
29 |
void r2d2usage(){ |
void r2d2usage(){ |
30 |
printf("\nUsage:\n"); |
printf("\nUsage:\n"); |
31 |
printf("\n R2-D2 [-h | --help] [--version] [-idRun ID_RUN] [-filename filename]\n"); |
printf("\n R2-D2 [ options ]\n"); |
32 |
printf("\n [-host host] [-user username] [-psw password] \n"); |
printf("\n Options are:\n\n"); |
33 |
printf("\n --version print informations about compilation and exit\n"); |
printf(" --version print informations about compilation and exit\n"); |
34 |
printf("\n -h | --help print this help and exit \n"); |
printf(" -h | --help print this help and exit \n"); |
35 |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
printf(" -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
36 |
printf("\n -idRun run ID_RUN: ID number of the run \n"); |
printf(" -idRun run ID_RUN: ID number of the run \n"); |
37 |
printf("\n -filename file output yoda filename \n"); |
printf(" -filename file output yoda filename \n"); |
38 |
printf("\n -host name for the host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
printf(" -host name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
39 |
printf("\n -user username for the DB [default = $PAM_DBUSER or \"anonymous\"] \n"); |
printf(" -user username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n"); |
40 |
printf("\n -psw password for the DB [default = $PAM_DBPSW or \"\"]\n"); |
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
41 |
printf("\n -tzone timezone the time zone: UTC,GMT,MSK,MSD,CET,CEST are accepted \n"); |
printf(" -tzone timezone the time zone: UTC,GMT,MSK,MSD,CET,CEST are accepted \n"); |
42 |
printf("\n -convert dbtime convert the dbtime given in seconds (from the DB) to a string\n"); |
printf(" -convert dbtime convert the dbtime given in seconds (from the DB) to a string\n"); |
43 |
printf("\n -runat date returns run number which contains the given date,\n"); |
printf(" -runat date returns run number which contains the given date,\n"); |
44 |
printf("\n for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
printf(" for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
45 |
printf("\n -runatDB time returns run number which contains the given DB time\n"); |
printf(" -runatDB time returns run number which contains the given DB time\n"); |
46 |
printf("\n -tsfile file yoda filename for the time sync (to be used with -obt)\n"); |
printf(" -tsfile file yoda filename for the time sync (to be used with -obt)\n"); |
47 |
printf("\n -obt OBT OBT in ms returns a date (to be used with -tsfile)\n"); |
printf(" -obt OBT OBT in ms returns a date (to be used with -tsfile)\n"); |
48 |
printf("\n -getRTime OBT OBT in ms returns Resurs time (to be used with -tsfile)\n"); |
printf(" -getRTime OBT OBT in ms returns Resurs time (to be used with -tsfile)\n"); |
49 |
printf("\n -dumpTLEfor date save into file tle.txt the TLE for the given date,\n"); |
printf(" -dumpTLEfor date save into file tle.txt the TLE for the given date,\n"); |
50 |
printf("\n for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
printf(" for date use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
51 |
printf("\nExamples: \n"); |
printf("\nExamples: \n"); |
52 |
printf("\n R2-D2 -idRun 1085 \n"); |
printf(" R2-D2 -idRun 1085 \n"); |
53 |
printf("\n R2-D2 -filename DW_050208_00900.root \n"); |
printf(" R2-D2 -filename DW_050208_00900.root \n"); |
54 |
printf("\n R2-D2 -idRun 1085 -filename DW_050208_00900.root \n"); |
printf(" R2-D2 -idRun 1085 -filename DW_050208_00900.root \n"); |
55 |
}; |
}; |
56 |
// |
// |
57 |
// Here the main |
// Here the main |
469 |
exit(-4); |
exit(-4); |
470 |
}; |
}; |
471 |
printf("\n Run %u belongs to file %s \n",run,(glroot->PATH+glroot->NAME).Data()); |
printf("\n Run %u belongs to file %s \n",run,(glroot->PATH+glroot->NAME).Data()); |
472 |
|
filename = glroot->NAME; |
473 |
found = true; |
found = true; |
474 |
}; |
}; |
475 |
// |
// |
522 |
} else { |
} else { |
523 |
myquery.str(""); |
myquery.str(""); |
524 |
myquery << "select "; |
myquery << "select "; |
525 |
myquery << " ID,RUNHEADER_TIME,RUNTRAILER_TIME "; |
myquery << " ID,RUNHEADER_TIME,RUNTRAILER_TIME,NEVENTS "; |
526 |
myquery << " from GL_RUN where ID_ROOT_L0=" << ID << ";"; |
myquery << " from GL_RUN where ID_ROOT_L0=" << ID << ";"; |
527 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
528 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
530 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
531 |
found = true; |
found = true; |
532 |
if ( !r ) printf("\n File %s contains the following runs: \n\n",filename.Data()); |
if ( !r ) printf("\n File %s contains the following runs: \n\n",filename.Data()); |
533 |
TString UTC="UTC"; |
TString UTC=tzone.Data(); |
534 |
printf(" => ID = %i --> the run started at %s UTC ended at %s UTC \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data()); |
printf(" => ID = %i --> the run started at %s %s ended at %s %s NEV = %u \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),tzone.Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data(),tzone.Data(),(UInt_t)atoll(Row->GetField(3))); |
535 |
}; |
}; |
536 |
delete pResult; |
delete pResult; |
537 |
myquery.str(""); |
myquery.str(""); |
543 |
Row = pResult->Next(); |
Row = pResult->Next(); |
544 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
545 |
if ( !r ) printf("\n File %s contains the following DELETED runs: \n\n",filename.Data()); |
if ( !r ) printf("\n File %s contains the following DELETED runs: \n\n",filename.Data()); |
546 |
TString UTC="UTC"; |
TString UTC=tzone.Data(); |
547 |
printf(" => ID = %i --> the run started at %s UTC ended at %s UTC \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data()); |
printf(" => ID = %i --> the run started at %s %s ended at %s %s \n\n",(UInt_t)atoll(Row->GetField(0)),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(1))).Data(),tzone.Data(),dbtime->ConvertTime(UTC,(UInt_t)atoll(Row->GetField(2))).Data(),tzone.Data()); |
548 |
}; |
}; |
549 |
// |
// |
550 |
if ( !found ){ |
if ( !found ){ |