diff --git a/DigitizerPHA.cpp b/DigitizerPHA.cpp index ce75380..5ee4d8a 100644 --- a/DigitizerPHA.cpp +++ b/DigitizerPHA.cpp @@ -143,7 +143,7 @@ void DigitizerPHA::SetSetting(Setting::PHA settingName, float value, int ch){ case Setting::PHA::EventPreAggregate_G_max1023: input = value; WriteRegister(Register::DPP::NumberEventsPerAggregate_G, input, ch) ; break; case Setting::PHA::AggregateOrganization_board_3bit: input = value; WriteRegister(Register::DPP::AggregateOrganization , input, ch) ; break; - case Setting::PHA::MaxAggregatePreBlockTransfer_board_10bit: input = value; WriteRegister(Register::DPP::MaxAggregatePerBlockTransfer, input, ch) ; break; + case Setting::PHA::MaxAggregatePerBlockTransfer_board_10bit: input = value; WriteRegister(Register::DPP::MaxAggregatePerBlockTransfer, input, ch) ; break; case Setting::PHA::VetoWidth_ns:{ unsigned int input = 0 ; @@ -289,7 +289,7 @@ double DigitizerPHA::GetSetting(Setting::PHA settingName, int ch){ value = ((temp & 0x007) < 2 ? 0 : (int)pow(2, temp & 7)); break; } - case Setting::PHA::MaxAggregatePreBlockTransfer_board_10bit: temp = ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer , ch); value = temp; break; + case Setting::PHA::MaxAggregatePerBlockTransfer_board_10bit: temp = ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer , ch); value = temp; break; case Setting::PHA::TriggerThreshold_LSD: temp = ReadRegister(Register::DPP::PHA::TriggerThreshold , ch); value = temp; break; case Setting::PHA::TriggerHoldOffWidth_ns: temp = ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth , ch); value = temp * 4 * ch2ns; break; diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 152c837..4294b13 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -230,9 +230,15 @@ void MainWindow::HandleMenu(Int_t id){ break; ///========================= Board setting - case M_BOARD_SETTINGS: - boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi); - break; + case M_BOARD_SETTINGS:{ + if( boardSetting == NULL ) { + boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi); + }else{ + if ( boardSetting->IsOpen() == false ){ + boardSetting = new BoardSetting(gClient->GetRoot(), 600, 600, digi, nDigi); + } + } + }break; ///========================= Program setting case M_PROGRAM_SETTINGS:{ diff --git a/RegisterAddress.h b/RegisterAddress.h index 9364f64..a46be0e 100644 --- a/RegisterAddress.h +++ b/RegisterAddress.h @@ -274,7 +274,7 @@ namespace Setting{ VetoWidth_ns, EventPreAggregate_G_max1023, AggregateOrganization_board_3bit, - MaxAggregatePreBlockTransfer_board_10bit, + MaxAggregatePerBlockTransfer_board_10bit, TriggerThreshold_LSD, TriggerHoldOffWidth_ns, diff --git a/boardSetting.cpp b/boardSetting.cpp index 46b31be..cff0dc2 100644 --- a/boardSetting.cpp +++ b/boardSetting.cpp @@ -41,9 +41,11 @@ TGTextEntry * BoardSetting::txtACQTemp1 = NULL; TGTextEntry * BoardSetting::txtACQTemp2 = NULL; TGTextEntry * BoardSetting::txtACQTemp3 = NULL; -TGTextEntry * BoardSetting::txtEventReady = NULL; -TGTextEntry * BoardSetting::txtBusError = NULL; -TGTextEntry * BoardSetting::txtVMEFIFO = NULL; +TGTextEntry * BoardSetting::txtEventReady = NULL; +TGTextEntry * BoardSetting::txtBusError = NULL; +TGTextEntry * BoardSetting::txtVMEFIFO = NULL; + +bool BoardSetting::isOpened = false; BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard){ @@ -89,9 +91,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d enADCPwrStatus->SetEnabled(false); enADCPwrStatus->Resize(50, 20); - TGTextButton * bSoftwareReset = new TGTextButton(hframe0, "Reset default Settings"); hframe0->AddFrame(bSoftwareReset, layoutHints); + TGTextButton * bSoftwareReset = new TGTextButton(hframe0, "Reset Settings to default"); hframe0->AddFrame(bSoftwareReset, layoutHints); + bSoftwareReset->Connect("Clicked()", "BoardSetting", this, "ResetSettingToDefault()"); TGTextButton * bSoftwareClear = new TGTextButton(hframe0, "Clear Buffer"); hframe0->AddFrame(bSoftwareClear, layoutHints); - + bSoftwareClear->Connect("Clicked()", "BoardSetting", this, "ClearBuffer()"); {///============ fixed info TGHorizontalFrame * hframeInfo = new TGHorizontalFrame(vframe); vframe->AddFrame(hframeInfo, new TGLayoutHints(kLHintsExpandX)); @@ -114,159 +117,11 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d } } - {///========= Board Configure - TGGroupFrame * gBdCfg = new TGGroupFrame(vframe, "Board Configure", kHorizontalFrame); vframe->AddFrame(gBdCfg , new TGLayoutHints(kLHintsExpandX)); - TGVerticalFrame * vBdCfg = new TGVerticalFrame(gBdCfg); gBdCfg->AddFrame(vBdCfg); - TGHorizontalFrame * hframeBdCfg1 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg1, layoutHints); - - bAutoDataFlush = new TGCheckButton(hframeBdCfg1, "Auto Data Flush", 1); hframeBdCfg1->AddFrame(bAutoDataFlush, layoutHints); - bAutoDataFlush->SetState(kButtonUp); - bAutoDataFlush->Connect("Clicked()", "BoardSetting", this, "SetAutoDataFlush()"); - - bDecimateWF = new TGCheckButton(hframeBdCfg1, "Decimate WaveForm", 1); hframeBdCfg1->AddFrame(bDecimateWF, layoutHints); - bDecimateWF->SetState(kButtonUp); - bDecimateWF->Connect("Clicked()", "BoardSetting", this, "SetDecimateWF()"); - - bWFRecord = new TGCheckButton(hframeBdCfg1, "Record WaveFrom", 1); hframeBdCfg1->AddFrame(bWFRecord, layoutHints); - bWFRecord->SetState(kButtonUp); - bWFRecord->Connect("Clicked()", "BoardSetting", this, "SetWaveFormRecord()"); - - bTrigPropa = new TGCheckButton(hframeBdCfg1, "Trigger Propagation (coincidence) ", 1); hframeBdCfg1->AddFrame(bTrigPropa, layoutHints); - bTrigPropa->SetState(kButtonUp); - bTrigPropa->Connect("Clicked()", "BoardSetting", this, "SetTriggerPropagation()"); - - bExtrac2 = new TGCheckButton(hframeBdCfg1, "Enable Extra2 word", 1); hframeBdCfg1->AddFrame(bExtrac2, layoutHints); - bExtrac2->SetState(kButtonUp); - bExtrac2->Connect("Clicked()", "BoardSetting", this, "SetEnableExtra2()"); - - TGHorizontalFrame * hframeBdCfg2 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg2, layoutHints); - bDualTrace = new TGCheckButton(hframeBdCfg2, "Dual Trace", 1); hframeBdCfg2->AddFrame(bDualTrace, layoutHints); - bDualTrace->SetState(kButtonUp); - bDualTrace->Connect("Clicked()", "BoardSetting", this, "SetDualTrace()"); - - TGLabel * lbAP1 = new TGLabel(hframeBdCfg2, "Ana. Prb. 1"); hframeBdCfg2->AddFrame(lbAP1, layoutHints); - cbAP1 = new TGComboBox(hframeBdCfg2, "Ana. Pb. 1", 1); hframeBdCfg2->AddFrame(cbAP1, layoutHints); - cbAP1->EnableTextInput(false); - cbAP1->AddEntry("Input", 0); - cbAP1->AddEntry("RC-CR (1st derivative)", 1); - cbAP1->AddEntry("RC-CR2 (2st derivative)", 2); - cbAP1->AddEntry("Trapezoid", 3); - cbAP1->Resize(150, 20); - cbAP1->Select(0); - cbAP1->Connect("Changed()", "BoardSetting", this, "SetAnalogProbe1()"); - - - TGLabel * lbAP2 = new TGLabel(hframeBdCfg2, "Ana. Prb. 2"); hframeBdCfg2->AddFrame(lbAP2, layoutHints); - cbAP2 = new TGComboBox(hframeBdCfg2, "Ana. Pb. 2", 1); hframeBdCfg2->AddFrame(cbAP2, layoutHints); - cbAP2->EnableTextInput(false); - cbAP2->AddEntry("Input", 0); - cbAP2->AddEntry("Threshold", 1); - cbAP2->AddEntry("Trapezoid - Baseline", 2); - cbAP2->AddEntry("Baseline", 3); - cbAP2->Resize(150, 20); - cbAP2->Select(0); - cbAP2->SetEnabled(false); - cbAP2->Connect("Changed()", "BoardSetting", this, "SetAnalogProbe2()"); - - TGLabel * lbDP = new TGLabel(hframeBdCfg2, "Digi. Prb. "); hframeBdCfg2->AddFrame(lbDP, layoutHints); - cbDP = new TGComboBox(hframeBdCfg2, "Digital. Pb.", 1); hframeBdCfg2->AddFrame(cbDP, layoutHints); - cbDP->EnableTextInput(false); - cbDP->AddEntry("Peaking", 0); - cbDP->AddEntry("Armed (Triggered)", 1); - cbDP->AddEntry("Peak Run", 2); - cbDP->AddEntry("Pile-Up", 3); - cbDP->AddEntry("Peaking", 4); - cbDP->AddEntry("TRG Validation Win.", 5); - cbDP->AddEntry("Baseline freeze", 6); - cbDP->AddEntry("TRG holdoff", 7); - cbDP->AddEntry("TRG Validation", 8); - cbDP->AddEntry("ACQ busy", 9); - cbDP->AddEntry("Zero Cross", 10); - cbDP->AddEntry("Ext. TRG", 11); - cbDP->AddEntry("Memory full", 12); - cbDP->Resize(150, 20); - cbDP->Select(0); - cbDP->Connect("Changed()", "BoardSetting", this, "SetDigitalProbe()"); - - TGHorizontalFrame * hframeBdCfg3 = new TGHorizontalFrame(vBdCfg); vBdCfg->AddFrame(hframeBdCfg3, layoutHints); - TGLabel * lbAggOrg = new TGLabel(hframeBdCfg3, "Aggregate Organization"); hframeBdCfg3->AddFrame(lbAggOrg, layoutHints); - cbAggOrg = new TGComboBox(hframeBdCfg3, "Aggregate Organization", 1); hframeBdCfg3->AddFrame(cbAggOrg, layoutHints); - cbAggOrg->EnableTextInput(false); - cbAggOrg->AddEntry("Not used", 0); - cbAggOrg->AddEntry("4", 2); - cbAggOrg->AddEntry("8", 3); - cbAggOrg->AddEntry("16", 4); - cbAggOrg->AddEntry("32", 5); - cbAggOrg->AddEntry("64", 6); - cbAggOrg->AddEntry("128", 7); - cbAggOrg->AddEntry("256", 8); - cbAggOrg->AddEntry("512", 9); - cbAggOrg->AddEntry("1024", 10); - cbAggOrg->Resize(150, 20); - cbAggOrg->Select(0); - cbAggOrg->Connect("Changed()", "BoardSetting", this, "SetAggregateOrganization()"); - - TGLabel * lbAggBLT = new TGLabel(hframeBdCfg3, "MAx. Aggregate pre Readout"); hframeBdCfg3->AddFrame(lbAggBLT, layoutHints); - numAggBLT = new TGNumberEntry(hframeBdCfg3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeBdCfg3->AddFrame(numAggBLT, layoutHints); - numAggBLT->SetWidth(60); - numAggBLT->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x3FF); - numAggBLT->Connect("Modified()", "BoardSetting", this, "SetReadOutAggregate()"); - - ///"FanSpeed Control", - TGLabel * lbFanCtrl = new TGLabel(hframeBdCfg3, "Fan Speed Control", kHorizontalFrame); hframeBdCfg3->AddFrame(lbFanCtrl, layoutHints ); - cbFanCtrl = new TGComboBox(hframeBdCfg3, "",1); hframeBdCfg3->AddFrame(cbFanCtrl, layoutHints); - cbFanCtrl->EnableTextInput(false); - cbFanCtrl->AddEntry("Slow/Auto",0x30); - cbFanCtrl->AddEntry("Fast", 0x38); - cbFanCtrl->Select(0x30); - cbFanCtrl->Resize(100, 20); - } - - {///========== ACQ control - TGGroupFrame * gAcqCtrl = new TGGroupFrame(vframe, "ACQ Control", kHorizontalFrame); vframe->AddFrame(gAcqCtrl , new TGLayoutHints(kLHintsExpandX)); - TGVerticalFrame * vAcqCtrl = new TGVerticalFrame(gAcqCtrl); gAcqCtrl->AddFrame(vAcqCtrl); - - TGHorizontalFrame * hfAcqCtrl = new TGHorizontalFrame(vAcqCtrl); vAcqCtrl->AddFrame(hfAcqCtrl, layoutHints); - - TGLabel * lbAcqMode = new TGLabel(hfAcqCtrl, "ACQ Mode"); hfAcqCtrl->AddFrame(lbAcqMode, layoutHints); - cbAcqMode = new TGComboBox(hfAcqCtrl, "ACQ Mode", 1); hfAcqCtrl->AddFrame(cbAcqMode, layoutHints); - cbAcqMode->EnableTextInput(false); - cbAcqMode->AddEntry("Software", 0); - cbAcqMode->AddEntry("S-IN / GPI", 1); - cbAcqMode->AddEntry("1st Trig. Ctrl.", 2); - cbAcqMode->AddEntry("LVSD Ctrl.", 3); - cbAcqMode->Select(0); - cbAcqMode->Resize(100, 20); - - bAcqArm = new TGCheckButton(hfAcqCtrl, "ACQ Start/Arm", 1); hfAcqCtrl->AddFrame(bAcqArm, layoutHints); - bAcqArm->SetState(kButtonUp); - //bAcqArm->Connect("Clicked()", "BoardSetting", this, "SetAutoDataFlush()"); - - TGLabel * lbPLLref = new TGLabel(hfAcqCtrl, "PLL Ref."); hfAcqCtrl->AddFrame(lbPLLref, layoutHints); - cbPLLref = new TGComboBox(hfAcqCtrl, "PLL Ref.", 1); hfAcqCtrl->AddFrame(cbPLLref, layoutHints); - cbPLLref->EnableTextInput(false); - cbPLLref->AddEntry("internal", 0); - cbPLLref->AddEntry("external", 1); - cbPLLref->Select(0); - cbPLLref->Resize(100, 20); - - TGHorizontalFrame * hfAcqCtrl2 = new TGHorizontalFrame(vAcqCtrl); vAcqCtrl->AddFrame(hfAcqCtrl2, layoutHints); - - bSWTrigger = new TGTextButton(hfAcqCtrl2, "Send Software Trigger"); hfAcqCtrl2->AddFrame(bSWTrigger, layoutHints); - //bSWTrigger->Connect("Clicked()", "BoardSetting", this, "SetAutoDataFlush()"); - - bSWClockSync = new TGTextButton(hfAcqCtrl2, "Send Software Clock Sync"); hfAcqCtrl2->AddFrame(bSWClockSync, layoutHints); - //bSWClockSync->Connect("Clicked()", "BoardSetting", this, "SetAutoDataFlush()"); - - TGLabel * lbRunStartStopDelay = new TGLabel(hfAcqCtrl2, "Run/Start/Stop Delay [ns]"); hfAcqCtrl2->AddFrame(lbRunStartStopDelay, layoutHints); - numRunStartStopDelay = new TGNumberEntry(hfAcqCtrl2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hfAcqCtrl2->AddFrame(numRunStartStopDelay, layoutHints); - numRunStartStopDelay->SetWidth(60); - numRunStartStopDelay->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x0FF); - } + TGHorizontalFrame * hRow3 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow3, new TGLayoutHints(kLHintsExpandX)); {///========= ACD Status - TGGroupFrame * gAcqStatus = new TGGroupFrame(vframe, "ACQ Status", kHorizontalFrame); vframe->AddFrame(gAcqStatus , new TGLayoutHints(kLHintsExpandX)); - TGHorizontalFrame * hfAcqStatus = new TGHorizontalFrame(gAcqStatus); gAcqStatus->AddFrame(hfAcqStatus, new TGLayoutHints(kLHintsExpandY , 5, 5, 3, 0)); + TGGroupFrame * gAcqStatus = new TGGroupFrame(hRow3, "ACQ Status", kHorizontalFrame); hRow3->AddFrame(gAcqStatus, new TGLayoutHints(kLHintsExpandX)); + TGHorizontalFrame * hfAcqStatus = new TGHorizontalFrame(gAcqStatus); gAcqStatus->AddFrame(hfAcqStatus, new TGLayoutHints(kLHintsExpandX)); TGVerticalFrame * vAcqStatus1 = new TGVerticalFrame(hfAcqStatus); hfAcqStatus->AddFrame(vAcqStatus1); @@ -281,28 +136,26 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d txtACQEventFull = new TGTextEntry(vAcqStatus1, new TGTextBuffer(1)); vAcqStatus1->AddFrame(txtACQEventFull, new TGLayoutHints(kLHintsRight, 5,5,0,0)); txtACQEventFull->SetEnabled(false); txtACQEventFull->SetText( "no channel FULL" ); - - TGVerticalFrame * vAcqStatus2 = new TGVerticalFrame(hfAcqStatus); hfAcqStatus->AddFrame(vAcqStatus2); - txtACQClockSource = new TGTextEntry(vAcqStatus2, new TGTextBuffer(1)); vAcqStatus2->AddFrame(txtACQClockSource, new TGLayoutHints(kLHintsRight, 5,5,0,0)); + txtACQClockSource = new TGTextEntry(vAcqStatus1, new TGTextBuffer(1)); vAcqStatus1->AddFrame(txtACQClockSource, new TGLayoutHints(kLHintsRight, 5,5,0,0)); txtACQClockSource->SetEnabled(false); txtACQClockSource->SetText( "Internal Clock" ); + TGVerticalFrame * vAcqStatus2 = new TGVerticalFrame(hfAcqStatus); hfAcqStatus->AddFrame(vAcqStatus2); + txtACQPLLLock = new TGTextEntry(vAcqStatus2, new TGTextBuffer(1)); vAcqStatus2->AddFrame(txtACQPLLLock, new TGLayoutHints(kLHintsRight, 5,5,0,0)); txtACQPLLLock->SetEnabled(false); txtACQPLLLock->SetText( "PLL unlock" ); - + txtACQChDown = new TGTextEntry(vAcqStatus2, new TGTextBuffer(1)); vAcqStatus2->AddFrame(txtACQChDown, new TGLayoutHints(kLHintsRight, 5,5,0,0)); txtACQChDown->SetEnabled(false); txtACQChDown->SetText( "Channels are ON" ); - - TGVerticalFrame * vAcqStatus3 = new TGVerticalFrame(hfAcqStatus); hfAcqStatus->AddFrame(vAcqStatus3); - txtACQSIN = new TGTextEntry(vAcqStatus3, new TGTextBuffer(1)); vAcqStatus3->AddFrame(txtACQSIN, new TGLayoutHints(kLHintsRight, 5,5,0,0)); + txtACQSIN = new TGTextEntry(vAcqStatus2, new TGTextBuffer(1)); vAcqStatus2->AddFrame(txtACQSIN, new TGLayoutHints(kLHintsRight, 5,5,0,0)); txtACQSIN->SetEnabled(false); txtACQSIN->SetText( "S-IN = 0" ); - txtACQTRIGIN = new TGTextEntry(vAcqStatus3, new TGTextBuffer(1)); vAcqStatus3->AddFrame(txtACQTRIGIN, new TGLayoutHints(kLHintsRight, 5,5,0,0)); + txtACQTRIGIN = new TGTextEntry(vAcqStatus2, new TGTextBuffer(1)); vAcqStatus2->AddFrame(txtACQTRIGIN, new TGLayoutHints(kLHintsRight, 5,5,0,0)); txtACQTRIGIN->SetEnabled(false); txtACQTRIGIN->SetText( "TRG-IN = 0" ); @@ -355,250 +208,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d } - {///========= Trigger Configure - TGGroupFrame * gTRGCfg = new TGGroupFrame(vframe, "Trigger Configure", kHorizontalFrame); vframe->AddFrame(gTRGCfg, new TGLayoutHints(kLHintsExpandX)); - TGVerticalFrame * vTRGCfg = new TGVerticalFrame(gTRGCfg); gTRGCfg->AddFrame(vTRGCfg, new TGLayoutHints(kLHintsExpandX)); - - ///--- various type of triggers - TGHorizontalFrame * hframeTRGCfg = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeTRGCfg, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); - TGVerticalFrame * vTRGType = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGType, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - - TGLabel * lbdummy0 = new TGLabel(vTRGType, ""); - vTRGType->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); - vTRGType->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); - - TGVerticalFrame * vTRGMsk[8]; - TGLabel * lbTRGMskCh0[8]; - TGLabel * lbTRGMskCh1[8]; - for( int i = 0; i < 8; i++){ - vTRGMsk[i] = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - lbTRGMskCh0[i] = new TGLabel(vTRGMsk[i], Form("%d", 2*i)); vTRGMsk[i]->AddFrame(lbTRGMskCh0[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - lbTRGMskCh1[i] = new TGLabel(vTRGMsk[i], Form("%d", 2*i+1)); vTRGMsk[i]->AddFrame(lbTRGMskCh1[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - } - - ///"Global Trigger Mask", - TGLabel * lbGbTRGMsk = new TGLabel(vTRGType, "Global Trigger Mask"); vTRGType->AddFrame(lbGbTRGMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - for( int i = 0; i < 8; i++){ - cbGbTRGMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbGbTRGMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - } - - ///"Trigger Validation Mask", - TGLabel * lbTRGValMsk = new TGLabel(vTRGType, "Trigger Validation Mask"); vTRGType->AddFrame(lbTRGValMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - for( int i = 0; i < 8; i++){ - cbTRGValMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbTRGValMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - } - - ///"Front Panel TRG-OUT Enable Mask", - TGLabel * lbTRGOUTMsk = new TGLabel(vTRGType, "TRG-OUT Mask"); vTRGType->AddFrame(lbTRGOUTMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - for( int i = 0; i < 8; i++){ - cbTRGOUTMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbTRGOUTMskCh[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - } - - TGVerticalFrame * vTRGMsk1 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk1, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - vTRGMsk1->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); - vTRGMsk1->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); - TGLabel * lbMajorCoinWin = new TGLabel(vTRGMsk1, "Maj. Coin. Win."); vTRGMsk1->AddFrame(lbMajorCoinWin, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - TGLabel * lbTRGMODE = new TGLabel(vTRGMsk1, "TRG MODE"); vTRGMsk1->AddFrame(lbTRGMODE, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - TGLabel * lbTRGOUTMODE = new TGLabel(vTRGMsk1, "TRG-OUT MODE"); vTRGMsk1->AddFrame(lbTRGOUTMODE, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); - - TGVerticalFrame * vTRGMsk2 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk2, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - vTRGMsk2->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); - vTRGMsk2->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); - - numMajorCoinWin = new TGNumberEntry(vTRGMsk2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk2->AddFrame(numMajorCoinWin); - numMajorCoinWin->Resize(70, 20); - - cbTRGMODE = new TGComboBox(vTRGMsk2, "TRG MODE",1); vTRGMsk2->AddFrame(cbTRGMODE); - cbTRGMODE->EnableTextInput(false); - cbTRGMODE->AddEntry("OR", 0); - cbTRGMODE->AddEntry("AND", 1); - cbTRGMODE->AddEntry("Majority", 2); - cbTRGMODE->Resize(70, 20); - cbTRGMODE->Select(0); - cbTRGOUTMODE = new TGComboBox(vTRGMsk2, "TRG MODE",1); vTRGMsk2->AddFrame(cbTRGOUTMODE); - cbTRGOUTMODE->EnableTextInput(false); - cbTRGOUTMODE->AddEntry("OR", 0); - cbTRGOUTMODE->AddEntry("AND", 1); - cbTRGOUTMODE->AddEntry("Majority", 2); - cbTRGOUTMODE->Resize(70, 20); - cbTRGOUTMODE->Select(0); - - TGVerticalFrame * vTRGMsk3 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk3, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - vTRGMsk3->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); - TGLabel * lbMajorLevel = new TGLabel(vTRGMsk3, "Majority Level"); vTRGMsk3->AddFrame(lbMajorLevel, layoutHints); - GlbMajorLevel = new TGNumberEntry(vTRGMsk3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk3->AddFrame(GlbMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); - GlbMajorLevel->Resize(70, 17); - TRGMajorLevel = new TGNumberEntry(vTRGMsk3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk3->AddFrame(TRGMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); - TRGMajorLevel->Resize(70, 17); - TRGOUTMajorLevel = new TGNumberEntry(vTRGMsk3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk3->AddFrame(TRGOUTMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); - TRGOUTMajorLevel->Resize(70, 17); - - //TGVerticalFrame * vTRGMsk4 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk4, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - //TGLabel * lbLVDSTrigger = new TGLabel(vTRGMsk4, "LVDS"); vTRGMsk4->AddFrame(lbLVDSTrigger, layoutHints); - //TGLabel * lbdummy1 = new TGLabel(vTRGMsk4, "Trg."); vTRGMsk4->AddFrame(lbdummy1, layoutHints); - //bGLBLVDSTrigger = new TGCheckButton(vTRGMsk4, "", 1); vTRGMsk4->AddFrame(bGLBLVDSTrigger, layoutHints); - //bGLBLVDSTrigger->SetState(kButtonUp); - //vTRGMsk4->AddFrame(lbdummy0, layoutHints); - //bTRGOUTLVDSTrigger = new TGCheckButton(vTRGMsk4, "", 1); vTRGMsk4->AddFrame(bTRGOUTLVDSTrigger, layoutHints); - //bTRGOUTLVDSTrigger->SetState(kButtonUp); - - TGVerticalFrame * vTRGMsk5 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk5, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - TGLabel * lbExtTrigger = new TGLabel(vTRGMsk5, "Ext."); vTRGMsk5->AddFrame(lbExtTrigger, layoutHints); - TGLabel * lbdummy2 = new TGLabel(vTRGMsk5, "Trg."); vTRGMsk5->AddFrame(lbdummy2, layoutHints); - - bGLBExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bGLBExtTrigger, layoutHints); - bGLBExtTrigger->SetState(kButtonUp); - bTRGExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGExtTrigger, layoutHints); - bTRGExtTrigger->SetState(kButtonUp); - bTRGOUTExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGOUTExtTrigger, layoutHints); - bTRGOUTExtTrigger->SetState(kButtonUp); - - TGVerticalFrame * vTRGMsk6 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk6, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); - TGLabel * lbSWTrigger = new TGLabel(vTRGMsk6, "Software"); vTRGMsk6->AddFrame(lbSWTrigger, layoutHints); - TGLabel * lbdummy3 = new TGLabel(vTRGMsk6, "Trg."); vTRGMsk6->AddFrame(lbdummy3, layoutHints); - - bGLBSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bGLBSoftwareTrigger, layoutHints); - bGLBSoftwareTrigger->SetState(kButtonDown); - bTRGSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGSoftwareTrigger, layoutHints); - bTRGSoftwareTrigger->SetState(kButtonDown); - bTRGOUTSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGOUTSoftwareTrigger, layoutHints); - bTRGOUTSoftwareTrigger->SetState(kButtonDown); - - TGHorizontalFrame * hframeTRGCfg2 = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeTRGCfg2, new TGLayoutHints(kLHintsCenterY | kLHintsRight, 2,2,2,2)); - //bTRGValMskLVSDGLB = new TGCheckButton(hframeTRGCfg2, "LVSD Global Trg. Valid", 1); hframeTRGCfg2->AddFrame(bTRGValMskLVSDGLB, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - //bTRGValMskLVSDLCL = new TGCheckButton(hframeTRGCfg2, "LVSD Local Trg. Valid", 1); hframeTRGCfg2->AddFrame(bTRGValMskLVSDLCL, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - - ///"Disable External Trigger", - bEnableExtTRG = new TGCheckButton(hframeTRGCfg2, "Enable Ext. Trigger", 1); hframeTRGCfg2->AddFrame(bEnableExtTRG, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - - ///"Extended Veto Delay", - TGLabel * lbExtendVetoDelay = new TGLabel(hframeTRGCfg2, "Extended Veto Delay"); hframeTRGCfg2->AddFrame(lbExtendVetoDelay, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - numExtendVetoDelay = new TGNumberEntry(hframeTRGCfg2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeTRGCfg2->AddFrame(numExtendVetoDelay, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - numExtendVetoDelay->Resize(70, 17); - } - - {///=================="Front Panel IO Control", - TGGroupFrame * gFrontIOCtrl = new TGGroupFrame(vframe, "Front Panel IO Control", kHorizontalFrame); vframe->AddFrame(gFrontIOCtrl, new TGLayoutHints(kLHintsExpandX)); - TGVerticalFrame * vFrontIOCtrl = new TGVerticalFrame(gFrontIOCtrl); gFrontIOCtrl->AddFrame(vFrontIOCtrl, new TGLayoutHints(kLHintsLeft, 5, 5, 3, 4)); - TGHorizontalFrame * hframeFrontIOCtrl = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); - - TGLabel * lbLEMOIO = new TGLabel(hframeFrontIOCtrl, "LEMO I/O"); hframeFrontIOCtrl->AddFrame(lbLEMOIO, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbLEMOIO = new TGComboBox(hframeFrontIOCtrl, "",1); hframeFrontIOCtrl->AddFrame(cbLEMOIO, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbLEMOIO->EnableTextInput(false); - cbLEMOIO->AddEntry("NIM", 0); - cbLEMOIO->AddEntry("TTL", 1); - cbLEMOIO->Select(0); - cbLEMOIO->Resize(50, 20); - - ///use 0x811C, bit:[14:19], 6bits - TGLabel * lbTRGOUTMODE2 = new TGLabel(hframeFrontIOCtrl, "TRG-OUT Mode"); hframeFrontIOCtrl->AddFrame(lbTRGOUTMODE2, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 4)); - cbTRGOUTmode = new TGComboBox(hframeFrontIOCtrl, "",1); hframeFrontIOCtrl->AddFrame(cbTRGOUTmode, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbTRGOUTmode->EnableTextInput(false); - cbTRGOUTmode->AddEntry("force TRG-OUT is 0", 0x08000); - cbTRGOUTmode->AddEntry("force TRG-OUT is 1", 0x0C000); - cbTRGOUTmode->AddEntry("Trigger", 0x00000); - cbTRGOUTmode->AddEntry("Channel Probe", 0x20000); - cbTRGOUTmode->AddEntry("S-IN", 0x30000); - cbTRGOUTmode->AddEntry("RUN", 0x10000); - cbTRGOUTmode->AddEntry("Sync Clock", 0x50000); - cbTRGOUTmode->AddEntry("Clock Phase", 0x90000); - cbTRGOUTmode->AddEntry("BUSY/UNLOCK", 0xD0000); - cbTRGOUTmode->Select(0); - cbTRGOUTmode->Resize(160, 20); - - bTRGOUTImp = new TGCheckButton(hframeFrontIOCtrl, "TRG-OUT high impe.(off)", 1); hframeFrontIOCtrl->AddFrame(bTRGOUTImp, layoutHints); - bTRGOUTImp->SetState(kButtonUp); - - TGHorizontalFrame * hframeFrontIOCtrl1 = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl1, new TGLayoutHints(kLHintsCenterY , 5,5,3,4)); - TGLabel * lbTRGINCtrl = new TGLabel(hframeFrontIOCtrl1, "TRG-IN control"); hframeFrontIOCtrl1->AddFrame(lbTRGINCtrl, new TGLayoutHints(kLHintsCenterY | kLHintsLeft , 5, 5, 3, 4)); - cbTRGINCtrl = new TGComboBox(hframeFrontIOCtrl1, "",1); hframeFrontIOCtrl1->AddFrame(cbTRGINCtrl, new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 5, 5, 3, 4)); - cbTRGINCtrl->EnableTextInput(false); - cbTRGINCtrl->AddEntry("trigger sync with the edge of the TRIG-IN", 0); - cbTRGINCtrl->AddEntry("trigger sync with the whole TRIG-IN", 1); - cbTRGINCtrl->Select(0); - cbTRGINCtrl->Resize(250, 20); - - TGLabel * lbTRGINMezzanines = new TGLabel(hframeFrontIOCtrl1, "TRG-IN to Mezzanines"); hframeFrontIOCtrl1->AddFrame(lbTRGINMezzanines, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 4)); - cbTRGINMezzanines = new TGComboBox(hframeFrontIOCtrl1, "",1); hframeFrontIOCtrl1->AddFrame(cbTRGINMezzanines, new TGLayoutHints(kLHintsCenterY | kLHintsCenterX, 5, 5, 3, 4)); - cbTRGINMezzanines->EnableTextInput(false); - cbTRGINMezzanines->AddEntry("Trigger local is sync with TRG-IN", 0); - cbTRGINMezzanines->AddEntry("TRG-IN send to mezzanines (no delay)", 1); - cbTRGINMezzanines->Select(0); - cbTRGINMezzanines->Resize(200, 20); - - ///"Front Panel LVDS IO New Features", - ///"LVDS IO Data", - - ///"Analog Monitor Mode - TGHorizontalFrame * hframeFrontIOCtrl2 = new TGHorizontalFrame(vFrontIOCtrl); vFrontIOCtrl->AddFrame(hframeFrontIOCtrl2, new TGLayoutHints(kLHintsCenterY, 5,5,3,2)); - TGLabel * lbAnaMonitor = new TGLabel(hframeFrontIOCtrl2, "Analog Monitor Mode (MON/Sigma)"); hframeFrontIOCtrl2->AddFrame(lbAnaMonitor, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 2)); - cbAnaMonitor = new TGComboBox(hframeFrontIOCtrl2, "",1); hframeFrontIOCtrl2->AddFrame(cbAnaMonitor, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 2)); - cbAnaMonitor->EnableTextInput(false); - cbAnaMonitor->AddEntry("Trigger Majority", 0); - cbAnaMonitor->AddEntry("Test", 1); - cbAnaMonitor->AddEntry("Buffer Occupancy", 3); - cbAnaMonitor->AddEntry("Voltage Level", 4); - cbAnaMonitor->Select(0); - cbAnaMonitor->Resize(150, 20); - cbAnaMonitor->Connect("Changed()", "BoardSetting", this, "SetAnalogMonitorMode()"); - cbAnaMonitor->Connect("Changed()", "ChannelSetting", this, "ChangePolarity()"); //Example to call other class - - ///"Buffer Occupancy Gain - TGLabel * lbBufferOccpGain = new TGLabel(hframeFrontIOCtrl2, "Buffer Occupancy Gain"); hframeFrontIOCtrl2->AddFrame(lbBufferOccpGain, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 2)); - numBufferOccpGain = new TGNumberEntry(hframeFrontIOCtrl2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeFrontIOCtrl2->AddFrame(numBufferOccpGain, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 2)); - numBufferOccpGain->SetState(false); - numBufferOccpGain->Resize(70, 17); - } - - TGHorizontalFrame * hRow = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow, new TGLayoutHints(kLHintsExpandX)); - - //TODO check is VME model - {///"Readout Control", - TGGroupFrame * gReadoutCtrl = new TGGroupFrame(hRow, "ReadOut Control", kHorizontalFrame); hRow->AddFrame(gReadoutCtrl); - TGVerticalFrame * vReadoutCtrl = new TGVerticalFrame(gReadoutCtrl); gReadoutCtrl->AddFrame(vReadoutCtrl); - - TGHorizontalFrame * hReadoutCtrl = new TGHorizontalFrame(vReadoutCtrl); vReadoutCtrl->AddFrame(hReadoutCtrl, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); - - TGLabel * lbVMEInterruptLevel = new TGLabel(hReadoutCtrl, "VME Interrupt Level"); hReadoutCtrl->AddFrame(lbVMEInterruptLevel, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 5, 5, 3, 4)); - - cbVMEInterrupLevel = new TGComboBox(hReadoutCtrl, "", 1); hReadoutCtrl->AddFrame(cbVMEInterrupLevel, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); - cbVMEInterrupLevel->EnableTextInput(false); - cbVMEInterrupLevel->AddEntry("Disabled", 0); - cbVMEInterrupLevel->AddEntry("1", 1); - cbVMEInterrupLevel->AddEntry("2", 2); - cbVMEInterrupLevel->AddEntry("3", 3); - cbVMEInterrupLevel->AddEntry("4", 4); - cbVMEInterrupLevel->AddEntry("5", 5); - cbVMEInterrupLevel->AddEntry("6", 6); - cbVMEInterrupLevel->AddEntry("7", 7); - cbVMEInterrupLevel->Select(0); - cbVMEInterrupLevel->Resize(70, 20); - - bOpticalLinkInterrupt = new TGCheckButton(hReadoutCtrl, "Optical Link Interrupt", 1); hReadoutCtrl->AddFrame(bOpticalLinkInterrupt, layoutHints); - bOpticalLinkInterrupt->SetState(kButtonUp); - - bEventAligned = new TGCheckButton(hReadoutCtrl, "Event Aligned Enabled", 1); hReadoutCtrl->AddFrame(bEventAligned, layoutHints); - bEventAligned->SetState(kButtonUp); - - bVMEAlogn64Mode = new TGCheckButton(hReadoutCtrl, "64-bit aligned", 1); hReadoutCtrl->AddFrame(bVMEAlogn64Mode, layoutHints); - bVMEAlogn64Mode->SetState(kButtonUp); - - TGHorizontalFrame * hReadoutCtrl2 = new TGHorizontalFrame(vReadoutCtrl); vReadoutCtrl->AddFrame(hReadoutCtrl2, new TGLayoutHints(kLHintsCenterY, 5,5,3,4)); - - //TGCheckButton * bVMEBaseAddRelocation= new TGCheckButton(hReadoutCtrl, "VME baase addr. relocation", 1); hReadoutCtrl->AddFrame(bVMEBaseAddRelocation, layoutHints); - //bVMEBaseAddRelocation->SetState(kButtonUp); - //Need Relocation address - - bInteruptReleaseMode = new TGCheckButton(hReadoutCtrl2, "Interrupt Release on Acknowldge", 1); hReadoutCtrl2->AddFrame(bInteruptReleaseMode, layoutHints); - bInteruptReleaseMode->SetState(kButtonUp); - - bEnableExtendedBlockTransfer = new TGCheckButton(hReadoutCtrl2, "Enable Extended Block Transfer", 1); hReadoutCtrl2->AddFrame(bEnableExtendedBlockTransfer, layoutHints); - bEnableExtendedBlockTransfer->SetState(kButtonUp); - } - {///==========="Readout Status" - TGGroupFrame * gReadoutStatus = new TGGroupFrame(hRow, "Readout Status", kHorizontalFrame); hRow->AddFrame(gReadoutStatus, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 0, 0) ); - TGVerticalFrame * vReadoutStatus = new TGVerticalFrame(gReadoutStatus); gReadoutStatus->AddFrame(vReadoutStatus, new TGLayoutHints(kLHintsExpandY , 5, 5, 3, 0)); + TGGroupFrame * gReadoutStatus = new TGGroupFrame(hRow3, "Readout Status", kHorizontalFrame); hRow3->AddFrame(gReadoutStatus, new TGLayoutHints( kLHintsExpandY, 5, 5, 0, 0) ); + + TGVerticalFrame * vReadoutStatus = new TGVerticalFrame(gReadoutStatus); gReadoutStatus->AddFrame(vReadoutStatus, new TGLayoutHints(kLHintsCenterY | kLHintsExpandY, 5, 5, 10, 0)); txtEventReady = new TGTextEntry(vReadoutStatus, new TGTextBuffer(1)); vReadoutStatus->AddFrame(txtEventReady, new TGLayoutHints(kLHintsRight, 5,5,0,0)); txtEventReady->SetEnabled(false); @@ -615,6 +228,487 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d txtVMEFIFO->SetText( "VME FIFO EMPTY" ); txtVMEFIFO->SetTextColor(blue); } + + TGHorizontalFrame * hRow1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow1, new TGLayoutHints( kLHintsExpandX)); + + {///========= Board Configure + TGGroupFrame * gBdCfg = new TGGroupFrame(hRow1, "Board Configure", kHorizontalFrame); hRow1->AddFrame(gBdCfg, new TGLayoutHints( kLHintsLeft, 5, 5, 0, 0)); + + TGVerticalFrame * vBdCfg0 = new TGVerticalFrame(gBdCfg); gBdCfg->AddFrame(vBdCfg0 ); + + TGHorizontalFrame * hBdCfg = new TGHorizontalFrame(vBdCfg0); vBdCfg0->AddFrame(hBdCfg, new TGLayoutHints( kLHintsLeft)); + + TGVerticalFrame * vBdCfg1 = new TGVerticalFrame(hBdCfg); hBdCfg->AddFrame(vBdCfg1, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0) ); + + TGLayoutHints * haha = new TGLayoutHints( kLHintsLeft, 5, 5, 3, 0); + + bAutoDataFlush = new TGCheckButton(vBdCfg1, "Auto Data Flush", 1); vBdCfg1->AddFrame(bAutoDataFlush, haha); + bAutoDataFlush->SetState(kButtonUp); + bAutoDataFlush->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); + + bDecimateWF = new TGCheckButton(vBdCfg1, "Decimate WaveForm", 1); vBdCfg1->AddFrame(bDecimateWF, haha); + bDecimateWF->SetState(kButtonUp); + bDecimateWF->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); + + bWFRecord = new TGCheckButton(vBdCfg1, "Record WaveFrom", 1); vBdCfg1->AddFrame(bWFRecord, haha); + bWFRecord->SetState(kButtonUp); + bWFRecord->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); + + bTrigPropa = new TGCheckButton(vBdCfg1, "Trigger Propagation (coincidence) ", 1); vBdCfg1->AddFrame(bTrigPropa, haha); + bTrigPropa->SetState(kButtonUp); + bTrigPropa->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); + + bExtrac2 = new TGCheckButton(vBdCfg1, "Enable Extra2 word", 1); vBdCfg1->AddFrame(bExtrac2, haha); + bExtrac2->SetState(kButtonUp); + bExtrac2->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); + + + TGVerticalFrame * vBdCfg2 = new TGVerticalFrame(hBdCfg); hBdCfg->AddFrame(vBdCfg2, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0)); + + bDualTrace = new TGCheckButton(vBdCfg2, "Dual Trace", 1); vBdCfg2->AddFrame(bDualTrace); + bDualTrace->SetState(kButtonUp); + bDualTrace->Connect("Clicked()", "BoardSetting", this, "SetBoardConfiguration()"); + + + TGHorizontalFrame * hBdCfg_Probe = new TGHorizontalFrame(vBdCfg2); vBdCfg2->AddFrame(hBdCfg_Probe); + + TGVerticalFrame * vBdCfg_Probe_Label = new TGVerticalFrame(hBdCfg_Probe); hBdCfg_Probe->AddFrame(vBdCfg_Probe_Label); + + TGVerticalFrame * vBdCfg_Probe_CBox = new TGVerticalFrame(hBdCfg_Probe); hBdCfg_Probe->AddFrame(vBdCfg_Probe_CBox); + + TGLayoutHints * kaka = new TGLayoutHints( kLHintsRight, 5, 5, 3, 2); + + TGLabel * lbAP1 = new TGLabel(vBdCfg_Probe_Label, "Ana. Prb. 1"); vBdCfg_Probe_Label->AddFrame(lbAP1, kaka); + cbAP1 = new TGComboBox(vBdCfg_Probe_CBox, "Ana. Pb. 1", 1); vBdCfg_Probe_CBox->AddFrame(cbAP1); + cbAP1->EnableTextInput(false); + cbAP1->AddEntry("Input", 0); + cbAP1->AddEntry("RC-CR (1st derivative)", 1); + cbAP1->AddEntry("RC-CR2 (2st derivative)", 2); + cbAP1->AddEntry("Trapezoid", 3); + cbAP1->Resize(150, 20); + cbAP1->Select(0); + cbAP1->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()"); + + + TGLabel * lbAP2 = new TGLabel(vBdCfg_Probe_Label, "Ana. Prb. 2"); vBdCfg_Probe_Label->AddFrame(lbAP2, kaka); + cbAP2 = new TGComboBox(vBdCfg_Probe_CBox, "Ana. Pb. 2", 1); vBdCfg_Probe_CBox->AddFrame(cbAP2); + cbAP2->EnableTextInput(false); + cbAP2->AddEntry("Input", 0); + cbAP2->AddEntry("Threshold", 1); + cbAP2->AddEntry("Trapezoid - Baseline", 2); + cbAP2->AddEntry("Baseline", 3); + cbAP2->Resize(150, 20); + cbAP2->Select(0); + cbAP2->SetEnabled(false); + cbAP2->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()"); + + TGLabel * lbDP1 = new TGLabel(vBdCfg_Probe_Label, "Digi. Prb. 1"); vBdCfg_Probe_Label->AddFrame(lbDP1, kaka); + cbDP1 = new TGComboBox(vBdCfg_Probe_CBox, "Digital. Pb.", 1); vBdCfg_Probe_CBox->AddFrame(cbDP1); + cbDP1->EnableTextInput(false); + cbDP1->AddEntry("Peaking", 0); + cbDP1->AddEntry("Armed (Triggered)", 1); + cbDP1->AddEntry("Peak Run", 2); + cbDP1->AddEntry("Pile-Up", 3); + cbDP1->AddEntry("Peaking", 4); + cbDP1->AddEntry("TRG Validation Win.", 5); + cbDP1->AddEntry("Baseline freeze", 6); + cbDP1->AddEntry("TRG holdoff", 7); + cbDP1->AddEntry("TRG Validation", 8); + cbDP1->AddEntry("ACQ busy", 9); + cbDP1->AddEntry("Zero Cross", 10); + cbDP1->AddEntry("Ext. TRG", 11); + cbDP1->AddEntry("Memory full", 12); + cbDP1->Resize(150, 20); + cbDP1->Select(0); + cbDP1->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()"); + + TGLabel * lbDP2 = new TGLabel(vBdCfg_Probe_Label, "Digi. Prb. 2"); vBdCfg_Probe_Label->AddFrame(lbDP2, kaka); + cbDP2 = new TGComboBox(vBdCfg_Probe_CBox, "Digital. Pb.", 1); vBdCfg_Probe_CBox->AddFrame(cbDP2); + cbDP2->EnableTextInput(false); + cbDP2->AddEntry("Peaking", 0); + cbDP2->AddEntry("Armed (Triggered)", 1); + cbDP2->AddEntry("Peak Run", 2); + cbDP2->AddEntry("Pile-Up", 3); + cbDP2->AddEntry("Peaking", 4); + cbDP2->AddEntry("TRG Validation Win.", 5); + cbDP2->AddEntry("Baseline freeze", 6); + cbDP2->AddEntry("TRG holdoff", 7); + cbDP2->AddEntry("TRG Validation", 8); + cbDP2->AddEntry("ACQ busy", 9); + cbDP2->AddEntry("Zero Cross", 10); + cbDP2->AddEntry("Ext. TRG", 11); + cbDP2->AddEntry("Memory full", 12); + cbDP2->Resize(150, 20); + cbDP2->Select(0); + cbDP2->SetEnabled(false); + cbDP2->Connect("Changed()", "BoardSetting", this, "SetBoardConfiguration()"); + + + TGHorizontalFrame * hframeBdCfg3 = new TGHorizontalFrame(vBdCfg0); vBdCfg0->AddFrame(hframeBdCfg3, new TGLayoutHints( kLHintsCenterX, 5, 5, 5, 5)); + + TGVerticalFrame * vBdCfga_label = new TGVerticalFrame(hframeBdCfg3); hframeBdCfg3->AddFrame(vBdCfga_label, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0) ); + TGVerticalFrame * vBdCfga_CBox = new TGVerticalFrame(hframeBdCfg3); hframeBdCfg3->AddFrame(vBdCfga_CBox, new TGLayoutHints( kLHintsLeft, 5, 5, 10, 0) ); + + + TGLabel * lbAggOrg = new TGLabel(vBdCfga_label, "Aggregate Organization"); vBdCfga_label->AddFrame(lbAggOrg, kaka); + cbAggOrg = new TGComboBox(vBdCfga_CBox, "Aggregate Organization", 1); vBdCfga_CBox->AddFrame(cbAggOrg); + cbAggOrg->EnableTextInput(false); + cbAggOrg->AddEntry("Not used", 0); + cbAggOrg->AddEntry("4", 2); + cbAggOrg->AddEntry("8", 3); + cbAggOrg->AddEntry("16", 4); + cbAggOrg->AddEntry("32", 5); + cbAggOrg->AddEntry("64", 6); + cbAggOrg->AddEntry("128", 7); + cbAggOrg->AddEntry("256", 8); + cbAggOrg->AddEntry("512", 9); + cbAggOrg->AddEntry("1024", 10); + cbAggOrg->Resize(100, 20); + cbAggOrg->Select(0); + cbAggOrg->Connect("Changed()", "BoardSetting", this, "SetAggregateOrganization()"); + + TGLabel * lbAggBLT = new TGLabel(vBdCfga_label, "MAx. Aggregate pre Readout"); vBdCfga_label->AddFrame(lbAggBLT, kaka); + numAggBLT = new TGNumberEntry(vBdCfga_CBox, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vBdCfga_CBox->AddFrame(numAggBLT); + numAggBLT->SetWidth(100); + numAggBLT->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x3FF); + numAggBLT->Connect("Modified()", "BoardSetting", this, "SetReadOutAggregate()"); + + ///"FanSpeed Control", + TGLabel * lbFanCtrl = new TGLabel(vBdCfga_label, "Fan Speed Control", kHorizontalFrame); vBdCfga_label->AddFrame(lbFanCtrl, kaka); + cbFanCtrl = new TGComboBox(vBdCfga_CBox, "",1); vBdCfga_CBox->AddFrame(cbFanCtrl); + cbFanCtrl->EnableTextInput(false); + cbFanCtrl->AddEntry("Slow/Auto",0x30); + cbFanCtrl->AddEntry("Fast", 0x38); + cbFanCtrl->Select(0x30); + cbFanCtrl->Resize(100, 20); + cbFanCtrl->Connect("Changed()", "BoardSetting", this, "SetFanSpeedControl()"); + + } + + {///========== ACQ control + TGGroupFrame * gAcqCtrl = new TGGroupFrame(hRow1, "ACQ Control", kHorizontalFrame); hRow1->AddFrame(gAcqCtrl , new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); + + TGVerticalFrame * vAcqCtrl1 = new TGVerticalFrame(gAcqCtrl); gAcqCtrl->AddFrame(vAcqCtrl1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 5, 5, 10, 10)); + + TGHorizontalFrame * hAcqCtrl_a = new TGHorizontalFrame(vAcqCtrl1); vAcqCtrl1->AddFrame(hAcqCtrl_a); + + TGVerticalFrame * vAcqCtrl_label = new TGVerticalFrame(hAcqCtrl_a); hAcqCtrl_a->AddFrame(vAcqCtrl_label ); + TGVerticalFrame * vAcqCtrl_CBox = new TGVerticalFrame(hAcqCtrl_a); hAcqCtrl_a->AddFrame(vAcqCtrl_CBox); + + TGLayoutHints * haha = new TGLayoutHints( kLHintsRight, 5, 5, 6, 5); + TGLayoutHints * kaka = new TGLayoutHints( kLHintsLeft, 5, 5, 3, 2); + + TGLabel * lbAcqMode = new TGLabel(vAcqCtrl_label, "ACQ Mode"); vAcqCtrl_label->AddFrame(lbAcqMode, haha); + cbAcqMode = new TGComboBox(vAcqCtrl_CBox, "ACQ Mode", 1); vAcqCtrl_CBox->AddFrame(cbAcqMode, kaka); + cbAcqMode->EnableTextInput(false); + cbAcqMode->AddEntry("Software", 0); + cbAcqMode->AddEntry("S-IN / GPI", 1); + cbAcqMode->AddEntry("1st Trig. Ctrl.", 2); + cbAcqMode->AddEntry("LVSD Ctrl.", 3); + cbAcqMode->Select(0); + cbAcqMode->Resize(100, 20); + cbAcqMode->Connect("Changed()", "BoardSetting", this, "SetACQControl()"); + + TGLabel * lbPLLref = new TGLabel(vAcqCtrl_label, "PLL Ref."); vAcqCtrl_label->AddFrame(lbPLLref, haha); + cbPLLref = new TGComboBox(vAcqCtrl_CBox, "PLL Ref.", 1); vAcqCtrl_CBox->AddFrame(cbPLLref, kaka); + cbPLLref->EnableTextInput(false); + cbPLLref->AddEntry("internal", 0); + cbPLLref->AddEntry("external", 1); + cbPLLref->Select(0); + cbPLLref->Resize(100, 20); + cbPLLref->Connect("Changed()", "BoardSetting", this, "SetACQControl()"); + + TGLabel * lbRunStartStopDelay = new TGLabel(vAcqCtrl_label, "Run/Start/Stop Delay [ns]"); vAcqCtrl_label->AddFrame(lbRunStartStopDelay, haha); + numRunStartStopDelay = new TGNumberEntry(vAcqCtrl_CBox, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vAcqCtrl_CBox->AddFrame(numRunStartStopDelay, kaka); + numRunStartStopDelay->SetWidth(100); + numRunStartStopDelay->SetLimits(TGNumberFormat::kNELLimitMinMax, 0, 0x0FF); + numRunStartStopDelay->Connect("Modified()", "BoardSetting", this, "SetRunStartStopDelay()"); + + + bAcqArm = new TGCheckButton(vAcqCtrl_CBox, "ACQ Start/Arm", 1); vAcqCtrl_CBox->AddFrame(bAcqArm, kaka); + bAcqArm->SetState(kButtonUp); + bAcqArm->Connect("Clicked()", "BoardSetting", this, "SetACQControl()"); + + + TGHorizontalFrame * hAcqCtrl_b = new TGHorizontalFrame(vAcqCtrl1); vAcqCtrl1->AddFrame(hAcqCtrl_b, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 10, 0)); + bSWTrigger = new TGTextButton(hAcqCtrl_b, "Send Software Trigger Signal"); hAcqCtrl_b->AddFrame(bSWTrigger, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); + bSWTrigger->Connect("Clicked()", "BoardSetting", this, "SendSoftwareTriggerSignal()"); + bSWTrigger->SetWidth(250); + + TGHorizontalFrame * hAcqCtrl_c = new TGHorizontalFrame(vAcqCtrl1); vAcqCtrl1->AddFrame(hAcqCtrl_c, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 0, 0, 10, 0)); + bSWClockSync = new TGTextButton(hAcqCtrl_c, "Send Software Clock Sync Signal"); hAcqCtrl_c->AddFrame(bSWClockSync, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY)); + bSWClockSync->Connect("Clicked()", "BoardSetting", this, "SendSoftwareClockSyncSignal()"); + bSWClockSync->Resize(250, 20); + + + + } + + {///========= Trigger Configure + TGGroupFrame * gTRGCfg = new TGGroupFrame(vframe, "Trigger Configure", kHorizontalFrame); vframe->AddFrame(gTRGCfg, new TGLayoutHints(kLHintsExpandX)); + TGVerticalFrame * vTRGCfg = new TGVerticalFrame(gTRGCfg); gTRGCfg->AddFrame(vTRGCfg, new TGLayoutHints(kLHintsExpandX)); + + ///--- various type of triggers + TGHorizontalFrame * hframeTRGCfg = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeTRGCfg, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TGVerticalFrame * vTRGType = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGType, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + TGLabel * lbdummy0 = new TGLabel(vTRGType, ""); + vTRGType->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + vTRGType->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + + TGLayoutHints * haha = new TGLayoutHints(kLHintsCenterX , 2, 2, 3, 3); + + TGVerticalFrame * vTRGMsk[8]; + TGLabel * lbTRGMskCh0[8]; + TGLabel * lbTRGMskCh1[8]; + for( int i = 0; i < 8; i++){ + vTRGMsk[i] = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk[i], haha); + lbTRGMskCh0[i] = new TGLabel(vTRGMsk[i], Form("%d", 2*i)); vTRGMsk[i]->AddFrame(lbTRGMskCh0[i], haha); + lbTRGMskCh1[i] = new TGLabel(vTRGMsk[i], Form("%d", 2*i+1)); vTRGMsk[i]->AddFrame(lbTRGMskCh1[i], haha); + } + + ///"Global Trigger Mask", + TGLabel * lbGbTRGMsk = new TGLabel(vTRGType, "Global Trigger Mask"); vTRGType->AddFrame(lbGbTRGMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + for( int i = 0; i < 8; i++){ + cbGbTRGMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbGbTRGMskCh[i], haha); + cbGbTRGMskCh[i]->Connect("Clicked()", "BoardSetting", this, "SetGlobalTriggerMask()"); + } + + ///"Trigger Validation Mask", + TGLabel * lbTRGValMsk = new TGLabel(vTRGType, "Trigger Validation Mask"); vTRGType->AddFrame(lbTRGValMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + for( int i = 0; i < 8; i++){ + cbTRGValMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbTRGValMskCh[i], haha); + cbTRGValMskCh[i]->Connect("Clicked()", "BoardSetting", this, "SetTriggerValidMask()"); + } + + ///"Front Panel TRG-OUT Enable Mask", + TGLabel * lbTRGOUTMsk = new TGLabel(vTRGType, "TRG-OUT Mask"); vTRGType->AddFrame(lbTRGOUTMsk, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + for( int i = 0; i < 8; i++){ + cbTRGOUTMskCh[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbTRGOUTMskCh[i], haha); + cbTRGOUTMskCh[i]->Connect("Clicked()", "BoardSetting", this, "SetTRGOUTMask()"); + } + + TGVerticalFrame * vTRGMsk1 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk1, haha); + vTRGMsk1->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + vTRGMsk1->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbMajorCoinWin = new TGLabel(vTRGMsk1, "Maj. Coin. Win."); vTRGMsk1->AddFrame(lbMajorCoinWin, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbTRGMODE = new TGLabel(vTRGMsk1, "TRG Vali. MODE"); vTRGMsk1->AddFrame(lbTRGMODE, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbTRGOUTMODE = new TGLabel(vTRGMsk1, "TRG-OUT MODE"); vTRGMsk1->AddFrame(lbTRGOUTMODE, new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + + TGVerticalFrame * vTRGMsk2 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk2, haha); + vTRGMsk2->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + vTRGMsk2->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + + numMajorCoinWin = new TGNumberEntry(vTRGMsk2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk2->AddFrame(numMajorCoinWin); + numMajorCoinWin->Resize(70, 20); + numMajorCoinWin->Connect("Modified()", "BoardSetting", this, "SetGlobalTriggerMask()"); + + cbTRGMODE = new TGComboBox(vTRGMsk2, "TRG Val. MODE",1); vTRGMsk2->AddFrame(cbTRGMODE); + cbTRGMODE->EnableTextInput(false); + cbTRGMODE->AddEntry("OR", 0); + cbTRGMODE->AddEntry("AND", 1); + cbTRGMODE->AddEntry("Majority", 2); + cbTRGMODE->Resize(70, 20); + cbTRGMODE->Select(0); + cbTRGMODE->Connect("Changed()", "BoardSetting", this, "SetTriggerValidMask()"); + + cbTRGOUTMODE = new TGComboBox(vTRGMsk2, "TRG-OUT MODE",1); vTRGMsk2->AddFrame(cbTRGOUTMODE); + cbTRGOUTMODE->EnableTextInput(false); + cbTRGOUTMODE->AddEntry("OR", 0); + cbTRGOUTMODE->AddEntry("AND", 1); + cbTRGOUTMODE->AddEntry("Majority", 2); + cbTRGOUTMODE->Resize(70, 20); + cbTRGOUTMODE->Select(0); + cbTRGOUTMODE->Connect("Changed()", "BoardSetting", this, "SetTRGOUTMask()"); + + TGVerticalFrame * vTRGMsk3 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk3, haha); + vTRGMsk3->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 4)); + TGLabel * lbMajorLevel = new TGLabel(vTRGMsk3, "Majority Level"); vTRGMsk3->AddFrame(lbMajorLevel, layoutHints); + GlbMajorLevel = new TGNumberEntry(vTRGMsk3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk3->AddFrame(GlbMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + GlbMajorLevel->Resize(70, 17); + GlbMajorLevel->Connect("Modified()", "BoardSetting", this, "SetGlobalTriggerMask()"); + + TRGMajorLevel = new TGNumberEntry(vTRGMsk3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk3->AddFrame(TRGMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TRGMajorLevel->Resize(70, 17); + TRGMajorLevel->Connect("Modified()", "BoardSetting", this, "SetTriggerValidMask()"); + + TRGOUTMajorLevel = new TGNumberEntry(vTRGMsk3, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGMsk3->AddFrame(TRGOUTMajorLevel, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + TRGOUTMajorLevel->Resize(70, 17); + TRGOUTMajorLevel->Connect("Modified()", "BoardSetting", this, "SetTRGOUTMask()"); + + TGVerticalFrame * vTRGMsk5 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk5, haha); + TGLabel * lbExtTrigger = new TGLabel(vTRGMsk5, "Ext."); vTRGMsk5->AddFrame(lbExtTrigger, layoutHints); + TGLabel * lbdummy2 = new TGLabel(vTRGMsk5, "Trg."); vTRGMsk5->AddFrame(lbdummy2, layoutHints); + + bGLBExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bGLBExtTrigger, layoutHints); + bGLBExtTrigger->SetState(kButtonUp); + bGLBExtTrigger->Connect("Clicked()", "BoardSetting", this, "SetGlobalTriggerMask()"); + + bTRGExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGExtTrigger, layoutHints); + bTRGExtTrigger->SetState(kButtonUp); + bTRGExtTrigger->Connect("Clicked()", "BoardSetting", this, "SetTriggerValidMask()"); + + bTRGOUTExtTrigger = new TGCheckButton(vTRGMsk5, "", 1); vTRGMsk5->AddFrame(bTRGOUTExtTrigger, layoutHints); + bTRGOUTExtTrigger->SetState(kButtonUp); + bTRGOUTExtTrigger->Connect("Clicked()", "BoardSetting", this, "SetTRGOUTMask()"); + + TGVerticalFrame * vTRGMsk6 = new TGVerticalFrame(hframeTRGCfg); hframeTRGCfg->AddFrame(vTRGMsk6, haha); + TGLabel * lbSWTrigger = new TGLabel(vTRGMsk6, "SW"); vTRGMsk6->AddFrame(lbSWTrigger, layoutHints); + TGLabel * lbdummy3 = new TGLabel(vTRGMsk6, "Trg."); vTRGMsk6->AddFrame(lbdummy3, layoutHints); + + bGLBSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bGLBSoftwareTrigger, layoutHints); + bGLBSoftwareTrigger->SetState(kButtonDown); + bGLBSoftwareTrigger->Connect("Clicked()", "BoardSetting", this, "SetGlobalTriggerMask()"); + + bTRGSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGSoftwareTrigger, layoutHints); + bTRGSoftwareTrigger->SetState(kButtonDown); + bTRGSoftwareTrigger->Connect("Clicked()", "BoardSetting", this, "SetTriggerValidMask()"); + + bTRGOUTSoftwareTrigger = new TGCheckButton(vTRGMsk6, "", 1); vTRGMsk6->AddFrame(bTRGOUTSoftwareTrigger, layoutHints); + bTRGOUTSoftwareTrigger->SetState(kButtonDown); + bTRGOUTSoftwareTrigger->Connect("Clicked()", "BoardSetting", this, "SetTRGOUTMask()"); + + TGHorizontalFrame * hframeTRGCfg2 = new TGHorizontalFrame(vTRGCfg); vTRGCfg->AddFrame(hframeTRGCfg2, new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2,2,2,2)); + + ///"Disable External Trigger", + bEnableExtTRG = new TGCheckButton(hframeTRGCfg2, "Enable Ext. Trigger", 1); hframeTRGCfg2->AddFrame(bEnableExtTRG, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + bEnableExtTRG->Connect("Clicked()", "BoardSetting", this, "SetEnableExternalTrigger()"); + + ///"Extended Veto Delay", + TGLabel * lbExtendVetoDelay = new TGLabel(hframeTRGCfg2, "Extended Veto Delay"); hframeTRGCfg2->AddFrame(lbExtendVetoDelay, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + numExtendVetoDelay = new TGNumberEntry(hframeTRGCfg2, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); hframeTRGCfg2->AddFrame(numExtendVetoDelay, new TGLayoutHints(kLHintsCenterY , 5, 5, 3, 4)); + numExtendVetoDelay->Resize(70, 17); + numExtendVetoDelay->Connect("Modified()", "BoardSetting", this, "SetExtendedVetoDelay()"); + } + + TGHorizontalFrame * hRow2 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow2, new TGLayoutHints(kLHintsExpandX)); + + {///=================="Front Panel IO Control", + TGGroupFrame * gFrontIOCtrl = new TGGroupFrame(hRow2, "Front Panel IO Control", kHorizontalFrame); hRow2->AddFrame(gFrontIOCtrl, new TGLayoutHints( kLHintsExpandX, 5, 5, 0, 0) ); + + TGHorizontalFrame * hFrontIOCtrl = new TGHorizontalFrame(gFrontIOCtrl); gFrontIOCtrl->AddFrame(hFrontIOCtrl); + + TGVerticalFrame * vFrontIOCtrl_label = new TGVerticalFrame(hFrontIOCtrl); hFrontIOCtrl->AddFrame(vFrontIOCtrl_label); + TGVerticalFrame * vFrontIOCtrl_CBox = new TGVerticalFrame(hFrontIOCtrl); hFrontIOCtrl->AddFrame(vFrontIOCtrl_CBox); + + TGLayoutHints * haha = new TGLayoutHints( kLHintsRight, 5, 5, 3, 2); + + TGLabel * lbLEMOIO = new TGLabel(vFrontIOCtrl_label, "LEMO I/O"); vFrontIOCtrl_label->AddFrame(lbLEMOIO, haha); + cbLEMOIO = new TGComboBox(vFrontIOCtrl_CBox, "",1); vFrontIOCtrl_CBox->AddFrame(cbLEMOIO); + cbLEMOIO->EnableTextInput(false); + cbLEMOIO->AddEntry("NIM", 0); + cbLEMOIO->AddEntry("TTL", 1); + cbLEMOIO->Select(0); + cbLEMOIO->Resize(50, 20); + cbLEMOIO->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()"); + + ///use 0x811C, bit:[14:19], 6bits + TGLabel * lbTRGOUTMODE2 = new TGLabel(vFrontIOCtrl_label, "TRG-OUT Mode"); vFrontIOCtrl_label->AddFrame(lbTRGOUTMODE2, haha); + cbTRGOUTmode = new TGComboBox(vFrontIOCtrl_CBox, "",1); vFrontIOCtrl_CBox->AddFrame(cbTRGOUTmode); + cbTRGOUTmode->EnableTextInput(false); + cbTRGOUTmode->AddEntry("Disable", 0x00001); /// this is TRG_OUT high imped. 0x811C bit[1] + cbTRGOUTmode->AddEntry("force TRG-OUT is 0", 0x08000); + cbTRGOUTmode->AddEntry("force TRG-OUT is 1", 0x0C000); + cbTRGOUTmode->AddEntry("Trigger", 0x00000); + cbTRGOUTmode->AddEntry("Channel Probe", 0x20000); + cbTRGOUTmode->AddEntry("S-IN", 0x30000); + cbTRGOUTmode->AddEntry("RUN", 0x10000); + cbTRGOUTmode->AddEntry("Sync Clock", 0x50000); + cbTRGOUTmode->AddEntry("Clock Phase", 0x90000); + cbTRGOUTmode->AddEntry("BUSY/UNLOCK", 0xD0000); + cbTRGOUTmode->Select(1); + cbTRGOUTmode->Resize(160, 20); + cbTRGOUTmode->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()"); + + TGLabel * lbTRGINCtrl = new TGLabel(vFrontIOCtrl_label, "TRG-IN control"); vFrontIOCtrl_label->AddFrame(lbTRGINCtrl, haha); + cbTRGINCtrl = new TGComboBox(vFrontIOCtrl_CBox, "",1); vFrontIOCtrl_CBox->AddFrame(cbTRGINCtrl); + cbTRGINCtrl->EnableTextInput(false); + cbTRGINCtrl->AddEntry("Trigger sync with the edge of the TRIG-IN", 0); + cbTRGINCtrl->AddEntry("Trigger sync with the whole TRIG-IN", 1); + cbTRGINCtrl->Select(0); + cbTRGINCtrl->Resize(250, 20); + cbTRGINCtrl->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()"); + + TGLabel * lbTRGINMezzanines = new TGLabel(vFrontIOCtrl_label, "TRG-IN to Mezzanines"); vFrontIOCtrl_label->AddFrame(lbTRGINMezzanines, haha); + cbTRGINMezzanines = new TGComboBox(vFrontIOCtrl_CBox, "",1); vFrontIOCtrl_CBox->AddFrame(cbTRGINMezzanines); + cbTRGINMezzanines->EnableTextInput(false); + cbTRGINMezzanines->AddEntry("Trigger local is sync with TRG-IN", 0); + cbTRGINMezzanines->AddEntry("TRG-IN send to mezzanines (no delay)", 1); + cbTRGINMezzanines->Select(0); + cbTRGINMezzanines->Resize(200, 20); + cbTRGINMezzanines->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()"); + + ///"Front Panel LVDS IO New Features", + ///"LVDS IO Data", + + ///"Analog Monitor Mode + TGLabel * lbAnaMonitor = new TGLabel(vFrontIOCtrl_label, "Analog Monitor Mode (MON/Sigma)"); vFrontIOCtrl_label->AddFrame(lbAnaMonitor, haha); + cbAnaMonitor = new TGComboBox(vFrontIOCtrl_CBox, "",1); vFrontIOCtrl_CBox->AddFrame(cbAnaMonitor); + cbAnaMonitor->EnableTextInput(false); + cbAnaMonitor->AddEntry("Trigger Majority", 0); + cbAnaMonitor->AddEntry("Test", 1); + cbAnaMonitor->AddEntry("Buffer Occupancy", 3); + cbAnaMonitor->AddEntry("Voltage Level", 4); + cbAnaMonitor->Select(0); + cbAnaMonitor->Resize(150, 20); + cbAnaMonitor->Connect("Changed()", "BoardSetting", this, "SetAnalogMonitorMode()"); + cbAnaMonitor->Connect("Changed()", "ChannelSetting", this, "ChangePolarity()"); //Example to call other class + + ///"Buffer Occupancy Gain + TGLabel * lbBufferOccpGain = new TGLabel(vFrontIOCtrl_label, "Buffer Occupancy Gain"); vFrontIOCtrl_label->AddFrame(lbBufferOccpGain, haha); + numBufferOccpGain = new TGNumberEntry(vFrontIOCtrl_CBox, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vFrontIOCtrl_CBox->AddFrame(numBufferOccpGain); + numBufferOccpGain->SetState(false); + numBufferOccpGain->Resize(70, 17); + numBufferOccpGain->Connect("Modified()", "BoardSetting", this, "SetAnalogMonitorMode()"); + + } + + + //TODO check is VME model + {///"Readout Control", + TGGroupFrame * gReadoutCtrl = new TGGroupFrame(hRow2, "ReadOut Control", kHorizontalFrame); hRow2->AddFrame(gReadoutCtrl, new TGLayoutHints( kLHintsExpandY)); + TGVerticalFrame * vReadoutCtrl = new TGVerticalFrame(gReadoutCtrl); gReadoutCtrl->AddFrame(vReadoutCtrl); + + TGHorizontalFrame * hReadoutCtrl = new TGHorizontalFrame(vReadoutCtrl); vReadoutCtrl->AddFrame(hReadoutCtrl, new TGLayoutHints( kLHintsLeft, 5, 5, 5, 5)); + + TGLabel * lbVMEInterruptLevel = new TGLabel(hReadoutCtrl, "VME Interrupt Level"); hReadoutCtrl->AddFrame(lbVMEInterruptLevel,new TGLayoutHints( kLHintsLeft, 5, 5, 3, 3)); + cbVMEInterrupLevel = new TGComboBox(hReadoutCtrl, "", 1); hReadoutCtrl->AddFrame(cbVMEInterrupLevel); + cbVMEInterrupLevel->EnableTextInput(false); + cbVMEInterrupLevel->AddEntry("Disabled", 0); + cbVMEInterrupLevel->AddEntry("1", 1); + cbVMEInterrupLevel->AddEntry("2", 2); + cbVMEInterrupLevel->AddEntry("3", 3); + cbVMEInterrupLevel->AddEntry("4", 4); + cbVMEInterrupLevel->AddEntry("5", 5); + cbVMEInterrupLevel->AddEntry("6", 6); + cbVMEInterrupLevel->AddEntry("7", 7); + cbVMEInterrupLevel->Select(0); + cbVMEInterrupLevel->Resize(80, 20); + cbVMEInterrupLevel->Connect("Changed()", "BoardSetting", this, "SetReadOutControl()"); + + + + bOpticalLinkInterrupt = new TGCheckButton(vReadoutCtrl, "Optical Link Interrupt", 1); vReadoutCtrl->AddFrame(bOpticalLinkInterrupt); + bOpticalLinkInterrupt->SetState(kButtonUp); + bOpticalLinkInterrupt->Connect("Clicked()", "BoardSetting", this, "SetReadOutControl()"); + + bEventAligned = new TGCheckButton(vReadoutCtrl, "Event Aligned Enabled", 1); vReadoutCtrl->AddFrame(bEventAligned); + bEventAligned->SetState(kButtonUp); + bEventAligned->Connect("Clicked()", "BoardSetting", this, "SetReadOutControl()"); + + bVMEAlogn64Mode = new TGCheckButton(vReadoutCtrl, "64-bit aligned", 1); vReadoutCtrl->AddFrame(bVMEAlogn64Mode); + bVMEAlogn64Mode->SetState(kButtonUp); + bVMEAlogn64Mode->Connect("Clicked()", "BoardSetting", this, "SetReadOutControl()"); + + bInteruptReleaseMode = new TGCheckButton(vReadoutCtrl, "Interrupt Release on Acknowldge", 1); vReadoutCtrl->AddFrame(bInteruptReleaseMode); + bInteruptReleaseMode->SetState(kButtonUp); + bInteruptReleaseMode->Connect("Clicked()", "BoardSetting", this, "SetReadOutControl()"); + + bEnableExtendedBlockTransfer = new TGCheckButton(vReadoutCtrl, "Enable Extended Block Transfer", 1); vReadoutCtrl->AddFrame(bEnableExtendedBlockTransfer); + bEnableExtendedBlockTransfer->SetState(kButtonUp); + bEnableExtendedBlockTransfer->Connect("Clicked()", "BoardSetting", this, "SetReadOutControl()"); + } + ///===== LVSD TGHorizontalFrame * hframeLVSD = new TGHorizontalFrame(vframe); vframe->AddFrame(hframeLVSD, new TGLayoutHints(kLHintsCenterY , 5,5,3,4)); @@ -627,48 +721,46 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d fMain->Resize(fMain->GetDefaultSize()); fMain->MapWindow(); + isOpened = true; ///Setup thread - readStatusThread = new TThread("hahaha", ReadStatus, (void *) 1); - if( digi != NULL ) { - readStatusThread->Run(); - } + readStatusThread = new TThread("readStatus", ReadStatus, (void *) 1); + if( digi != NULL ) readStatusThread->Run(); isOpened = true; } + BoardSetting::~BoardSetting(){ isOpened = false; + printf("close BoardSetting window\n"); + for( int i = 0; i < nDigi; i++) digi[i] = 0; pha = 0; psd = 0; - delete readStatusThread; - fMain->Cleanup(); delete fMain; } void * BoardSetting::ReadStatus(void * ptr){ - int boardID = boardIDEntry->GetNumber(); - if( digi == NULL ) { - printf("no didgitizers\n"); - return 0; - } + if( digi == NULL ) return 0; int pauseTime = 1000; /// msec - + int boardID = boardIDEntry->GetNumber(); + if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) { pha = dynamic_cast (digi[boardID]); //while( digi[boardID]->isACQRunning() == false ){ - while( true ){ - + while( isOpened ){ + + printf("=========== readStatus () for PHA\n"); /// ACQ Status uint32_t temp = pha->ReadRegister(Register::DPP::AcquisitionStatus); @@ -709,6 +801,7 @@ void * BoardSetting::ReadStatus(void * ptr){ txtVMEFIFO->SetText( "VME FIFO EMPTY" ); txtVMEFIFO->SetTextColor(red); } + usleep(pauseTime*1000); } pha = 0; @@ -716,15 +809,15 @@ void * BoardSetting::ReadStatus(void * ptr){ } void BoardSetting::ChangeBoard(){ - int boardID = boardIDEntry->GetNumber(); if( digi == NULL ) { printf("no didgitizers\n"); return; - }else{ - digi[boardID]->PrintBoard(); } - + + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->PrintBoard(); + for( int i = 0; i < NUM_BOARD_INFO; i++){ switch (i) { case 0 : entry[i]->SetText( Form("%s", (digi[boardID]->GetModelName()).c_str()) ); break; @@ -780,31 +873,32 @@ void BoardSetting::ChangeBoard(){ enADCPwrStatus->SetText( "Failure" ); enADCPwrStatus->SetTextColor(red); } - pha->PrintBoardConfiguration(); + //pha->PrintBoardConfiguration(); + temp = pha->ReadRegister(Register::DPP::BoardConfiguration); - bAutoDataFlush->SetState( pha->GetSetting(Setting::PHA::AutoDataFlush_board_bool) == 1.0 ? kButtonDown : kButtonUp ); - bDecimateWF->SetState( pha->GetSetting(Setting::PHA::DecimateWaveForm_board_bool) == 1.0 ? kButtonDown : kButtonUp ); - bWFRecord->SetState( pha->GetSetting(Setting::PHA::WavefromRecording_board_bool) == 1.0? kButtonDown : kButtonUp ); - bTrigPropa->SetState( pha->GetSetting(Setting::PHA::TriggerPropapation_board_bool) == 1.0? kButtonDown : kButtonUp ); - bExtrac2->SetState( pha->GetSetting(Setting::PHA::EnableExtra2Word_board_bool) == 1.0? kButtonDown : kButtonUp); - bDualTrace->SetState( pha->GetSetting(Setting::PHA::DualTrace_board_bool) == 1.0? kButtonDown : kButtonUp); + bAutoDataFlush->SetState( (temp & 0x1) ? kButtonDown : kButtonUp ); + bDecimateWF->SetState( ((temp >> 1) & 0x1) ? kButtonDown : kButtonUp ); + bWFRecord->SetState( ((temp >> 16) & 0x1) ? kButtonDown : kButtonUp ); + bTrigPropa->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp ); + bExtrac2->SetState( ((temp >> 17) & 0x1) ? kButtonDown : kButtonUp); + bDualTrace->SetState( ((temp >> 11) & 0x1) ? kButtonDown : kButtonUp); + cbAP1->Select( ((temp >> 12) & 0x3) ); + cbAP2->Select( ((temp >> 14) & 0x3) ); + cbDP1->Select( ((temp >> 20) & 0x7) ); - cbAP1->Select( pha->GetSetting(Setting::PHA::AnalogProbe1_board_2bit) ); - cbAP2->Select( pha->GetSetting(Setting::PHA::AnalogProbe2_board_2bit) ); - cbDP->Select( pha->GetSetting(Setting::PHA::VirtualProbe_board_4bit) ); + cbAggOrg->Select( pha->ReadRegister(Register::DPP::AggregateOrganization) ); + numAggBLT->SetNumber( pha->ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer) ); - cbAggOrg->Select( pha->GetSetting(Setting::PHA::AggregateOrganization_board_3bit) ); - numAggBLT->SetNumber( pha->GetSetting(Setting::PHA::MaxAggregatePreBlockTransfer_board_10bit) ); + cbFanCtrl->Select( pha->ReadRegister(Register::DPP::FanSpeedControl) ); - cbFanCtrl->Select( pha->GetSetting(Setting::PHA::FanSpeedControl_bool) ); + //pha->PrintACQControl(); + temp = pha->ReadRegister(Register::DPP::AcquisitionControl); - pha->PrintACQControl(); + cbAcqMode->Select( temp & 0x3 ); + bAcqArm->SetState( ((temp >> 2) & 0x1) ? kButtonDown : kButtonUp); + cbPLLref->Select( ((temp >> 6) & 0x1)); - cbAcqMode->Select( pha->GetSetting(Setting::PHA::StartStopMode_2bit)); - bAcqArm->SetState( pha->GetSetting(Setting::PHA::StartStopACQ_bool) == 1.0 ? kButtonDown : kButtonUp); - cbPLLref->Select( pha->GetSetting(Setting::PHA::PLLClockSource_bool)); - - numRunStartStopDelay->SetNumber( pha->GetSetting(Setting::PHA::RunStartStopDelay_8bit)); + numRunStartStopDelay->SetNumber( pha->ReadRegister(Register::DPP::RunStartStopDelay)); /// Global Trigger Mask temp = pha->ReadRegister(Register::DPP::GlobalTriggerMask); @@ -813,7 +907,6 @@ void BoardSetting::ChangeBoard(){ } numMajorCoinWin->SetNumber( (temp >> 20 ) & 0x7 ); GlbMajorLevel->SetNumber( ( temp >> 24) & 0x7 ); - //bGLBLVDSTrigger->SetState( (( temp >> 29) & 0x1 ) == 0 ? kButtonUp : kButtonDown); bGLBExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown); bGLBSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown); @@ -827,9 +920,6 @@ void BoardSetting::ChangeBoard(){ bTRGExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown); bTRGSoftwareTrigger->SetState( (( temp >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown); - //bTRGValMskLVSDGLB->SetState( (( temp >> 28) & 0x1 ) == 0 ? kButtonUp : kButtonDown); - //bTRGValMskLVSDLCL->SetState( (( temp >> 29) & 0x1 ) == 0 ? kButtonUp : kButtonDown); - /// Front Panel TRG-OUT Enable Mask temp = pha->ReadRegister(Register::DPP::FrontPanelTRGOUTEnableMask); for( int i = 0; i < 8; i++){ @@ -837,24 +927,27 @@ void BoardSetting::ChangeBoard(){ } cbTRGOUTMODE->Select( ( temp >> 8 ) & 0x3) ; TRGOUTMajorLevel->SetNumber( ( temp >> 10 ) & 0x7); - //bTRGOUTLVDSTrigger->SetState( (( temp >> 29) & 0x1 ) == 0 ? kButtonUp : kButtonDown); bTRGOUTExtTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown); bTRGOUTSoftwareTrigger->SetState( (( temp >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown); - bEnableExtTRG->SetState( pha->GetSetting(Setting::PHA::DisableExternalTrigger_bool) == 1.0 ? kButtonDown : kButtonUp); + bEnableExtTRG->SetState( (pha->ReadRegister(Register::DPP::DisableExternalTrigger) & 0x1) ? kButtonDown : kButtonUp); - numExtendVetoDelay->SetNumber( pha->GetSetting(Setting::PHA::ExtendedVetoDelay_16bit) ); + numExtendVetoDelay->SetNumber( pha->ReadRegister(Register::DPP::ExtendedVetoDelay) ); /// Front Panel I/O Control temp = pha->ReadRegister(Register::DPP::FrontPanelIOControl); cbLEMOIO->Select( temp & 0x1 ); - cbTRGOUTmode->Select( (temp >> 14) & 0x3F ); - bTRGOUTImp->SetState( ((temp >> 1) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ; + + if( ((temp >> 1) & 0x1 ) == 0 ) { + cbTRGOUTmode->Select( 1 ); + }else{ + cbTRGOUTmode->Select( (temp >> 14) & 0x3F ); + } cbTRGINCtrl->Select( (temp >> 10) & 0x1 ); cbTRGINMezzanines->Select( (temp >> 11) & 0x1 ); - cbAnaMonitor->Select( pha->GetSetting(Setting::PHA::AnalogMonitorMode_3bit) ); - numBufferOccpGain->SetNumber( pha->GetSetting(Setting::PHA::BufferOccupancyGain_4bit)); + cbAnaMonitor->Select( pha->ReadRegister(Register::DPP::AnalogMonitorMode) & 0x7 ); + numBufferOccpGain->SetNumber( pha->ReadRegister(Register::DPP::BufferOccupancyGain) & 0xf); /// Readout Control temp = pha->ReadRegister(Register::DPP::ReadoutControl); @@ -865,8 +958,6 @@ void BoardSetting::ChangeBoard(){ bInteruptReleaseMode->SetState( (( temp >> 7 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ; bEnableExtendedBlockTransfer->SetState( (( temp >> 8 ) & 0x1 ) == 0 ? kButtonUp : kButtonDown) ; - - pha = NULL; ///unlink the pointer }else if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ) { @@ -874,71 +965,254 @@ void BoardSetting::ChangeBoard(){ }else{ ///========== disable all others bAutoDataFlush->SetEditable(false); - - } - - - return; } -void BoardSetting::SetAutoDataFlush(){ - printf("========== Auto Data Flush \n"); +//################################################ Change Settings + +void BoardSetting::ResetSettingToDefault(){ /// same for PHA and PSD + printf("============== ResetSettingToDefault() \n"); + + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->WriteRegister(Register::DPP::SoftwareReset, 1); } -void BoardSetting::SetDecimateWF(){ - printf("========== Decimate WF \n"); +void BoardSetting::ClearBuffer(){ /// same for PHA and PSD + printf("============== ClearBuffer() \n"); + + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->WriteRegister(Register::DPP::SoftwareClear, 1); } -void BoardSetting::SetWaveFormRecord(){ - printf("========== WF Record \n"); +void BoardSetting::SetBoardConfiguration(){ + printf("============== SetBoardConfiguration() \n"); + + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + uint32_t bit = 0; + if( digi[boardID]->GetDPPType() == V1730_DPP_PHA_CODE ) { + + uint32_t bit = (3 << 18); /// timestamp and energy recording + if( bAutoDataFlush->GetState() == kButtonDown ) bit += 1; + if( bDecimateWF->GetState() == kButtonDown ) bit += (1 << 1); + if( bWFRecord->GetState() == kButtonDown ) bit += ( 1 << 16); + if( bTrigPropa->GetState() == kButtonDown ) bit += ( 1 << 2); + if( bExtrac2->GetState() == kButtonDown ) bit += ( 1 << 17); + if( bDualTrace->GetState() == kButtonDown ) bit += ( 1 << 11); + + bit += (cbAP1->GetSelected() << 12); + bit += (cbAP2->GetSelected() << 14); + bit += (cbDP1->GetSelected() << 20); + + } + + if( digi[boardID]->GetDPPType() == V1730_DPP_PSD_CODE ) { + + //uint32_t bit = (3 << 18); /// timestamp and energy recording + //if( bAutoDataFlush->GetState() == kButtonDown ) bit += 1; + //if( bDecimateWF->GetState() == kButtonDown ) bit += (1 << 1); + //if( bWFRecord->GetState() == kButtonDown ) bit += ( 1 << 16); + //if( bTrigPropa->GetState() == kButtonDown ) bit += ( 1 << 2); + //if( bExtrac2->GetState() == kButtonDown ) bit += ( 1 << 17); + //if( bDualTrace->GetState() == kButtonDown ) bit += ( 1 << 11); + // + //bit += (cbAP1->GetSelected() << 12); + //bit += (cbAP2->GetSelected() << 14); + //bit += (cbDP1->GetSelected() << 20); + + } + + printf("bit : 0x%x \n", bit); + + digi[boardID]->WriteRegister(Register::DPP::BoardConfiguration, bit); } -void BoardSetting::SetDualTrace(){ - printf("========== Dual trace \n"); - cbAP2->SetEnabled(bDualTrace->IsDown()); -} - -void BoardSetting::SetTriggerPropagation(){ - printf("========== Trigger Propagation \n"); -} - -void BoardSetting::SetEnableExtra2(){ - printf("========== SetEnableExtra2 \n"); -} - -void BoardSetting::SetAnalogProbe1(){ - printf("========== SetAnalogProbe1, %d \n", cbAP1->GetSelected()); +void BoardSetting::SetAggregateOrganization(){ /// same for PHA and PSD + printf("========== SetAggregateOrganization, %d \n", cbAggOrg->GetSelected()); + + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->WriteRegister(Register::DPP::AggregateOrganization, cbAggOrg->GetSelected()); } -void BoardSetting::SetAnalogProbe2(){ - printf("========== SetAnalogProbe2, %d \n", cbAP2->GetSelected()); -} - -void BoardSetting::SetDigitalProbe(){ - printf("========== SetDigitalProbe, %d \n", cbDP->GetSelected()); -} - -void BoardSetting::SetAggregateOrganization(){ - printf("========== SetAggregateOrganization, %d \n", cbAggOrg->GetSelected()); -} - -void BoardSetting::SetReadOutAggregate(){ +void BoardSetting::SetReadOutAggregate(){ /// same for PHA and PSD printf("========== SetReadOutAggregate, %d \n", (int) numAggBLT->GetNumber()); + + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->WriteRegister(Register::DPP::MaxAggregatePerBlockTransfer, (unsigned int) numAggBLT->GetNumber()); + } -void BoardSetting::SetAnalogMonitorMode(){ - printf("========== SetAnalogMonitorMode, %d \n", cbAnaMonitor->GetSelected()); +void BoardSetting::SetFanSpeedControl(){ /// same for PHA and PSD + printf("============== SetFanSpeedControl() \n"); + + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->WriteRegister(Register::DPP::FanSpeedControl, cbFanCtrl->GetSelected() ); +} + +void BoardSetting::SetACQControl(){ /// same for PHA and PSD + printf("========== SetACQControl()\n"); + + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + uint32_t bit = 0; + bit += ( cbAcqMode->GetSelected() ); + bit += ( bAcqArm->GetState() == kButtonDown ? (1 << 2) : 0 ); + bit += ( cbPLLref->GetSelected() << 6 ); + + printf("bit : 0x%x \n", bit); + + digi[boardID]->WriteRegister(Register::DPP::AcquisitionControl, bit ); +} + + +void BoardSetting::SendSoftwareTriggerSignal(){ /// same for PHA and PSD + printf("========== SendSoftwareTriggerSignal()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->WriteRegister(Register::DPP::SoftwareTrigger, 1 ); +} + +void BoardSetting::SendSoftwareClockSyncSignal(){ /// same for PHA and PSD + printf("========== SendSoftwareClockSyncSignal()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + digi[boardID]->WriteRegister(Register::DPP::SoftwareClockSync, 1 ); +} + +void BoardSetting::SetRunStartStopDelay(){ /// same for PHA and PSD + printf("========== SetRunStartStopDelay()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + digi[boardID]->WriteRegister(Register::DPP::RunStartStopDelay, (unsigned int) numRunStartStopDelay->GetNumber() ); +} + +void BoardSetting::SetGlobalTriggerMask(){ /// same for PHA and PSD + printf("========== SetGlobalTriggerMask()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + uint32_t bit = 0; + for( int i = 0; i < 8; i ++ ) bit += ( (cbGbTRGMskCh[i]->GetState() == kButtonDown) ? (1 << i ) : 0); + bit += ( ((unsigned int) numMajorCoinWin->GetNumber() ) << 20 ); + bit += ( ((unsigned int) GlbMajorLevel->GetNumber() ) << 24 ); + bit += ( (bGLBExtTrigger->GetState() == kButtonDown) ? (1 << 30) : 0); + bit += ( (bGLBSoftwareTrigger->GetState() == kButtonDown) ? (1 << 31) : 0 ); + + printf("bit : 0x%x \n", bit); + + digi[boardID]->WriteRegister(Register::DPP::GlobalTriggerMask, bit ); +} + +void BoardSetting::SetTriggerValidMask(){ /// same for PHA and PSD + printf("========== SetTriggerValidMask()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + uint32_t bit = 0; + for( int i = 0; i < 8; i ++ ) bit += ( (cbTRGValMskCh[i]->GetState() == kButtonDown) ? (1 << i ) :0 ); + bit += ( (cbTRGMODE->GetSelected() << 8) ); + bit += ( ((unsigned int) TRGMajorLevel->GetNumber() ) << 24 ); + bit += ( (bTRGExtTrigger->GetState() == kButtonDown) ? (1 << 30) : 0); + bit += ( (bTRGSoftwareTrigger->GetState() == kButtonDown) ? (1 << 31) : 0 ); + + printf("bit : 0x%x \n", bit); + + digi[boardID]->WriteRegister(Register::DPP::TriggerValidationMask, bit ); +} + +void BoardSetting::SetTRGOUTMask(){ /// same for PHA and PSD + printf("========== SetTRGOUTMask()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + uint32_t bit = 0; + for( int i = 0; i < 8; i ++ ) bit += ( (cbTRGOUTMskCh[i]->GetState() == kButtonDown) ? (1 << i ) : 0 ); + bit += ( (cbTRGOUTMODE->GetSelected() << 8) ); + bit += ( ((unsigned int) TRGOUTMajorLevel->GetNumber() ) << 24 ); + bit += ( (bTRGOUTExtTrigger->GetState() == kButtonDown) ? (1 << 30) : 0 ); + bit += ( (bTRGOUTSoftwareTrigger->GetState() == kButtonDown) ? (1 << 31) : 0 ); + + printf("bit : 0x%x \n", bit); + + digi[boardID]->WriteRegister(Register::DPP::FrontPanelTRGOUTEnableMask, bit ); +} +void BoardSetting::SetEnableExternalTrigger(){ /// same for PHA and PSD + printf("========== SetTRGOUTMask()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + if (bEnableExtTRG->GetState() == kButtonDown) { + digi[boardID]->WriteRegister(Register::DPP::DisableExternalTrigger, 0x1 ); + } +} + +void BoardSetting::SetExtendedVetoDelay(){ /// same for PHA and PSD + printf("========== SetExtendedVetoDelay()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + digi[boardID]->WriteRegister(Register::DPP::ExtendedVetoDelay, (unsigned int) numExtendVetoDelay->GetNumber() ); +} + +void BoardSetting::SetFrontPanelIO(){ /// bit[20] different, bit[20] (PSD) not impletemented, PHA, bit[20] not use + printf("========== SetFrontPanelIO()\n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + uint32_t bit = 0; + bit += ( cbLEMOIO->GetSelected() ); + if( cbTRGOUTmode->GetSelected() != 1 ) { /// has TRG-OUT + bit += 0x2; /// TRG-OUT + bit += ( cbTRGOUTmode->GetSelected() << 14 ) ; + } + bit += ( cbTRGINCtrl->GetSelected() << 10 ); + bit += ( cbTRGINMezzanines->GetSelected() << 11 ); + + ///bit[20] = 0 by default. + printf("bit : 0x%x \n", bit); + + digi[boardID]->WriteRegister(Register::DPP::FrontPanelIOControl, bit ); +} + +void BoardSetting::SetAnalogMonitorMode(){ /// same for PHA and PSD + printf("========== SetAnalogMonitorMode(), %d \n", cbAnaMonitor->GetSelected()); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + digi[boardID]->WriteRegister(Register::DPP::AnalogMonitorMode, cbAnaMonitor->GetSelected() ); + if( cbAnaMonitor->GetSelected() == 3) { numBufferOccpGain->SetState(true); + digi[boardID]->WriteRegister(Register::DPP::BufferOccupancyGain, (int) numBufferOccpGain->GetNumber() ); }else{ numBufferOccpGain->SetState(false); } } -void BoardSetting::SoftwareReset(){ +void BoardSetting::SetReadOutControl(){ /// same for PHA and PSD + printf("========== SetReadOutControl() \n"); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + uint32_t bit = 0; + bit += cbVMEInterrupLevel->GetSelected(); + bit += ( (bOpticalLinkInterrupt->GetState() == kButtonDown) ? (1 << 3) : 0 ); + bit += ( (bEventAligned->GetState() == kButtonDown) ? (1 << 4) : 0 ); + bit += ( (bVMEAlogn64Mode->GetState() == kButtonDown) ? (1 << 5) : 0 ); + bit += ( (bInteruptReleaseMode->GetState() == kButtonDown) ? (1 << 7) : 0 ); + bit += ( (bEnableExtendedBlockTransfer->GetState() == kButtonDown) ? (1 << 8) : 0 ); + + printf("bit : 0x%x \n", bit); + + digi[boardID]->WriteRegister(Register::DPP::ReadoutControl, bit ); } diff --git a/boardSetting.h b/boardSetting.h index ee9beb4..8d580b0 100644 --- a/boardSetting.h +++ b/boardSetting.h @@ -44,7 +44,8 @@ class BoardSetting{ TGCheckButton * bDualTrace; TGComboBox * cbAP1; TGComboBox * cbAP2; /// for ComboBox for analog probe 2 - TGComboBox * cbDP; + TGComboBox * cbDP1; + TGComboBox * cbDP2; TGComboBox * cbAggOrg; TGNumberEntry * numAggBLT; /// number of Agg pre Block transfer TGComboBox * cbFanCtrl; @@ -86,9 +87,6 @@ class BoardSetting{ TGNumberEntry * TRGMajorLevel; TGNumberEntry * TRGOUTMajorLevel; - TGCheckButton * bGLBLVDSTrigger; - TGCheckButton * bTRGOUTLVDSTrigger; - TGCheckButton * bGLBExtTrigger; TGCheckButton * bTRGExtTrigger; TGCheckButton * bTRGOUTExtTrigger; @@ -105,7 +103,7 @@ class BoardSetting{ /// Front Panel IO Control TGComboBox * cbLEMOIO; TGComboBox * cbTRGOUTmode; - TGCheckButton * bTRGOUTImp; + //TGCheckButton * bTRGOUTImp; TGComboBox * cbTRGINCtrl; TGComboBox * cbTRGINMezzanines; TGComboBox * cbAnaMonitor; @@ -125,38 +123,56 @@ class BoardSetting{ static TGTextEntry * txtVMEFIFO; TThread * readStatusThread; + static bool isOpened; public: BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** digi, int nBoard); virtual ~BoardSetting(); + + bool IsOpen() {return isOpened;} void CloseWindow() { - printf("close BoardSetting window\n"); - for( int i = 0; i < nDigi; i++) digi[i] = NULL; + delete this; } void ChangeBoard(); static void * ReadStatus(void * ptr); /// thread. - + + ///=== Button + void ResetSettingToDefault(); + void ClearBuffer(); + ///=== Board Configure - void SetAutoDataFlush(); - void SetDecimateWF(); - void SetWaveFormRecord(); - void SetDualTrace(); - void SetTriggerPropagation(); - void SetEnableExtra2(); - void SetAnalogProbe1(); - void SetAnalogProbe2(); - void SetDigitalProbe(); - void SoftwareReset(); + void SetBoardConfiguration(); void SetAggregateOrganization(); void SetReadOutAggregate(); + void SetFanSpeedControl(); + ///=== ACQ Control + void SetACQControl(); + + void SendSoftwareTriggerSignal(); + void SendSoftwareClockSyncSignal(); + void SetRunStartStopDelay(); + + ///==== Trigger + void SetGlobalTriggerMask(); + void SetTriggerValidMask(); + void SetTRGOUTMask(); + + void SetEnableExternalTrigger(); + void SetExtendedVetoDelay(); + + ///==== FrontPanelIO + void SetFrontPanelIO(); void SetAnalogMonitorMode(); - bool isOpened; + ///==== Readout Control + void SetReadOutControl(); + + }; #endif