443 |
|
|
444 |
void PAMevcontrol::DIALOG(Int_t ty, TString warn){ |
void PAMevcontrol::DIALOG(Int_t ty, TString warn){ |
445 |
// |
// |
446 |
// ty = 0 -> INFO, ty = 1 -> WARNING, ty = 3 -> ERROR |
// ty = 0 -> INFO, ty = 1 -> WARNING, ty = 2 -> ERROR |
447 |
// |
// |
448 |
Int_t retval; |
Int_t retval; |
449 |
TString title; |
TString title; |
450 |
EMsgBoxIcon mb_icon = kMBIconStop; |
EMsgBoxIcon mb_icon = kMBIconStop; |
451 |
if ( ty == 0 ){ |
if ( ty == 2 ){ |
452 |
|
title="ERROR!!"; |
453 |
|
mb_icon = kMBIconStop; |
454 |
|
new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval); |
455 |
|
} else { |
456 |
|
if ( ty == 0 ){ |
457 |
title="INFO"; |
title="INFO"; |
458 |
mb_icon = kMBIconAsterisk; |
mb_icon = kMBIconAsterisk; |
459 |
}; |
}; |
460 |
if ( ty == 1 ){ |
if ( ty == 1 ){ |
461 |
title="WARNING!"; |
title="WARNING!"; |
462 |
mb_icon = kMBIconExclamation; |
mb_icon = kMBIconExclamation; |
463 |
|
}; |
464 |
|
const TGPicture *icon_pic; |
465 |
|
switch (mb_icon) { |
466 |
|
case kMBIconStop: |
467 |
|
icon_pic = gClient->GetPicture("mb_stop_s.xpm"); |
468 |
|
if (!icon_pic) Error("TGMsgBox", "mb_stop_s.xpm not found"); |
469 |
|
break; |
470 |
|
|
471 |
|
case kMBIconQuestion: |
472 |
|
icon_pic = gClient->GetPicture("mb_question_s.xpm"); |
473 |
|
if (!icon_pic) Error("TGMsgBox", "mb_question_s.xpm not found"); |
474 |
|
break; |
475 |
|
|
476 |
|
case kMBIconExclamation: |
477 |
|
icon_pic = gClient->GetPicture("mb_exclamation_s.xpm"); |
478 |
|
if (!icon_pic) Error("TGMsgBox", "mb_exclamation_s.xpm not found"); |
479 |
|
break; |
480 |
|
|
481 |
|
case kMBIconAsterisk: |
482 |
|
icon_pic = gClient->GetPicture("mb_asterisk_s.xpm"); |
483 |
|
if (!icon_pic) Error("TGMsgBox", "mb_asterisk_s.xpm not found"); |
484 |
|
break; |
485 |
|
|
486 |
|
default: |
487 |
|
icon_pic = 0; |
488 |
|
break; |
489 |
|
} |
490 |
|
// |
491 |
|
TGTransientFrame *compofra = new TGTransientFrame(gClient->GetRoot(), 0, 200, 80, kHorizontalFrame); |
492 |
|
TGHorizontalFrame *fIconFrame = new TGHorizontalFrame(compofra, 98, 78); |
493 |
|
TGIcon *fIcon = new TGIcon(fIconFrame, icon_pic, icon_pic->GetWidth(), icon_pic->GetHeight()); |
494 |
|
fIconFrame->AddFrame(fIcon, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
495 |
|
compofra->AddFrame(fIconFrame, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
496 |
|
// |
497 |
|
TGHorizontalFrame *fLabelFrame = new TGHorizontalFrame(compofra, 98, 78); |
498 |
|
TGLabel *la=new TGLabel(fLabelFrame,warn.Data()); |
499 |
|
la->SetTextJustify(kLHintsCenterX); |
500 |
|
fLabelFrame->AddFrame(la, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
501 |
|
compofra->AddFrame(fLabelFrame, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
502 |
|
// |
503 |
|
compofra->SetWindowName(title.Data()); |
504 |
|
compofra->MapSubwindows(); |
505 |
|
compofra->Resize(compofra->GetDefaultWidth(),80); |
506 |
|
compofra->CenterOnParent(); |
507 |
|
compofra->MapWindow(); |
508 |
|
// |
509 |
|
Int_t kkk = 0; |
510 |
|
while ( kkk < 200 ){ |
511 |
|
gSystem->ProcessEvents(); |
512 |
|
gSystem->Sleep(10); |
513 |
|
kkk++; |
514 |
|
}; |
515 |
|
if ( compofra ){ |
516 |
|
la->Delete(); |
517 |
|
fLabelFrame->Delete(); |
518 |
|
fIcon->Delete(); |
519 |
|
fIconFrame->Delete(); |
520 |
|
compofra->DestroyWindow(); |
521 |
|
compofra->Delete(); |
522 |
|
}; |
523 |
}; |
}; |
524 |
if ( ty == 2 ){ |
// |
|
title="ERROR!!"; |
|
|
mb_icon = kMBIconStop; |
|
|
}; |
|
|
new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval); |
|
525 |
} |
} |
526 |
|
|
527 |
void PAMevcontrol::refreshdec(Int_t n){ |
void PAMevcontrol::refreshdec(Int_t n){ |
630 |
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
631 |
TString text = entry->GetText(); |
TString text = entry->GetText(); |
632 |
cvar->thefilename=text.Data(); |
cvar->thefilename=text.Data(); |
633 |
|
cvar->i = 0; |
634 |
cvar->nevents = 0; |
cvar->nevents = 0; |
635 |
cvar->firstevno = 0; |
cvar->firstevno = 0; |
636 |
cvar->lastevno = 0; |
cvar->lastevno = 0; |
663 |
cout<<"PSW "<<psw<<endl; |
cout<<"PSW "<<psw<<endl; |
664 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
665 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
666 |
|
// |
667 |
|
TSQLResult *pResult; |
668 |
|
TSQLRow *Row; |
669 |
|
// |
670 |
if( dbc && dbc->IsConnected() ){ |
if( dbc && dbc->IsConnected() ){ |
671 |
// |
// |
672 |
// Starting from level2 |
// Retrieve the file |
673 |
// |
// |
674 |
if ( clev->file == 2 ){ |
if ( clev->file == 2 ){ |
675 |
|
// |
676 |
|
// Starting from level2 |
677 |
|
// |
678 |
GL_ROOT glroot = GL_ROOT(); |
GL_ROOT glroot = GL_ROOT(); |
679 |
if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){ |
if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){ |
680 |
// |
// |
693 |
cvar->thefilter=""; |
cvar->thefilter=""; |
694 |
cvar->selex = true; |
cvar->selex = true; |
695 |
}; |
}; |
696 |
cvar->i = -(cvar->EVF + cvar->i -1); |
cvar->i = cvar->EVF + cvar->i ; |
697 |
//cvar->refresh = true; |
//cvar->refresh = true; |
698 |
// cvar->file = 0; |
// cvar->file = 0; |
699 |
// |
// |
700 |
} else { |
} else { |
701 |
stringstream warning; |
stringstream warning; |
702 |
warning.str(""); |
warning.str(""); |
703 |
warning << " Problems getting Level0 file "; |
warning << " Problems getting Level0 file "; |
704 |
DIALOG(2,warning.str().c_str()); |
DIALOG(2,warning.str().c_str()); |
705 |
}; |
}; |
706 |
} else { |
} else { |
707 |
// |
// |
708 |
// starting from L0 |
// starting from L0 |
709 |
// |
// |
710 |
stringstream warning; |
stringstream query; |
711 |
warning.str(""); |
query.str(""); |
712 |
warning << " Not yet implemented "; |
query << " SELECT ID FROM GL_ROOT WHERE NAME='"<< gSystem->BaseName(cvar->thefilename.Data()) <<"' order by INSERT_TIME desc limit 1;"; |
713 |
DIALOG(2,warning.str().c_str()); |
// printf(" query is %s \n",query.str().c_str()); |
714 |
|
pResult = dbc->Query(query.str().c_str()); |
715 |
|
Row = pResult->Next(); |
716 |
|
UInt_t idrl0 = 0; |
717 |
|
if ( Row ){ |
718 |
|
idrl0 = (UInt_t)atoll(Row->GetField(0)); |
719 |
|
}; |
720 |
|
// |
721 |
|
query.str(""); |
722 |
|
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 <<";"; |
723 |
|
// printf(" query is %s \n",query.str().c_str()); |
724 |
|
pResult = dbc->Query(query.str().c_str()); |
725 |
|
Row = pResult->Next(); |
726 |
|
UInt_t idrl2 = 0; |
727 |
|
UInt_t idrlun = 0; |
728 |
|
UInt_t evfrom = 0; |
729 |
|
if ( Row ){ |
730 |
|
idrlun = (UInt_t)atoll(Row->GetField(0)); |
731 |
|
idrl2 = (UInt_t)atoll(Row->GetField(1)); |
732 |
|
evfrom = (UInt_t)atoll(Row->GetField(2)); |
733 |
|
}; |
734 |
|
// |
735 |
|
query.str(""); |
736 |
|
query << " SELECT ID,NEVENTS FROM GL_RUN WHERE ID_ROOT_L2="<< idrl2 <<" order by RUNHEADER_TIME asc;"; |
737 |
|
// printf(" query is %s \n",query.str().c_str()); |
738 |
|
pResult = dbc->Query(query.str().c_str()); |
739 |
|
Row = pResult->Next(); |
740 |
|
UInt_t coren = 0; |
741 |
|
while ( Row ){ |
742 |
|
if ( (UInt_t)atoll(Row->GetField(0)) == idrlun ) break; |
743 |
|
coren += (UInt_t)atoll(Row->GetField(1)); |
744 |
|
Row = pResult->Next(); |
745 |
|
}; |
746 |
|
coren += cvar->i - evfrom; |
747 |
|
// |
748 |
|
GL_ROOT glroot = GL_ROOT(); |
749 |
|
if( !glroot.Query_GL_ROOT(idrl2,dbc) ){ |
750 |
|
// |
751 |
|
cvar->i = coren; |
752 |
|
// |
753 |
|
cvar->thefilename= glroot.PATH + glroot.NAME; |
754 |
|
cvar->nevents = 0; |
755 |
|
cvar->firstevno = 0; |
756 |
|
cvar->lastevno = 0; |
757 |
|
if ( cvar->fl0 ) { |
758 |
|
cvar->fl0 = false; |
759 |
|
ffl0->SetState(kButtonUp); |
760 |
|
}; |
761 |
|
cvar->restart = true; |
762 |
|
cvar->waitforever = false; |
763 |
|
// |
764 |
|
if ( cvar->thefilter != "" ){ |
765 |
|
cvar->thefilter=""; |
766 |
|
cvar->selex = true; |
767 |
|
}; |
768 |
|
// |
769 |
|
} else { |
770 |
|
stringstream warning; |
771 |
|
warning.str(""); |
772 |
|
warning << " Problems getting Level2 file "; |
773 |
|
DIALOG(2,warning.str().c_str()); |
774 |
|
}; |
775 |
|
// stringstream warning; |
776 |
|
// warning.str(""); |
777 |
|
// warning << " Not yet implemented "; |
778 |
|
// DIALOG(2,warning.str().c_str()); |
779 |
}; |
}; |
780 |
// |
// |
781 |
} else { |
} else { |
821 |
void PAMevcontrol::RefreshButtons() { |
void PAMevcontrol::RefreshButtons() { |
822 |
if ( cvar->jumprog ){ |
if ( cvar->jumprog ){ |
823 |
jbwc1->SetState(kButtonDown); |
jbwc1->SetState(kButtonDown); |
824 |
|
jbwc0->SetState(kButtonUp); |
825 |
} else { |
} else { |
826 |
|
jbwc1->SetState(kButtonUp); |
827 |
jbwc0->SetState(kButtonDown); |
jbwc0->SetState(kButtonDown); |
828 |
}; |
}; |
829 |
if ( cvar->fl0 ){ |
if ( cvar->fl0 ){ |
834 |
// if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); |
// if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); |
835 |
if ( cvar->bw ){ |
if ( cvar->bw ){ |
836 |
bwc1->SetState(kButtonDown); |
bwc1->SetState(kButtonDown); |
837 |
|
bwc0->SetState(kButtonUp); |
838 |
} else { |
} else { |
839 |
bwc0->SetState(kButtonDown); |
bwc0->SetState(kButtonDown); |
840 |
|
bwc1->SetState(kButtonUp); |
841 |
}; |
}; |
842 |
if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp); |
if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp); |
843 |
if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp); |
if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp); |