30 |
printf("\n --version print informations about compilation and exit\n"); |
printf("\n --version print informations about compilation and exit\n"); |
31 |
printf("\n -h | --help print this help and exit \n"); |
printf("\n -h | --help print this help and exit \n"); |
32 |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
printf("\n -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
33 |
printf("\n -idRun ID_RUN: ID number of the run \n"); |
printf("\n -idRun run ID_RUN: ID number of the run \n"); |
34 |
printf("\n -filename output yoda filename \n"); |
printf("\n -filename file output yoda filename \n"); |
35 |
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"); |
36 |
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"); |
37 |
printf("\n -psw password for the DB [default = $PAM_DBPSW or \"\"]\n"); |
printf("\n -psw password for the DB [default = $PAM_DBPSW or \"\"]\n"); |
39 |
printf("\n -convert dbtime convert the dbtime given in seconds (from the DB) to a string\n"); |
printf("\n -convert dbtime convert the dbtime given in seconds (from the DB) to a string\n"); |
40 |
printf("\n -runat time returns run number which contains the given date,\n"); |
printf("\n -runat time returns run number which contains the given date,\n"); |
41 |
printf("\n for time use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
printf("\n for time use the SQL format \"yyyy-mm-dd hh:mm:ss\" \n"); |
42 |
|
printf("\n -tsfile file yoda filename for the time sync (to be used with -obt)\n"); |
43 |
|
printf("\n -obt OBT OBT in ms returns a date (to be used with -tsfile)\n"); |
44 |
printf("\nExamples: \n"); |
printf("\nExamples: \n"); |
45 |
printf("\n R2-D2 -idRun 1085 \n"); |
printf("\n R2-D2 -idRun 1085 \n"); |
46 |
printf("\n R2-D2 -filename DW_050208_00900.root \n"); |
printf("\n R2-D2 -filename DW_050208_00900.root \n"); |
82 |
UInt_t dbti = 0; |
UInt_t dbti = 0; |
83 |
Bool_t convert = false; |
Bool_t convert = false; |
84 |
Bool_t ruti = false; |
Bool_t ruti = false; |
85 |
|
Bool_t convobt = false; |
86 |
|
Bool_t convobtts = false; |
87 |
|
// |
88 |
|
UInt_t obt = 0; |
89 |
|
TString tsfile = ""; |
90 |
// |
// |
91 |
TSQLResult *pResult; |
TSQLResult *pResult; |
92 |
TSQLRow *Row; |
TSQLRow *Row; |
143 |
psw = (TString)inps[i+1]; |
psw = (TString)inps[i+1]; |
144 |
}; |
}; |
145 |
// |
// |
146 |
|
if ( !strcmp(inps[i],"-tsfile") ) { |
147 |
|
convobtts = true; |
148 |
|
if ( numinp-1 < i+1 ){ |
149 |
|
r2d2usage(); |
150 |
|
exit(-3); |
151 |
|
}; |
152 |
|
tsfile = (TString)inps[i+1]; |
153 |
|
}; |
154 |
|
// |
155 |
|
if ( !strcmp(inps[i],"-obt") ) { |
156 |
|
convobt = true; |
157 |
|
if ( numinp-1 < i+1 ){ |
158 |
|
r2d2usage(); |
159 |
|
exit(-3); |
160 |
|
}; |
161 |
|
obt = (UInt_t)atoll(inps[i+1]); |
162 |
|
}; |
163 |
|
// |
164 |
|
// |
165 |
if ( !strcmp(inps[i],"-tzone") ) { |
if ( !strcmp(inps[i],"-tzone") ) { |
166 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
167 |
r2d2usage(); |
r2d2usage(); |
221 |
printf("\n DB time %u is %s %s \n",dbti,dbtime->ConvertTime(tzone,dbti).Data(),tzone.Data()); |
printf("\n DB time %u is %s %s \n",dbti,dbtime->ConvertTime(tzone,dbti).Data(),tzone.Data()); |
222 |
}; |
}; |
223 |
// |
// |
224 |
|
// |
225 |
|
// |
226 |
|
if ( convobt && convobtts ){ |
227 |
|
UInt_t id = 0; |
228 |
|
myquery.str(""); |
229 |
|
myquery << "select "; |
230 |
|
myquery << " ID"; |
231 |
|
myquery << " from GL_ROOT where NAME=\"" << tsfile.Data() << "\";"; |
232 |
|
pResult = dbc->Query(myquery.str().c_str()); |
233 |
|
if ( pResult ){ |
234 |
|
Row = pResult->Next(); |
235 |
|
if ( Row ){ |
236 |
|
id = (UInt_t)atoll(Row->GetField(0)); |
237 |
|
delete pResult; |
238 |
|
GL_TIMESYNC *ctime = new GL_TIMESYNC(id,"ID",dbc); |
239 |
|
UInt_t abtime = ctime->DBabsTime(obt); |
240 |
|
TString UTC="UTC"; |
241 |
|
TString thetime = dbtime->ConvertTime(tzone,abtime); |
242 |
|
printf("\n OBT %u in the file %s corresponds to DBtime %u and date %s %s \n",obt,tsfile.Data(),abtime,thetime.Data(),tzone.Data()); |
243 |
|
delete ctime; |
244 |
|
}; |
245 |
|
}; |
246 |
|
}; |
247 |
|
if ( (convobt && !convobtts) || (convobtts && !convobt) ){ |
248 |
|
printf("\n To convert a OBT to a date you must provide both OBT and file to be used for time sync \n"); |
249 |
|
}; |
250 |
|
// |
251 |
// Which run contains the date "runtime"? |
// Which run contains the date "runtime"? |
252 |
// |
// |
253 |
if ( ruti ){ |
if ( ruti ){ |