From bf824f76a7a0a34225499d8592fdde0a4a1d741e Mon Sep 17 00:00:00 2001 From: "carina@hades" Date: Tue, 18 Oct 2022 16:38:27 -0400 Subject: [PATCH] added complete Trigger Validation mask --- ClassDigitizer.cpp | 2 +- FSUDAQ.cpp | 11 +- boardSetting.cpp | 280 ++++++++++++++++++++++++++------------------- boardSetting.h | 22 ++-- 4 files changed, 184 insertions(+), 131 deletions(-) diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index cf4a171..aff8655 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -402,7 +402,7 @@ void Digitizer::ReadData(){ //=========================================================== void Digitizer::WriteRegister (Reg registerAddress, uint32_t value, int ch, bool isSave2MemAndFile){ - printf("%s[0x%04X](ch-%02d): %u \n", registerAddress.GetNameChar(), registerAddress.GetAddress(),ch, value); + printf("%s[0x%04X](ch-%02d) [0x%04X]: %u \n", registerAddress.GetNameChar(), registerAddress.GetAddress(),ch, registerAddress.ActualAddress(ch), value); if( !isConnected ) { SetSettingToMemory(registerAddress, value, ch); diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 2846570..6865f3a 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -223,6 +223,7 @@ MainWindow::MainWindow(const TGWindow *p,UInt_t w,UInt_t h) { LogMsg((char*)"Please \"Open Digitizers\" to start."); + //HandleMenu(M_DIGITIZER_OPEN); //HandleMenu(M_BOARD_SETTINGS); //HandleMenu(M_CH_SETTING_PHA); @@ -368,6 +369,7 @@ void MainWindow::OpenDigitizers(){ /// if dig exist, say, from loading setting file without digitizer for( int i = 0 ; i < nDigi; i++ ) delete digi[i]; + nDigi = 0; LogMsg((char*)"============= detect digitizers"); std::vector DPPType; @@ -471,11 +473,10 @@ void MainWindow::LoadSettingFromFile(){ }else{ loadStatus = digi[0]->LoadSettingBinary( fi.fFilename ); /// still dummy digitizer } - - - if( boardSetting != NULL ) boardSetting->CloseWindow(); - if( channelSettingPHA != NULL ) channelSettingPHA->CloseWindow(); - if( channelSettingPSD != NULL ) channelSettingPSD->CloseWindow(); + + //if( boardSetting != NULL ) boardSetting->CloseWindow(); + //if( channelSettingPHA != NULL ) channelSettingPHA->CloseWindow(); + //if( channelSettingPSD != NULL ) channelSettingPSD->CloseWindow(); HandleMenu(M_BOARD_SETTINGS); OpenChannelSetting(0); diff --git a/boardSetting.cpp b/boardSetting.cpp index 0c82622..8d90394 100644 --- a/boardSetting.cpp +++ b/boardSetting.cpp @@ -225,22 +225,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d txtVMEFIFO->SetTextColor(blue); } - TGHorizontalFrame * hRow0 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow0, new TGLayoutHints( kLHintsExpandX)); - //hRow0->ChangeOptions((hRow0->GetOptions() | kFixedHeight)); - //hRow0-> - - TGTextButton * bProgramDefaultBoard = new TGTextButton(hRow0, "Program Default Board"); hRow0->AddFrame(bProgramDefaultBoard, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); - bProgramDefaultBoard->Connect("Clicked()", "BoardSetting", this, "ProgramDefaultBoard()"); - - TGTextButton * bUpdateStatus = new TGTextButton(hRow0, "Update Status and Settings"); hRow0->AddFrame(bUpdateStatus, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); - bUpdateStatus->Connect("Clicked()", "BoardSetting", this, "ChangeBoard()"); - - TGTextButton * bOpenChannelSetting = new TGTextButton(hRow0, "Open Channel Setting"); hRow0->AddFrame(bOpenChannelSetting, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); - bOpenChannelSetting->Connect("Clicked()", "BoardSetting", this, "OpenChannelSetting()"); - - TGTextButton * bReadData = new TGTextButton(hRow0, "Read Data"); hRow0->AddFrame(bReadData, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); - bReadData->Connect("Clicked()", "BoardSetting", this, "ReadData()"); - TGHorizontalFrame * hRow1 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow1, new TGLayoutHints( kLHintsExpandX)); {///========= Board Configure @@ -466,26 +450,18 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d 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", + ///"TRG-OUT 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()"); + cbTRGOUTMsk[i] = new TGCheckButton(vTRGMsk[i], ""); vTRGMsk[i]->AddFrame(cbTRGOUTMsk[i], haha); + cbTRGOUTMsk[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)); + TGLabel * lbTRGOUTMode_haha = new TGLabel(vTRGMsk1, "TRG-OUT MODE"); vTRGMsk1->AddFrame(lbTRGOUTMode_haha, 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)); @@ -495,21 +471,13 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d 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->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->Connect("Changed()", "BoardSetting", this, "SetTRGOUTMask()"); + cbTRGOUTMode = new TGComboBox(vTRGMsk2, "OR",0); vTRGMsk2->AddFrame(cbTRGOUTMode); + cbTRGOUTMode->EnableTextInput(false); + cbTRGOUTMode->AddEntry("OR", 0); + cbTRGOUTMode->AddEntry("AND", 1); + cbTRGOUTMode->AddEntry("Majority", 2); + cbTRGOUTMode->Resize(70, 20); + 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)); @@ -518,14 +486,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d 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); @@ -534,14 +498,10 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d 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); @@ -550,10 +510,6 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d 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()"); @@ -567,6 +523,99 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d ///numExtendVetoDelay->Connect("Modified()", "BoardSetting", this, "SetExtendedVetoDelay()"); } + TGHorizontalFrame * hRow0 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow0, new TGLayoutHints( kLHintsExpandX)); + + {///================= ///"Trigger Validation Mask", + TGGroupFrame * gTRGValMsk = new TGGroupFrame(hRow0, "Trigger Validation Mask", kHorizontalFrame); hRow0->AddFrame(gTRGValMsk, new TGLayoutHints(kLHintsExpandX, 0, 5, 5, 5)); + TGVerticalFrame * vTRGValMsk = new TGVerticalFrame(gTRGValMsk); gTRGValMsk->AddFrame(vTRGValMsk, new TGLayoutHints(kLHintsExpandX)); + TGHorizontalFrame * hfTRGValMsk = new TGHorizontalFrame(vTRGValMsk); vTRGValMsk->AddFrame(hfTRGValMsk, new TGLayoutHints(kLHintsCenterY, 2,2,2,2)); + + TGLayoutHints * haha = new TGLayoutHints(kLHintsCenterX , 2, 2, 3, 3); + + TGVerticalFrame * vTRGch = new TGVerticalFrame(hfTRGValMsk); hfTRGValMsk->AddFrame(vTRGch, new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + TGLabel * lbdummy0 = new TGLabel(vTRGch, ""); + vTRGch->AddFrame(lbdummy0); + vTRGch->AddFrame(lbdummy0); + TGLabel * lbTRGValMsk[8]; + for( int i = 0; i < 8 ; i++){ + lbTRGValMsk[i] = new TGLabel(vTRGch, Form("ch %2d - %2d", 2*i, 2*i+1)); vTRGch->AddFrame(lbTRGValMsk[i], new TGLayoutHints(kLHintsRight | kLHintsCenterY , 5, 5, 3, 4)); + } + + TGVerticalFrame * vTRGMsk[8]; + for( int i = 0; i < 8; i++){vTRGMsk[i] = new TGVerticalFrame(hfTRGValMsk); hfTRGValMsk->AddFrame(vTRGMsk[i], new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); } + for( int i = 0; i < 8; i++){TGLabel * lbdummy0 = new TGLabel(vTRGMsk[i], Form("%d", 2*i )); vTRGMsk[i]->AddFrame(lbdummy0); } + for( int i = 0; i < 8; i++){TGLabel * lbdummy0 = new TGLabel(vTRGMsk[i], Form("%d", 2*i+1)); vTRGMsk[i]->AddFrame(lbdummy0); } + + for( int i = 0; i < 8; i++){ + for( int j = 0; j < 8 ; j++){ + cbTRGValMskCh[i][j] = new TGCheckButton(vTRGMsk[j], ""); vTRGMsk[j]->AddFrame(cbTRGValMskCh[i][j], haha); + cbTRGValMskCh[i][j]->Connect("Clicked()", "BoardSetting", this, "SetTriggerValidMask()"); + } + } + + TGVerticalFrame * vTRGValMode = new TGVerticalFrame(hfTRGValMsk); hfTRGValMsk->AddFrame(vTRGValMode,new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + vTRGValMode->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 0)); + TGLabel * lbTRGValMODE = new TGLabel(vTRGValMode, "MODE"); vTRGValMode->AddFrame(lbTRGValMODE, haha); + for( int i = 0; i < 8; i++){ + cbTRGValMODE[i] = new TGComboBox(vTRGValMode, "OR",0); vTRGValMode->AddFrame(cbTRGValMODE[i]); + cbTRGValMODE[i]->EnableTextInput(false); + cbTRGValMODE[i]->AddEntry("OR", 0); + cbTRGValMODE[i]->AddEntry("AND", 1); + cbTRGValMODE[i]->AddEntry("Majority", 2); + cbTRGValMODE[i]->Resize(70, 20); + cbTRGValMODE[i]->Connect("Changed()", "BoardSetting", this, "SetTriggerValidMask()"); + } + + TGVerticalFrame * vTRGValMajor = new TGVerticalFrame(hfTRGValMsk); hfTRGValMsk->AddFrame(vTRGValMajor,new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + vTRGValMajor->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 0)); + TGLabel * lbMajorLevel = new TGLabel(vTRGValMajor, "Majority Level"); vTRGValMajor->AddFrame(lbMajorLevel, haha); + for( int i =0 ; i < 8; i++){ + TRGValMajorLevel[i] = new TGNumberEntry(vTRGValMajor, 0, 0, 0, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative); vTRGValMajor->AddFrame(TRGValMajorLevel[i]); + TRGValMajorLevel[i]->Resize(70, 20); + TRGValMajorLevel[i]->Connect("Modified()", "BoardSetting", this, "SetTriggerValidMask()"); + } + + TGVerticalFrame * vTRGValExtTrg = new TGVerticalFrame(hfTRGValMsk); hfTRGValMsk->AddFrame(vTRGValExtTrg,new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + vTRGValExtTrg->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 0)); + TGLabel * lbExtTrigger = new TGLabel(vTRGValExtTrg, "Ext."); vTRGValExtTrg->AddFrame(lbExtTrigger, haha); + for( int i =0 ; i < 8; i++){ + bTRGValExtTrigger[i] = new TGCheckButton(vTRGValExtTrg, "", 1); vTRGValExtTrg->AddFrame(bTRGValExtTrigger[i], haha); + bTRGValExtTrigger[i]->SetState(kButtonUp); + bTRGValExtTrigger[i]->Connect("Clicked()", "BoardSetting", this, "SetTriggerValidMask()"); + } + + TGVerticalFrame * vTRGOUTSWTrg = new TGVerticalFrame(hfTRGValMsk); hfTRGValMsk->AddFrame(vTRGOUTSWTrg,new TGLayoutHints(kLHintsCenterX , 5, 5, 3, 4)); + + vTRGOUTSWTrg->AddFrame(lbdummy0, new TGLayoutHints(kLHintsLeft | kLHintsCenterY , 5, 5, 3, 0)); + TGLabel * lbSWTrigger = new TGLabel(vTRGOUTSWTrg, "SW"); vTRGOUTSWTrg->AddFrame(lbSWTrigger, haha); + for( int i = 0; i < 8; i++){ + bTRGValSoftwareTrigger[i] = new TGCheckButton(vTRGOUTSWTrg, "", 1); vTRGOUTSWTrg->AddFrame(bTRGValSoftwareTrigger[i], haha); + bTRGValSoftwareTrigger[i]->SetState(kButtonDown); + bTRGValSoftwareTrigger[i]->Connect("Clicked()", "BoardSetting", this, "SetTriggerValidMask()"); + } + } + + {///================== Button + TGGroupFrame * gButton = new TGGroupFrame(hRow0, "Others Buttons", kHorizontalFrame); hRow0->AddFrame(gButton, new TGLayoutHints(kLHintsExpandY, 0, 0, 5, 5)); + TGVerticalFrame * vfButton = new TGVerticalFrame(gButton); gButton->AddFrame(vfButton, new TGLayoutHints(kLHintsExpandX)); + + TGTextButton * bProgramDefaultBoard = new TGTextButton(vfButton, "Program Default Board"); vfButton->AddFrame(bProgramDefaultBoard, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); + bProgramDefaultBoard->Connect("Clicked()", "BoardSetting", this, "ProgramDefaultBoard()"); + + TGTextButton * bUpdateStatus = new TGTextButton(vfButton, "Update Status and Settings"); vfButton->AddFrame(bUpdateStatus, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); + bUpdateStatus->Connect("Clicked()", "BoardSetting", this, "ChangeBoard()"); + + TGTextButton * bOpenChannelSetting = new TGTextButton(vfButton, "Open Channel Setting"); vfButton->AddFrame(bOpenChannelSetting, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); + bOpenChannelSetting->Connect("Clicked()", "BoardSetting", this, "OpenChannelSetting()"); + + TGTextButton * bReadData = new TGTextButton(vfButton, "Read Data"); vfButton->AddFrame(bReadData, new TGLayoutHints( kLHintsExpandX | kLHintsExpandY, 5, 0, 5, 0)); + bReadData->Connect("Clicked()", "BoardSetting", this, "ReadData()"); + } + TGHorizontalFrame * hRow2 = new TGHorizontalFrame(vframe); vframe->AddFrame(hRow2, new TGLayoutHints(kLHintsExpandX)); {///=================="Front Panel IO Control", @@ -589,20 +638,20 @@ BoardSetting::BoardSetting(const TGWindow *p, UInt_t w, UInt_t h, Digitizer ** d ///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", 0x00002); /// 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->Resize(160, 20); - cbTRGOUTmode->Connect("Changed()", "BoardSetting", this, "SetFrontPanelIO()"); + cbTRGOUTMODE2 = new TGComboBox(vFrontIOCtrl_CBox, "",1); vFrontIOCtrl_CBox->AddFrame(cbTRGOUTMODE2); + cbTRGOUTMODE2->EnableTextInput(false); + cbTRGOUTMODE2->AddEntry("Disable", 0x00002); /// this is TRG_OUT high imped. 0x811C bit[1] + cbTRGOUTMODE2->AddEntry("force TRG-OUT is 0", 0x08000); + cbTRGOUTMODE2->AddEntry("force TRG-OUT is 1", 0x0C000); + cbTRGOUTMODE2->AddEntry("Trigger", 0x00000); + cbTRGOUTMODE2->AddEntry("Channel Probe", 0x20000); + cbTRGOUTMODE2->AddEntry("S-IN", 0x30000); + cbTRGOUTMODE2->AddEntry("RUN", 0x10000); + cbTRGOUTMODE2->AddEntry("Sync Clock", 0x50000); + cbTRGOUTMODE2->AddEntry("Clock Phase", 0x90000); + cbTRGOUTMODE2->AddEntry("BUSY/UNLOCK", 0xD0000); + cbTRGOUTMODE2->Resize(160, 20); + cbTRGOUTMODE2->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); @@ -891,33 +940,37 @@ void BoardSetting::ChangeBoard(){ bGLBExtTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); bGLBSoftwareTrigger->SetState( (( tempBits >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); - /// Trigger Validation Mask - tempBits = digi[boardID]->GetSettingFromMemory(Register::DPP::TriggerValidationMask_G); - for( int i = 0; i < 8; i++){ - cbTRGValMskCh[i]->SetState( ((tempBits >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown , false); - } - cbTRGMODE->Select( ( tempBits >> 8 ) & 0x3, false) ; - TRGMajorLevel->SetNumber( ( tempBits >> 10 ) & 0x3, false); - bTRGExtTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); - bTRGSoftwareTrigger->SetState( (( tempBits >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); - /// Front Panel TRG-OUT Enable Mask , PHA = PSD only for bit[19:0] tempBits = digi[boardID]->GetSettingFromMemory(Register::DPP::FrontPanelTRGOUTEnableMask); for( int i = 0; i < 8; i++){ - cbTRGOUTMskCh[i]->SetState( ((tempBits >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown, false ); + cbTRGOUTMsk[i]->SetState( ((tempBits >> i ) & 0x1) == 0 ? kButtonUp : kButtonDown, false ); } - cbTRGOUTMODE->Select( ( tempBits >> 8 ) & 0x3, false) ; + cbTRGOUTMode->Select( ( tempBits >> 8 ) & 0x3, false) ; TRGOUTMajorLevel->SetNumber( ( tempBits >> 10 ) & 0x7, false); bTRGOUTExtTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); bTRGOUTSoftwareTrigger->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + + /// Trigger Validation Mask + for( int i = 0; i < 8; i++){ + tempBits = digi[boardID]->GetSettingFromMemory(Register::DPP::TriggerValidationMask_G, 2*i); + printf("%2d | 0x%04X \n", i, tempBits); + for( int j = 0; j < 8; j++){ + cbTRGValMskCh[i][j]->SetState( ((tempBits >> j ) & 0x1) == 0 ? kButtonUp : kButtonDown , false); + } + cbTRGValMODE[i]->Select( ( tempBits >> 8 ) & 0x3, false) ; + TRGValMajorLevel[i]->SetNumber( ( tempBits >> 10 ) & 0x3, false); + bTRGValExtTrigger[i]->SetState( (( tempBits >> 30) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + bTRGValSoftwareTrigger[i]->SetState( (( tempBits >> 31) & 0x1 ) == 0 ? kButtonUp : kButtonDown, false); + } + /// Front Panel I/O Control, PHA = PSD only for bit[19:0] tempBits = digi[boardID]->GetSettingFromMemory(Register::DPP::FrontPanelIOControl); cbLEMOIO->Select( tempBits & 0x1 , false); if( ((tempBits >> 1) & 0x1 ) == 0 ) { - cbTRGOUTmode->Select( 2 , false); + cbTRGOUTMODE2->Select( 2 , false); }else{ - cbTRGOUTmode->Select( (tempBits) & 0x3F000 , false); + cbTRGOUTMODE2->Select( (tempBits) & 0x3F000 , false); } cbTRGINCtrl->Select( (tempBits >> 10) & 0x1 , false); cbTRGINMezzanines->Select( (tempBits >> 11) & 0x1 , false); @@ -1245,39 +1298,40 @@ void BoardSetting::SetGlobalTriggerMask(){ /// same for PHA and PSD digi[boardID]->WriteRegister(Register::DPP::GlobalTriggerMask, bit ); } -void BoardSetting::SetTriggerValidMask(){ /// same for PHA and PSD - printf("=== %s\n", __func__); - 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_G, bit ); -} - void BoardSetting::SetTRGOUTMask(){ /// same for PHA and PSD printf("=== %s\n", __func__); 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) ); + for( int i = 0; i < 8; i ++ ) bit += ( (cbTRGOUTMsk[i]->GetState() == kButtonDown) ? (1 << i ) :0 ); + bit += ( (cbTRGOUTMode->GetSelected() << 8) ); bit += ( ((unsigned int) TRGOUTMajorLevel->GetNumber() ) << 24 ); - bit += ( (bTRGOUTExtTrigger->GetState() == kButtonDown) ? (1 << 30) : 0 ); + bit += ( (bTRGOUTExtTrigger->GetState() == kButtonDown) ? (1 << 30) : 0); bit += ( (bTRGOUTSoftwareTrigger->GetState() == kButtonDown) ? (1 << 31) : 0 ); - - printf("bit : 0x%x \n", bit); + printf("bit : 0x%x \n", bit); + digi[boardID]->WriteRegister(Register::DPP::FrontPanelTRGOUTEnableMask, bit ); } + +void BoardSetting::SetTriggerValidMask(){ /// same for PHA and PSD + printf("=== %s\n", __func__); + if( digi == NULL ) return; + int boardID = boardIDEntry->GetNumber(); + + uint32_t bit = 0; + for( int i = 0; i < 8; i++){ + bit = 0; + for( int j = 0; j < 8; j++) bit += ( (cbTRGValMskCh[i][j]->GetState() == kButtonDown) ? (1 << j ) : 0 ); + bit += ( (cbTRGValMODE[i]->GetSelected() << 8) ); + bit += ( ((unsigned int) TRGValMajorLevel[i]->GetNumber() ) << 24 ); + bit += ( (bTRGValExtTrigger[i]->GetState() == kButtonDown) ? (1 << 30) : 0 ); + bit += ( (bTRGValSoftwareTrigger[i]->GetState() == kButtonDown) ? (1 << 31) : 0 ); + printf("pch : %d, bit : 0x%x \n", i, bit); + digi[boardID]->WriteRegister(Register::DPP::TriggerValidationMask_G, bit , 2*i); + } +} void BoardSetting::SetEnableExternalTrigger(){ /// same for PHA and PSD printf("=== %s\n", __func__); if( digi == NULL ) return; @@ -1285,6 +1339,8 @@ void BoardSetting::SetEnableExternalTrigger(){ /// same for PHA and PSD if (bEnableExtTRG->GetState() == kButtonDown) { digi[boardID]->WriteRegister(Register::DPP::DisableExternalTrigger, 0x1 ); + }else{ + digi[boardID]->WriteRegister(Register::DPP::DisableExternalTrigger, 0x0 ); } } @@ -1303,13 +1359,7 @@ void BoardSetting::SetFrontPanelIO(){ /// bit[20] different, bit[20] (PSD) not uint32_t bit = 0; bit += ( cbLEMOIO->GetSelected() ); - bit += cbTRGOUTmode->GetSelected() ; - - //if( cbTRGOUTmode->GetSelected() != 2 ) { /// has TRG-OUT - // bit += cbTRGOUTmode->GetSelected() ; - //}else{ - // bit += 0x2; /// TRG-OUT (high0impedance) or off - //} + bit += cbTRGOUTMODE2->GetSelected() ; bit += ( cbTRGINCtrl->GetSelected() << 10 ); bit += ( cbTRGINMezzanines->GetSelected() << 11 ); diff --git a/boardSetting.h b/boardSetting.h index 33dcb0e..88539e5 100644 --- a/boardSetting.h +++ b/boardSetting.h @@ -78,33 +78,35 @@ class BoardSetting{ /// Trigger control TGCheckButton * cbGbTRGMskCh[8]; - TGCheckButton * cbTRGValMskCh[8]; - TGCheckButton * cbTRGOUTMskCh[8]; + TGCheckButton * cbTRGOUTMsk[8]; TGNumberEntry * numMajorCoinWin; - TGComboBox * cbTRGMODE; - TGComboBox * cbTRGOUTMODE; + TGComboBox * cbTRGOUTMode; TGNumberEntry * GlbMajorLevel; - TGNumberEntry * TRGMajorLevel; TGNumberEntry * TRGOUTMajorLevel; TGCheckButton * bGLBExtTrigger; - TGCheckButton * bTRGExtTrigger; TGCheckButton * bTRGOUTExtTrigger; TGCheckButton * bGLBSoftwareTrigger; - TGCheckButton * bTRGSoftwareTrigger; TGCheckButton * bTRGOUTSoftwareTrigger; - TGCheckButton * bTRGValMskLVSDGLB; - TGCheckButton * bTRGValMskLVSDLCL; + //TGCheckButton * bTRGValMskLVSDGLB; + //TGCheckButton * bTRGValMskLVSDLCL; TGCheckButton * bEnableExtTRG; TGNumberEntry * numExtendVetoDelay; + /// Trigger Validation Mask + TGCheckButton * cbTRGValMskCh[8][8]; + TGComboBox * cbTRGValMODE[8]; + TGNumberEntry * TRGValMajorLevel[8]; + TGCheckButton * bTRGValExtTrigger[8]; + TGCheckButton * bTRGValSoftwareTrigger[8]; + /// Front Panel IO Control TGComboBox * cbLEMOIO; - TGComboBox * cbTRGOUTmode; + TGComboBox * cbTRGOUTMODE2; TGComboBox * cbTRGINCtrl; TGComboBox * cbTRGINMezzanines; TGComboBox * cbAnaMonitor;