added a button on the channel setting to set default channel settings for Si-detector

This commit is contained in:
Ryan Tang 2024-11-01 17:03:10 -04:00
parent 9bdd6b77eb
commit c1f223532c
4 changed files with 49 additions and 11 deletions

View File

@ -326,6 +326,14 @@ void Digitizer::ProgramBoard(){
if( DPPType == DPPTypeCode::DPP_QDC_CODE ) ProgramBoard_QDC(); 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(){ int Digitizer::ProgramBoard_PHA(){
DebugPrint("%s", "Digitizer"); DebugPrint("%s", "Digitizer");
printf("===== Digitizer::%s\n", __func__); printf("===== Digitizer::%s\n", __func__);

View File

@ -99,6 +99,7 @@ class Digitizer{
void PrintBoard(); void PrintBoard();
void ProgramBoard(); void ProgramBoard();
void ProgramChannel(short chOrGroup);
void AutoSetDPPEventAggregation(); void AutoSetDPPEventAggregation();

View File

@ -1562,12 +1562,13 @@ void DigiSettingsPanel::SetUpChannel_PHA(){
QWidget * jaja = new QWidget(this); QWidget * jaja = new QWidget(this);
allSettingLayout->addWidget(jaja); allSettingLayout->addWidget(jaja);
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
const unsigned short numChannel = digi[ID]->GetNumRegChannels(); const unsigned short numChannel = digi[ID]->GetNumRegChannels();
{//^============================== Channel selection {//^============================== Channel selection
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
QLabel * lbChSel = new QLabel ("Channel : ", this); QLabel * lbChSel = new QLabel ("Channel : ", this);
lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight);
papa->addWidget(lbChSel); papa->addWidget(lbChSel);
@ -1580,6 +1581,16 @@ void DigiSettingsPanel::SetUpChannel_PHA(){
connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){
SyncAllChannelsTab_PHA(); 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 {//*========================= input
@ -2011,12 +2022,12 @@ void DigiSettingsPanel::SetUpChannel_PSD(){
QWidget * jaja = new QWidget(this); QWidget * jaja = new QWidget(this);
allSettingLayout->addWidget(jaja); allSettingLayout->addWidget(jaja);
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
const unsigned short numChannel = digi[ID]->GetNumRegChannels(); const unsigned short numChannel = digi[ID]->GetNumRegChannels();
{//^============================== Channel selection {//^============================== Channel selection
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
QLabel * lbChSel = new QLabel ("Ch : ", this); QLabel * lbChSel = new QLabel ("Ch : ", this);
lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight);
papa->addWidget(lbChSel); papa->addWidget(lbChSel);
@ -2029,6 +2040,16 @@ void DigiSettingsPanel::SetUpChannel_PSD(){
connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){
SyncAllChannelsTab_PSD(); 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 {//*=============== input
@ -2595,12 +2616,12 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QWidget * jaja = new QWidget(this); QWidget * jaja = new QWidget(this);
allSettingLayout->addWidget(jaja); allSettingLayout->addWidget(jaja);
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
const unsigned short numGroup = digi[ID]->GetNumRegChannels(); const unsigned short numGroup = digi[ID]->GetNumRegChannels();
{//^============================== Group selection {//^============================== Group selection
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
QLabel * lbChSel = new QLabel ("Group : ", this); QLabel * lbChSel = new QLabel ("Group : ", this);
lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight);
papa->addWidget(lbChSel); papa->addWidget(lbChSel);
@ -2612,14 +2633,21 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){
SyncAllChannelsTab_QDC(); SyncAllChannelsTab_QDC();
int grpID = chSelection[ID]->currentIndex() - 1; int grpID = chSelection[ID]->currentIndex() - 1;
for( int i = 0; i < 8; i ++){ for( int i = 0; i < 8; i ++){
lbSubCh[ID][i] ->setText((grpID == -1 ? "Sub-Ch:" : "Ch:" )+ QString::number(grpID < 0 ? i : grpID*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)); 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();
}); });
} }

View File

@ -198,6 +198,7 @@ private:
QTabWidget * chTab; QTabWidget * chTab;
RComboBox * chSelection[MaxNDigitizer]; RComboBox * chSelection[MaxNDigitizer];
QPushButton * bnProgramChannel[MaxNDigitizer];
//----------- common for PHA and PSD //----------- common for PHA and PSD
RSpinBox * sbRecordLength[MaxNDigitizer][MaxRegChannel + 1]; RSpinBox * sbRecordLength[MaxNDigitizer][MaxRegChannel + 1];