From c1f223532c4dff108324a002929b473dcd250f81 Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Fri, 1 Nov 2024 17:03:10 -0400 Subject: [PATCH] added a button on the channel setting to set default channel settings for Si-detector --- ClassDigitizer.cpp | 8 +++++++ ClassDigitizer.h | 1 + DigiSettingsPanel.cpp | 50 +++++++++++++++++++++++++++++++++---------- DigiSettingsPanel.h | 1 + 4 files changed, 49 insertions(+), 11 deletions(-) diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index 34425da..80570d1 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -326,6 +326,14 @@ void Digitizer::ProgramBoard(){ if( DPPType == DPPTypeCode::DPP_QDC_CODE ) ProgramBoard_QDC(); } +void Digitizer::ProgramChannel(short chOrGroup){ + if( softwareDisable ) return; + if( AcqRun ) return; + if( DPPType == DPPTypeCode::DPP_PHA_CODE ) ProgramChannel_PHA(chOrGroup); + if( DPPType == DPPTypeCode::DPP_PSD_CODE ) ProgramChannel_PSD(chOrGroup); + if( DPPType == DPPTypeCode::DPP_QDC_CODE ) ProgramChannel_QDC(chOrGroup); +} + int Digitizer::ProgramBoard_PHA(){ DebugPrint("%s", "Digitizer"); printf("===== Digitizer::%s\n", __func__); diff --git a/ClassDigitizer.h b/ClassDigitizer.h index 5340d26..af10da9 100644 --- a/ClassDigitizer.h +++ b/ClassDigitizer.h @@ -99,6 +99,7 @@ class Digitizer{ void PrintBoard(); void ProgramBoard(); + void ProgramChannel(short chOrGroup); void AutoSetDPPEventAggregation(); diff --git a/DigiSettingsPanel.cpp b/DigiSettingsPanel.cpp index e3f48af..0377d5a 100644 --- a/DigiSettingsPanel.cpp +++ b/DigiSettingsPanel.cpp @@ -1562,12 +1562,13 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ QWidget * jaja = new QWidget(this); allSettingLayout->addWidget(jaja); - QHBoxLayout * papa = new QHBoxLayout(jaja); - papa->setAlignment(Qt::AlignLeft); const unsigned short numChannel = digi[ID]->GetNumRegChannels(); {//^============================== Channel selection + QHBoxLayout * papa = new QHBoxLayout(jaja); + papa->setAlignment(Qt::AlignLeft); + QLabel * lbChSel = new QLabel ("Channel : ", this); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); papa->addWidget(lbChSel); @@ -1580,6 +1581,16 @@ void DigiSettingsPanel::SetUpChannel_PHA(){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ SyncAllChannelsTab_PHA(); }); + + bnProgramChannel[ID] = new QPushButton("Program Default Channel Settings",this); + papa->addWidget(bnProgramChannel[ID]); + connect(bnProgramChannel[ID], &QPushButton::clicked, this, [=](){ + short ch = chSelection[ID]->currentData().toInt(); + digi[ID]->ProgramChannel(ch); + digi[ID]->ReadAllSettingsFromBoard(true); + UpdatePanelFromMemory(); + emit UpdateOtherPanels(); + }); } {//*========================= input @@ -2011,12 +2022,12 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ QWidget * jaja = new QWidget(this); allSettingLayout->addWidget(jaja); - QHBoxLayout * papa = new QHBoxLayout(jaja); - papa->setAlignment(Qt::AlignLeft); - const unsigned short numChannel = digi[ID]->GetNumRegChannels(); {//^============================== Channel selection + QHBoxLayout * papa = new QHBoxLayout(jaja); + papa->setAlignment(Qt::AlignLeft); + QLabel * lbChSel = new QLabel ("Ch : ", this); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); papa->addWidget(lbChSel); @@ -2029,6 +2040,16 @@ void DigiSettingsPanel::SetUpChannel_PSD(){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ SyncAllChannelsTab_PSD(); }); + + bnProgramChannel[ID] = new QPushButton("Program Default Channel Settings",this); + papa->addWidget(bnProgramChannel[ID]); + connect(bnProgramChannel[ID], &QPushButton::clicked, this, [=](){ + short ch = chSelection[ID]->currentData().toInt(); + digi[ID]->ProgramChannel(ch); + digi[ID]->ReadAllSettingsFromBoard(true); + UpdatePanelFromMemory(); + emit UpdateOtherPanels(); + }); } {//*=============== input @@ -2595,12 +2616,12 @@ void DigiSettingsPanel::SetUpChannel_QDC(){ QWidget * jaja = new QWidget(this); allSettingLayout->addWidget(jaja); - QHBoxLayout * papa = new QHBoxLayout(jaja); - papa->setAlignment(Qt::AlignLeft); - const unsigned short numGroup = digi[ID]->GetNumRegChannels(); {//^============================== Group selection + QHBoxLayout * papa = new QHBoxLayout(jaja); + papa->setAlignment(Qt::AlignLeft); + QLabel * lbChSel = new QLabel ("Group : ", this); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); papa->addWidget(lbChSel); @@ -2612,14 +2633,21 @@ void DigiSettingsPanel::SetUpChannel_QDC(){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ SyncAllChannelsTab_QDC(); - int grpID = chSelection[ID]->currentIndex() - 1; - for( int i = 0; i < 8; i ++){ lbSubCh[ID][i] ->setText((grpID == -1 ? "Sub-Ch:" : "Ch:" )+ QString::number(grpID < 0 ? i : grpID*8 + i)); lbSubCh2[ID][i]->setText((grpID == -1 ? "Sub-Ch:" : "Ch:" )+ QString::number(grpID < 0 ? i : grpID*8 + i)); - } + } + }); + bnProgramChannel[ID] = new QPushButton("Program Default Channel Settings",this); + papa->addWidget(bnProgramChannel[ID]); + connect(bnProgramChannel[ID], &QPushButton::clicked, this, [=](){ + short group = chSelection[ID]->currentData().toInt(); + digi[ID]->ProgramChannel(group); + digi[ID]->ReadAllSettingsFromBoard(true); + UpdatePanelFromMemory(); + emit UpdateOtherPanels(); }); } diff --git a/DigiSettingsPanel.h b/DigiSettingsPanel.h index 779000c..80f6c06 100644 --- a/DigiSettingsPanel.h +++ b/DigiSettingsPanel.h @@ -198,6 +198,7 @@ private: QTabWidget * chTab; RComboBox * chSelection[MaxNDigitizer]; + QPushButton * bnProgramChannel[MaxNDigitizer]; //----------- common for PHA and PSD RSpinBox * sbRecordLength[MaxNDigitizer][MaxRegChannel + 1];