File indexing completed on 2024-04-06 11:57:54
0001 #include <iostream>
0002 using namespace std;
0003
0004 #include "MELeafPanel.hh"
0005 #include "../../interface/MEGeom.h"
0006
0007 #include "MusEcalGUI.hh"
0008 #include <TSystem.h>
0009
0010 ClassImp(MELeafPanel);
0011
0012 MELeafPanel::MELeafPanel( const TGWindow *p, MusEcalGUI* main,
0013 UInt_t w, UInt_t h)
0014 : _gui( main )
0015 {
0016 _type = _gui->_type;
0017 _color = _gui->_color;
0018 _var = _gui->_var;
0019 _zoom = _gui->_zoom;
0020
0021 fMain=0;
0022 fVframe1=0;
0023 fHframe1=0;
0024 fHframe2=0;
0025 fVarBox=0;
0026 fZoomBox=0;
0027 fPlotButton=0;
0028 fOneLevelUpButton=0;
0029
0030 fDiffPlotButton=0;
0031
0032 fHint1 = new TGLayoutHints( kLHintsTop | kLHintsCenterX, 5, 5, 5, 5 );
0033 fHint3 = new TGLayoutHints( kLHintsTop | kLHintsLeft , 3 ,3 ,3 ,3 );
0034 fHint2 = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 3, 0);
0035 fHint4 = new TGLayoutHints( kLHintsTop | kLHintsLeft | kLHintsExpandX,
0036 2, 2, 0, 0);
0037 fHint5 = new TGLayoutHints( kLHintsCenterX, 0, 0, 0, 0 );
0038
0039 fMain = new TGTransientFrame(p, main, w, h);
0040 fMain->Connect( "CloseWindow()", "MELeafPanel", this, "DoClose()" );
0041 fMain->DontCallClose();
0042 fMain->SetCleanup(kDeepCleanup);
0043
0044 fMain->ChangeOptions( (fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame );
0045
0046 fVframe1 = new TGVerticalFrame( fMain, 0, 0, 0 );
0047 fHframe1 = new TGHorizontalFrame( fVframe1, 0, 0, 0 );
0048 fHframe2 = new TGHorizontalFrame( fVframe1, 0, 0, 0 );
0049
0050 fVarBox = new TGListBox( fHframe1, 150, 100 );
0051 fVarBox->Connect( "Selected(Int_t)", "MELeafPanel", this, "SetVar(UInt_t)" );
0052
0053 fZoomBox = new TGListBox( fHframe1, 150, 100 );
0054 fZoomBox->Connect( "Selected(Int_t)", "MELeafPanel", this, "SetZoom(UInt_t)" );
0055
0056 if( _type==ME::iLaser )
0057 {
0058 _var = MusEcal::iAPD;
0059 for( int jj=0; jj<MusEcal::iSizeLV; jj++ )
0060 {
0061 fVarBox->AddEntry( MusEcal::historyVarName[jj], jj );
0062 }
0063 fVarBox->Resize(150,100);
0064 fVarBox->Select( _var );
0065 fVarBox->Layout();
0066
0067 _zoom = MusEcal::historyVarZoom[_color][ _var ];
0068 if( _zoom==MusEcal::iZero ) _zoom = MusEcal::iThirtyPercent;
0069 for( int iZoom=0; iZoom<MusEcal::iZero; iZoom++ )
0070 {
0071 fZoomBox->AddEntry( MusEcal::zoomName[iZoom], iZoom );
0072 }
0073 fZoomBox->Resize(150,100);
0074 fZoomBox->Select( _zoom );
0075 fZoomBox->Layout();
0076 }
0077 else if( _type==ME::iTestPulse )
0078 {
0079 int jj_Var = 0;
0080 for( int jj=0; jj<MusEcal::iSizeTPV; jj++ )
0081 {
0082 fVarBox->AddEntry( MusEcal::historyTPVarName[jj], jj );
0083 }
0084 fVarBox->Resize(150,100);
0085 fVarBox->Select( jj_Var );
0086 fVarBox->Layout();
0087
0088 int jj_Zoom = MusEcal::historyTPVarZoom[ jj_Var ];
0089 for( int iZoom=0; iZoom<MusEcal::iZero; iZoom++ )
0090 {
0091 fZoomBox->AddEntry( MusEcal::zoomName[iZoom], iZoom );
0092 }
0093 fZoomBox->Resize(150,100);
0094 if( jj_Zoom!=MusEcal::iZero ) fZoomBox->Select( jj_Zoom );
0095 else fZoomBox->Select(0);
0096 fZoomBox->Layout();
0097 }
0098
0099 fPlotButton = new TGTextButton( fHframe2 , " Plot " );
0100 fPlotButton->Connect("Clicked()","MELeafPanel",this,"DoPlot()");
0101
0102
0103
0104
0105 fOneLevelUpButton = new TGTextButton( fHframe2, " One Level Up " );
0106 fOneLevelUpButton->Connect("Clicked()","MELeafPanel",this,"DoOneLevelUp()");
0107
0108 fHframe1->AddFrame( fVarBox, fHint3 );
0109 fHframe1->AddFrame( fZoomBox, fHint3 );
0110 fHframe1->Resize(310,110);
0111 fHframe1->MapSubwindows();
0112 fVframe1->AddFrame( fHframe1, fHint5 );
0113 fHframe2->AddFrame( fPlotButton, fHint3 );
0114
0115 fHframe2->AddFrame( fOneLevelUpButton, fHint3 );
0116 fHframe2->Resize(310,50);
0117 fHframe2->MapSubwindows();
0118 fVframe1->AddFrame( fHframe2, fHint5 );
0119 fVframe1->MapSubwindows();
0120 fMain->AddFrame( fVframe1, fHint5 );
0121
0122 TString str;
0123 str += ME::type[_type];
0124 str += " Zoom Panel";
0125 fMain->SetWindowName(str);
0126 TGDimension size = fMain->GetDefaultSize();
0127 fMain->Resize(size);
0128
0129 fMain->MapSubwindows();
0130 fMain->MapWindow();
0131
0132 }
0133
0134 MELeafPanel::~MELeafPanel()
0135 {
0136 _gui->_fLeafPanel=0;
0137 fMain->DeleteWindow();
0138 }
0139
0140 void
0141 MELeafPanel::CloseWindow()
0142 {
0143
0144
0145 delete this;
0146 }
0147
0148 void
0149 MELeafPanel::DoClose()
0150 {
0151 CloseWindow();
0152 }
0153
0154 void
0155 MELeafPanel::DoPlot()
0156 {
0157
0158 _gui->_var = _var;
0159 _gui->_zoom = _zoom;
0160 _gui->leafPlot(1);
0161 }
0162
0163 void
0164 MELeafPanel::DoDiffPlot()
0165 {
0166
0167
0168
0169
0170
0171
0172
0173
0174 }
0175
0176 void
0177 MELeafPanel::DoOneLevelUp()
0178 {
0179 _gui->oneLevelUp();
0180 DoPlot();
0181 }
0182
0183 void
0184 MELeafPanel::SetVar( int ii )
0185 {
0186 _var = ii;
0187 }
0188
0189 void
0190 MELeafPanel::SetZoom( int iZoom )
0191 {
0192 _zoom = iZoom;
0193 }