2023-04-18 13:12:05 -04:00
|
|
|
#ifndef SCOPE_H
|
|
|
|
#define SCOPE_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QChart>
|
|
|
|
#include <QChartView>
|
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QGridLayout>
|
2023-04-19 14:46:10 -04:00
|
|
|
#include <QGroupBox>
|
2024-08-29 16:49:52 -04:00
|
|
|
#include <QTimer>
|
2023-04-18 13:12:05 -04:00
|
|
|
#include <QLineSeries>
|
|
|
|
#include <QRubberBand>
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QGestureEvent>
|
|
|
|
|
|
|
|
#include "macro.h"
|
|
|
|
#include "ClassDigitizer.h"
|
|
|
|
#include "CustomThreads.h"
|
|
|
|
#include "CustomWidgets.h"
|
|
|
|
|
2024-08-29 16:49:52 -04:00
|
|
|
class ScopeWorker; //Forward declaration
|
|
|
|
|
2023-04-18 13:12:05 -04:00
|
|
|
//^====================================================
|
|
|
|
//^====================================================
|
|
|
|
class Scope : public QMainWindow{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataThread, QMainWindow * parent = nullptr);
|
|
|
|
~Scope();
|
|
|
|
|
2023-05-16 14:31:19 -04:00
|
|
|
void closeEvent(QCloseEvent * event){
|
2023-11-17 11:44:28 -05:00
|
|
|
if(isACQStarted) StopScope();
|
2023-05-16 14:31:19 -04:00
|
|
|
emit CloseWindow();
|
|
|
|
event->accept();
|
|
|
|
}
|
|
|
|
|
2023-10-23 12:53:51 -04:00
|
|
|
QVector<QPointF> TrapezoidFilter(QVector<QPointF> data, int baseLineEndS, int riseTimeS, int flatTopS, float decayTime_ns );
|
|
|
|
|
2023-05-23 17:02:39 -04:00
|
|
|
public slots:
|
2023-04-18 13:12:05 -04:00
|
|
|
void StartScope();
|
|
|
|
void StopScope();
|
2023-04-19 18:08:20 -04:00
|
|
|
void UpdateScope();
|
2023-04-21 18:10:12 -04:00
|
|
|
void ReadSettingsFromBoard();
|
2023-05-23 17:02:39 -04:00
|
|
|
void UpdatePanelFromMomeory();
|
2023-04-19 18:08:20 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
2023-05-16 14:31:19 -04:00
|
|
|
void CloseWindow();
|
2023-04-20 18:15:30 -04:00
|
|
|
void SendLogMsg(const QString &msg);
|
2023-05-16 14:31:19 -04:00
|
|
|
void TellACQOnOff(const bool onOff);
|
2023-05-23 17:02:39 -04:00
|
|
|
void UpdateOtherPanels();
|
2023-04-19 18:08:20 -04:00
|
|
|
|
2023-04-20 18:15:30 -04:00
|
|
|
private:
|
2023-04-18 13:12:05 -04:00
|
|
|
|
2023-04-21 18:10:12 -04:00
|
|
|
void SetUpComboBoxSimple(RComboBox * &cb, QString str, int row, int col);
|
2023-05-01 16:20:16 -04:00
|
|
|
void SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Reg para);
|
|
|
|
void SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Reg para);
|
2023-04-19 14:46:10 -04:00
|
|
|
|
|
|
|
void CleanUpSettingsGroupBox();
|
2023-10-11 18:28:19 -04:00
|
|
|
void SetUpPanel_PHA();
|
|
|
|
void SetUpPanel_PSD();
|
|
|
|
void SetUpPanel_QDC();
|
2023-04-21 18:10:12 -04:00
|
|
|
void EnableControl(bool enable);
|
2023-04-18 13:12:05 -04:00
|
|
|
|
2023-05-01 16:20:16 -04:00
|
|
|
void UpdateComobox(RComboBox * &cb, const Reg para);
|
|
|
|
void UpdateSpinBox(RSpinBox * &sb, const Reg para);
|
2023-10-11 18:28:19 -04:00
|
|
|
void UpdatePanel_PHA();
|
|
|
|
void UpdatePanel_PSD();
|
|
|
|
void UpdatePanel_QDC();
|
|
|
|
|
|
|
|
void NullThePointers();
|
2023-04-20 18:15:30 -04:00
|
|
|
|
2023-04-18 13:12:05 -04:00
|
|
|
Digitizer ** digi;
|
|
|
|
unsigned short nDigi;
|
2023-04-19 13:41:43 -04:00
|
|
|
unsigned short ID; // the id of digi, index of cbScopeDigi
|
2023-06-23 13:50:21 -04:00
|
|
|
bool isACQStarted;
|
2023-06-20 11:57:39 -04:00
|
|
|
int tick2ns;
|
2023-08-17 12:38:15 -04:00
|
|
|
int factor; // whether dual trace or not
|
2024-02-26 15:37:06 -05:00
|
|
|
int AggPerRead[MaxNDigitizer];
|
2023-04-18 13:12:05 -04:00
|
|
|
|
2024-05-06 14:06:00 -04:00
|
|
|
bool traceOn[MaxNDigitizer];
|
|
|
|
uint32_t dppAlg, dppAlg2, chMask; //for single channel run
|
2024-10-21 15:11:33 -04:00
|
|
|
uint32_t subChMask; // for QDC
|
2024-05-17 17:45:30 -04:00
|
|
|
unsigned short oldCh, oldDigi;
|
2024-05-06 14:06:00 -04:00
|
|
|
|
2023-04-18 13:12:05 -04:00
|
|
|
ReadDataThread ** readDataThread;
|
|
|
|
|
|
|
|
bool enableSignalSlot;
|
|
|
|
|
2023-05-26 18:06:37 -04:00
|
|
|
RChart * plot;
|
|
|
|
RChartView * plotView;
|
2023-10-11 18:28:19 -04:00
|
|
|
QLineSeries * dataTrace[MaxNumberOfTrace]; // 2 analog, 2 digi for PHA, PSD, 1 analog, 4 digi for QDC
|
2023-04-18 13:12:05 -04:00
|
|
|
|
|
|
|
RComboBox * cbScopeDigi;
|
|
|
|
RComboBox * cbScopeCh;
|
|
|
|
|
|
|
|
QPushButton * bnScopeStart;
|
|
|
|
QPushButton * bnScopeStop;
|
2023-04-21 18:10:12 -04:00
|
|
|
QPushButton * bnReadSettingsFromBoard;
|
2023-04-18 13:12:05 -04:00
|
|
|
|
|
|
|
QLineEdit * leTriggerRate;
|
|
|
|
|
2023-04-19 14:46:10 -04:00
|
|
|
QGroupBox * settingGroup;
|
|
|
|
QGridLayout * settingLayout;
|
|
|
|
|
2024-05-06 14:06:00 -04:00
|
|
|
QCheckBox * chkSoleRun;
|
2023-10-19 15:32:44 -04:00
|
|
|
QPushButton * runStatus;
|
|
|
|
|
2023-04-19 14:46:10 -04:00
|
|
|
/// common to PSD and PHA
|
2023-04-19 13:41:43 -04:00
|
|
|
RSpinBox * sbReordLength;
|
2023-04-19 14:46:10 -04:00
|
|
|
RSpinBox * sbPreTrigger;
|
|
|
|
RSpinBox * sbDCOffset;
|
2023-04-21 18:10:12 -04:00
|
|
|
RComboBox * cbDynamicRange;
|
|
|
|
RComboBox * cbPolarity;
|
2023-04-19 13:41:43 -04:00
|
|
|
|
2023-04-19 14:46:10 -04:00
|
|
|
/// PHA
|
|
|
|
RSpinBox * sbInputRiseTime;
|
|
|
|
RSpinBox * sbTriggerHoldOff;
|
|
|
|
RSpinBox * sbThreshold;
|
2023-04-21 18:10:12 -04:00
|
|
|
RComboBox * cbSmoothingFactor;
|
2023-04-19 14:46:10 -04:00
|
|
|
|
|
|
|
RSpinBox * sbTrapRiseTime;
|
|
|
|
RSpinBox * sbTrapFlatTop;
|
|
|
|
RSpinBox * sbDecayTime;
|
|
|
|
RSpinBox * sbPeakingTime;
|
2023-04-21 18:10:12 -04:00
|
|
|
RSpinBox * sbPeakHoldOff;
|
|
|
|
RComboBox * cbPeakAvg;
|
|
|
|
RComboBox * cbBaselineAvg;
|
2023-04-19 14:46:10 -04:00
|
|
|
|
2023-04-24 15:27:05 -04:00
|
|
|
RComboBox * cbAnaProbe1;
|
|
|
|
RComboBox * cbAnaProbe2;
|
|
|
|
RComboBox * cbDigiProbe1;
|
|
|
|
RComboBox * cbDigiProbe2;
|
|
|
|
|
2023-05-12 16:06:32 -04:00
|
|
|
/// PSD
|
|
|
|
RSpinBox * sbShortGate;
|
|
|
|
RSpinBox * sbLongGate;
|
|
|
|
RSpinBox * sbGateOffset;
|
|
|
|
|
2023-10-11 18:28:19 -04:00
|
|
|
/// QDC
|
|
|
|
//sbShortGate -> GateWidth
|
|
|
|
//sbGateOffset -> GateOffset
|
|
|
|
//sbTriggerHoldOff ->Trigger Hold Off
|
|
|
|
|
2024-08-29 16:49:52 -04:00
|
|
|
QThread * workerThread;
|
|
|
|
ScopeWorker * scopeWorker;
|
|
|
|
QTimer * scopeTimer;
|
|
|
|
|
2023-04-18 13:12:05 -04:00
|
|
|
};
|
|
|
|
|
2024-08-29 16:49:52 -04:00
|
|
|
//^#======================================================== ScopeWorker
|
|
|
|
class ScopeWorker : public QObject{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ScopeWorker(Scope * parent): SS(parent){}
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void UpdateScope(){
|
|
|
|
SS->UpdateScope();
|
|
|
|
emit workDone();
|
|
|
|
}
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void workDone();
|
2023-04-18 13:12:05 -04:00
|
|
|
|
2024-08-29 16:49:52 -04:00
|
|
|
private:
|
|
|
|
Scope * SS;
|
|
|
|
};
|
2023-04-18 13:12:05 -04:00
|
|
|
|
|
|
|
#endif
|