601 |
cout<<"PSW "<<psw<<endl; |
cout<<"PSW "<<psw<<endl; |
602 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
603 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
604 |
|
// |
605 |
|
TSQLResult *pResult; |
606 |
|
TSQLRow *Row; |
607 |
|
// |
608 |
if( dbc && dbc->IsConnected() ){ |
if( dbc && dbc->IsConnected() ){ |
609 |
// |
// |
610 |
// Starting from level2 |
// Retrieve the file |
611 |
// |
// |
612 |
if ( clev->file == 2 ){ |
if ( clev->file == 2 ){ |
613 |
|
// |
614 |
|
// Starting from level2 |
615 |
|
// |
616 |
GL_ROOT glroot = GL_ROOT(); |
GL_ROOT glroot = GL_ROOT(); |
617 |
if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){ |
if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){ |
618 |
// |
// |
631 |
cvar->thefilter=""; |
cvar->thefilter=""; |
632 |
cvar->selex = true; |
cvar->selex = true; |
633 |
}; |
}; |
634 |
cvar->i = -(cvar->EVF + cvar->i -1); |
cvar->i = cvar->EVF + cvar->i ; |
635 |
//cvar->refresh = true; |
//cvar->refresh = true; |
636 |
// cvar->file = 0; |
// cvar->file = 0; |
637 |
// |
// |
638 |
} else { |
} else { |
639 |
stringstream warning; |
stringstream warning; |
640 |
warning.str(""); |
warning.str(""); |
641 |
warning << " Problems getting Level0 file "; |
warning << " Problems getting Level0 file "; |
642 |
DIALOG(2,warning.str().c_str()); |
DIALOG(2,warning.str().c_str()); |
643 |
}; |
}; |
644 |
} else { |
} else { |
645 |
// |
// |
646 |
// starting from L0 |
// starting from L0 |
647 |
// |
// |
648 |
stringstream warning; |
stringstream query; |
649 |
warning.str(""); |
query.str(""); |
650 |
warning << " Not yet implemented "; |
query << " SELECT ID FROM GL_ROOT WHERE NAME='"<< gSystem->BaseName(cvar->thefilename.Data()) <<"' order by INSERT_TIME desc limit 1;"; |
651 |
DIALOG(2,warning.str().c_str()); |
// printf(" query is %s \n",query.str().c_str()); |
652 |
|
pResult = dbc->Query(query.str().c_str()); |
653 |
|
Row = pResult->Next(); |
654 |
|
UInt_t idrl0 = 0; |
655 |
|
if ( Row ){ |
656 |
|
idrl0 = (UInt_t)atoll(Row->GetField(0)); |
657 |
|
}; |
658 |
|
// |
659 |
|
query.str(""); |
660 |
|
query << " SELECT ID,ID_ROOT_L2,EV_FROM FROM GL_RUN WHERE EV_FROM<="<<cvar->i<<" AND EV_TO>="<< cvar->i<<" AND ID_ROOT_L0="<< idrl0 <<";"; |
661 |
|
// printf(" query is %s \n",query.str().c_str()); |
662 |
|
pResult = dbc->Query(query.str().c_str()); |
663 |
|
Row = pResult->Next(); |
664 |
|
UInt_t idrl2 = 0; |
665 |
|
UInt_t idrlun = 0; |
666 |
|
UInt_t evfrom = 0; |
667 |
|
if ( Row ){ |
668 |
|
idrlun = (UInt_t)atoll(Row->GetField(0)); |
669 |
|
idrl2 = (UInt_t)atoll(Row->GetField(1)); |
670 |
|
evfrom = (UInt_t)atoll(Row->GetField(2)); |
671 |
|
}; |
672 |
|
// |
673 |
|
query.str(""); |
674 |
|
query << " SELECT ID,NEVENTS FROM GL_RUN WHERE ID_ROOT_L2="<< idrl2 <<" order by RUNHEADER_TIME asc;"; |
675 |
|
// printf(" query is %s \n",query.str().c_str()); |
676 |
|
pResult = dbc->Query(query.str().c_str()); |
677 |
|
Row = pResult->Next(); |
678 |
|
UInt_t coren = 0; |
679 |
|
while ( Row ){ |
680 |
|
if ( (UInt_t)atoll(Row->GetField(0)) == idrlun ) break; |
681 |
|
coren += (UInt_t)atoll(Row->GetField(1)); |
682 |
|
Row = pResult->Next(); |
683 |
|
}; |
684 |
|
coren += cvar->i - evfrom; |
685 |
|
// |
686 |
|
GL_ROOT glroot = GL_ROOT(); |
687 |
|
if( !glroot.Query_GL_ROOT(idrl2,dbc) ){ |
688 |
|
// |
689 |
|
cvar->i = coren; |
690 |
|
// |
691 |
|
cvar->thefilename= glroot.PATH + glroot.NAME; |
692 |
|
cvar->nevents = 0; |
693 |
|
cvar->firstevno = 0; |
694 |
|
cvar->lastevno = 0; |
695 |
|
if ( cvar->fl0 ) { |
696 |
|
cvar->fl0 = false; |
697 |
|
ffl0->SetState(kButtonUp); |
698 |
|
}; |
699 |
|
cvar->restart = true; |
700 |
|
cvar->waitforever = false; |
701 |
|
// |
702 |
|
if ( cvar->thefilter != "" ){ |
703 |
|
cvar->thefilter=""; |
704 |
|
cvar->selex = true; |
705 |
|
}; |
706 |
|
// |
707 |
|
} else { |
708 |
|
stringstream warning; |
709 |
|
warning.str(""); |
710 |
|
warning << " Problems getting Level2 file "; |
711 |
|
DIALOG(2,warning.str().c_str()); |
712 |
|
}; |
713 |
|
// stringstream warning; |
714 |
|
// warning.str(""); |
715 |
|
// warning << " Not yet implemented "; |
716 |
|
// DIALOG(2,warning.str().c_str()); |
717 |
}; |
}; |
718 |
// |
// |
719 |
} else { |
} else { |