FSUDAQ_Qt6/DigiSettingsPanel.h

312 lines
12 KiB
C
Raw Normal View History

2023-04-24 17:37:03 -04:00
#ifndef DigiSettings_H
#define DigiSettings_H
#include <QMainWindow>
#include <QTabWidget>
#include <QLineEdit>
#include <QGridLayout>
2023-04-25 17:04:46 -04:00
#include <QCheckBox>
#include <QGroupBox>
#include <QPushButton>
2023-05-15 17:18:53 -04:00
#include <QRadioButton>
2023-04-24 17:37:03 -04:00
#include "macro.h"
#include "ClassDigitizer.h"
#include "CustomWidgets.h"
class DigiSettingsPanel : public QMainWindow{
Q_OBJECT
public:
DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QString rawDataPath, QMainWindow * parent = nullptr);
2023-04-24 17:37:03 -04:00
~DigiSettingsPanel();
2023-12-12 19:13:38 -05:00
unsigned short GetTabID() const {return ID;}
2023-10-19 14:29:28 -04:00
public slots:
2023-04-25 17:04:46 -04:00
void UpdatePanelFromMemory();
void ReadSettingsFromBoard();
2023-10-19 14:29:28 -04:00
void UpdateACQStatus(uint32_t status);
void UpdateReadOutStatus(uint32_t status);
void UpdateBoardAndChannelsStatus(); // directly read from register
2023-04-25 17:04:46 -04:00
void SaveSetting(int opt);
void LoadSetting();
void EnableButtons(bool enable);
2023-04-24 17:37:03 -04:00
signals:
void SendLogMsg(const QString &msg);
void UpdateOtherPanels();
2023-04-24 17:37:03 -04:00
private:
2023-04-25 17:04:46 -04:00
void SetUpInfo(QString label, std::string value, QGridLayout *gLayout, int row, int col);
2023-05-09 12:16:08 -04:00
void SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Reg para, std::pair<unsigned short, unsigned short> bit, int ch = -1, int colSpan = 1);
void SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector<std::pair<std::string, unsigned int>> items, Reg para, std::pair<unsigned short, unsigned short> bit, int colspan = 1, int ch = -1);
void SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, Reg para, int ch = -1);
void SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout *gLayout, int row, int col, Reg para, int ch = -1, bool isBoard = false);
2023-04-25 17:04:46 -04:00
void CleanUpGroupBox(QGroupBox * & gBox);
2023-05-09 12:16:08 -04:00
void SetUpChannelMask(unsigned int digiID);
2023-05-09 12:16:08 -04:00
void SetUpACQReadOutTab();
void SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * & gLayout);
void SetUpInquiryCopyTab();
void SetUpBoard_PHA();
void SetUpChannel_PHA();
2023-04-28 18:18:34 -04:00
void SetUpBoard_PSD();
void SetUpChannel_PSD();
void SetUpBoard_QDC();
void SetUpChannel_QDC();
2023-04-24 17:37:03 -04:00
void UpdateSpinBox(RSpinBox * &sb, Reg para, int ch);
void UpdateComboBox(RComboBox * &cb, Reg para, int ch);
void UpdateComboBoxBit(RComboBox * &cb, uint32_t fullBit, std::pair<unsigned short, unsigned short> bit);
void SyncSpinBox(RSpinBox *(&spb)[][MaxRegChannel+1]);
void SyncComboBox(RComboBox *(&cb)[][MaxRegChannel+1]);
void SyncCheckBox(QCheckBox *(&chk)[][MaxRegChannel+1]);
2023-05-09 15:54:55 -04:00
void SyncAllChannelsTab_PHA();
void UpdateSettings_PHA();
2023-05-09 15:54:55 -04:00
void SyncAllChannelsTab_PSD();
void UpdateSettings_PSD();
void SyncAllChannelsTab_QDC();
void UpdateSettings_QDC();
2023-05-15 17:18:53 -04:00
void CheckRadioAndCheckedButtons();
2023-04-24 17:37:03 -04:00
Digitizer ** digi;
unsigned int nDigi;
2023-04-25 17:04:46 -04:00
unsigned short ID;
2023-04-24 17:37:03 -04:00
2023-05-12 16:06:32 -04:00
std::vector<Reg> chRegList;
2023-05-15 17:18:53 -04:00
RComboBox * cbFromBoard;
RComboBox * cbToBoard;
QRadioButton * rbCh[MaxRegChannel]; // Copy from ch
QCheckBox * chkCh[MaxRegChannel]; // Copy to Ch
2023-05-15 17:18:53 -04:00
QPushButton * bnCopyBoard;
QPushButton * bnCopyChannel;
QString rawDataPath;
2023-04-24 17:37:03 -04:00
bool enableSignalSlot;
QTabWidget * tabWidget;
2023-04-25 17:04:46 -04:00
QGroupBox * infoBox[MaxNDigitizer];
QGridLayout * infoLayout[MaxNDigitizer];
QLineEdit * leSaveFilePath[MaxNDigitizer];
2023-04-28 18:18:12 -04:00
QWidget * buttonsWidget[MaxNDigitizer];
2023-04-25 17:04:46 -04:00
QPushButton * bnRefreshSetting; // read setting from board
2023-04-26 16:39:54 -04:00
QPushButton * bnProgramPreDefined;
QPushButton * bnClearBuffer;
// QPushButton * bnSendSoftwareTriggerSignal;
QPushButton * bnSetNoTrace;
QPushButton * bhAutoSetEventPulling;
//QPushButton * bnSendSoftwareClockSyncSignal;
2023-04-26 16:39:54 -04:00
QPushButton * bnSaveSettings;
QPushButton * bnLoadSettings;
//QPushButton * bnSaveSettingsToText;
QCheckBox * chkCoupledSettingFile;
2023-04-26 16:39:54 -04:00
2023-04-28 18:18:12 -04:00
/// ============================= Board Configure
QGridLayout * bdCfgLayout[MaxNDigitizer];
QGridLayout * bdACQLayout[MaxNDigitizer];
QGridLayout * bdGlbTRGOUTLayout[MaxNDigitizer];
QGridLayout * bdTriggerLayout[MaxNDigitizer];
QGridLayout * bdLVDSLayout[MaxNDigitizer];
2023-04-25 17:04:46 -04:00
// RComboBox * cbSWDecimation[MaxNDigitizer]; // software decimation
RSpinBox * sbSWDecimation[MaxNDigitizer];
2023-04-25 17:04:46 -04:00
QCheckBox * chkAutoDataFlush[MaxNDigitizer];
QCheckBox * chkDecimateTrace[MaxNDigitizer];
QCheckBox * chkTrigPropagation[MaxNDigitizer];
QCheckBox * chkDualTrace[MaxNDigitizer];
QCheckBox * chkTraceRecording[MaxNDigitizer];
QCheckBox * chkEnableExtra2[MaxNDigitizer];
RComboBox * cbAnaProbe1[MaxNDigitizer];
RComboBox * cbAnaProbe2[MaxNDigitizer];
RComboBox * cbDigiProbe1[MaxNDigitizer];
RComboBox * cbDigiProbe2[MaxNDigitizer];
QPushButton * bnChEnableMask[MaxNDigitizer][MaxRegChannel];
QCheckBox * cbDigiEnable[MaxNDigitizer];
2023-04-25 17:04:46 -04:00
RComboBox * cbAggOrg[MaxNDigitizer];
2023-04-26 16:39:54 -04:00
RSpinBox * sbAggNum[MaxNDigitizer];
QCheckBox * chkEnableExternalTrigger[MaxNDigitizer];
RSpinBox * sbRunDelay[MaxNDigitizer];
RComboBox * cbAnalogMonitorMode[MaxNDigitizer];
RSpinBox * sbBufferGain[MaxNDigitizer];
RSpinBox * sbVoltageLevel[MaxNDigitizer];
2023-04-26 16:39:54 -04:00
RComboBox * cbStartStopMode[MaxNDigitizer];
RComboBox * cbAcqStartArm[MaxNDigitizer];
RComboBox * cbPLLRefClock[MaxNDigitizer];
2023-04-28 18:18:12 -04:00
RComboBox * cbLEMOMode[MaxNDigitizer];
RComboBox * cbTRGOUTMode[MaxNDigitizer];
RComboBox * cbTRGINMode[MaxNDigitizer];
RComboBox * cbTRINMezzanines[MaxNDigitizer];
RSpinBox * sbVMEInterruptLevel[MaxNDigitizer];
QCheckBox * chkEnableOpticalInterrupt[MaxNDigitizer];
QCheckBox * chkEnableVMEReadoutStatus[MaxNDigitizer];
QCheckBox * chkEnableVME64Aligment[MaxNDigitizer];
QCheckBox * chkEnableAddRelocation[MaxNDigitizer];
RComboBox * cbInterruptMode[MaxNDigitizer];
QCheckBox * chkEnableExtendedBlockTransfer[MaxNDigitizer];
/// ============================= trigger validation mask
RComboBox * cbMaskLogic[MaxNDigitizer][MaxRegChannel/2];
RSpinBox * sbMaskMajorLevel[MaxNDigitizer][MaxRegChannel/2];
QCheckBox * chkMaskExtTrigger[MaxNDigitizer][MaxRegChannel/2];
QCheckBox * chkMaskSWTrigger[MaxNDigitizer][MaxRegChannel/2];
QPushButton * bnTriggerMask[MaxNDigitizer][MaxRegChannel/2][MaxRegChannel/2];
2023-04-28 18:18:12 -04:00
/// ============================= board Status
2023-04-26 16:39:54 -04:00
QPushButton * bnACQStatus[MaxNDigitizer][9];
QPushButton * bnBdFailStatus[MaxNDigitizer][3];
QPushButton * bnReadOutStatus[MaxNDigitizer][3];
2023-05-12 16:06:32 -04:00
QLineEdit * leACQStatus[MaxNDigitizer];
QLineEdit * leBdFailStatus[MaxNDigitizer];
QLineEdit * leReadOutStatus[MaxNDigitizer];
2023-04-25 17:04:46 -04:00
/// ============================= Mask Configure
QPushButton * bnGlobalTriggerMask[MaxNDigitizer][MaxRegChannel/2];
2023-04-28 18:18:12 -04:00
RSpinBox * sbGlbMajCoinWin[MaxNDigitizer];
RSpinBox * sbGlbMajLvl[MaxNDigitizer];
RComboBox * cbGlbUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31
QPushButton * bnTRGOUTMask[MaxNDigitizer][MaxRegChannel/2];
2023-04-28 18:18:12 -04:00
RSpinBox * sbTRGOUTMajLvl[MaxNDigitizer];
RComboBox * cbTRGOUTLogic[MaxNDigitizer];
RComboBox * cbTRGOUTUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31
2023-04-28 18:18:34 -04:00
/// ============================ Channel
2023-05-09 12:16:08 -04:00
QTabWidget * chTab;
2023-04-25 17:04:46 -04:00
RComboBox * chSelection[MaxNDigitizer];
QPushButton * bnProgramChannel[MaxNDigitizer];
2023-05-09 12:16:08 -04:00
//----------- common for PHA and PSD
RSpinBox * sbRecordLength[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDynamicRange[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPreTrigger[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbThreshold[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbDCOffset[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbPolarity[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbShapedTrigWidth[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTriggerHoldOff[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTrigMode[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbBaseLineAvg[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbNumEventAgg[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbVetoWidth[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbVetoStep[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbLocalShapedTrigger[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbLocalTriggerValid[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbExtra2Option[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbVetoSource[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDisableSelfTrigger[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTrigCount[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTRGOUTChannelProbe[MaxNDigitizer][MaxRegChannel + 1];
2023-10-04 13:13:38 -04:00
2023-05-09 12:16:08 -04:00
//---------- PHA
RComboBox * cbRCCR2Smoothing[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbInputRiseTime[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbRiseTimeValidWin[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTrapRiseTime[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTrapFlatTop[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbDecay[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTrapScaling[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPeaking[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPeakingHoldOff[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbPeakAvg[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkActiveBaseline[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkBaselineRestore[MaxNDigitizer][MaxRegChannel + 1];
// RSpinBox * sbFineGain[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkEnableRollOver[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkEnablePileUp[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkTagCorrelation[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDecimateTrace[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDecimateGain[MaxNDigitizer][MaxRegChannel + 1];
2023-05-09 12:16:08 -04:00
//---------------- PSD
RComboBox * cbChargeSensitivity[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkChargePedestal[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTriggerOpt[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDiscriMode[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkPileUpInGate[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkTestPule[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTestPulseRate[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkBaseLineCal[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDiscardQLong[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkRejPileUp[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkCutBelow[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkCutAbove[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkRejOverRange[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDisableTriggerHysteresis[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDisableOppositePulse[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbChargeZeroSupZero[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbShortGate[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbLongGate[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbGateOffset[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbFixedBaseline[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTriggerLatency[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPSDCutThreshold[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPURGAPThreshold[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbCFDDely[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbCFDFraction[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbCFDInterpolation[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbSmoothedChargeIntegration[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkMarkSaturation[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbAdditionLocalTrigValid[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbVetoMode[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkResetTimestampByTRGIN[MaxNDigitizer][MaxRegChannel + 1];
//------------------- QDC
RComboBox * cbExtTriggerMode[MaxNDigitizer];
RSpinBox * sbEventPreAgg_QDC[MaxNDigitizer];
//...... reuse varaible
//Gate Width -> sbShortGate
//Gate offset -> sbGateOffset
//PreTrigger -> sbPreTrigger
//Trig Hold off with -> sbTriggerHoldOff
//Trig out width -> sbShapedTrigWidth
QCheckBox * chkOverthreshold[MaxNDigitizer][MaxRegChannel+1]; //TODO need firmware version 4.25 & 135.17
RSpinBox * sbOverThresholdWidth[MaxNDigitizer][MaxRegChannel + 1];
2023-10-11 18:28:19 -04:00
QPushButton * pbSubChMask[MaxNDigitizer][MaxRegChannel+1][8];
2023-10-06 19:26:01 -04:00
RSpinBox * sbSubChOffset[MaxNDigitizer][MaxRegChannel + 1][8];
RSpinBox * sbSubChThreshold[MaxNDigitizer][MaxRegChannel + 1][8];
QLabel * lbSubCh[MaxNDigitizer][8];
QLabel * lbSubCh2[MaxNDigitizer][8];
2023-05-09 12:16:08 -04:00
//---------------- channel status
QPushButton * bnChStatus[MaxNDigitizer][MaxRegChannel][3];
QLineEdit * leADCTemp[MaxNDigitizer][MaxRegChannel];
2023-04-24 17:37:03 -04:00
};
#endif