40 |
printf(" -host name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
printf(" -host name of the DB host [default = $PAM_DBHOST or mysql://localhost/pamelaprod]\n"); |
41 |
printf(" -user username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n"); |
printf(" -user username for the DB connection [default = $PAM_DBUSER or \"anonymous\"] \n"); |
42 |
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
43 |
printf(" -splitat file shows relationship between files around the given file\n"); |
printf(" -deps file shows dependencies of the given file\n"); |
44 |
|
printf(" -splitat file shows dependenices of the given file and the following files (given by -nsplit)\n"); |
45 |
|
printf(" -nsplit number number of files to be shown by -splitat [default 20]\n"); |
46 |
printf(" -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"); |
47 |
printf(" -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"); |
48 |
printf(" -runat date returns run number which contains the given date,\n"); |
printf(" -runat date returns run number which contains the given date,\n"); |
73 |
TString filename = ""; |
TString filename = ""; |
74 |
TString l2filename = ""; |
TString l2filename = ""; |
75 |
TString splitat = ""; |
TString splitat = ""; |
76 |
|
UInt_t nsplit = 20; |
77 |
// |
// |
78 |
TSQLServer *dbc = 0; |
TSQLServer *dbc = 0; |
79 |
TString host = "mysql://localhost/pamelaprod"; |
TString host = "mysql://localhost/pamelaprod"; |
155 |
}; |
}; |
156 |
splitat = (TString)inps[i+1]; |
splitat = (TString)inps[i+1]; |
157 |
}; |
}; |
158 |
|
// |
159 |
|
if ( !strcmp(inps[i],"-nsplit") ) { |
160 |
|
if ( numinp-1 < i+1 ){ |
161 |
|
r2d2usage(); |
162 |
|
exit(-3); |
163 |
|
}; |
164 |
|
nsplit = (UInt_t)atoll(inps[i+1]); |
165 |
|
}; |
166 |
|
if ( !strcmp(inps[i],"-deps") ) { |
167 |
|
if ( numinp-1 < i+1 ){ |
168 |
|
r2d2usage(); |
169 |
|
exit(-3); |
170 |
|
}; |
171 |
|
nsplit = 1; |
172 |
|
splitat = (TString)inps[i+1]; |
173 |
|
}; |
174 |
if ( !strcmp(inps[i],"-l2filename") ) { |
if ( !strcmp(inps[i],"-l2filename") ) { |
175 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
176 |
r2d2usage(); |
r2d2usage(); |
703 |
TString NAME; |
TString NAME; |
704 |
UInt_t atime1 = 0; |
UInt_t atime1 = 0; |
705 |
UInt_t atime2 = 0; |
UInt_t atime2 = 0; |
706 |
|
UInt_t minid = 0; |
707 |
|
UInt_t maxid = 0; |
708 |
// |
// |
709 |
myquery.str(""); |
myquery.str(""); |
710 |
myquery << " select ID,PATH,NAME from GL_ROOT where NAME>=\"" << splitat.Data() << "\" order by NAME asc limit 20;"; |
myquery << " select ID,PATH,NAME from GL_ROOT where NAME>=\"" << splitat.Data() << "\" order by NAME asc limit " << nsplit << ";"; |
711 |
// printf(" myquery is %s \n",myquery.str().c_str()); |
// printf(" myquery is %s \n",myquery.str().c_str()); |
712 |
pResult = dbc->Query(myquery.str().c_str()); |
pResult = dbc->Query(myquery.str().c_str()); |
713 |
GL_TIMESYNC *dbtime; |
GL_TIMESYNC *dbtime; |
716 |
for( r=0; r < 1000; r++){ |
for( r=0; r < 1000; r++){ |
717 |
Row = pResult->Next(); |
Row = pResult->Next(); |
718 |
if( Row == NULL ) break; |
if( Row == NULL ) break; |
719 |
|
printf("\n\n#################################################\n"); |
720 |
Int_t s=0; |
Int_t s=0; |
721 |
Int_t t=0; |
Int_t t=0; |
722 |
Int_t c=0; |
Int_t c=0; |
728 |
NAME = Row->GetField(2); |
NAME = Row->GetField(2); |
729 |
printf("\n FILE: %s/%s \n",PATH.Data(),NAME.Data()); |
printf("\n FILE: %s/%s \n",PATH.Data(),NAME.Data()); |
730 |
myquery.str(""); |
myquery.str(""); |
731 |
myquery << " select ID,RUNHEADER_OBT,RUNTRAILER_OBT from GL_RUN where ID_ROOT_L0=" << ID << ";"; |
myquery << " select ID,RUNHEADER_OBT,RUNTRAILER_OBT from GL_RUN where ID_ROOT_L0=" << ID << " order by ID;"; |
732 |
pResult2 = dbc->Query(myquery.str().c_str()); |
pResult2 = dbc->Query(myquery.str().c_str()); |
733 |
for( Int_t run=0; run < pResult2->GetRowCount(); run++){ |
for( Int_t run=0; run < pResult2->GetRowCount(); run++){ |
734 |
Row2 = pResult2->Next(); |
Row2 = pResult2->Next(); |
735 |
if( Row2 == NULL ) break; |
if( Row2 == NULL ) break; |
736 |
IDR = atoi(Row2->GetField(0)); |
IDR = atoi(Row2->GetField(0)); |
737 |
|
if ( run == 0 ) minid = IDR; |
738 |
|
if ( run == pResult2->GetRowCount()-1 ) maxid = IDR; |
739 |
// |
// |
740 |
// here we make queries to DB looking for needed files and print results |
// here we make queries to DB looking for needed files and print results |
741 |
// |
// |
742 |
dbtime = new GL_TIMESYNC(ID,"ID",dbc); |
dbtime = new GL_TIMESYNC(ID,"ID",dbc); |
743 |
// |
// |
744 |
atime1 = dbtime->DBabsTime(atoi(Row2->GetField(1))); |
atime1 = dbtime->DBabsTime((UInt_t)atoll(Row2->GetField(1))); |
745 |
atime2 = dbtime->DBabsTime(atoi(Row2->GetField(2))); |
atime2 = dbtime->DBabsTime((UInt_t)atoll(Row2->GetField(2))); |
746 |
|
// printf(" atime1 %u atime2 %u field 1 %s field2 %s \n",atime1,atime2,Row2->GetField(1),Row2->GetField(2)); |
747 |
// |
// |
748 |
// S4 |
// S4 |
749 |
// |
// |
952 |
printf(" %s",cfiles[f]->Data()); |
printf(" %s",cfiles[f]->Data()); |
953 |
delete cfiles[f]; |
delete cfiles[f]; |
954 |
}; |
}; |
955 |
printf("\n\n#################################################\n"); |
printf("\n\n"); |
956 |
|
printf(" Minimum ID number in the file: %u \n",minid); |
957 |
|
printf(" Maximum ID number in the file: %u \n",maxid); |
958 |
|
printf("\n#################################################\n"); |
959 |
// |
// |
960 |
}; |
}; |
961 |
delete pResult; |
delete pResult; |