441 |
// |
// |
442 |
} |
} |
443 |
|
|
444 |
|
void PAMevcontrol::Refresh(){ |
445 |
|
// bah |
446 |
|
return; |
447 |
|
this->Clear(); |
448 |
|
MapSubwindows(); |
449 |
|
// Initialize the layout algorithm |
450 |
|
Resize(GetDefaultSize()); |
451 |
|
// Map main frame |
452 |
|
MapWindow(); |
453 |
|
} |
454 |
|
|
455 |
void PAMevcontrol::DIALOG(Int_t ty, TString warn){ |
void PAMevcontrol::DIALOG(Int_t ty, TString warn){ |
456 |
// |
// |
457 |
// ty = 0 -> INFO, ty = 1 -> WARNING, ty = 3 -> ERROR |
// ty = 0 -> INFO, ty = 1 -> WARNING, ty = 2 -> ERROR |
458 |
// |
// |
459 |
Int_t retval; |
Int_t retval; |
460 |
TString title; |
TString title; |
461 |
EMsgBoxIcon mb_icon = kMBIconStop; |
EMsgBoxIcon mb_icon = kMBIconStop; |
462 |
if ( ty == 0 ){ |
if ( ty == 2 || ty == 3 ){ |
463 |
|
if ( ty == 2 ){ |
464 |
|
title="ERROR!!"; |
465 |
|
mb_icon = kMBIconStop; |
466 |
|
new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval); |
467 |
|
} else { |
468 |
|
title="HELP"; |
469 |
|
mb_icon = kMBIconQuestion; |
470 |
|
new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval); |
471 |
|
}; |
472 |
|
} else { |
473 |
|
if ( ty == 0 ){ |
474 |
title="INFO"; |
title="INFO"; |
475 |
mb_icon = kMBIconAsterisk; |
mb_icon = kMBIconAsterisk; |
476 |
}; |
}; |
477 |
if ( ty == 1 ){ |
if ( ty == 1 ){ |
478 |
title="WARNING!"; |
title="WARNING!"; |
479 |
mb_icon = kMBIconExclamation; |
mb_icon = kMBIconExclamation; |
480 |
|
}; |
481 |
|
if ( ty == 4 ){ |
482 |
|
title="DATA"; |
483 |
|
mb_icon = kMBIconExclamation; |
484 |
|
}; |
485 |
|
const TGPicture *icon_pic; |
486 |
|
switch (mb_icon) { |
487 |
|
case kMBIconStop: |
488 |
|
icon_pic = gClient->GetPicture("mb_stop_s.xpm"); |
489 |
|
if (!icon_pic) Error("TGMsgBox", "mb_stop_s.xpm not found"); |
490 |
|
break; |
491 |
|
|
492 |
|
case kMBIconQuestion: |
493 |
|
icon_pic = gClient->GetPicture("mb_question_s.xpm"); |
494 |
|
if (!icon_pic) Error("TGMsgBox", "mb_question_s.xpm not found"); |
495 |
|
break; |
496 |
|
|
497 |
|
case kMBIconExclamation: |
498 |
|
icon_pic = gClient->GetPicture("mb_exclamation_s.xpm"); |
499 |
|
if (!icon_pic) Error("TGMsgBox", "mb_exclamation_s.xpm not found"); |
500 |
|
break; |
501 |
|
|
502 |
|
case kMBIconAsterisk: |
503 |
|
icon_pic = gClient->GetPicture("mb_asterisk_s.xpm"); |
504 |
|
if (!icon_pic) Error("TGMsgBox", "mb_asterisk_s.xpm not found"); |
505 |
|
break; |
506 |
|
|
507 |
|
default: |
508 |
|
icon_pic = 0; |
509 |
|
break; |
510 |
|
} |
511 |
|
// |
512 |
|
if ( ty == 4 ){// non funziona il recupero dei puntatori a questi oggetti come e` possibile? |
513 |
|
// gObjectTable->Print(); |
514 |
|
TGLabel *la=dynamic_cast<TGLabel*>(gDirectory->FindObject("la")); |
515 |
|
TGHorizontalFrame *fLabelFrame=dynamic_cast<TGHorizontalFrame*>(gDirectory->FindObject("fLabelFrame")); |
516 |
|
TGTransientFrame *compofra=dynamic_cast<TGTransientFrame*>(gDirectory->FindObject("compofra")); |
517 |
|
if ( la ) la->Delete(); |
518 |
|
if ( fLabelFrame ) fLabelFrame->Delete(); |
519 |
|
if ( compofra ){ |
520 |
|
compofra->DestroyWindow(); |
521 |
|
compofra->Delete(); |
522 |
|
}; |
523 |
|
}; |
524 |
|
TGTransientFrame *compofra = new TGTransientFrame(gClient->GetRoot(), 0, 200, 80, kHorizontalFrame); |
525 |
|
TGHorizontalFrame *fIconFrame = NULL; |
526 |
|
TGIcon *fIcon = NULL; |
527 |
|
if ( ty != 4 ){ |
528 |
|
compofra->DontCallClose(); |
529 |
|
fIconFrame = new TGHorizontalFrame(compofra, 98, 78); |
530 |
|
fIcon = new TGIcon(fIconFrame, icon_pic, icon_pic->GetWidth(), icon_pic->GetHeight()); |
531 |
|
fIconFrame->AddFrame(fIcon, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
532 |
|
compofra->AddFrame(fIconFrame, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
533 |
|
}; |
534 |
|
// |
535 |
|
TGHorizontalFrame *fLabelFrame = new TGHorizontalFrame(compofra, 98, 78); |
536 |
|
TGLabel *la=new TGLabel(fLabelFrame,warn.Data()); |
537 |
|
la->SetTextJustify(kLHintsCenterX); |
538 |
|
fLabelFrame->AddFrame(la, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
539 |
|
compofra->AddFrame(fLabelFrame, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1)); |
540 |
|
// |
541 |
|
compofra->SetWindowName(title.Data()); |
542 |
|
compofra->MapSubwindows(); |
543 |
|
if ( ty != 4 ){ |
544 |
|
compofra->Resize(compofra->GetDefaultWidth(),80); |
545 |
|
} else { |
546 |
|
compofra->Resize(compofra->GetDefaultSize()); |
547 |
|
}; |
548 |
|
compofra->CenterOnParent(); |
549 |
|
compofra->MapWindow(); |
550 |
|
// |
551 |
|
if ( ty != 4 ){ |
552 |
|
Int_t kkk = 0; |
553 |
|
while ( kkk < 200 ){ |
554 |
|
gSystem->ProcessEvents(); |
555 |
|
gSystem->Sleep(10); |
556 |
|
kkk++; |
557 |
|
}; |
558 |
|
}; |
559 |
|
if ( compofra && ty != 4 ){ |
560 |
|
la->Delete(); |
561 |
|
fLabelFrame->Delete(); |
562 |
|
if ( fIcon ) fIcon->Delete(); |
563 |
|
if ( fIconFrame ) fIconFrame->Delete(); |
564 |
|
compofra->DestroyWindow(); |
565 |
|
compofra->Delete(); |
566 |
|
}; |
567 |
}; |
}; |
568 |
if ( ty == 2 ){ |
// |
|
title="ERROR!!"; |
|
|
mb_icon = kMBIconStop; |
|
|
}; |
|
|
new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval); |
|
569 |
} |
} |
570 |
|
|
571 |
void PAMevcontrol::refreshdec(Int_t n){ |
void PAMevcontrol::refreshdec(Int_t n){ |
674 |
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
675 |
TString text = entry->GetText(); |
TString text = entry->GetText(); |
676 |
cvar->thefilename=text.Data(); |
cvar->thefilename=text.Data(); |
677 |
|
cvar->i = 0; |
678 |
cvar->nevents = 0; |
cvar->nevents = 0; |
679 |
cvar->firstevno = 0; |
cvar->firstevno = 0; |
680 |
cvar->lastevno = 0; |
cvar->lastevno = 0; |
707 |
cout<<"PSW "<<psw<<endl; |
cout<<"PSW "<<psw<<endl; |
708 |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl; |
709 |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
710 |
|
// |
711 |
|
TSQLResult *pResult; |
712 |
|
TSQLRow *Row; |
713 |
|
// |
714 |
if( dbc && dbc->IsConnected() ){ |
if( dbc && dbc->IsConnected() ){ |
715 |
// |
// |
716 |
// Starting from level2 |
// Retrieve the file |
717 |
// |
// |
718 |
if ( clev->file == 2 ){ |
if ( clev->file == 2 ){ |
719 |
|
// |
720 |
|
// Starting from level2 |
721 |
|
// |
722 |
GL_ROOT glroot = GL_ROOT(); |
GL_ROOT glroot = GL_ROOT(); |
723 |
if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){ |
if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){ |
724 |
// |
// |
737 |
cvar->thefilter=""; |
cvar->thefilter=""; |
738 |
cvar->selex = true; |
cvar->selex = true; |
739 |
}; |
}; |
740 |
cvar->i = -(cvar->EVF + cvar->i -1); |
cvar->i = cvar->EVF + cvar->i ; |
741 |
//cvar->refresh = true; |
//cvar->refresh = true; |
742 |
// cvar->file = 0; |
// cvar->file = 0; |
743 |
// |
// |
744 |
} else { |
} else { |
745 |
stringstream warning; |
stringstream warning; |
746 |
warning.str(""); |
warning.str(""); |
747 |
warning << " Problems getting Level0 file "; |
warning << " Problems getting Level0 file "; |
748 |
DIALOG(2,warning.str().c_str()); |
DIALOG(2,warning.str().c_str()); |
749 |
}; |
}; |
750 |
} else { |
} else { |
751 |
// |
// |
752 |
// starting from L0 |
// starting from L0 |
753 |
// |
// |
754 |
stringstream warning; |
stringstream query; |
755 |
warning.str(""); |
query.str(""); |
756 |
warning << " Not yet implemented "; |
query << " SELECT ID FROM GL_ROOT WHERE NAME='"<< gSystem->BaseName(cvar->thefilename.Data()) <<"' order by INSERT_TIME desc limit 1;"; |
757 |
DIALOG(2,warning.str().c_str()); |
// printf(" query is %s \n",query.str().c_str()); |
758 |
|
pResult = dbc->Query(query.str().c_str()); |
759 |
|
Row = pResult->Next(); |
760 |
|
UInt_t idrl0 = 0; |
761 |
|
if ( Row ){ |
762 |
|
idrl0 = (UInt_t)atoll(Row->GetField(0)); |
763 |
|
}; |
764 |
|
// |
765 |
|
query.str(""); |
766 |
|
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 <<";"; |
767 |
|
// printf(" query is %s \n",query.str().c_str()); |
768 |
|
pResult = dbc->Query(query.str().c_str()); |
769 |
|
Row = pResult->Next(); |
770 |
|
UInt_t idrl2 = 0; |
771 |
|
UInt_t idrlun = 0; |
772 |
|
UInt_t evfrom = 0; |
773 |
|
if ( Row ){ |
774 |
|
idrlun = (UInt_t)atoll(Row->GetField(0)); |
775 |
|
idrl2 = (UInt_t)atoll(Row->GetField(1)); |
776 |
|
evfrom = (UInt_t)atoll(Row->GetField(2)); |
777 |
|
}; |
778 |
|
// |
779 |
|
query.str(""); |
780 |
|
query << " SELECT ID,NEVENTS FROM GL_RUN WHERE ID_ROOT_L2="<< idrl2 <<" order by RUNHEADER_TIME asc;"; |
781 |
|
// printf(" query is %s \n",query.str().c_str()); |
782 |
|
pResult = dbc->Query(query.str().c_str()); |
783 |
|
Row = pResult->Next(); |
784 |
|
UInt_t coren = 0; |
785 |
|
while ( Row ){ |
786 |
|
if ( (UInt_t)atoll(Row->GetField(0)) == idrlun ) break; |
787 |
|
coren += (UInt_t)atoll(Row->GetField(1)); |
788 |
|
Row = pResult->Next(); |
789 |
|
}; |
790 |
|
coren += cvar->i - evfrom; |
791 |
|
// |
792 |
|
GL_ROOT glroot = GL_ROOT(); |
793 |
|
if( !glroot.Query_GL_ROOT(idrl2,dbc) ){ |
794 |
|
// |
795 |
|
cvar->i = coren; |
796 |
|
// |
797 |
|
cvar->thefilename= glroot.PATH + glroot.NAME; |
798 |
|
cvar->nevents = 0; |
799 |
|
cvar->firstevno = 0; |
800 |
|
cvar->lastevno = 0; |
801 |
|
if ( cvar->fl0 ) { |
802 |
|
cvar->fl0 = false; |
803 |
|
ffl0->SetState(kButtonUp); |
804 |
|
}; |
805 |
|
cvar->restart = true; |
806 |
|
cvar->waitforever = false; |
807 |
|
// |
808 |
|
if ( cvar->thefilter != "" ){ |
809 |
|
cvar->thefilter=""; |
810 |
|
cvar->selex = true; |
811 |
|
}; |
812 |
|
// |
813 |
|
} else { |
814 |
|
stringstream warning; |
815 |
|
warning.str(""); |
816 |
|
warning << " Problems getting Level2 file "; |
817 |
|
DIALOG(2,warning.str().c_str()); |
818 |
|
}; |
819 |
|
// stringstream warning; |
820 |
|
// warning.str(""); |
821 |
|
// warning << " Not yet implemented "; |
822 |
|
// DIALOG(2,warning.str().c_str()); |
823 |
}; |
}; |
824 |
// |
// |
825 |
} else { |
} else { |
865 |
void PAMevcontrol::RefreshButtons() { |
void PAMevcontrol::RefreshButtons() { |
866 |
if ( cvar->jumprog ){ |
if ( cvar->jumprog ){ |
867 |
jbwc1->SetState(kButtonDown); |
jbwc1->SetState(kButtonDown); |
868 |
|
jbwc0->SetState(kButtonUp); |
869 |
} else { |
} else { |
870 |
|
jbwc1->SetState(kButtonUp); |
871 |
jbwc0->SetState(kButtonDown); |
jbwc0->SetState(kButtonDown); |
872 |
}; |
}; |
873 |
if ( cvar->fl0 ){ |
if ( cvar->fl0 ){ |
878 |
// if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); |
// if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); |
879 |
if ( cvar->bw ){ |
if ( cvar->bw ){ |
880 |
bwc1->SetState(kButtonDown); |
bwc1->SetState(kButtonDown); |
881 |
|
bwc0->SetState(kButtonUp); |
882 |
} else { |
} else { |
883 |
bwc0->SetState(kButtonDown); |
bwc0->SetState(kButtonDown); |
884 |
|
bwc1->SetState(kButtonUp); |
885 |
}; |
}; |
886 |
if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp); |
if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp); |
887 |
if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp); |
if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp); |