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();
}
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__);

View File

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

View File

@ -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();
});
}

View File

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