File indexing completed on 2024-04-06 11:57:55
0001 #include <iostream>
0002 using namespace std;
0003
0004 #include "MEMultiVarPanel.hh"
0005
0006 #include "MusEcalGUI.hh"
0007 #include <TSystem.h>
0008
0009 ClassImp(MEMultiVarPanel);
0010
0011 MEMultiVarPanel::MEMultiVarPanel(const TGWindow *p, MusEcalGUI* main,
0012 UInt_t w, UInt_t h)
0013 : _gui( main )
0014 {
0015 _type = _gui->_type;
0016 _color = _gui->_color;
0017
0018 fMain=0;
0019 fVframe1=0;
0020
0021 fHint1 = new TGLayoutHints( kLHintsTop | kLHintsCenterX, 5, 5, 5, 5 );
0022 fHint3 = new TGLayoutHints( kLHintsTop | kLHintsLeft , 0 ,0 ,0 ,0 );
0023 fHint2 = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0);
0024 fHint4 = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX,
0025 0, 0, 0, 0);
0026 fHint5 = new TGLayoutHints( kLHintsCenterX, 0, 0, 0, 0 );
0027
0028
0029 fClose = kTRUE;
0030
0031 fMain = new TGTransientFrame(p, main, w, h);
0032 fMain->Connect( "CloseWindow()", "MEMultiVarPanel", this, "DoClose()" );
0033 fMain->DontCallClose();
0034 fMain->SetCleanup(kDeepCleanup);
0035
0036 fMain->ChangeOptions( (fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame );
0037
0038 fHframe1 = new TGHorizontalFrame( fMain, 0, 0, 0 );
0039 fMain->AddFrame( fHframe1, fHint5 );
0040 fVframe1 = new TGVerticalFrame( fHframe1, 0, 0, 0 );
0041 fHframe1->AddFrame( fVframe1, fHint5 );
0042 fVframe2 = new TGVerticalFrame( fHframe1, 0, 0, 0 );
0043 fHframe1->AddFrame( fVframe2, fHint5 );
0044
0045 TGVerticalFrame* fVframe = fVframe1;
0046
0047 if( _type==ME::iLaser )
0048 {
0049 f_GroupFrame.resize( MusEcal::iSizeLV, 0 );
0050 f_ComboBox.resize( MusEcal::iSizeLV, 0 );
0051 for( int jj=0; jj<MusEcal::iSizeLV; jj++ )
0052 {
0053 if( jj>8 ) fVframe = fVframe2;
0054 f_GroupFrame[jj] = new TGGroupFrame( fVframe, "", kHorizontalFrame | kRaisedFrame );
0055 f_GroupFrame[jj]->SetTitle( MusEcal::historyVarName[jj] );
0056 fVframe->AddFrame( f_GroupFrame[jj] );
0057 f_ComboBox[jj] = new TGComboBox( f_GroupFrame[jj] , 1000+jj );
0058 f_GroupFrame[jj]->AddFrame( f_ComboBox[jj], fHint4 );
0059
0060 int jj_Zoom = MusEcal::historyVarZoom[_type][ jj ];
0061 f_ComboBox[jj]->AddEntry( "- not selected -", MusEcal::iZero );
0062 for( int iZoom=0; iZoom<MusEcal::iZero; iZoom++ )
0063 {
0064 f_ComboBox[jj]->AddEntry( MusEcal::zoomName[iZoom], iZoom );
0065 if( iZoom==jj_Zoom ) f_ComboBox[jj]->Select( iZoom );
0066 }
0067 if( jj_Zoom==MusEcal::iZero ) f_ComboBox[jj]->Select(MusEcal::iZero);
0068 f_ComboBox[jj]->Resize(120,20);
0069
0070 }
0071 }
0072 else if( _type==ME::iTestPulse )
0073 {
0074 f_GroupFrame.resize( MusEcal::iSizeTPV, 0 );
0075 f_ComboBox.resize( MusEcal::iSizeTPV, 0 );
0076 for( int jj=0; jj<MusEcal::iSizeTPV; jj++ )
0077 {
0078 f_GroupFrame[jj] = new TGGroupFrame( fVframe, "", kHorizontalFrame | kRaisedFrame );
0079 f_GroupFrame[jj]->SetTitle( MusEcal::historyTPVarName[jj] );
0080 fVframe->AddFrame( f_GroupFrame[jj] );
0081 f_ComboBox[jj] = new TGComboBox( f_GroupFrame[jj] , 1000+jj );
0082 f_GroupFrame[jj]->AddFrame( f_ComboBox[jj], fHint4 );
0083
0084 int jj_Zoom = MusEcal::historyTPVarZoom[ jj ];
0085 f_ComboBox[jj]->AddEntry( "- not selected -", MusEcal::iZero );
0086 for( int iZoom=0; iZoom<MusEcal::iZero; iZoom++ )
0087 {
0088 f_ComboBox[jj]->AddEntry( MusEcal::zoomName[iZoom], iZoom );
0089 if( iZoom==jj_Zoom ) f_ComboBox[jj]->Select( iZoom );
0090 }
0091 if( jj_Zoom==MusEcal::iZero ) f_ComboBox[jj]->Select(MusEcal::iZero);
0092 f_ComboBox[jj]->Resize(120,20);
0093 }
0094 }
0095
0096 f_Go_Button = new TGTextButton( fVframe, " Plot " );
0097 f_Go_Button->Connect("Clicked()","MEMultiVarPanel",this,"DoGo()");
0098 fVframe->AddFrame( f_Go_Button, fHint3 );
0099
0100 TString str;
0101 str += ME::type[_type];
0102 str += "Multi-Variable Panel";
0103 fMain->SetWindowName(str);
0104 TGDimension size = fMain->GetDefaultSize();
0105 fMain->Resize(size);
0106
0107 fMain->MapSubwindows();
0108 fMain->MapWindow();
0109
0110 }
0111
0112 MEMultiVarPanel::~MEMultiVarPanel()
0113 {
0114 _gui->_fMultiVarPanel=0;
0115 fMain->DeleteWindow();
0116 }
0117
0118 void
0119 MEMultiVarPanel::CloseWindow()
0120 {
0121
0122 delete this;
0123 }
0124
0125 void
0126 MEMultiVarPanel::DoClose()
0127 {
0128 CloseWindow();
0129 }
0130
0131 void
0132 MEMultiVarPanel::DoGo()
0133 {
0134 if( _type==ME::iLaser )
0135 {
0136 for( int jj=0; jj<MusEcal::iSizeLV; jj++ )
0137 {
0138 int iZoom = f_ComboBox[jj]->GetSelected();
0139 if( iZoom==MusEcal::iZero )
0140 {
0141 MusEcal::historyVarZoom[_color][jj] = MusEcal::iZero;
0142 continue;
0143 }
0144 else
0145 {
0146 MusEcal::historyVarZoom[_color][jj] = iZoom;
0147 }
0148 }
0149 }
0150 else if( _type==ME::iTestPulse )
0151 {
0152 for( int jj=0; jj<MusEcal::iSizeTPV; jj++ )
0153 {
0154 int iZoom = f_ComboBox[jj]->GetSelected();
0155 if( iZoom==MusEcal::iZero )
0156 {
0157 MusEcal::historyTPVarZoom[jj] = MusEcal::iZero;
0158 continue;
0159 }
0160 else
0161 {
0162 MusEcal::historyTPVarZoom[jj] = iZoom;
0163 }
0164 }
0165 }
0166 _gui->multiVarPlot(1);
0167 }