add a basic scope window
This commit is contained in:
parent
9dc44b5070
commit
19a637f366
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"script.C": "cpp",
|
"script.C": "cpp",
|
||||||
"SOLARIS_Qt6_DAQ.pro" : "makefile"
|
"SOLARIS_Qt6_DAQ.pro": "makefile",
|
||||||
|
"qlineseries": "cpp"
|
||||||
},
|
},
|
||||||
|
|
||||||
"better-comments.multilineComments": true,
|
"better-comments.multilineComments": true,
|
||||||
|
|
|
@ -6,7 +6,7 @@ CAEN_DIG2_v1.5.3
|
||||||
|
|
||||||
CAEN_FELIB_v1.2.2
|
CAEN_FELIB_v1.2.2
|
||||||
|
|
||||||
`sudo apt install qt6-base-dev libcurl4-openssl-dev`
|
`sudo apt install qt6-base-dev libcurl4-openssl-dev libqt6charts6-dev`
|
||||||
|
|
||||||
Digitizer firmware V2745-dpp-pha-2022092903.cup
|
Digitizer firmware V2745-dpp-pha-2022092903.cup
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ TEMPLATE = app
|
||||||
TARGET = SOLARIS_DAQ
|
TARGET = SOLARIS_DAQ
|
||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
|
|
||||||
QT += widgets
|
QT += widgets charts
|
||||||
|
|
||||||
LIBS += -lcurl -lCAEN_FELib
|
LIBS += -lcurl -lCAEN_FELib
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QRegularExpression>
|
|
||||||
|
#include <QChartView>
|
||||||
|
#include <QLineSeries>
|
||||||
|
#include <QValueAxis>
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -27,6 +30,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
digiSetting = NULL;
|
digiSetting = NULL;
|
||||||
readDataThread = NULL;
|
readDataThread = NULL;
|
||||||
|
|
||||||
|
plot = new QChart();
|
||||||
|
|
||||||
QWidget * mainLayoutWidget = new QWidget(this);
|
QWidget * mainLayoutWidget = new QWidget(this);
|
||||||
setCentralWidget(mainLayoutWidget);
|
setCentralWidget(mainLayoutWidget);
|
||||||
QVBoxLayout * layoutMain = new QVBoxLayout(mainLayoutWidget);
|
QVBoxLayout * layoutMain = new QVBoxLayout(mainLayoutWidget);
|
||||||
|
@ -52,8 +57,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
leExpName->setAlignment(Qt::AlignHCenter);
|
leExpName->setAlignment(Qt::AlignHCenter);
|
||||||
leExpName->setReadOnly(true);
|
leExpName->setReadOnly(true);
|
||||||
|
|
||||||
QPushButton * bnOpenScope = new QPushButton("Open scope", this);
|
bnOpenScope = new QPushButton("Open scope", this);
|
||||||
bnOpenScope->setEnabled(false);
|
bnOpenScope->setEnabled(false);
|
||||||
|
connect(bnOpenScope, &QPushButton::clicked, this, &MainWindow::OpenScope);
|
||||||
|
|
||||||
bnOpenDigitizers = new QPushButton("Open Digitizers", this);
|
bnOpenDigitizers = new QPushButton("Open Digitizers", this);
|
||||||
connect(bnOpenDigitizers, SIGNAL(clicked()), this, SLOT(OpenDigitizers()));
|
connect(bnOpenDigitizers, SIGNAL(clicked()), this, SLOT(OpenDigitizers()));
|
||||||
|
@ -66,7 +72,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
bnDigiSettings->setEnabled(false);
|
bnDigiSettings->setEnabled(false);
|
||||||
connect(bnDigiSettings, SIGNAL(clicked()), this, SLOT(OpenDigitizersSettings()));
|
connect(bnDigiSettings, SIGNAL(clicked()), this, SLOT(OpenDigitizersSettings()));
|
||||||
|
|
||||||
QPushButton * bnSOLSettings = new QPushButton("SOLARIS Settings", this);
|
bnSOLSettings = new QPushButton("SOLARIS Settings", this);
|
||||||
bnSOLSettings->setEnabled(false);
|
bnSOLSettings->setEnabled(false);
|
||||||
|
|
||||||
layout1->addWidget(bnProgramSettings, 0, 0);
|
layout1->addWidget(bnProgramSettings, 0, 0);
|
||||||
|
@ -163,8 +169,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
|
|
||||||
if( OpenProgramSettings() ) OpenExpSettings();
|
if( OpenProgramSettings() ) OpenExpSettings();
|
||||||
|
|
||||||
//bnOpenDigitizers_clicked();
|
bnOpenScope->setEnabled(true);
|
||||||
//OpenDigitizersSettings();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,6 +183,8 @@ MainWindow::~MainWindow(){
|
||||||
//delete bnNewExp;
|
//delete bnNewExp;
|
||||||
//delete logInfo;
|
//delete logInfo;
|
||||||
|
|
||||||
|
if( plot != NULL )delete plot;
|
||||||
|
|
||||||
//---- need manually delete
|
//---- need manually delete
|
||||||
if( digiSetting != NULL ) delete digiSetting;
|
if( digiSetting != NULL ) delete digiSetting;
|
||||||
|
|
||||||
|
@ -233,7 +240,7 @@ void MainWindow::StopACQ(){
|
||||||
//^###################################################################### open and close digitizer
|
//^###################################################################### open and close digitizer
|
||||||
void MainWindow::OpenDigitizers(){
|
void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
LogMsg("Opening " + QString::number(nDigi) + " Digitizers.....");
|
LogMsg("<font style=\"color:blue;\">Opening " + QString::number(nDigi) + " Digitizers..... </font>");
|
||||||
|
|
||||||
digi = new Digitizer2Gen*[nDigi];
|
digi = new Digitizer2Gen*[nDigi];
|
||||||
readDataThread = new ReadDataThread*[nDigi];
|
readDataThread = new ReadDataThread*[nDigi];
|
||||||
|
@ -252,6 +259,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
LogMsg("Opened digitizer : <font style=\"color:red;\">" + QString::number(digi[i]->GetSerialNumber()) + "</font>");
|
LogMsg("Opened digitizer : <font style=\"color:red;\">" + QString::number(digi[i]->GetSerialNumber()) + "</font>");
|
||||||
bnStartACQ->setEnabled(true);
|
bnStartACQ->setEnabled(true);
|
||||||
bnStopACQ->setEnabled(false);
|
bnStopACQ->setEnabled(false);
|
||||||
|
bnOpenScope->setEnabled(true);
|
||||||
|
|
||||||
readDataThread[i] = new ReadDataThread(digi[i], this);
|
readDataThread[i] = new ReadDataThread(digi[i], this);
|
||||||
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
||||||
|
@ -273,6 +281,8 @@ void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
void MainWindow::CloseDigitizers(){
|
void MainWindow::CloseDigitizers(){
|
||||||
|
|
||||||
|
if( digi == NULL) return;
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
digi[i]->CloseDigitizer();
|
digi[i]->CloseDigitizer();
|
||||||
|
|
||||||
|
@ -306,6 +316,49 @@ void MainWindow::CloseDigitizers(){
|
||||||
bnOpenDigitizers->setFocus();
|
bnOpenDigitizers->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//^###################################################################### Open Scope
|
||||||
|
void MainWindow::OpenScope(){
|
||||||
|
|
||||||
|
QMainWindow * scope = new QMainWindow(this);
|
||||||
|
scope->setWindowTitle("Scope");
|
||||||
|
scope->setGeometry(0, 0, 1000, 800);
|
||||||
|
|
||||||
|
QWidget * layoutWidget = new QWidget(scope);
|
||||||
|
scope->setCentralWidget(layoutWidget);
|
||||||
|
QGridLayout * layout = new QGridLayout(layoutWidget);
|
||||||
|
layoutWidget->setLayout(layout);
|
||||||
|
|
||||||
|
|
||||||
|
plot->removeAllSeries();
|
||||||
|
|
||||||
|
QLineSeries * data = new QLineSeries(this);
|
||||||
|
data->setName("data");
|
||||||
|
|
||||||
|
//--------- add data
|
||||||
|
data->append(1, 2);
|
||||||
|
data->append(2, 2);
|
||||||
|
data->append(3, 5);
|
||||||
|
data->append(4, 2);
|
||||||
|
|
||||||
|
plot->addSeries(data);
|
||||||
|
|
||||||
|
|
||||||
|
plot->createDefaultAxes(); /// this must be after addSeries();
|
||||||
|
plot->axes(Qt::Vertical).first()->setRange(0, 10); /// this must be after createDefaultAxes();
|
||||||
|
plot->axes(Qt::Horizontal).first()->setRange(0, 5);
|
||||||
|
|
||||||
|
QChartView * plotView = new QChartView(plot);
|
||||||
|
plotView->setRenderHints(QPainter::Antialiasing);
|
||||||
|
|
||||||
|
//scope->setCentralWidget(plotView);
|
||||||
|
layout->addWidget(plotView);
|
||||||
|
|
||||||
|
|
||||||
|
scope->show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//^###################################################################### Open digitizer setting panel
|
||||||
void MainWindow::OpenDigitizersSettings(){
|
void MainWindow::OpenDigitizersSettings(){
|
||||||
LogMsg("Open digitizers Settings Panel");
|
LogMsg("Open digitizers Settings Panel");
|
||||||
|
|
||||||
|
|
124
mainwindow.h
124
mainwindow.h
|
@ -11,6 +11,7 @@
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QChart>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <time.h> // time in nano-sec
|
#include <time.h> // time in nano-sec
|
||||||
|
@ -85,92 +86,99 @@ private:
|
||||||
//=================================================
|
//=================================================
|
||||||
|
|
||||||
class MainWindow : public QMainWindow{
|
class MainWindow : public QMainWindow{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void OpenDigitizers();
|
void OpenDigitizers();
|
||||||
void CloseDigitizers();
|
void CloseDigitizers();
|
||||||
|
|
||||||
void OpenDigitizersSettings();
|
void OpenScope();
|
||||||
|
|
||||||
|
void OpenDigitizersSettings();
|
||||||
|
|
||||||
|
|
||||||
void ProgramSettings();
|
void ProgramSettings();
|
||||||
bool OpenProgramSettings();
|
bool OpenProgramSettings();
|
||||||
void SaveProgramSettings();
|
void SaveProgramSettings();
|
||||||
void OpenDirectory(int id);
|
void OpenDirectory(int id);
|
||||||
|
|
||||||
void SetupNewExp();
|
void SetupNewExp();
|
||||||
bool OpenExpSettings();
|
bool OpenExpSettings();
|
||||||
void CreateNewExperiment(const QString newExpName);
|
void CreateNewExperiment(const QString newExpName);
|
||||||
void ChangeExperiment(const QString newExpName);
|
void ChangeExperiment(const QString newExpName);
|
||||||
void CreateRawDataFolderAndLink(const QString newExpName);
|
void CreateRawDataFolderAndLink(const QString newExpName);
|
||||||
|
|
||||||
signals :
|
signals :
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QPushButton * bnProgramSettings;
|
QPushButton * bnProgramSettings;
|
||||||
QPushButton * bnNewExp;
|
QPushButton * bnNewExp;
|
||||||
QLineEdit * leExpName;
|
QLineEdit * leExpName;
|
||||||
|
|
||||||
QPushButton * bnOpenDigitizers;
|
QPushButton * bnOpenDigitizers;
|
||||||
QPushButton * bnCloseDigitizers;
|
QPushButton * bnCloseDigitizers;
|
||||||
QPushButton * bnDigiSettings;
|
|
||||||
|
|
||||||
QPushButton * bnStartACQ;
|
QPushButton * bnDigiSettings;
|
||||||
QPushButton * bnStopACQ;
|
QPushButton * bnSOLSettings;
|
||||||
QLineEdit * leRunID;
|
|
||||||
QLineEdit * leRawDataPath;
|
|
||||||
|
|
||||||
DigiSettings * digiSetting;
|
QPushButton * bnOpenScope;
|
||||||
|
QChart * plot;
|
||||||
|
|
||||||
QPlainTextEdit * logInfo;
|
QPushButton * bnStartACQ;
|
||||||
|
QPushButton * bnStopACQ;
|
||||||
|
QLineEdit * leRunID;
|
||||||
|
QLineEdit * leRawDataPath;
|
||||||
|
|
||||||
static Digitizer2Gen ** digi;
|
DigiSettings * digiSetting;
|
||||||
unsigned short nDigi;
|
|
||||||
std::vector<unsigned short> digiSerialNum;
|
|
||||||
|
|
||||||
void StartACQ();
|
QPlainTextEdit * logInfo;
|
||||||
void StopACQ();
|
|
||||||
|
|
||||||
ReadDataThread ** readDataThread;
|
static Digitizer2Gen ** digi;
|
||||||
|
unsigned short nDigi;
|
||||||
|
std::vector<unsigned short> digiSerialNum;
|
||||||
|
|
||||||
void LogMsg(QString msg);
|
void StartACQ();
|
||||||
bool logMsgHTMLMode = true;
|
void StopACQ();
|
||||||
|
|
||||||
//---------------- Program settings
|
ReadDataThread ** readDataThread;
|
||||||
QLineEdit * lSaveSettingPath; // only live in ProgramSettigns()
|
|
||||||
QLineEdit * lAnalysisPath; // only live in ProgramSettigns()
|
|
||||||
QLineEdit * lDataPath; // only live in ProgramSettigns()
|
|
||||||
|
|
||||||
QLineEdit * lIPDomain;
|
void LogMsg(QString msg);
|
||||||
QLineEdit * lDatbaseIP;
|
bool logMsgHTMLMode = true;
|
||||||
QLineEdit * lDatbaseName;
|
|
||||||
QLineEdit * lElogIP;
|
|
||||||
|
|
||||||
QString settingFilePath;
|
//---------------- Program settings
|
||||||
QString analysisPath;
|
QLineEdit * lSaveSettingPath; // only live in ProgramSettigns()
|
||||||
QString dataPath;
|
QLineEdit * lAnalysisPath; // only live in ProgramSettigns()
|
||||||
QString IPListStr;
|
QLineEdit * lDataPath; // only live in ProgramSettigns()
|
||||||
QStringList IPList;
|
|
||||||
QString DatabaseIP;
|
|
||||||
QString DatabaseName;
|
|
||||||
QString ElogIP;
|
|
||||||
|
|
||||||
//------------- experiment settings
|
QLineEdit * lIPDomain;
|
||||||
bool isGitExist;
|
QLineEdit * lDatbaseIP;
|
||||||
bool useGit;
|
QLineEdit * lDatbaseName;
|
||||||
QString expName;
|
QLineEdit * lElogIP;
|
||||||
QString rawDataFolder;
|
|
||||||
unsigned int runID;
|
QString settingFilePath;
|
||||||
unsigned int elogID;
|
QString analysisPath;
|
||||||
|
QString dataPath;
|
||||||
|
QString IPListStr;
|
||||||
|
QStringList IPList;
|
||||||
|
QString DatabaseIP;
|
||||||
|
QString DatabaseName;
|
||||||
|
QString ElogIP;
|
||||||
|
|
||||||
|
//------------- experiment settings
|
||||||
|
bool isGitExist;
|
||||||
|
bool useGit;
|
||||||
|
QString expName;
|
||||||
|
QString rawDataFolder;
|
||||||
|
unsigned int runID;
|
||||||
|
unsigned int elogID;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user