Compare commits

...

2 Commits

Author SHA1 Message Date
splitPoleDAQ c37f132477 added channel settings (only UI) 2023-04-28 18:18:34 -04:00
splitPoleDAQ 2643511df6 finish board setting for PHA 2023-04-28 18:18:12 -04:00
4 changed files with 472 additions and 33 deletions

View File

@ -32,7 +32,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
enableSignalSlot = false;
setWindowTitle("Digitizer Settings");
setGeometry(0, 0, 1000, 800);
setGeometry(0, 0, 1300, 800);
tabWidget = new QTabWidget(this);
setCentralWidget(tabWidget);
@ -58,10 +58,10 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
{//^====================== Group of Digitizer Info
infoBox[iDigi] = new QGroupBox("Board Info", tab);
//infoBox->setSizePolicy(sizePolicy);
infoLayout[iDigi] = new QGridLayout(infoBox[iDigi]);
tabLayout_V1->addWidget(infoBox[iDigi]);
infoLayout[iDigi] = new QGridLayout(infoBox[iDigi]);
infoLayout[iDigi]->setSpacing(2);
SetUpInfo( "Model ", digi[ID]->GetModelName(), infoLayout[ID], 0, 0);
SetUpInfo( "DPP Type ", digi[ID]->GetDPPString(), infoLayout[ID], 0, 2);
@ -137,31 +137,44 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
QWidget * buttonsWidget = new QWidget(tab);
tabLayout_V1->addWidget(buttonsWidget);
QGridLayout * buttonLayout = new QGridLayout(buttonsWidget);
buttonLayout->setSpacing(2);
int rowID = 0 ;
QLabel * lbSavePath = new QLabel("Save File Path : ", this);
lbSavePath->setAlignment(Qt::AlignRight | Qt::AlignCenter);
buttonLayout->addWidget(lbSavePath, rowID, 0);
leSaveFilePath = new QLineEdit(this);
leSaveFilePath->setReadOnly(true);
buttonLayout->addWidget(leSaveFilePath, rowID, 1, 1, 3);
rowID ++; //---------------------------
bnRefreshSetting = new QPushButton("Refresh Settings", this);
buttonLayout->addWidget(bnRefreshSetting, 0, 0);
buttonLayout->addWidget(bnRefreshSetting, rowID, 0);
connect(bnRefreshSetting, &QPushButton::clicked, this, &DigiSettingsPanel::ReadSettingsFromBoard);
bnProgramPreDefined = new QPushButton("Clear Buffer/FIFO", this);
buttonLayout->addWidget(bnProgramPreDefined, 0, 1);
buttonLayout->addWidget(bnProgramPreDefined, rowID, 1);
connect(bnProgramPreDefined, &QPushButton::clicked, this, [=](){ digi[ID]->ProgramPHABoard();}); //TODO for PSD
bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this);
buttonLayout->addWidget(bnClearBuffer, 0, 2);
buttonLayout->addWidget(bnClearBuffer, rowID, 2);
connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(Register::DPP::SoftwareClear_W, 1);});
rowID ++; //---------------------------
bnSendSoftwareTriggerSignal = new QPushButton("Send SW Trigger Signal", this);
buttonLayout->addWidget(bnSendSoftwareTriggerSignal, 1, 0);
buttonLayout->addWidget(bnSendSoftwareTriggerSignal, rowID, 0);
connect(bnSendSoftwareTriggerSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(Register::DPP::SoftwareTrigger_W, 1);});
bnSendSoftwareClockSyncSignal = new QPushButton("Send SW Clock-Sync Signal", this);
buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, 1, 1);
buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, rowID, 1);
connect(bnSendSoftwareClockSyncSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(Register::DPP::SoftwareClockSync_W, 1);});
bnSaveSettings = new QPushButton("Save Settings", this);
buttonLayout->addWidget(bnSaveSettings, 1, 2);
buttonLayout->addWidget(bnSaveSettings, rowID, 2);
bnLoadSettings = new QPushButton("Load Settings", this);
buttonLayout->addWidget(bnLoadSettings, 1, 3);
buttonLayout->addWidget(bnLoadSettings, rowID, 3);
}
@ -170,9 +183,101 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
tabLayout_V1->addWidget(boardSettingBox[iDigi]);
settingLayout[iDigi] = new QGridLayout(boardSettingBox[iDigi]);
settingLayout[iDigi]->setSpacing(2);
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard();
//--------------- trigger
QWidget * triggerBox = new QWidget(this);
int row = settingLayout[iDigi]->rowCount();
settingLayout[iDigi]->addWidget(triggerBox, row +1, 0, 3, 4);
triggerLayout[iDigi] = new QGridLayout(triggerBox);
triggerLayout[iDigi]->setAlignment(Qt::AlignLeft);
triggerLayout[iDigi]->setSpacing(2);
for( int i = 0; i < MaxNChannels/2; i++){
if( i % 2 == 0 ){
QLabel * chIDLabel = new QLabel(QString::number(2*i) + "-" + QString::number(2*i + 1), this);
chIDLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
triggerLayout[iDigi]->addWidget(chIDLabel, 0, 1 + i, 1, 2);
}
bnGlobalTriggerMask[ID][i] = new QPushButton(this);
bnGlobalTriggerMask[ID][i]->setFixedSize(QSize(20,20));
//bnGlobalTriggerMask[ID][i]->setToolTip("Ch-" + QString::number(2*i) + "," + QString::number(2*i+1));
bnGlobalTriggerMask[ID][i]->setToolTipDuration(-1);
triggerLayout[iDigi]->addWidget(bnGlobalTriggerMask[ID][i], 1, 1 + i );
bnTRGOUTMask[ID][i] = new QPushButton(this);
bnTRGOUTMask[ID][i]->setFixedSize(QSize(20,20));
bnTRGOUTMask[ID][i]->setToolTipDuration(-1);
triggerLayout[iDigi]->addWidget(bnTRGOUTMask[ID][i], 2, 1 + i );
}
QLabel * lbGlobalTrg = new QLabel("Global Trigger Mask : ", this);
lbGlobalTrg->setAlignment(Qt::AlignRight | Qt::AlignCenter);
triggerLayout[iDigi]->addWidget(lbGlobalTrg, 1, 0);
QLabel * lbMajorCoinWin = new QLabel("Coin. Win [ns] : ", this);
triggerLayout[iDigi]->addWidget(lbMajorCoinWin, 1, 9);
sbGlbMajCoinWin[iDigi] = new RSpinBox(this);
sbGlbMajCoinWin[iDigi]->setMinimum(0);
sbGlbMajCoinWin[iDigi]->setMaximum(0xF * 4 * digi[iDigi]->GetCh2ns() );
sbGlbMajCoinWin[iDigi]->setSingleStep(1);
triggerLayout[iDigi]->addWidget(sbGlbMajCoinWin[iDigi], 1, 10);
QLabel * lbMajorLvl = new QLabel("Maj. Level", this);
lbMajorLvl->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
triggerLayout[iDigi]->addWidget(lbMajorLvl, 0, 11);
sbGlbMajLvl[iDigi] = new RSpinBox(this);
sbGlbMajLvl[iDigi]->setMinimum(0);
sbGlbMajLvl[iDigi]->setMaximum(16);
sbGlbMajLvl[iDigi]->setSingleStep(1);
QLabel * lbOtherTrigger = new QLabel("OR trigger", this);
lbOtherTrigger->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
triggerLayout[iDigi]->addWidget(lbOtherTrigger, 0, 12);
cbGlbUseOtherTriggers[iDigi] = new RComboBox(this);
cbGlbUseOtherTriggers[iDigi]->addItem("None", 0);
cbGlbUseOtherTriggers[iDigi]->addItem("TRG-IN", 1);
cbGlbUseOtherTriggers[iDigi]->addItem("SW", 2);
cbGlbUseOtherTriggers[iDigi]->addItem("TRG-IN OR SW", 3);
triggerLayout[iDigi]->addWidget(cbGlbUseOtherTriggers[iDigi], 1, 12);
QLabel * lbTrgOut = new QLabel("TRG-OUT Mask : ", this);
lbTrgOut->setAlignment(Qt::AlignRight | Qt::AlignCenter);
triggerLayout[iDigi]->addWidget(lbTrgOut, 2, 0);
QLabel * lbTrgOutLogic = new QLabel("Logic : ", this);
lbTrgOutLogic->setAlignment(Qt::AlignRight | Qt::AlignCenter);
triggerLayout[iDigi]->addWidget(lbTrgOutLogic, 2, 9);
cbTRGOUTLogic[iDigi] = new RComboBox(this);
cbTRGOUTLogic[iDigi]->addItem("OR", 0);
cbTRGOUTLogic[iDigi]->addItem("AND", 1);
cbTRGOUTLogic[iDigi]->addItem("Maj.", 3);
triggerLayout[iDigi]->addWidget(cbTRGOUTLogic[iDigi], 2, 10);
triggerLayout[iDigi]->addWidget(sbGlbMajLvl[iDigi], 1, 11);
sbTRGOUTMajLvl[iDigi] = new RSpinBox(this);
sbTRGOUTMajLvl[iDigi]->setMinimum(0);
sbTRGOUTMajLvl[iDigi]->setMaximum(16);
sbTRGOUTMajLvl[iDigi]->setSingleStep(1);
triggerLayout[iDigi]->addWidget(sbTRGOUTMajLvl[iDigi], 2, 11);
cbTRGOUTUseOtherTriggers[iDigi] = new RComboBox(this);
cbTRGOUTUseOtherTriggers[iDigi]->addItem("None", 0);
cbTRGOUTUseOtherTriggers[iDigi]->addItem("TRG-IN", 1);
cbTRGOUTUseOtherTriggers[iDigi]->addItem("SW", 2);
cbTRGOUTUseOtherTriggers[iDigi]->addItem("TRG-IN OR SW", 3);
triggerLayout[iDigi]->addWidget(cbTRGOUTUseOtherTriggers[iDigi], 2, 12);
}
{//^======================= Channel Settings
@ -180,15 +285,35 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
QTabWidget * chTab = new QTabWidget(tab);
tabLayout_H->addWidget(chTab);
QScrollArea * scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
chTab->addTab(scrollArea, "Channel Settings");
chAllSetting = new QWidget(this);
//chAllSetting->setStyleSheet("background-color: #ECECEC;");
chTab->addTab(chAllSetting, "Channel Settings");
QWidget * chStatus = new QWidget(this);
//chStatus->setStyleSheet("background-color: #ECECEC;");
chTab->addTab(chStatus, "Status");
QWidget * chInput = new QWidget(this);
chTab->addTab(chInput, "Input");
QWidget * chTrap = new QWidget(this);
chTab->addTab(chTrap, "Trapezoid");
QWidget * chOthers = new QWidget(this);
chTab->addTab(chOthers, "Others");
QWidget * chTrigger = new QWidget(this);
chTab->addTab(chTrigger, "Trigger");
SetUpPHAChannel();
}
}
//TODO ----- Copy settings tab
connect(tabWidget, &QTabWidget::currentChanged, this, [=](int index){
if( index < (int) nDigi) {
ID = index;
@ -245,7 +370,6 @@ void DigiSettingsPanel::SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLa
cb = new RComboBox(this);
gLayout->addWidget(cb, row, col + 1);
for(int i = 0; i < (int) items.size(); i++){
cb->addItem(QString::fromStdString(items[i].first), items[i].second);
}
@ -286,10 +410,11 @@ void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout
gLayout->addWidget(sb, row, col + 1);
sb->setMinimum(0);
sb->setMaximum(para.GetMax());
if( para.GetPartialStep() == -1 ) {
sb->setSingleStep(1);
sb->setMaximum(para.GetMaxBit());
}else{
sb->setMaximum(para.GetMaxBit() * para.GetPartialStep() * digi[ID]->GetCh2ns());
sb->setSingleStep(para.GetPartialStep() * digi[ID]->GetCh2ns());
}
@ -307,6 +432,7 @@ void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout
sb->setValue( (std::round(value/step)*step));
}
sb->setStyleSheet("");
digi[ID]->WriteRegister(para, sb->value(), -1); //TODO for each channel
});
@ -381,9 +507,9 @@ void DigiSettingsPanel::SetUpPHABoard(){
SetUpCheckBox(chkEnableExtra2[ID], "Enable Extra2", settingLayout[ID], 3, 1, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::EnableExtra2);
SetUpComboBoxBit(cbAnaProbe1[ID], "Ana. Probe 1 ", settingLayout[ID], 1, 2, Register::DPP::Bit_BoardConfig::ListAnaProbe1, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe1);
SetUpComboBoxBit(cbAnaProbe2[ID], "Ana. Probe 2 ", settingLayout[ID], 2, 2, Register::DPP::Bit_BoardConfig::ListAnaProbe2, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe2);
SetUpComboBoxBit(cbDigiProbe1[ID], "Digi. Probe 1 ", settingLayout[ID], 3, 2, Register::DPP::Bit_BoardConfig::ListDigiProbe1, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DigiProbel1);
SetUpComboBoxBit(cbAnaProbe1[ID], "Ana. Probe 1 ", settingLayout[ID], 1, 2, Register::DPP::Bit_BoardConfig::ListAnaProbe1_PHA, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe1);
SetUpComboBoxBit(cbAnaProbe2[ID], "Ana. Probe 2 ", settingLayout[ID], 2, 2, Register::DPP::Bit_BoardConfig::ListAnaProbe2_PHA, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe2);
SetUpComboBoxBit(cbDigiProbe1[ID], "Digi. Probe 1 ", settingLayout[ID], 3, 2, Register::DPP::Bit_BoardConfig::ListDigiProbe1_PHA, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DigiProbel1);
SetUpComboBoxBit(cbDigiProbe2[ID], "Digi. Probe 2 ", settingLayout[ID], 4, 2, {{"trigger", 0}}, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DigiProbel2);
cbDigiProbe2[ID]->setEnabled(false);
@ -408,8 +534,179 @@ void DigiSettingsPanel::SetUpPHABoard(){
SetUpSpinBox(sbBufferGain[ID], "Buffer Occup. Gain ", settingLayout[ID], 8, 2, Register::DPP::BufferOccupancyGain);
SetUpComboBoxBit(cbLEMOMode[ID], "LEMO Mode ", settingLayout[ID], 9, 0, Register::DPP::Bit_FrontPanelIOControl::ListLEMOLevel, Register::DPP::FrontPanelIOControl, Register::DPP::Bit_FrontPanelIOControl::LEMOLevel);
///============================ Trig out mode
QLabel * trgOutMode = new QLabel("TRI-OUT Mode ", this);
trgOutMode->setAlignment(Qt::AlignRight | Qt::AlignCenter);
settingLayout[ID]->addWidget(trgOutMode, 9, 2);
cbTRGOUTMode[ID] = new RComboBox(this);
settingLayout[ID]->addWidget(cbTRGOUTMode[ID], 9, 3);
std::vector<std::pair<std::string, unsigned int>> items = Register::DPP::Bit_FrontPanelIOControl::ListTRGOUTConfig;
for(int i = 0; i < (int) items.size(); i++){
cbTRGOUTMode[ID]->addItem(QString::fromStdString(items[i].first), items[i].second);
}
connect( cbTRGOUTMode[ID], &RComboBox::currentIndexChanged, this, [=](int index){
if( !enableSignalSlot ) return;
if( index == 0 ) {
digi[ID]->SetBits(Register::DPP::FrontPanelIOControl, Register::DPP::Bit_FrontPanelIOControl::DisableTrgOut, 1, -1);
}else{
digi[ID]->SetBits(Register::DPP::FrontPanelIOControl, Register::DPP::Bit_FrontPanelIOControl::DisableTrgOut, 0, -1);
unsigned short bit = (cbTRGOUTMode[ID]->currentData().toUInt() >> 14) & 0x3F ;
digi[ID]->SetBits(Register::DPP::FrontPanelIOControl, {6, 14}, bit, -1);
}
});
}
void DigiSettingsPanel::SetUpPHAChannel(){
QVBoxLayout * allSettingLayout = new QVBoxLayout(chAllSetting);
allSettingLayout->setAlignment(Qt::AlignTop);
{//^========================= input
QGroupBox * inputBox = new QGroupBox("input Settings", this);
allSettingLayout->addWidget(inputBox);
QGridLayout * inputLayout = new QGridLayout(inputBox);
RSpinBox * sbRecordLength;
SetUpSpinBox(sbRecordLength, "Record Length [G][ns] : ", inputLayout, 0, 0, Register::DPP::RecordLength_G);
RComboBox * cbDynamicRange;
SetUpComboBox(cbDynamicRange, "Dynamic Range : ", inputLayout, 0, 2, Register::DPP::InputDynamicRange);
RSpinBox * sbPreTrigger;
SetUpSpinBox(sbPreTrigger, "Pre-Trigger [ns] : ", inputLayout, 1, 0, Register::DPP::PreTrigger);
RComboBox * cbRCCR2Smoothing;
SetUpComboBox(cbRCCR2Smoothing, "Smoothing factor : ", inputLayout, 1, 2, Register::DPP::PHA::RCCR2SmoothingFactor);
RSpinBox * sbInputRiseTime;
SetUpSpinBox(sbInputRiseTime, "Rise Time [ns] : ", inputLayout, 2, 0, Register::DPP::PHA::InputRiseTime);
RSpinBox * sbThreshold;
SetUpSpinBox(sbThreshold, "Threshold [LSB] : ", inputLayout, 2, 2, Register::DPP::PHA::TriggerThreshold);
RSpinBox * sbRiseTimeValidWin;
SetUpSpinBox(sbRiseTimeValidWin, "Rise Time Valid. Win. [ns] : ", inputLayout, 3, 0, Register::DPP::PHA::RiseTimeValidationWindow);
RSpinBox * sbTriggerHoldOff;
SetUpSpinBox(sbTriggerHoldOff, "Tigger Hold-off [ns] : ", inputLayout, 3, 2, Register::DPP::PHA::TriggerHoldOffWidth);
RSpinBox * sbShapedTrigWidth;
SetUpSpinBox(sbShapedTrigWidth, "Shaped Trig. Width [ns] : ", inputLayout, 4, 0, Register::DPP::PHA::ShapedTriggerWidth);
RSpinBox * sbDCOffset;
SetUpSpinBox(sbDCOffset, "DC Offset [%] : ", inputLayout, 4, 2, Register::DPP::ChannelDCOffset);
RComboBox * cbPolarity;
SetUpComboBoxBit(cbPolarity, "Polarity : ", inputLayout, 5, 0, Register::DPP::Bit_DPPAlgorithmControl::ListPolarity, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::Polarity);
}
{//^===================== Trapezoid
QGroupBox * trapBox = new QGroupBox("Trapezoid Settings", this);
allSettingLayout->addWidget(trapBox);
QGridLayout * trapLayout = new QGridLayout(trapBox);
RSpinBox * sbTrapRiseTime;
SetUpSpinBox(sbTrapRiseTime, "Rise Time [ns] : ", trapLayout, 0, 0, Register::DPP::PHA::TrapezoidRiseTime);
RSpinBox * sbTrapFlatTop;
SetUpSpinBox(sbTrapFlatTop, "Flat Top [ns] : ", trapLayout, 0, 2, Register::DPP::PHA::TrapezoidFlatTop);
RSpinBox * sbDecay;
SetUpSpinBox(sbDecay, "Decay [ns] : ", trapLayout, 1, 0, Register::DPP::PHA::DecayTime);
RSpinBox * sbTrapScaling;
SetUpSpinBox(sbTrapScaling, "Rescaling : ", trapLayout, 1, 2, Register::DPP::PHA::DPPAlgorithmControl2_G);
RSpinBox * sbPeaking;
SetUpSpinBox(sbPeaking, "Peaking [ns] : ", trapLayout, 2, 0, Register::DPP::PHA::PeakingTime);
RSpinBox * sbPeakingHoldOff;
SetUpSpinBox(sbPeakingHoldOff, "Peaking Hold-off [ns] : ", trapLayout, 2, 2, Register::DPP::PHA::PeakHoldOff);
RComboBox * cbPeakAvg;
SetUpComboBoxBit(cbPeakAvg, "Peak Avg. : ", trapLayout, 3, 0, Register::DPP::Bit_DPPAlgorithmControl::ListPeakMean, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::PeakMean);
RComboBox * cBaseLineAvg;
SetUpComboBoxBit(cBaseLineAvg, "Baseline Avg. : ", trapLayout, 3, 2, Register::DPP::Bit_DPPAlgorithmControl::ListBaselineAvg, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::BaselineAvg);
QCheckBox * chkActiveBaseline;
SetUpCheckBox(chkActiveBaseline, "Active basline [G]", trapLayout, 4, 0, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ActivebaselineCalulation);
QCheckBox * chkBaselineRestore;
SetUpCheckBox(chkBaselineRestore, "Baseline Restorer [G]", trapLayout, 4, 1, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::EnableActiveBaselineRestoration);
RSpinBox * sbFineGain;
SetUpSpinBox(sbFineGain, "Fine Gain : ", trapLayout, 4, 2, Register::DPP::PHA::FineGain);
}
{//^====================== Others
QGroupBox * otherBox = new QGroupBox("Others Settings", this);
allSettingLayout->addWidget(otherBox);
QGridLayout * otherLayout = new QGridLayout(otherBox);
RComboBox * cbDecimateTrace;
SetUpComboBoxBit(cbDecimateTrace, "Decimate Trace : ", otherLayout, 0, 0, Register::DPP::Bit_DPPAlgorithmControl::ListTraceDecimation, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TraceDecimation);
RComboBox * cbDecimateGain;
SetUpComboBoxBit(cbDecimateGain, "Decimate Gain : ", otherLayout, 0, 2, Register::DPP::Bit_DPPAlgorithmControl::ListDecimationGain, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TraceDeciGain);
RComboBox * cbTrigMode;
SetUpComboBoxBit(cbTrigMode, "Trig Mode : ", otherLayout, 1, 0, Register::DPP::Bit_DPPAlgorithmControl::ListTrigMode, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TriggerMode);
QCheckBox * chkDisableSelfTrigger;
SetUpCheckBox(chkDisableSelfTrigger, "Disable Self Trigger ", otherLayout, 1, 2, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::DisableSelfTrigger);
QCheckBox * chkEnableRollOver;
SetUpCheckBox(chkEnableRollOver, "Enable Roll-Over Event", otherLayout, 2, 0, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::EnableRollOverFlag);
QCheckBox * chkEnablePileUp;
SetUpCheckBox(chkEnablePileUp, "Allow Pile-up Event", otherLayout, 2, 2, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::EnablePileUpFlag);
RComboBox * cbShapedTrigger;
SetUpComboBoxBit(cbShapedTrigger, "Local Shaped Trig. [G] : ", otherLayout, 3, 0, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode);
RComboBox * cbTriggerValid;
SetUpComboBoxBit(cbTriggerValid, "Local Trig. Valid. [G] : ", otherLayout, 3, 2, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode);
RComboBox * cbExtra2Option;
SetUpComboBoxBit(cbExtra2Option, "Extra2 Option [G] : ", otherLayout, 4, 0, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option);
RComboBox * cbVetoSource;
SetUpComboBoxBit(cbVetoSource, "Veto Source [G] : ", otherLayout, 4, 2, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListVetoSource, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::VetoSource);
RComboBox * cbTrigCount;
SetUpComboBoxBit(cbTrigCount, "Trig. Counter Flag [G] : ", otherLayout, 5, 0, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListTrigCounter, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag);
RSpinBox * sbNumEventAgg;
SetUpSpinBox(sbNumEventAgg, "Events per Agg. [G] : ", otherLayout, 5, 2, Register::DPP::NumberEventsPerAggregate_G);
QCheckBox * chkTagCorrelation;
SetUpCheckBox(chkTagCorrelation, "Tag Correlated events [G]", otherLayout, 6, 0, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::TagCorrelatedEvents);
//TODO VETO width
}
}
void DigiSettingsPanel::SetUpPSDBoard(){
@ -529,9 +826,24 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
sbBufferGain[ID]->setValue(digi[ID]->GetSettingFromMemory(Register::DPP::BufferOccupancyGain));
enableSignalSlot = true;
printf("============== end of %s \n", __func__);
uint32_t frontPanel = digi[ID]->GetSettingFromMemory(Register::DPP::FrontPanelIOControl);
cbLEMOMode[ID]->setCurrentIndex( ( frontPanel & 0x1 ));
if( (frontPanel >> 1 ) & 0x1 ) { // bit-1, TRIG-OUT high impedance, i.e. disable
cbTRGOUTMode[ID]->setCurrentIndex(0);
}else{
unsigned short trgOutBit = ((frontPanel >> 14 ) & 0x3F ) << 14 ;
for( int i = 0; i < cbTRGOUTMode[ID]->count() ; i++ ){
if( cbTRGOUTMode[ID]->itemData(i).toUInt() == trgOutBit ){
cbTRGOUTMode[ID]->setCurrentIndex(i);
break;
}
}
}
enableSignalSlot = true;
}

View File

@ -38,8 +38,11 @@ private:
void CleanUpGroupBox(QGroupBox * & gBox);
void SetUpPHABoard();
void SetUpPHAChannel();
void SetUpPSDBoard();
Digitizer ** digi;
unsigned int nDigi;
unsigned short ID;
@ -51,6 +54,8 @@ private:
QGroupBox * infoBox[MaxNDigitizer];
QGridLayout * infoLayout[MaxNDigitizer];
QLineEdit * leSaveFilePath;
QPushButton * bnRefreshSetting; // read setting from board
QPushButton * bnProgramPreDefined;
QPushButton * bnClearBuffer;
@ -60,7 +65,7 @@ private:
QPushButton * bnSaveSettings;
QPushButton * bnLoadSettings;
/// ============================= Board Configure
QGroupBox * boardSettingBox[MaxNDigitizer];
QGridLayout * settingLayout[MaxNDigitizer];
@ -88,11 +93,31 @@ private:
RComboBox * cbAcqStartArm[MaxNDigitizer];
RComboBox * cbPLLRefClock[MaxNDigitizer];
RComboBox * cbLEMOMode[MaxNDigitizer];
RComboBox * cbTRGOUTMode[MaxNDigitizer];
/// ============================= board Status
QPushButton * bnACQStatus[MaxNDigitizer][9];
QPushButton * bnBdFailStatus[MaxNDigitizer][3];
QPushButton * bnReadOutStatus[MaxNDigitizer][3];
/// ============================= Trigger Configure
QGridLayout * triggerLayout[MaxNDigitizer];
QPushButton * bnGlobalTriggerMask[MaxNDigitizer][MaxNChannels/2];
RSpinBox * sbGlbMajCoinWin[MaxNDigitizer];
RSpinBox * sbGlbMajLvl[MaxNDigitizer];
RComboBox * cbGlbUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31
QPushButton * bnTRGOUTMask[MaxNDigitizer][MaxNChannels/2];
RSpinBox * sbTRGOUTMajLvl[MaxNDigitizer];
RComboBox * cbTRGOUTLogic[MaxNDigitizer];
RComboBox * cbTRGOUTUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31
/// ============================ Channel
QWidget * chAllSetting;
//QPushButton * bnTriggerValidMask[MaxNDigitizer][MaxNChannels/2];
};

View File

@ -31,7 +31,7 @@ class Reg{
address = 0;
type = RW::ReadWrite;
group = 0;
maxValue = 0;
maxBit = 0;
partialStep = 0;
comboList.clear();
}
@ -40,7 +40,7 @@ class Reg{
this->address = address;
this->type = type;
this->group = group;
this->maxValue = max;
this->maxBit = max;
this->partialStep = pStep;
comboList.clear();
};
@ -50,7 +50,7 @@ class Reg{
this->address = address;
this->type = type;
this->group = group;
this->maxValue = 0;
this->maxBit = 0;
this->partialStep = 0;
this->comboList = list;
}
@ -64,7 +64,7 @@ class Reg{
uint32_t GetAddress() const {return address; }
RW GetType() const {return type;}
bool GetGroup() const {return group;}
unsigned int GetMax() const {return maxValue;}
unsigned int GetMaxBit() const {return maxBit;}
int GetPartialStep() const {return partialStep;} /// step = partialStep * ch2ns, -1 : step = 1
void Print() const ;
@ -88,7 +88,7 @@ class Reg{
uint32_t address; /// This is the table of register, the actual address should call ActualAddress();
RW type; /// read/write = 0; read = 1; write = 2
bool group;
unsigned int maxValue ;
unsigned int maxBit ;
int partialStep;
std::vector<std::pair<std::string, unsigned int>> comboList;
};
@ -98,7 +98,7 @@ inline void Reg::Print() const{
printf(" Re.Address: 0x%04X\n", address);
printf(" Type: %s\n", type == RW::ReadWrite ? "Read/Write" : (type == RW::ReadONLY ? "Read-Only" : "Write-Only") );
printf(" Group: %s\n", group ? "True" : "False");
printf(" Max Value : 0x%X = %d \n", maxValue, maxValue);
printf(" Max Value : 0x%X = %d \n", maxBit, maxBit);
}
inline unsigned short Reg::Index (unsigned short ch){
@ -211,16 +211,16 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const std::pair<unsigned short, unsigned short> DigiProbel1 = {4, 20} ;
const std::pair<unsigned short, unsigned short> DigiProbel2 = {3, 26} ;
const std::vector<std::pair<std::string, unsigned int>> ListAnaProbe1 = {{"Input", 0},
const std::vector<std::pair<std::string, unsigned int>> ListAnaProbe1_PHA = {{"Input", 0},
{"RC-CR", 1},
{"RC-CR2", 2},
{"Trapezoid", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListAnaProbe2 = {{"Input", 0},
const std::vector<std::pair<std::string, unsigned int>> ListAnaProbe2_PHA = {{"Input", 0},
{"Threshold", 1},
{"Trap. - Baseline", 2},
{"Trap. Baseline", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListDigiProbe1 = {{"Peaking", 0},
const std::vector<std::pair<std::string, unsigned int>> ListDigiProbe1_PHA = {{"Peaking", 0},
{"Armed", 1},
{"Peak Run", 2},
{"Pile Up", 3},
@ -248,6 +248,36 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const std::pair<unsigned short, unsigned short> EnableRollOverFlag = {1, 26};
const std::pair<unsigned short, unsigned short> EnablePileUpFlag = {1, 27};
const std::vector<std::pair<std::string, unsigned int>> ListTraceDecimation = {{"Disabled", 0},
{"2 samples", 1},
{"4 samples", 2},
{"8 samples", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListDecimationGain = {{"x1", 0},
{"x2", 1},
{"x4", 2},
{"x8", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListPeakMean = {{"1 sample", 0},
{"4 sample", 1},
{"16 sample", 2},
{"64 sample", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListPolarity = {{"Positive", 0},
{"Negative", 1}};
const std::vector<std::pair<std::string, unsigned int>> ListTrigMode = {{"Independent", 0},
{"Coincident (Shape Trig.)", 1},
{"Anti-Coincident (Shape Trig.)", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListBaselineAvg = {{"Not Used", 0},
{"16 samples", 1},
{"64 samples", 2},
{"256 samples", 3},
{"1024 samples", 4},
{"4096 samples", 5},
{"16384 samples", 6}};
}
namespace Bit_AcquistionControl {
@ -279,7 +309,40 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const std::pair<unsigned short, unsigned short> VMEBaseAddressReclocated = {1, 6} ;
const std::pair<unsigned short, unsigned short> InterrupReleaseMode = {1, 7} ;
const std::pair<unsigned short, unsigned short> EnableExtendedBlockTransfer = {1, 8} ;
}
namespace Bit_FrontPanelIOControl {
const std::pair<unsigned short, unsigned short> LEMOLevel = {1, 0} ;
const std::pair<unsigned short, unsigned short> DisableTrgOut = {1, 1} ;
const std::pair<unsigned short, unsigned short> LVDSDirection1 = {1, 2} ; // [3:0]
const std::pair<unsigned short, unsigned short> LVDSDirection2 = {1, 3} ; // [7:4]
const std::pair<unsigned short, unsigned short> LVDSDirection3 = {1, 4} ; // [11:8]
const std::pair<unsigned short, unsigned short> LVDSDirection4 = {1, 5} ; // [15:12]
const std::pair<unsigned short, unsigned short> LVDSConfiguration = {2, 6};
const std::pair<unsigned short, unsigned short> LVDSNewFeature = {1, 8};
const std::pair<unsigned short, unsigned short> LVDSLatchMode = {1, 9};
const std::pair<unsigned short, unsigned short> TRGINMode = {1, 10};
const std::pair<unsigned short, unsigned short> TRGINMezzanine = {1, 11};
const std::pair<unsigned short, unsigned short> TRGOUTConfig = {6, 14};
const std::pair<unsigned short, unsigned short> PatternConfig = {2, 21};
const std::vector<std::pair<std::string, unsigned int>> ListLEMOLevel = {{"NIM I/O", 0},
{"TTL I/O", 1}};
const std::vector<std::pair<std::string, unsigned int>> ListTRGIMode = {{"Edge of TRG-IN", 0},
{"Whole duration of TR-IN", 1}};
const std::vector<std::pair<std::string, unsigned int>> ListTRGIMezzanine = {{"Pocessed by Motherboard", 0},
{"Skip Motherboard", 1}};
const std::vector<std::pair<std::string, unsigned int>> ListTRGOUTConfig = {{"Disable", 0x00002}, /// this is TRG_OUT high imped. 0x811C bit[1]
{"force TRG-OUT is 0", 0x08000},
{"force TRG-OUT is 1", 0x0C000},
{"Trigger (Mask)", 0x00000},
{"Channel Probe", 0x20000},
{"S-IN", 0x30000},
{"RUN", 0x10000},
{"Sync Clock", 0x50000},
{"Clock Phase", 0x90000},
{"BUSY/UNLOCK", 0xD0000}};
}
@ -401,6 +464,45 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1084, RW::ReadWrite, false, 0x3FF, 4); /// R/W not sure
const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x10A0, RW::ReadWrite, true, {}); /// R/W OK
const Reg FineGain ("FineGain" , 0x10C4, RW::ReadWrite, false, {}); /// R/W OK
namespace Bit_DPPAlgorithmControl2 {
const std::pair<unsigned short, unsigned short> LocalShapeTriggerMode = {3, 0} ;
const std::pair<unsigned short, unsigned short> LocalTrigValidMode = {3, 4} ;
const std::pair<unsigned short, unsigned short> Extra2Option = {3, 8} ;
const std::pair<unsigned short, unsigned short> VetoSource = {2, 14} ;
const std::pair<unsigned short, unsigned short> TriggerCounterFlag = {2, 16} ;
const std::pair<unsigned short, unsigned short> ActivebaselineCalulation = {1, 18} ;
const std::pair<unsigned short, unsigned short> TagCorrelatedEvents = {1, 19} ;
const std::pair<unsigned short, unsigned short> EnableActiveBaselineRestoration = {1, 29} ;
const std::vector<std::pair<std::string, unsigned int>> ListLocalShapeTrigMode = {{"Disabled", 0},
{"AND", 4},
{"The even Channel", 5},
{"The odd Channel", 6},
{"OR", 7}};
const std::vector<std::pair<std::string, unsigned int>> ListLocalTrigValidMode = {{"Disabled", 0},
{"Crossed", 4},
{"Equal", 5},
{"AND", 6},
{"OR", 7}};
const std::vector<std::pair<std::string, unsigned int>> ListExtra2 = {{"Extended timeStamp + baseline * 4", 0},
{"Extended timeStamp + Fine timestamp", 2},
{"Lost Trig. Count + Total Trig. Count", 4},
{"Event Before 0-xing + After 0-xing", 5}};
const std::vector<std::pair<std::string, unsigned int>> ListVetoSource = {{"Disabled", 0},
{"Common (Global Trig. Mask)", 1},
{"Difference (Trig. Mask)", 2},
{"Negative Saturation", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListTrigCounter = {{"1024", 0},
{"128", 1},
{"8192", 2}};
}
}
namespace PSD {

View File

@ -350,7 +350,7 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re
sb = new RSpinBox(settingGroup);
if( para.GetPartialStep() != 0 ){
sb->setMinimum(0);
sb->setMaximum(para.GetMax() * para.GetPartialStep() * ch2ns);
sb->setMaximum(para.GetMaxBit() * para.GetPartialStep() * ch2ns);
if( para.GetPartialStep() > 0 ) sb->setSingleStep(para.GetPartialStep() * ch2ns);
if( para.GetPartialStep() == -1 ) sb->setSingleStep(1);
}