added channel settings (only UI)

This commit is contained in:
splitPoleDAQ 2023-04-28 18:18:34 -04:00
parent 2643511df6
commit c37f132477
3 changed files with 245 additions and 13 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);
@ -141,6 +141,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
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);
@ -284,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;
@ -411,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
});
@ -485,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);
@ -547,6 +569,144 @@ void DigiSettingsPanel::SetUpPHABoard(){
}
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(){
@ -685,8 +845,6 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
enableSignalSlot = true;
printf("============== end of %s \n", __func__);
}
void DigiSettingsPanel::ReadSettingsFromBoard(){

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;
@ -111,6 +114,8 @@ private:
RComboBox * cbTRGOUTLogic[MaxNDigitizer];
RComboBox * cbTRGOUTUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31
/// ============================ Channel
QWidget * chAllSetting;
//QPushButton * bnTriggerValidMask[MaxNDigitizer][MaxNChannels/2];
};

View File

@ -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 {
@ -434,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 {