FSUDAQ_Qt6/Scope.h

150 lines
3.5 KiB
C
Raw Normal View History

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>
#include <QGroupBox>
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"
//^====================================================
//^====================================================
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){
if(isACQStarted) StopScope();
2023-05-16 14:31:19 -04:00
emit CloseWindow();
event->accept();
}
QVector<QPointF> TrapezoidFilter(QVector<QPointF> data, int baseLineEndS, int riseTimeS, int flatTopS, float decayTime_ns );
public slots:
2023-04-18 13:12:05 -04:00
void StartScope();
void StopScope();
void UpdateScope();
void ReadSettingsFromBoard();
void UpdatePanelFromMomeory();
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-17 16:16:48 -04:00
void UpdateScaler();
void UpdateOtherPanels();
2023-04-20 18:15:30 -04:00
private:
2023-04-18 13:12:05 -04:00
void SetUpComboBoxSimple(RComboBox * &cb, QString str, int row, int col);
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);
void CleanUpSettingsGroupBox();
2023-10-11 18:28:19 -04:00
void SetUpPanel_PHA();
void SetUpPanel_PSD();
void SetUpPanel_QDC();
void EnableControl(bool enable);
2023-04-18 13:12:05 -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;
unsigned short ID; // the id of digi, index of cbScopeDigi
bool isACQStarted;
int tick2ns;
int factor; // whether dual trace or not
bool traceOn[MaxNDigitizer];
int AggPerRead[MaxNDigitizer];
2023-04-18 13:12:05 -04:00
ReadDataThread ** readDataThread;
2023-04-19 16:21:14 -04:00
TimingThread * updateTraceThread;
TimingThread * updateScalarThread;
2023-04-18 13:12:05 -04:00
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;
QPushButton * bnReadSettingsFromBoard;
2023-04-18 13:12:05 -04:00
QLineEdit * leTriggerRate;
QGroupBox * settingGroup;
QGridLayout * settingLayout;
2023-10-19 15:32:44 -04:00
QPushButton * runStatus;
/// common to PSD and PHA
RSpinBox * sbReordLength;
RSpinBox * sbPreTrigger;
RSpinBox * sbDCOffset;
RComboBox * cbDynamicRange;
RComboBox * cbPolarity;
/// PHA
RSpinBox * sbInputRiseTime;
RSpinBox * sbTriggerHoldOff;
RSpinBox * sbThreshold;
RComboBox * cbSmoothingFactor;
RSpinBox * sbTrapRiseTime;
RSpinBox * sbTrapFlatTop;
RSpinBox * sbDecayTime;
RSpinBox * sbPeakingTime;
RSpinBox * sbPeakHoldOff;
RComboBox * cbPeakAvg;
RComboBox * cbBaselineAvg;
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
2023-04-18 13:12:05 -04:00
};
#endif