35 |
printf(" -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
printf(" -v | --verbose be verbose [default: print nothing on STDOUT]\n"); |
36 |
printf(" -idRun run ID_RUN: ID number of the run \n"); |
printf(" -idRun run ID_RUN: ID number of the run \n"); |
37 |
printf(" -filename file output yoda filename \n"); |
printf(" -filename file output yoda filename \n"); |
38 |
|
printf(" -l2filename file output amidala filename \n"); |
39 |
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"); |
40 |
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"); |
41 |
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
printf(" -psw password for the DB connection [default = $PAM_DBPSW or \"\"]\n"); |
67 |
UInt_t run = 0ULL; |
UInt_t run = 0ULL; |
68 |
// |
// |
69 |
TString filename = ""; |
TString filename = ""; |
70 |
|
TString l2filename = ""; |
71 |
// |
// |
72 |
TSQLServer *dbc = 0; |
TSQLServer *dbc = 0; |
73 |
TString host = "mysql://localhost/pamelaprod"; |
TString host = "mysql://localhost/pamelaprod"; |
136 |
}; |
}; |
137 |
filename = (TString)inps[i+1]; |
filename = (TString)inps[i+1]; |
138 |
}; |
}; |
139 |
|
if ( !strcmp(inps[i],"-l2filename") ) { |
140 |
|
if ( numinp-1 < i+1 ){ |
141 |
|
r2d2usage(); |
142 |
|
exit(-3); |
143 |
|
}; |
144 |
|
l2filename = (TString)inps[i+1]; |
145 |
|
}; |
146 |
if ( !strcmp(inps[i],"-host") ) { |
if ( !strcmp(inps[i],"-host") ) { |
147 |
if ( numinp-1 < i+1 ){ |
if ( numinp-1 < i+1 ){ |
148 |
r2d2usage(); |
r2d2usage(); |
268 |
GL_ROOT *glroot = new GL_ROOT(); |
GL_ROOT *glroot = new GL_ROOT(); |
269 |
GL_RUN *glrun = new GL_RUN(); |
GL_RUN *glrun = new GL_RUN(); |
270 |
GL_TIMESYNC *dbtime = new GL_TIMESYNC(); |
GL_TIMESYNC *dbtime = new GL_TIMESYNC(); |
271 |
|
UInt_t nr = 0; |
272 |
|
UInt_t rlist[500]; |
273 |
// |
// |
274 |
// At which date correspond the DB time "dbti"? |
// At which date correspond the DB time "dbti"? |
275 |
// |
// |
480 |
exit(-4); |
exit(-4); |
481 |
}; |
}; |
482 |
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()); |
483 |
filename = glroot->NAME; |
//filename = glroot->NAME; |
484 |
found = true; |
found = true; |
485 |
}; |
}; |
486 |
// |
// |
579 |
}; |
}; |
580 |
}; |
}; |
581 |
// |
// |
582 |
|
// Which runs are contained in the file "l2filename"? |
583 |
|
// |
584 |
|
if ( strcmp(l2filename.Data(),"") ){ |
585 |
|
// ---------------- |
586 |
|
Bool_t found = false; |
587 |
|
Int_t ID = 0; |
588 |
|
Int_t ID_RAW = 0; |
589 |
|
// |
590 |
|
const char *rawpath = ""; |
591 |
|
const char *rawname = ""; |
592 |
|
// |
593 |
|
myquery.str(""); |
594 |
|
myquery << "select "; |
595 |
|
myquery << " ID"; |
596 |
|
myquery << ",ID_RAW"; |
597 |
|
myquery << ",PATH"; |
598 |
|
myquery << ",NAME"; |
599 |
|
myquery << " from GL_ROOT where NAME=\"" << l2filename.Data() << "\" order by INSERT_TIME desc limit 1;"; |
600 |
|
pResult = dbc->Query(myquery.str().c_str()); |
601 |
|
for( r=0; r < 1000; r++){ |
602 |
|
Row = pResult->Next(); |
603 |
|
if( Row == NULL ) break; |
604 |
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
605 |
|
if(t==0) ID = atoi(Row->GetField(t)); |
606 |
|
if(t==1) ID_RAW = atoi(Row->GetField(t)); |
607 |
|
}; |
608 |
|
}; |
609 |
|
delete pResult; |
610 |
|
if ( !ID ){ |
611 |
|
printf("\n No file with name %s in the DB!\n",l2filename.Data()); |
612 |
|
} else { |
613 |
|
nr = 0; |
614 |
|
rlist[0] = 0; |
615 |
|
myquery.str(""); |
616 |
|
myquery << "select "; |
617 |
|
myquery << " ID,ID_ROOT_L0 "; |
618 |
|
myquery << " from GL_RUN where ID_ROOT_L2=" << ID << ";"; |
619 |
|
pResult = dbc->Query(myquery.str().c_str()); |
620 |
|
for( r=0; r < pResult->GetRowCount(); r++){ |
621 |
|
Row = pResult->Next(); |
622 |
|
if( Row == NULL ) break; |
623 |
|
found = true; |
624 |
|
if ( !r ) printf("\n File %s contains the following runs: \n\n",l2filename.Data()); |
625 |
|
printf(" %u ",(UInt_t)atoll(Row->GetField(0))); |
626 |
|
if ( r < (pResult->GetRowCount()-1) ){ |
627 |
|
printf("-"); |
628 |
|
} else { |
629 |
|
printf("\n\n"); |
630 |
|
}; |
631 |
|
if ( (UInt_t)atoll(Row->GetField(1)) != rlist[nr] ){ |
632 |
|
nr++; |
633 |
|
rlist[nr] = (UInt_t)atoll(Row->GetField(1)); |
634 |
|
}; |
635 |
|
}; |
636 |
|
delete pResult; |
637 |
|
// |
638 |
|
printf("\n File %s contains runs from L0 files: \n\n",l2filename.Data()); |
639 |
|
for (UInt_t l=1; l<nr+1; l++){ |
640 |
|
myquery.str(""); |
641 |
|
myquery << "select "; |
642 |
|
myquery << " PATH,NAME"; |
643 |
|
myquery << " from GL_ROOT where ID=" << rlist[l] << ";"; |
644 |
|
pResult = dbc->Query(myquery.str().c_str()); |
645 |
|
for( r=0; r < pResult->GetRowCount(); r++){ |
646 |
|
Row = pResult->Next(); |
647 |
|
if( Row == NULL ) break; |
648 |
|
for( t = 0; t < pResult->GetFieldCount(); t++){ |
649 |
|
if(t==0) rawpath = Row->GetField(t); |
650 |
|
if(t==1) rawname = Row->GetField(t); |
651 |
|
}; |
652 |
|
printf(" %s/%s \n",rawpath,rawname); |
653 |
|
}; |
654 |
|
delete pResult; |
655 |
|
}; |
656 |
|
}; |
657 |
|
}; |
658 |
|
// |
659 |
// Close the DB connection |
// Close the DB connection |
660 |
// |
// |
661 |
if ( dbc ) dbc->Close(); |
if ( dbc ) dbc->Close(); |