SOLARIS_QT6_DAQ/digiSettingsPanel.h

328 lines
13 KiB
C
Raw Normal View History

2023-02-23 16:08:47 -05:00
#ifndef DigiSettings_H
#define DigiSettings_H
#include <QWidget>
#include <QLineEdit>
#include <QSpinBox>
#include <QDoubleSpinBox>
#include <QGridLayout>
#include <QScrollArea>
#include <QTabWidget>
#include <QGroupBox>
2023-03-13 18:31:10 -04:00
#include <QRadioButton>
2023-02-23 16:08:47 -05:00
#include <QCheckBox>
#include <QComboBox>
#include <QTableWidget>
#include <QDebug>
#include <QPushButton>
#include <QFrame>
#include <QSignalMapper>
2023-02-23 16:08:47 -05:00
#include "ClassDigitizer2Gen.h"
#include "CustomWidgets.h"
2023-03-16 17:28:55 -04:00
#include "macro.h"
2023-02-23 16:08:47 -05:00
//^#######################################################
2023-02-23 16:08:47 -05:00
class DigiSettingsPanel : public QWidget{
Q_OBJECT
public:
2023-03-27 15:48:41 -04:00
DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QString analysisPath, QWidget * parent = nullptr);
2023-02-23 16:08:47 -05:00
~DigiSettingsPanel();
private slots:
2023-02-23 16:08:47 -05:00
void onTriggerClick(int haha);
2023-03-14 16:17:22 -04:00
void ReadTriggerMap();
2023-02-23 16:08:47 -05:00
void SaveSettings();
void LoadSettings();
2023-03-11 18:35:15 -05:00
void SetDefaultPHASettigns();
void RefreshSettings(); // this read digitizer and ShowSettingToPanel
public slots:
void EnableControl();
void UpdatePanelFromMemory(bool onlyStatus = false);
void UpdateStatus();
2023-02-23 16:08:47 -05:00
signals:
void UpdateOtherPanels();
void SendLogMsg(const QString &msg);
2023-02-23 16:08:47 -05:00
private:
Digitizer2Gen ** digi;
unsigned short nDigi;
unsigned short ID; // index for digitizer;
2023-03-27 15:48:41 -04:00
QString digiSettingPath;
QTabWidget * tabWidget;
//------------ Layout/GroupBox
2023-09-18 19:16:28 -04:00
QWidget * bdCfg[MaxNumberOfDigitizer];
QWidget * bdTestPulse[MaxNumberOfDigitizer];
QWidget * bdVGA[MaxNumberOfDigitizer];
QWidget * bdLVDS[MaxNumberOfDigitizer];
QWidget * bdITL[MaxNumberOfDigitizer];
2023-03-16 16:05:55 -04:00
2023-03-16 16:05:55 -04:00
QGroupBox * box0[MaxNumberOfDigitizer];
QGroupBox * box1[MaxNumberOfDigitizer];
QGroupBox * box3[MaxNumberOfDigitizer];
QGroupBox * box4[MaxNumberOfDigitizer];
QGroupBox * box5[MaxNumberOfDigitizer];
QGroupBox * box6[MaxNumberOfDigitizer];
QTabWidget * inputTab[MaxNumberOfDigitizer];
QTabWidget * trapTab[MaxNumberOfDigitizer];
QTabWidget * probeTab[MaxNumberOfDigitizer];
QTabWidget * otherTab[MaxNumberOfDigitizer];
QTabWidget * triggerTab[MaxNumberOfDigitizer];
QTabWidget * triggerMapTab[MaxNumberOfDigitizer];
2023-03-13 16:51:11 -04:00
2023-09-25 14:29:27 -04:00
QTabWidget * chTabWidget[MaxNumberOfDigitizer];
QWidget * digiTab[MaxNumberOfDigitizer];
2023-02-24 19:21:27 -05:00
bool enableSignalSlot;
2023-03-11 18:35:15 -05:00
//---------------- Inquiry and copy
2023-03-16 16:05:55 -04:00
QTabWidget * ICTab; // inquiry and copy
2023-03-13 18:31:10 -04:00
RComboBox * cbIQDigi;
RComboBox * cbBdSettings;
RComboBox * cbIQCh;
RComboBox * cbChSettings;
2023-03-16 16:05:55 -04:00
QGroupBox * icBox1;
QGroupBox * icBox2;
2023-03-11 18:35:15 -05:00
QLineEdit * leBdSettingsType;
QLineEdit * leBdSettingsRead;
2023-03-13 16:51:11 -04:00
QLineEdit * leBdSettingsUnit;
2023-03-11 18:35:15 -05:00
RComboBox * cbBdAns;
RSpinBox * sbBdSettingsWrite;
2023-03-13 16:51:11 -04:00
QLineEdit * leBdSettingsWrite;
QLineEdit * leChSettingsType;
QLineEdit * leChSettingsRead;
QLineEdit * leChSettingsUnit;
RComboBox * cbChSettingsWrite;
2023-03-13 16:51:11 -04:00
RSpinBox * sbChSettingsWrite;
QLineEdit * leChSettingsWrite;
2023-03-11 18:35:15 -05:00
2023-03-13 18:31:10 -04:00
RComboBox * cbCopyDigiFrom;
RComboBox * cbCopyDigiTo;
QRadioButton * rbCopyChFrom[MaxNumberOfChannel];
QCheckBox * chkChTo[MaxNumberOfChannel];
QPushButton * pbCopyChannel;
QPushButton * pbCopyBoard;
QPushButton * pbCopyDigi;
//------------ status
2023-04-25 17:23:50 -04:00
QLineEdit * leInfo[MaxNumberOfDigitizer][12];
2023-02-23 16:08:47 -05:00
QPushButton * LEDStatus[MaxNumberOfDigitizer][19];
QPushButton * ACQStatus[MaxNumberOfDigitizer][19];
2023-02-24 19:21:27 -05:00
QLineEdit * leTemp[MaxNumberOfDigitizer][8];
2023-02-23 16:08:47 -05:00
//------------- buttons
QPushButton * bnReadSettngs[MaxNumberOfChannel];
QPushButton * bnResetBd[MaxNumberOfChannel];
QPushButton * bnDefaultSetting[MaxNumberOfChannel];
QPushButton * bnSaveSettings[MaxNumberOfChannel];
QPushButton * bnLoadSettings[MaxNumberOfChannel];
QPushButton * bnClearData[MaxNumberOfChannel];
QPushButton * bnArmACQ[MaxNumberOfChannel];
QPushButton * bnDisarmACQ[MaxNumberOfChannel];
QPushButton * bnSoftwareStart[MaxNumberOfChannel];
QPushButton * bnSoftwareStop[MaxNumberOfChannel];
//-------------- board settings
RComboBox * cbbClockSource[MaxNumberOfDigitizer];
2023-09-15 17:31:07 -04:00
RComboBox * cbbEnClockFrontPanel[MaxNumberOfDigitizer];
QCheckBox * ckbStartSource[MaxNumberOfDigitizer][5];
QCheckBox * ckbGlbTrgSource[MaxNumberOfDigitizer][5];
RComboBox * cbbTrgOut[MaxNumberOfDigitizer];
RComboBox * cbbGPIO[MaxNumberOfDigitizer];
RComboBox * cbbAutoDisarmAcq[MaxNumberOfDigitizer];
RComboBox * cbbBusyIn[MaxNumberOfDigitizer];
RComboBox * cbbStatEvents[MaxNumberOfDigitizer];
RComboBox * cbbSyncOut[MaxNumberOfDigitizer];
RComboBox * cbbBoardVetoSource[MaxNumberOfDigitizer];
RSpinBox * dsbBdVetoWidth[MaxNumberOfDigitizer];
RComboBox * cbbBdVetoPolarity[MaxNumberOfDigitizer];
RComboBox * cbbIOLevel[MaxNumberOfDigitizer];
RSpinBox * spbRunDelay[MaxNumberOfDigitizer];
RSpinBox * dsbVolatileClockOutDelay[MaxNumberOfDigitizer];
RSpinBox * dsbClockOutDelay[MaxNumberOfDigitizer];
//-------------- Test pulse
RSpinBox * dsbTestPuslePeriod[MaxNumberOfDigitizer];
RSpinBox * dsbTestPusleWidth[MaxNumberOfDigitizer];
RSpinBox * spbTestPusleLowLevel[MaxNumberOfDigitizer];
RSpinBox * spbTestPusleHighLevel[MaxNumberOfDigitizer];
//-------------- VGA
RSpinBox * VGA[MaxNumberOfDigitizer][4];
2023-02-23 16:08:47 -05:00
2023-09-18 19:16:28 -04:00
//-------------- ITL-A/B
RComboBox * cbITLAMainLogic[MaxNumberOfDigitizer];
RSpinBox * sbITLAMajority[MaxNumberOfDigitizer];
RComboBox * cbITLAPairLogic[MaxNumberOfDigitizer];
RComboBox * cbITLAPolarity[MaxNumberOfDigitizer];
RSpinBox * sbITLAGateWidth[MaxNumberOfDigitizer];
RComboBox * cbITLBMainLogic[MaxNumberOfDigitizer];
RComboBox * cbITLBPairLogic[MaxNumberOfDigitizer];
RComboBox * cbITLBPolarity[MaxNumberOfDigitizer];
RSpinBox * sbITLBMajority[MaxNumberOfDigitizer];
RSpinBox * sbITLBGateWidth[MaxNumberOfDigitizer];
QPushButton * chITLConnect[MaxNumberOfDigitizer][MaxNumberOfChannel][2]; // 0 for A, 1 for B
unsigned short ITLConnectStatus[MaxNumberOfDigitizer][MaxNumberOfChannel]; // 0 = disabled, 1 = A, 2 = B
//-------------- LVDS
RComboBox * cbLVDSMode[MaxNumberOfDigitizer][4];
RComboBox * cbLVDSDirection[MaxNumberOfDigitizer][4];
QLineEdit * leLVDSIOReg[MaxNumberOfDigitizer];
//-------------- DAC output
RComboBox * cbDACoutMode[MaxNumberOfDigitizer];
RSpinBox * sbDACoutStaticLevel[MaxNumberOfDigitizer];
RSpinBox * sbDACoutChSelect[MaxNumberOfDigitizer];
2023-03-03 16:19:39 -05:00
//--------------- trigger map
//RComboBox * cbAllEvtTrigger[MaxNumberOfDigitizer];
//RComboBox * cbAllWaveTrigger[MaxNumberOfDigitizer];
//RComboBox * cbAllCoinMask[MaxNumberOfDigitizer];
//RComboBox * cbAllAntiCoinMask[MaxNumberOfDigitizer];
//RSpinBox * sbAllCoinLength[MaxNumberOfDigitizer];
2023-03-16 16:05:55 -04:00
QPushButton * trgMap[MaxNumberOfDigitizer][MaxNumberOfChannel][MaxNumberOfChannel];
bool trgMapClickStatus[MaxNumberOfDigitizer][MaxNumberOfChannel][MaxNumberOfChannel];
2023-02-23 16:08:47 -05:00
2023-03-03 16:19:39 -05:00
//--------------- Channel status
QPushButton * chStatus[MaxNumberOfDigitizer][MaxNumberOfChannel][9];
QLineEdit * chGainFactor[MaxNumberOfDigitizer][MaxNumberOfChannel];
QLineEdit * chADCToVolts[MaxNumberOfDigitizer][MaxNumberOfChannel];
//--------------- Channel settings
2023-03-13 16:51:11 -04:00
RComboBox * cbChPick[MaxNumberOfDigitizer];
2023-02-23 16:08:47 -05:00
RComboBox * cbbOnOff[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbRecordLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbPreTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbDCOffset[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbThreshold[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbParity[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveSource[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveRes[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveSave[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-09-25 14:29:27 -04:00
RComboBox * cbbEvtTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-09-25 14:29:27 -04:00
RComboBox * cbbCoinMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbAntiCoinMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbCoinLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-09-25 14:29:27 -04:00
QLineEdit * leTriggerMask[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-02-28 13:28:30 -05:00
2023-09-25 14:29:27 -04:00
RComboBox * cbbChVetoSrc[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbADCVetoWidth[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbEventSelector[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveSelector[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbEnergySkimLow[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbEnergySkimHigh[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-02-28 13:28:30 -05:00
RComboBox * cbbAnaProbe0[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbAnaProbe1[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe0[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe1[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe2[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbDigProbe3[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-02-28 13:28:30 -05:00
2023-09-25 14:29:27 -04:00
//........... PHA
RSpinBox * spbInputRiseTime[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTriggerGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbLowFilter[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-02-23 16:08:47 -05:00
2023-09-25 14:29:27 -04:00
RSpinBox * spbTrapRiseTime[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTrapFlatTop[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTrapPoleZero[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-03-23 19:57:14 -04:00
2023-09-25 14:29:27 -04:00
RSpinBox * spbPeaking[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbBaselineGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbPileupGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-02-28 13:28:30 -05:00
2023-09-25 14:29:27 -04:00
RComboBox * cbbBaselineAvg[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbFineGain[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbPeakingAvg[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-02-28 13:28:30 -05:00
2023-09-25 14:29:27 -04:00
//.............. PSD
RComboBox * cbbADCInputBaselineAvg[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbAbsBaseline[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbADCInputBaselineGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbTimeFilterReTriggerGuard[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbTriggerHysteresis[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbTriggerFilter[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbCFDDelay[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbCFDFraction[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbSmoothingFactor[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbChargeSmooting[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbTimeFilterSmoothing[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbPileupGap[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbGateLong[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbGateShort[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbGateOffset[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbLongChargeIntergratorPedestal[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbShortChargeIntergratorPedestal[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbEnergyGain[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RSpinBox * spbNeutronThreshold[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbEventNeutronReject[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
RComboBox * cbbWaveNeutronReject[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
2023-02-28 13:28:30 -05:00
//-------------------------
2023-02-23 16:08:47 -05:00
QLineEdit * leSettingFile[MaxNumberOfDigitizer];
2023-03-14 16:17:22 -04:00
2023-02-23 16:08:47 -05:00
void SetStartSource();
void SetGlobalTriggerSource();
2023-03-03 16:19:39 -05:00
void SetupShortComboBox(RComboBox * &cbb, Reg para);
2023-02-28 13:28:30 -05:00
void SetupComboBox(RComboBox * &cbb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
2023-03-14 16:17:22 -04:00
void SetupSpinBox(RSpinBox * &spb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SyncComboBox(RComboBox *(&cbb)[][MaxNumberOfChannel+1], int ch);
void SyncSpinBox(RSpinBox *(&spb)[][MaxNumberOfChannel+1], int ch);
void SetupComboBoxTab(RComboBox *(&cbb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel, int nCol = 4);
void SetupSpinBoxTab(RSpinBox *(&spb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel);
2023-02-23 16:08:47 -05:00
void FillComboBoxValueFromMemory(RComboBox * &cbb, const Reg para, int ch_index = -1);
void FillSpinBoxValueFromMemory(RSpinBox * &spb, const Reg para, int ch_index = -1 );
2023-02-24 19:21:27 -05:00
2023-09-25 14:29:27 -04:00
void SetupPHAChannels(unsigned short digiID);
void SetupPSDChannels(unsigned short digiID);
2023-03-13 16:51:11 -04:00
void ReadBoardSetting(int cbIndex);
void ReadChannelSetting(int cbIndex);
2023-03-16 16:05:55 -04:00
bool CheckDigitizersCanCopy();
2023-03-13 18:31:10 -04:00
void CheckRadioAndCheckedButtons();
2023-03-14 16:17:22 -04:00
bool CopyChannelSettings(int digiFrom, int chFrom, int digiTo, int chTo);
2023-03-13 18:31:10 -04:00
bool CopyBoardSettings();
bool CopyWholeDigitizer();
2023-02-23 16:08:47 -05:00
};
#endif