2023-01-25 14:59:48 -05:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QPlainTextEdit>
|
|
|
|
#include <qdebug.h>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QScrollBar>
|
|
|
|
#include <QPushButton>
|
2023-02-06 15:58:21 -05:00
|
|
|
#include <QComboBox>
|
2023-02-13 17:56:15 -05:00
|
|
|
#include <QLabel>
|
2023-02-17 19:30:31 -05:00
|
|
|
#include <QTimer>
|
2023-03-30 13:09:11 -04:00
|
|
|
#include <QThread>
|
2023-02-09 18:27:20 -05:00
|
|
|
|
2023-02-03 16:58:27 -05:00
|
|
|
#include <QChart>
|
2023-02-03 17:44:36 -05:00
|
|
|
#include <QLineSeries>
|
2023-01-25 14:59:48 -05:00
|
|
|
|
2023-01-25 17:16:14 -05:00
|
|
|
#include <vector>
|
2023-01-30 18:40:24 -05:00
|
|
|
#include <time.h> // time in nano-sec
|
2023-01-25 17:16:14 -05:00
|
|
|
|
2023-03-16 17:28:55 -04:00
|
|
|
#include "macro.h"
|
2023-01-30 18:40:24 -05:00
|
|
|
#include "ClassDigitizer2Gen.h"
|
|
|
|
#include "influxdb.h"
|
|
|
|
|
2023-09-15 17:31:07 -04:00
|
|
|
#include "CustomThreads.h"
|
2023-01-30 18:40:24 -05:00
|
|
|
|
2023-02-23 16:08:47 -05:00
|
|
|
#include "digiSettingsPanel.h"
|
2023-02-09 18:27:20 -05:00
|
|
|
#include "scope.h"
|
2023-03-17 17:08:56 -04:00
|
|
|
#include "SOLARISpanel.h"
|
2023-01-25 14:59:48 -05:00
|
|
|
|
2023-03-15 15:48:33 -04:00
|
|
|
const int chromeWindowID = -1; // disable capture screenshot
|
2023-02-22 12:41:48 -05:00
|
|
|
|
2023-02-03 18:58:35 -05:00
|
|
|
//^#===================================================== MainWindow
|
2023-01-25 14:59:48 -05:00
|
|
|
class MainWindow : public QMainWindow{
|
2023-02-03 16:58:27 -05:00
|
|
|
Q_OBJECT
|
2023-01-25 14:59:48 -05:00
|
|
|
|
|
|
|
public:
|
2023-02-03 16:58:27 -05:00
|
|
|
MainWindow(QWidget *parent = nullptr);
|
|
|
|
~MainWindow();
|
2023-01-25 14:59:48 -05:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
2023-02-03 16:58:27 -05:00
|
|
|
void OpenDigitizers();
|
|
|
|
void CloseDigitizers();
|
2023-02-09 18:40:47 -05:00
|
|
|
|
|
|
|
void OpenScope();
|
2023-02-03 16:58:27 -05:00
|
|
|
void OpenDigitizersSettings();
|
2023-09-15 17:31:07 -04:00
|
|
|
void OpenSyncHelper();
|
2023-01-25 17:16:14 -05:00
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
void OpenSOLARISpanel();
|
|
|
|
bool CheckSOLARISpanelOK();
|
|
|
|
|
2023-04-03 18:20:36 -04:00
|
|
|
int StartACQ(); // return 1 when ACQ start
|
2023-03-17 17:08:56 -04:00
|
|
|
void StopACQ();
|
2023-02-17 19:30:31 -05:00
|
|
|
void AutoRun();
|
|
|
|
|
2023-02-13 15:22:24 -05:00
|
|
|
void OpenScaler();
|
|
|
|
void SetUpScalar();
|
2023-04-18 10:38:40 -04:00
|
|
|
void CleanUpScalar();
|
2023-02-13 17:07:26 -05:00
|
|
|
void UpdateScalar();
|
2023-02-13 15:22:24 -05:00
|
|
|
|
2023-02-17 19:30:31 -05:00
|
|
|
void ProgramSettingsPanel();
|
|
|
|
bool LoadProgramSettings();
|
2023-02-03 16:58:27 -05:00
|
|
|
void SaveProgramSettings();
|
2023-02-13 15:22:24 -05:00
|
|
|
void DecodeIPList();
|
2023-02-13 18:40:02 -05:00
|
|
|
void SetupInflux();
|
2023-02-17 19:30:31 -05:00
|
|
|
void CheckElog();
|
2023-02-03 16:58:27 -05:00
|
|
|
void OpenDirectory(int id);
|
2023-02-01 16:38:02 -05:00
|
|
|
|
2023-02-17 19:30:31 -05:00
|
|
|
void SetupNewExpPanel();
|
2024-06-28 18:30:35 -04:00
|
|
|
bool LoadExpNameSh();
|
2023-02-03 16:58:27 -05:00
|
|
|
void CreateNewExperiment(const QString newExpName);
|
|
|
|
void ChangeExperiment(const QString newExpName);
|
2023-02-22 12:41:48 -05:00
|
|
|
void WriteExpNameSh();
|
2024-07-01 17:19:23 -04:00
|
|
|
void CreateRawDataFolder();
|
|
|
|
void CreateDataSymbolicLink();
|
2023-01-31 18:59:12 -05:00
|
|
|
|
2023-02-09 18:27:20 -05:00
|
|
|
void closeEvent(QCloseEvent * event){
|
2023-03-17 17:08:56 -04:00
|
|
|
if( digiSetting ) digiSetting->close();
|
|
|
|
if( scope ) scope->close();
|
|
|
|
if( solarisSetting ) solarisSetting->close();
|
2023-02-09 18:27:20 -05:00
|
|
|
event->accept();
|
|
|
|
}
|
|
|
|
|
2023-02-22 12:41:48 -05:00
|
|
|
void WriteElog(QString htmlText, QString subject = "", QString category = "", int runNumber = 0);
|
2023-02-17 19:30:31 -05:00
|
|
|
void AppendElog(QString appendHtmlText, int screenID = -1);
|
2023-02-09 18:27:20 -05:00
|
|
|
|
2023-12-07 18:10:17 -05:00
|
|
|
void WriteRunTimeStampDat(bool isStartRun, QString timeStr);
|
2023-03-15 19:10:17 -04:00
|
|
|
|
2023-01-25 14:59:48 -05:00
|
|
|
signals :
|
|
|
|
|
|
|
|
private:
|
2023-03-17 17:08:56 -04:00
|
|
|
|
|
|
|
static Digitizer2Gen ** digi;
|
|
|
|
unsigned short nDigi;
|
2023-03-27 18:34:22 -04:00
|
|
|
unsigned short nDigiConnected = 0;
|
2023-03-17 17:08:56 -04:00
|
|
|
|
|
|
|
//@----- log msg
|
|
|
|
QPlainTextEdit * logInfo;
|
|
|
|
void LogMsg(QString msg);
|
|
|
|
bool logMsgHTMLMode = true;
|
2023-01-30 18:40:24 -05:00
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
//@----- buttons
|
2023-02-03 16:58:27 -05:00
|
|
|
QPushButton * bnProgramSettings;
|
|
|
|
QPushButton * bnNewExp;
|
|
|
|
QLineEdit * leExpName;
|
|
|
|
|
2023-09-15 17:31:07 -04:00
|
|
|
QPushButton * bnSyncHelper;
|
2023-02-03 16:58:27 -05:00
|
|
|
QPushButton * bnOpenDigitizers;
|
|
|
|
QPushButton * bnCloseDigitizers;
|
|
|
|
|
|
|
|
QPushButton * bnDigiSettings;
|
|
|
|
QPushButton * bnSOLSettings;
|
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
//@----- scope
|
2023-02-09 18:27:20 -05:00
|
|
|
Scope * scope;
|
2023-02-03 16:58:27 -05:00
|
|
|
QPushButton * bnOpenScope;
|
|
|
|
|
2023-02-13 15:22:24 -05:00
|
|
|
//@----- scalar;
|
2023-02-22 12:48:54 -05:00
|
|
|
QMainWindow * scalar;
|
2023-04-18 10:38:40 -04:00
|
|
|
QGridLayout * scalarLayout;
|
2023-04-25 17:23:50 -04:00
|
|
|
TimingThread * scalarThread;
|
2023-02-22 12:48:54 -05:00
|
|
|
QPushButton * bnOpenScalar;
|
2024-04-08 20:41:57 -04:00
|
|
|
QLabel ** lbFileSize;// need to delete manually
|
2023-02-22 12:48:54 -05:00
|
|
|
QLineEdit *** leTrigger; // need to delete manually
|
|
|
|
QLineEdit *** leAccept; // need to delete manually
|
|
|
|
QLabel * lbLastUpdateTime;
|
|
|
|
QLabel * lbScalarACQStatus;
|
2023-09-19 12:57:42 -04:00
|
|
|
bool scalarOutputInflux;
|
2023-04-18 10:38:40 -04:00
|
|
|
|
2023-02-22 12:48:54 -05:00
|
|
|
InfluxDB * influx;
|
2023-02-13 15:22:24 -05:00
|
|
|
|
2023-02-06 15:58:21 -05:00
|
|
|
//@------ ACQ things
|
2023-02-03 16:58:27 -05:00
|
|
|
QPushButton * bnStartACQ;
|
|
|
|
QPushButton * bnStopACQ;
|
2023-02-13 17:56:15 -05:00
|
|
|
QCheckBox * chkSaveRun;
|
|
|
|
QComboBox * cbAutoRun;
|
2023-09-15 17:31:07 -04:00
|
|
|
QComboBox * cbDataFormat;
|
2023-02-03 16:58:27 -05:00
|
|
|
QLineEdit * leRunID;
|
|
|
|
QLineEdit * leRawDataPath;
|
2023-02-14 18:44:10 -05:00
|
|
|
QLineEdit * leRunComment;
|
2023-02-13 15:22:24 -05:00
|
|
|
ReadDataThread ** readDataThread;
|
2023-02-14 18:44:10 -05:00
|
|
|
QString startComment;
|
|
|
|
QString stopComment;
|
2023-03-27 15:48:41 -04:00
|
|
|
QString appendComment;
|
2023-03-15 15:48:33 -04:00
|
|
|
bool needManualComment;
|
2023-12-07 18:10:17 -05:00
|
|
|
bool isACQRunning;
|
2023-03-17 17:08:56 -04:00
|
|
|
QTimer * runTimer;
|
2023-03-30 13:09:11 -04:00
|
|
|
QElapsedTimer elapsedTimer;
|
2023-03-17 17:08:56 -04:00
|
|
|
unsigned int autoRunStartRunID;
|
2023-02-03 16:58:27 -05:00
|
|
|
|
2024-04-08 20:17:26 -04:00
|
|
|
bool ACQStopButtonPressed;
|
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
//@----- digi Setting panel
|
2023-02-23 16:08:47 -05:00
|
|
|
DigiSettingsPanel * digiSetting;
|
2023-02-03 16:58:27 -05:00
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
//@----- SOLARIS setting panel
|
|
|
|
SOLARISpanel * solarisSetting;
|
|
|
|
std::vector<std::vector<int>> mapping;
|
|
|
|
QStringList detType;
|
|
|
|
std::vector<int> detMaxID;
|
2023-03-31 20:01:27 -04:00
|
|
|
std::vector<int> detGroupID;
|
|
|
|
QStringList detGroupName;
|
2023-02-03 16:58:27 -05:00
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
//@----- Program settings
|
2024-07-01 17:19:23 -04:00
|
|
|
// QLineEdit * lSaveSettingPath;
|
2024-06-28 18:30:35 -04:00
|
|
|
QLineEdit * lAnalysisPath; //for git
|
|
|
|
QLineEdit * lExpDataPath;
|
|
|
|
|
2024-07-01 17:19:23 -04:00
|
|
|
QLineEdit * lExpName;
|
2023-02-03 16:58:27 -05:00
|
|
|
|
|
|
|
QLineEdit * lIPDomain;
|
|
|
|
QLineEdit * lDatbaseIP;
|
|
|
|
QLineEdit * lDatbaseName;
|
|
|
|
QLineEdit * lElogIP;
|
|
|
|
|
2024-07-01 18:19:36 -04:00
|
|
|
QStringList existGitBranches;
|
|
|
|
|
2024-07-01 17:19:23 -04:00
|
|
|
QString programPath;
|
2023-02-03 16:58:27 -05:00
|
|
|
QString analysisPath;
|
2024-07-01 17:19:23 -04:00
|
|
|
QString masterExpDataPath;
|
2024-06-28 18:30:35 -04:00
|
|
|
QString expDataPath;
|
|
|
|
QString rawDataPath;
|
2023-03-28 16:58:46 -04:00
|
|
|
QString rootDataPath;
|
2023-02-03 16:58:27 -05:00
|
|
|
QString IPListStr;
|
|
|
|
QStringList IPList;
|
|
|
|
QString DatabaseIP;
|
|
|
|
QString DatabaseName;
|
|
|
|
QString ElogIP;
|
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
//@------ experiment settings
|
2023-02-03 16:58:27 -05:00
|
|
|
bool isGitExist;
|
|
|
|
bool useGit;
|
|
|
|
QString expName;
|
2023-02-22 12:41:48 -05:00
|
|
|
int runID;
|
2023-02-14 17:39:49 -05:00
|
|
|
QString runIDStr;
|
2023-02-17 19:30:31 -05:00
|
|
|
int elogID; // 0 = ready, -1 = disable, >1 = elogID
|
|
|
|
|
2023-03-17 17:08:56 -04:00
|
|
|
//@------ calculate instant accept Rate
|
2023-03-15 19:10:17 -04:00
|
|
|
unsigned long oldSavedCount[MaxNumberOfDigitizer][MaxNumberOfChannel];
|
|
|
|
unsigned long oldTimeStamp[MaxNumberOfDigitizer][MaxNumberOfChannel];
|
|
|
|
|
2023-03-23 16:36:47 -04:00
|
|
|
//@------ connection between pannels
|
2023-03-24 17:23:59 -04:00
|
|
|
void UpdateAllPanel(int panelID);
|
2023-01-25 14:59:48 -05:00
|
|
|
|
2023-03-27 15:48:41 -04:00
|
|
|
//@------ custom comment;
|
|
|
|
QPushButton * bnComment;
|
|
|
|
void AppendComment();
|
2023-03-30 13:09:11 -04:00
|
|
|
|
2023-01-25 14:59:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|