File indexing completed on 2024-04-06 11:57:55
0001 #include <iostream>
0002 using namespace std;
0003
0004 #include "MERunPanel.hh"
0005
0006 #include "MusEcalGUI.hh"
0007 #include "MERunManager.hh"
0008 #include "MERun.hh"
0009 #include <TSystem.h>
0010
0011 ClassImp(MERunPanel);
0012
0013 MERunPanel::MERunPanel( const TGWindow *p, MusEcalGUI* main,
0014 UInt_t w, UInt_t h )
0015 : _gui( main )
0016 {
0017
0018 fMain=0;
0019 fVframe1=0;
0020 f_Run_Group=0;
0021 fHint1=0;
0022 fHint2=0;
0023 fHint3=0;
0024 f_RunList=0;
0025
0026 fHint1 = new TGLayoutHints( kLHintsTop | kLHintsCenterX, 5, 5, 5, 5 );
0027 fHint2 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0);
0028 fHint3 = new TGLayoutHints( kLHintsTop | kLHintsLeft , 3 ,3 ,3 ,3 );
0029
0030
0031
0032 fClose = kTRUE;
0033
0034 fMain = new TGTransientFrame(p, main, w, h);
0035 fMain->Connect( "CloseWindow()", "MERunPanel", this, "DoClose()" );
0036 fMain->DontCallClose();
0037 fMain->SetCleanup(kDeepCleanup);
0038
0039 fMain->ChangeOptions( (fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame );
0040
0041 fVframe1 = new TGVerticalFrame(fMain, 0, 0, 0);
0042
0043 f_Run_Group = new TGGroupFrame( fVframe1,"", kHorizontalFrame | kRaisedFrame );
0044 TString str = "Run Selection Panel";
0045 f_Run_Group->SetTitle(str);
0046
0047 f_RunList = new TGListBox( f_Run_Group, 100, 200 );
0048 f_RunList->Connect( "Selected(Int_t)", "MERunPanel", this, "SetCurrentRun(UInt_t)" );
0049
0050 MERunManager* mgr_ = _gui->_runMgr.begin()->second;
0051 MusEcal::RunIterator it;
0052 unsigned int ii=0;
0053 unsigned int irun=0;
0054 for( it=mgr_->begin(); it!=mgr_->end(); it++ )
0055 {
0056 ME::Time time = it->first;
0057 MERun* aRun = it->second;
0058 unsigned int run = aRun->run();
0059 if( run!=irun )
0060 {
0061 irun= run;
0062 ii=0;
0063 }
0064 ii++;
0065 TString runstr;
0066 runstr+=irun;
0067 runstr+="_";
0068 runstr+=ii;
0069 f_RunList->AddEntry(runstr,time);
0070 }
0071 f_RunList->Resize(100,200);
0072 f_RunList->Select( mgr_->curKey() );
0073 f_RunList->MapSubwindows();
0074 f_RunList->Layout();
0075
0076 fVframe1->Resize(160, 50);
0077
0078 f_Run_Group->AddFrame( f_RunList, fHint3 );
0079
0080 fVframe1->AddFrame( f_Run_Group, fHint1 );
0081
0082 fMain->AddFrame( fVframe1, fHint3 );
0083
0084 fMain->SetWindowName("Selection Panel");
0085 TGDimension size = fMain->GetDefaultSize();
0086 fMain->Resize(size);
0087
0088
0089 fMain->MapSubwindows();
0090 fMain->MapWindow();
0091
0092 }
0093
0094 MERunPanel::~MERunPanel()
0095 {
0096 _gui->_fRunPanel=0;
0097 fMain->DeleteWindow();
0098 }
0099
0100 void
0101 MERunPanel::CloseWindow()
0102 {
0103
0104
0105 delete this;
0106 }
0107
0108 void
0109 MERunPanel::DoClose()
0110 {
0111 CloseWindow();
0112 }
0113
0114 void
0115 MERunPanel::SetCurrentRun( UInt_t key )
0116 {
0117 _gui->setTime( key );
0118 }
0119