2024-06-26 16:40:40 -04:00
|
|
|
#ifndef FSUDAQ_H
|
|
|
|
#define FSUDAQ_H
|
2023-04-11 11:13:23 -04:00
|
|
|
|
|
|
|
#include <QMainWindow>
|
2023-04-14 16:12:52 -04:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
#include <QLineEdit>
|
2023-04-17 15:17:25 -04:00
|
|
|
#include <QLabel>
|
2023-04-18 13:12:05 -04:00
|
|
|
#include <QComboBox>
|
|
|
|
#include <QCheckBox>
|
2023-04-17 15:17:25 -04:00
|
|
|
#include <QGridLayout>
|
2023-04-14 16:12:52 -04:00
|
|
|
|
|
|
|
#include "ClassDigitizer.h"
|
|
|
|
#include "CustomThreads.h"
|
2023-05-18 17:14:24 -04:00
|
|
|
#include "CustomWidgets.h"
|
2023-04-18 13:12:05 -04:00
|
|
|
#include "Scope.h"
|
2023-04-24 17:37:03 -04:00
|
|
|
#include "DigiSettingsPanel.h"
|
2023-06-02 15:41:26 -04:00
|
|
|
#include "SingleSpectra.h"
|
2024-03-01 16:58:27 -05:00
|
|
|
#include "ClassInfluxDB.h"
|
2023-08-25 11:23:23 -04:00
|
|
|
#include "analyzers/Analyser.h"
|
2023-04-11 11:13:23 -04:00
|
|
|
|
2024-08-28 17:22:41 -04:00
|
|
|
class ScalarWorker; //Forward declaration
|
|
|
|
|
2024-06-26 16:40:40 -04:00
|
|
|
//^#===================================================== FSUDAQ
|
|
|
|
class FSUDAQ : public QMainWindow{
|
2023-04-11 11:13:23 -04:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2024-06-26 16:40:40 -04:00
|
|
|
FSUDAQ(QWidget *parent = nullptr);
|
|
|
|
~FSUDAQ();
|
2023-04-11 11:13:23 -04:00
|
|
|
|
2023-04-19 13:41:43 -04:00
|
|
|
void closeEvent(QCloseEvent * event){
|
2023-10-23 12:53:51 -04:00
|
|
|
if( scope ) {
|
|
|
|
delete scope;
|
|
|
|
scope = nullptr;
|
|
|
|
}
|
|
|
|
if( digiSettings ) {
|
|
|
|
delete digiSettings;
|
|
|
|
digiSettings = nullptr;
|
|
|
|
}
|
2024-08-20 14:59:22 -04:00
|
|
|
if( singleHistograms ) {
|
|
|
|
delete singleHistograms;
|
|
|
|
singleHistograms = nullptr;
|
2023-10-23 12:53:51 -04:00
|
|
|
}
|
|
|
|
if( onlineAnalyzer ) {
|
|
|
|
delete onlineAnalyzer;
|
|
|
|
onlineAnalyzer = nullptr;
|
|
|
|
}
|
2023-04-19 13:41:43 -04:00
|
|
|
event->accept();
|
|
|
|
}
|
2023-04-14 16:12:52 -04:00
|
|
|
|
2024-08-28 17:58:12 -04:00
|
|
|
public slots:
|
|
|
|
void UpdateScalar();
|
|
|
|
|
2023-04-14 16:12:52 -04:00
|
|
|
private slots:
|
|
|
|
|
2023-04-17 15:17:25 -04:00
|
|
|
void OpenDataPath();
|
2023-07-11 18:02:42 -04:00
|
|
|
void OpenRecord();
|
|
|
|
void UpdateRecord();
|
2023-04-17 14:09:21 -04:00
|
|
|
void LoadProgramSettings();
|
|
|
|
void SaveProgramSettings();
|
|
|
|
void LoadLastRunFile();
|
|
|
|
void SaveLastRunFile();
|
|
|
|
|
2023-04-14 16:12:52 -04:00
|
|
|
void OpenDigitizers();
|
|
|
|
void CloseDigitizers();
|
2023-04-19 13:41:43 -04:00
|
|
|
void WaitForDigitizersOpen(bool onOff);
|
2023-04-14 16:12:52 -04:00
|
|
|
|
2023-04-17 15:17:25 -04:00
|
|
|
void SetupScalar();
|
|
|
|
void CleanUpScalar();
|
|
|
|
void OpenScalar();
|
2023-04-14 16:12:52 -04:00
|
|
|
|
|
|
|
void StartACQ();
|
|
|
|
void StopACQ();
|
2023-04-18 13:12:05 -04:00
|
|
|
void AutoRun();
|
|
|
|
bool CommentDialog(bool isStartRun);
|
|
|
|
void WriteRunTimestamp(bool isStartRun);
|
|
|
|
|
|
|
|
void OpenScope();
|
2023-04-14 16:12:52 -04:00
|
|
|
|
2023-04-24 16:37:57 -04:00
|
|
|
void OpenDigiSettings();
|
|
|
|
|
2024-08-20 14:59:22 -04:00
|
|
|
void OpenSingleHistograms();
|
2023-05-17 17:40:32 -04:00
|
|
|
|
2023-05-26 18:06:37 -04:00
|
|
|
void OpenAnalyzer();
|
|
|
|
|
2023-05-23 17:02:39 -04:00
|
|
|
void UpdateAllPanels(int panelID);
|
|
|
|
|
2023-05-24 17:10:36 -04:00
|
|
|
void SetUpInflux();
|
|
|
|
|
2023-05-25 14:20:55 -04:00
|
|
|
void CheckElog();
|
|
|
|
void WriteElog(QString htmlText, QString subject, QString category, int runNumber);
|
|
|
|
void AppendElog(QString appendHtmlText);
|
|
|
|
|
2023-06-29 18:59:36 -04:00
|
|
|
void SetSyncMode();
|
|
|
|
|
2023-12-12 16:17:11 -05:00
|
|
|
void SetAndLockInfluxElog();
|
2023-05-26 18:06:37 -04:00
|
|
|
|
2024-08-28 17:58:12 -04:00
|
|
|
private:
|
2023-04-14 16:12:52 -04:00
|
|
|
|
|
|
|
Digitizer ** digi;
|
|
|
|
unsigned int nDigi;
|
2024-08-28 17:58:12 -04:00
|
|
|
bool isACQStarted;
|
2023-04-14 16:12:52 -04:00
|
|
|
|
2023-04-17 14:09:21 -04:00
|
|
|
QString programSettingsFilePath;
|
|
|
|
QString rawDataPath;
|
|
|
|
QString prefix;
|
|
|
|
unsigned int runID;
|
2023-05-25 14:20:55 -04:00
|
|
|
int elogID;
|
2023-04-17 14:09:21 -04:00
|
|
|
|
2023-10-26 17:57:06 -04:00
|
|
|
RComboBox * cbOpenDigitizers;
|
2024-01-19 14:15:37 -05:00
|
|
|
RComboBox * cbOpenMethod;
|
2023-10-26 17:57:06 -04:00
|
|
|
|
|
|
|
//QPushButton * bnOpenDigitizers;
|
2023-04-17 15:17:25 -04:00
|
|
|
QPushButton * bnCloseDigitizers;
|
|
|
|
QPushButton * bnOpenScope;
|
|
|
|
QPushButton * bnDigiSettings;
|
2023-08-28 15:02:56 -04:00
|
|
|
//QPushButton * bnAnalyzer;
|
|
|
|
|
|
|
|
RComboBox * cbAnalyzer;
|
2023-04-17 15:17:25 -04:00
|
|
|
|
|
|
|
QPushButton * bnOpenScaler;
|
|
|
|
QPushButton * bnStartACQ;
|
|
|
|
QPushButton * bnStopACQ;
|
2023-06-29 18:59:36 -04:00
|
|
|
QPushButton * bnSync;
|
2023-04-17 15:17:25 -04:00
|
|
|
|
2023-05-17 17:40:32 -04:00
|
|
|
QPushButton * bnCanvas;
|
|
|
|
|
2023-07-11 18:02:42 -04:00
|
|
|
QTimer * runTimer;
|
|
|
|
bool breakAutoRepeat;
|
|
|
|
bool needManualComment;
|
|
|
|
QMetaObject::Connection runTimerConnection;
|
|
|
|
|
2023-05-24 16:04:32 -04:00
|
|
|
//@----- influx
|
|
|
|
InfluxDB * influx;
|
|
|
|
|
2023-05-25 14:20:55 -04:00
|
|
|
QString influxIP;
|
|
|
|
QString dataBaseName;
|
2023-05-24 17:10:36 -04:00
|
|
|
QLineEdit * leInfluxIP;
|
|
|
|
QLineEdit * leDatabaseName;
|
|
|
|
QPushButton * bnLock;
|
2024-03-01 19:18:23 -05:00
|
|
|
QString influxToken;
|
2024-04-18 10:06:55 -04:00
|
|
|
short scalarCount;
|
2023-05-24 17:10:36 -04:00
|
|
|
|
|
|
|
//@----- Elog
|
2023-05-25 14:20:55 -04:00
|
|
|
QString elogIP;
|
2024-10-18 16:30:21 -04:00
|
|
|
QString elogPort;
|
2023-05-25 14:20:55 -04:00
|
|
|
QString elogName;
|
|
|
|
QString elogUser;
|
|
|
|
QString elogPWD;
|
2023-05-24 17:10:36 -04:00
|
|
|
QLineEdit * leElogIP;
|
2023-05-25 14:20:55 -04:00
|
|
|
QLineEdit * leElogName;
|
2023-05-24 17:10:36 -04:00
|
|
|
|
2024-06-27 17:27:28 -04:00
|
|
|
QCheckBox * chkInflux;
|
|
|
|
QCheckBox * chkElog;
|
|
|
|
|
2023-04-14 16:12:52 -04:00
|
|
|
//@----- log msg
|
|
|
|
QPlainTextEdit * logInfo;
|
|
|
|
void LogMsg(QString msg);
|
|
|
|
bool logMsgHTMLMode = true;
|
|
|
|
|
|
|
|
//@-----
|
|
|
|
QLineEdit * leDataPath;
|
|
|
|
QLineEdit * lePrefix;
|
|
|
|
QLineEdit * leComment;
|
2023-04-17 14:09:21 -04:00
|
|
|
QLineEdit * leRunID;
|
2023-04-14 16:12:52 -04:00
|
|
|
|
2023-04-18 13:12:05 -04:00
|
|
|
QCheckBox * chkSaveData;
|
2023-05-18 17:14:24 -04:00
|
|
|
RComboBox * cbAutoRun;
|
2023-04-18 13:12:05 -04:00
|
|
|
|
|
|
|
QString startComment;
|
|
|
|
QString stopComment;
|
|
|
|
|
2023-04-14 16:12:52 -04:00
|
|
|
//@----- Scalar
|
|
|
|
QMainWindow * scalar;
|
2023-04-17 15:17:25 -04:00
|
|
|
QGridLayout * scalarLayout;
|
2024-09-04 17:50:59 -04:00
|
|
|
TimingThread * scalarTimingThread;
|
|
|
|
// QThread * scalarThread;
|
|
|
|
// ScalarWorker * scalarWorker;
|
|
|
|
// QTimer * scalarTimer;
|
|
|
|
|
2024-08-28 17:22:41 -04:00
|
|
|
|
|
|
|
// TimingThread * scalarThread;
|
2023-04-18 13:12:05 -04:00
|
|
|
QLineEdit *** leTrigger; // need to delete manually
|
|
|
|
QLineEdit *** leAccept; // need to delete manually
|
2023-10-19 15:32:44 -04:00
|
|
|
QPushButton * runStatus[MaxNDigitizer];
|
2023-04-17 15:17:25 -04:00
|
|
|
QLabel * lbLastUpdateTime;
|
|
|
|
QLabel * lbScalarACQStatus;
|
2024-02-26 19:05:16 -05:00
|
|
|
QLabel * lbAggCount[MaxNDigitizer];
|
2024-04-09 13:54:44 -04:00
|
|
|
QLabel * lbFileSize[MaxNDigitizer];
|
2024-04-25 17:01:45 -04:00
|
|
|
QLabel * lbTotalFileSize;
|
2023-04-14 16:12:52 -04:00
|
|
|
|
2023-07-11 18:02:42 -04:00
|
|
|
//@----- Run Record
|
|
|
|
QMainWindow * runRecord;
|
|
|
|
QStandardItemModel *model;
|
|
|
|
QTableView * tableView;
|
|
|
|
|
2023-04-14 16:12:52 -04:00
|
|
|
//@----- ACQ
|
|
|
|
ReadDataThread ** readDataThread;
|
2023-10-19 14:29:28 -04:00
|
|
|
|
2023-04-18 13:12:05 -04:00
|
|
|
//@----- Scope
|
|
|
|
Scope * scope;
|
|
|
|
|
2023-04-24 16:37:57 -04:00
|
|
|
//@----- DigiSettings
|
2023-04-24 17:37:03 -04:00
|
|
|
DigiSettingsPanel * digiSettings;
|
2023-04-24 16:37:57 -04:00
|
|
|
|
2023-06-02 15:41:26 -04:00
|
|
|
//@----- SingleSpectra
|
2024-08-20 14:59:22 -04:00
|
|
|
SingleSpectra * singleHistograms;
|
2023-05-17 17:40:32 -04:00
|
|
|
|
2023-05-26 18:06:37 -04:00
|
|
|
//@----- Analyzer
|
2023-06-02 15:41:26 -04:00
|
|
|
Analyzer * onlineAnalyzer;
|
2023-05-26 18:06:37 -04:00
|
|
|
|
2024-09-09 14:22:21 -04:00
|
|
|
QString maskText(const QString &password) {
|
|
|
|
if (password.length() <= 3) {
|
|
|
|
return password; // No masking needed for short passwords
|
|
|
|
} else if (password.length() <= 10) {
|
|
|
|
QString maskedPassword = password.left(3);
|
|
|
|
maskedPassword += QString("*").repeated(password.length() - 3);
|
|
|
|
return maskedPassword;
|
|
|
|
} else {
|
|
|
|
return password.left(3) + QString("*").repeated(7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-26 18:06:37 -04:00
|
|
|
|
2023-04-11 11:13:23 -04:00
|
|
|
};
|
|
|
|
|
2024-08-28 17:22:41 -04:00
|
|
|
//^======================== Scalar Worker
|
|
|
|
|
2024-09-04 17:50:59 -04:00
|
|
|
// class ScalarWorker : public QObject{
|
|
|
|
// Q_OBJECT
|
|
|
|
// public:
|
|
|
|
// ScalarWorker(FSUDAQ * parent): SS(parent){}
|
2024-08-28 17:22:41 -04:00
|
|
|
|
2024-09-04 17:50:59 -04:00
|
|
|
// public slots:
|
|
|
|
// void UpdateScalar(){
|
|
|
|
// SS->UpdateScalar();
|
|
|
|
// emit workDone();
|
|
|
|
// }
|
2024-08-28 17:22:41 -04:00
|
|
|
|
2024-09-04 17:50:59 -04:00
|
|
|
// signals:
|
|
|
|
// void workDone();
|
2024-08-28 17:22:41 -04:00
|
|
|
|
2024-09-04 17:50:59 -04:00
|
|
|
// private:
|
|
|
|
// FSUDAQ * SS;
|
|
|
|
// };
|
2024-08-28 17:22:41 -04:00
|
|
|
|
2023-04-11 11:13:23 -04:00
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|