--- eventviewer/flight/src/FEVpamevcontrol.cpp 2007/11/08 11:05:35 1.5 +++ eventviewer/flight/src/FEVpamevcontrol.cpp 2008/10/14 09:21:27 1.8 @@ -569,6 +569,7 @@ TGTextEntry *entry = (TGTextEntry*)gTQSender; TString text = entry->GetText(); cvar->thefilename=text.Data(); + cvar->i = 0; cvar->nevents = 0; cvar->firstevno = 0; cvar->lastevno = 0; @@ -601,11 +602,18 @@ cout<<"PSW "<IsConnected() ){ // - // Starting from level2 + // Retrieve the file // if ( clev->file == 2 ){ + // + // Starting from level2 + // GL_ROOT glroot = GL_ROOT(); if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){ // @@ -624,24 +632,89 @@ cvar->thefilter=""; cvar->selex = true; }; - cvar->i = -(cvar->EVF + cvar->i -1); + cvar->i = cvar->EVF + cvar->i ; //cvar->refresh = true; // cvar->file = 0; // - } else { + } else { stringstream warning; warning.str(""); warning << " Problems getting Level0 file "; DIALOG(2,warning.str().c_str()); }; - } else { + } else { // // starting from L0 // - stringstream warning; - warning.str(""); - warning << " Not yet implemented "; - DIALOG(2,warning.str().c_str()); + stringstream query; + query.str(""); + query << " SELECT ID FROM GL_ROOT WHERE NAME='"<< gSystem->BaseName(cvar->thefilename.Data()) <<"' order by INSERT_TIME desc limit 1;"; + // printf(" query is %s \n",query.str().c_str()); + pResult = dbc->Query(query.str().c_str()); + Row = pResult->Next(); + UInt_t idrl0 = 0; + if ( Row ){ + idrl0 = (UInt_t)atoll(Row->GetField(0)); + }; + // + query.str(""); + query << " SELECT ID,ID_ROOT_L2,EV_FROM FROM GL_RUN WHERE EV_FROM<="<i<<" AND EV_TO>="<< cvar->i<<" AND ID_ROOT_L0="<< idrl0 <<";"; + // printf(" query is %s \n",query.str().c_str()); + pResult = dbc->Query(query.str().c_str()); + Row = pResult->Next(); + UInt_t idrl2 = 0; + UInt_t idrlun = 0; + UInt_t evfrom = 0; + if ( Row ){ + idrlun = (UInt_t)atoll(Row->GetField(0)); + idrl2 = (UInt_t)atoll(Row->GetField(1)); + evfrom = (UInt_t)atoll(Row->GetField(2)); + }; + // + query.str(""); + query << " SELECT ID,NEVENTS FROM GL_RUN WHERE ID_ROOT_L2="<< idrl2 <<" order by RUNHEADER_TIME asc;"; + // printf(" query is %s \n",query.str().c_str()); + pResult = dbc->Query(query.str().c_str()); + Row = pResult->Next(); + UInt_t coren = 0; + while ( Row ){ + if ( (UInt_t)atoll(Row->GetField(0)) == idrlun ) break; + coren += (UInt_t)atoll(Row->GetField(1)); + Row = pResult->Next(); + }; + coren += cvar->i - evfrom; + // + GL_ROOT glroot = GL_ROOT(); + if( !glroot.Query_GL_ROOT(idrl2,dbc) ){ + // + cvar->i = coren; + // + cvar->thefilename= glroot.PATH + glroot.NAME; + cvar->nevents = 0; + cvar->firstevno = 0; + cvar->lastevno = 0; + if ( cvar->fl0 ) { + cvar->fl0 = false; + ffl0->SetState(kButtonUp); + }; + cvar->restart = true; + cvar->waitforever = false; + // + if ( cvar->thefilter != "" ){ + cvar->thefilter=""; + cvar->selex = true; + }; + // + } else { + stringstream warning; + warning.str(""); + warning << " Problems getting Level2 file "; + DIALOG(2,warning.str().c_str()); + }; + // stringstream warning; + // warning.str(""); + // warning << " Not yet implemented "; + // DIALOG(2,warning.str().c_str()); }; // } else { @@ -687,7 +760,9 @@ void PAMevcontrol::RefreshButtons() { if ( cvar->jumprog ){ jbwc1->SetState(kButtonDown); + jbwc0->SetState(kButtonUp); } else { + jbwc1->SetState(kButtonUp); jbwc0->SetState(kButtonDown); }; if ( cvar->fl0 ){ @@ -698,8 +773,10 @@ // if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); if ( cvar->bw ){ bwc1->SetState(kButtonDown); + bwc0->SetState(kButtonUp); } else { bwc0->SetState(kButtonDown); + bwc1->SetState(kButtonUp); }; if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp); if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp);