many bugs fix, plan to add SyncHelper

This commit is contained in:
Ryan Tang 2023-09-15 17:31:07 -04:00
parent 8a0c828ebe
commit 9736f5cdc6
11 changed files with 215 additions and 74 deletions

View File

@ -1,13 +1,12 @@
#ifndef MANYTHREADS_H #ifndef CUSTOMTHREADS_H
#define MANYTHREADS_H #define CUSTOMTHREADS_H
#include <QThread> #include <QThread>
#include <QMutex> #include <QMutex>
#include "macro.h" #include "macro.h"
#include "ClassDigitizer2Gen.h" #include "ClassDigitizer2Gen.h"
#include "macro.h"
static QMutex digiMTX[MaxNumberOfDigitizer]; static QMutex digiMTX[MaxNumberOfDigitizer];
@ -19,11 +18,15 @@ public:
this->digi = dig; this->digi = dig;
this->ID = digiID; this->ID = digiID;
isSaveData = false; isSaveData = false;
stop = false;
} }
void Stop(){ this->stop = true;}
void SetSaveData(bool onOff) {this->isSaveData = onOff;} void SetSaveData(bool onOff) {this->isSaveData = onOff;}
void run(){ void run(){
stop = false;
clock_gettime(CLOCK_REALTIME, &ta); clock_gettime(CLOCK_REALTIME, &ta);
while(true){
while(!stop){
digiMTX[ID].lock(); digiMTX[ID].lock();
int ret = digi->ReadData(); int ret = digi->ReadData();
digiMTX[ID].unlock(); digiMTX[ID].unlock();
@ -59,7 +62,7 @@ private:
Digitizer2Gen * digi; Digitizer2Gen * digi;
int ID; int ID;
timespec ta, tb; timespec ta, tb;
bool isSaveData; bool isSaveData, stop;
}; };
//^#======================================================= Timing Thread, for some action need to be done periodically //^#======================================================= Timing Thread, for some action need to be done periodically

View File

@ -1,3 +1,41 @@
# Architecture
The core digitizer control classes are independent from the UI classes
## Core digitizer class/files
- Event.h
- DigiParameters.h
- ClassDigitizer2Gen.h/cpp
The test.cpp is a demo code to use the ClassDigitizer2Gen.h/cpp.
## Auxillary classes
- influxdb.h/cpp
## UI classes/files
- main.cpp
- mainwindow.h/cpp
- digiSettingsPanel.h/cpp
- CustomWidget.h
- CustomThreads.h
- scope.h/cpp
- SOLARISpanel.h/cpp
## Other files
- makeTest
- test.cpp
- script.C
- SolReader.h
- windowID.cpp
## Wiki
https://fsunuc.physics.fsu.edu/wiki/index.php/FRIB_SOLARIS_Collaboration
# Required / Development enviroment # Required / Development enviroment
Ubuntu 22.04 Ubuntu 22.04
@ -12,6 +50,7 @@ Digitizer firmware V2745-dpp-pha-2022092903.cup
# Compile # Compile
## if *.pro does not exist
use `qmake6 -project ` to generate the *.pro use `qmake6 -project ` to generate the *.pro
in the *.pro, add in the *.pro, add
@ -20,6 +59,8 @@ in the *.pro, add
` LIBS += -lcurl -lCAEN_FELib` ` LIBS += -lcurl -lCAEN_FELib`
then run ` qmake6 *.pro` it will generate Makefile ## if *.pro exist
run ` qmake6 *.pro` it will generate Makefile
then ` make` then ` make`

View File

@ -8,6 +8,7 @@ INCLUDEPATH += .
QT += widgets charts QT += widgets charts
QMAKE_CXXFLAGS += -g # for gdb debug
LIBS += -lcurl -lCAEN_FELib -lX11 LIBS += -lcurl -lCAEN_FELib -lX11
# You can make your code fail to compile if you use deprecated APIs. # You can make your code fail to compile if you use deprecated APIs.
@ -18,5 +19,22 @@ LIBS += -lcurl -lCAEN_FELib -lX11
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Input # Input
HEADERS += ClassDigitizer2Gen.h Event.h influxdb.h mainwindow.h digiSettingsPanel.h Digiparameters.h scope.h manyThread.h CustomWidgets.h macro.h SOLARISpanel.h HEADERS += ClassDigitizer2Gen.h \
SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp digiSettingsPanel.cpp scope.cpp SOLARISpanel.cpp Event.h \
influxdb.h \
mainwindow.h \
digiSettingsPanel.h \
Digiparameters.h \
scope.h \
CustomThreads.h \
CustomWidgets.h \
macro.h \
SOLARISpanel.h
SOURCES += ClassDigitizer2Gen.cpp \
influxdb.cpp \
main.cpp \
mainwindow.cpp \
digiSettingsPanel.cpp \
scope.cpp \
SOLARISpanel.cpp

View File

@ -276,6 +276,29 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------------- //-------------------------------------
SetupComboBox(cbbClockSource[iDigi], PHA::DIG::ClockSource, -1, true, "Clock Source :", boardLayout, rowId, 0, 1, 2); SetupComboBox(cbbClockSource[iDigi], PHA::DIG::ClockSource, -1, true, "Clock Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbEnClockFP = new QLabel("Enable Clock Out Font Panel :", tab);
lbEnClockFP->setAlignment(Qt::AlignRight | Qt::AlignCenter);
boardLayout->addWidget(lbEnClockFP, rowId, 2, 1, 3);
cbbEnClockFrontPanel[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbEnClockFrontPanel[iDigi], rowId, 5);
SetupShortComboBox(cbbEnClockFrontPanel[iDigi], PHA::DIG::EnableClockOutFrontPanel);
connect(cbbEnClockFrontPanel[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableClockOutFrontPanel.GetPara());
msg += " = " + cbbEnClockFrontPanel[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableClockOutFrontPanel, cbbEnClockFrontPanel[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK.");
cbbEnClockFrontPanel[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbEnClockFrontPanel[ID]->setStyleSheet("color:red;");
}
});
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
QLabel * lbStartSource = new QLabel("Start Source :", tab); QLabel * lbStartSource = new QLabel("Start Source :", tab);
@ -320,7 +343,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str()); //printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg; QString msg;
msg = QString::fromStdString(PHA::DIG::EnableAutoDisarmACQ.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableAutoDisarmACQ.GetPara());
msg += " = " + cbbAutoDisarmAcq[ID]->currentData().toString(); msg += " = " + cbbAutoDisarmAcq[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableAutoDisarmACQ, cbbAutoDisarmAcq[ID]->currentData().toString().toStdString())){ if( digi[ID]->WriteValue(PHA::DIG::EnableAutoDisarmACQ, cbbAutoDisarmAcq[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
@ -345,7 +368,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
connect(cbbStatEvents[iDigi], &RComboBox::currentIndexChanged, this, [=](){ connect(cbbStatEvents[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
QString msg; QString msg;
msg = QString::fromStdString(PHA::DIG::EnableStatisticEvents.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableStatisticEvents.GetPara());
msg += " = " + cbbStatEvents[ID]->currentData().toString(); msg += " = " + cbbStatEvents[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableStatisticEvents, cbbStatEvents[ID]->currentData().toString().toStdString()) ){ if( digi[ID]->WriteValue(PHA::DIG::EnableStatisticEvents, cbbStatEvents[ID]->currentData().toString().toStdString()) ){
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
@ -382,7 +405,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value()); //printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
QString msg; QString msg;
msg = QString::fromStdString(PHA::DIG::BoardVetoWidth.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::BoardVetoWidth.GetPara());
msg += " = " + QString::number(dsbBdVetoWidth[iDigi]->value()); msg += " = " + QString::number(dsbBdVetoWidth[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::BoardVetoWidth, std::to_string(dsbBdVetoWidth[iDigi]->value()), -1) ){ if( digi[ID]->WriteValue(PHA::DIG::BoardVetoWidth, std::to_string(dsbBdVetoWidth[iDigi]->value()), -1) ){
dsbBdVetoWidth[ID]->setStyleSheet(""); dsbBdVetoWidth[ID]->setStyleSheet("");
@ -424,7 +447,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
double value = dsbVolatileClockOutDelay[ID]->value(); double value = dsbVolatileClockOutDelay[ID]->value();
dsbVolatileClockOutDelay[ID]->setValue( (std::round(value/step) * step) ); dsbVolatileClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg; QString msg;
msg = QString::fromStdString(PHA::DIG::VolatileClockOutDelay.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::VolatileClockOutDelay.GetPara());
msg += " = " + QString::number(dsbVolatileClockOutDelay[iDigi]->value()); msg += " = " + QString::number(dsbVolatileClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::VolatileClockOutDelay, std::to_string(dsbVolatileClockOutDelay[ID]->value()), -1) ){ if( digi[ID]->WriteValue(PHA::DIG::VolatileClockOutDelay, std::to_string(dsbVolatileClockOutDelay[ID]->value()), -1) ){
dsbVolatileClockOutDelay[ID]->setStyleSheet(""); dsbVolatileClockOutDelay[ID]->setStyleSheet("");
@ -461,7 +484,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
double value = dsbClockOutDelay[ID]->value(); double value = dsbClockOutDelay[ID]->value();
dsbClockOutDelay[ID]->setValue( (std::round(value/step) * step) ); dsbClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg; QString msg;
msg = QString::fromStdString(PHA::DIG::PermanentClockOutDelay.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::PermanentClockOutDelay.GetPara());
msg += " = " + QString::number(dsbClockOutDelay[iDigi]->value()); msg += " = " + QString::number(dsbClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::PermanentClockOutDelay, std::to_string(dsbClockOutDelay[ID]->value()), -1) ){ if( digi[ID]->WriteValue(PHA::DIG::PermanentClockOutDelay, std::to_string(dsbClockOutDelay[ID]->value()), -1) ){
dsbClockOutDelay[ID]->setStyleSheet(""); dsbClockOutDelay[ID]->setStyleSheet("");
@ -523,7 +546,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
double value = VGA[ID][k]->value(); double value = VGA[ID][k]->value();
VGA[ID][k]->setValue( (std::round(value/step) * step) ); VGA[ID][k]->setValue( (std::round(value/step) * step) );
QString msg; QString msg;
msg = QString::fromStdString(PHA::VGA::VGAGain.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::VGA::VGAGain.GetPara());
if( PHA::VGA::VGAGain.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(k); if( PHA::VGA::VGAGain.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(k);
msg += " = " + QString::number(VGA[ID][k]->value()); msg += " = " + QString::number(VGA[ID][k]->value());
if( digi[ID]->WriteValue(PHA::VGA::VGAGain, std::to_string(VGA[ID][k]->value()), k)){ if( digi[ID]->WriteValue(PHA::VGA::VGAGain, std::to_string(VGA[ID][k]->value()), k)){
@ -1543,7 +1566,7 @@ void DigiSettingsPanel::onTriggerClick(int haha){
QString kaka = QString::number(mask); QString kaka = QString::number(mask);
QString msg; QString msg;
msg = QString::fromStdString(PHA::CH::ChannelsTriggerMask.GetPara() ) + "|DIG:" + QString::number(digi[iDig]->GetNChannels()) + ",CH:" + QString::number(ch) + " = 0x" + QString::number(mask,16); msg = "DIG:" + QString::number(digi[iDig]->GetNChannels()) + ",CH:" + QString::number(ch) + "|" + QString::fromStdString(PHA::CH::ChannelsTriggerMask.GetPara() ) + " = 0x" + QString::number(mask,16);
if( digi[iDig]->WriteValue(PHA::CH::ChannelsTriggerMask, kaka.toStdString(), ch) ){ if( digi[iDig]->WriteValue(PHA::CH::ChannelsTriggerMask, kaka.toStdString(), ch) ){
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
@ -1616,50 +1639,52 @@ void DigiSettingsPanel::EnableControl(){
UpdatePanelFromMemory(); UpdatePanelFromMemory();
bool enable = !digi[ID]->IsAcqOn(); for( int id = 0; id < nDigi; id ++){
bool enable = !digi[id]->IsAcqOn();
digiBox[ID]->setEnabled(enable); digiBox[id]->setEnabled(enable);
if( digi[ID]->GetFPGAType() == "DPP_PHA") VGABox[ID]->setEnabled(enable); if( digi[id]->GetFPGAType() == "DPP_PHA") VGABox[id]->setEnabled(enable);
if( ckbGlbTrgSource[ID][3]->isChecked() ) testPulseBox[ID]->setEnabled(enable); if( ckbGlbTrgSource[id][3]->isChecked() ) testPulseBox[id]->setEnabled(enable);
box1[ID]->setEnabled(enable); box1[id]->setEnabled(enable);
box3[ID]->setEnabled(enable); box3[id]->setEnabled(enable);
box4[ID]->setEnabled(enable); box4[id]->setEnabled(enable);
box5[ID]->setEnabled(enable); box5[id]->setEnabled(enable);
box6[ID]->setEnabled(enable); box6[id]->setEnabled(enable);
bnReadSettngs[ID]->setEnabled(enable); bnReadSettngs[id]->setEnabled(enable);
bnResetBd[ID]->setEnabled(enable); bnResetBd[id]->setEnabled(enable);
bnDefaultSetting[ID]->setEnabled(enable); bnDefaultSetting[id]->setEnabled(enable);
bnSaveSettings[ID]->setEnabled(enable); bnSaveSettings[id]->setEnabled(enable);
bnLoadSettings[ID]->setEnabled(enable); bnLoadSettings[id]->setEnabled(enable);
bnClearData[ID]->setEnabled(enable); bnClearData[id]->setEnabled(enable);
bnArmACQ[ID]->setEnabled(enable); bnArmACQ[id]->setEnabled(enable);
bnDisarmACQ[ID]->setEnabled(enable); bnDisarmACQ[id]->setEnabled(enable);
bnSoftwareStart[ID]->setEnabled(enable); bnSoftwareStart[id]->setEnabled(enable);
bnSoftwareStop[ID]->setEnabled(enable); bnSoftwareStop[id]->setEnabled(enable);
if( digi[ID]->GetFPGAType() != "DPP_PHA" || digi[ID]->GetModelName() != "VX2745" ) VGABox[ID]->setEnabled(false); if( digi[id]->GetFPGAType() != "DPP_PHA" || digi[id]->GetModelName() != "VX2745" ) VGABox[id]->setEnabled(false);
QVector<QTabWidget*> tempArray = {inputTab[ID], trapTab[ID], probeTab[ID], otherTab[ID] }; QVector<QTabWidget*> tempArray = {inputTab[id], trapTab[id], probeTab[id], otherTab[id] };
for( int k = 0; k < tempArray.size(); k++){ for( int k = 0; k < tempArray.size(); k++){
for( int i = 0; i < tempArray[k]->count(); i++) { for( int i = 0; i < tempArray[k]->count(); i++) {
if( k == 0 && (i == 0 || i == 1 || i == 2 ) ) continue; if( k == 0 && (i == 0 || i == 1 || i == 2 ) ) continue;
QWidget* currentTab = tempArray[k]->widget(i); QWidget* currentTab = tempArray[k]->widget(i);
if( currentTab ){ if( currentTab ){
QList<QWidget*> childWidgets = currentTab->findChildren<QWidget*>(); QList<QWidget*> childWidgets = currentTab->findChildren<QWidget*>();
for(int j=0; j<childWidgets.count(); j++) { for(int j=0; j<childWidgets.count(); j++) {
childWidgets[j]->setEnabled(enable); childWidgets[j]->setEnabled(enable);
}
} }
} }
} }
//triggerMapTab[ID]->setEnabled(enable);
icBox1->setEnabled(enable);
icBox2->setEnabled(enable);
} }
//triggerMapTab[ID]->setEnabled(enable);
icBox1->setEnabled(enable);
icBox2->setEnabled(enable);
} }
void DigiSettingsPanel::SaveSettings(){ void DigiSettingsPanel::SaveSettings(){
@ -1964,7 +1989,7 @@ void DigiSettingsPanel::SetStartSource(){
//printf("================ %s\n", value.c_str()); //printf("================ %s\n", value.c_str());
QString msg; QString msg;
msg = QString::fromStdString(PHA::DIG::StartSource.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::StartSource.GetPara());
msg += " = " + QString::fromStdString(value); msg += " = " + QString::fromStdString(value);
SendLogMsg(msg); SendLogMsg(msg);
@ -1987,7 +2012,7 @@ void DigiSettingsPanel::SetGlobalTriggerSource(){
//printf("================ %s\n", value.c_str()); //printf("================ %s\n", value.c_str());
QString msg; QString msg;
msg = QString::fromStdString(PHA::DIG::GlobalTriggerSource.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::GlobalTriggerSource.GetPara());
msg += " = " + QString::fromStdString(value); msg += " = " + QString::fromStdString(value);
SendLogMsg(msg); SendLogMsg(msg);
@ -2019,7 +2044,7 @@ void DigiSettingsPanel::SetupComboBox(RComboBox *&cbb, const Reg para, int ch_in
//int index = ch_index; //int index = ch_index;
//printf("%s %d %s \n", para.GetPara().c_str(), index, cbb->currentData().toString().toStdString().c_str()); //printf("%s %d %s \n", para.GetPara().c_str(), index, cbb->currentData().toString().toStdString().c_str());
QString msg; QString msg;
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index)); if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
if( para.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(index); if( para.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(index);
msg += " = " + cbb->currentData().toString(); msg += " = " + cbb->currentData().toString();
@ -2069,7 +2094,7 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
} }
int index = ( ch_index == -1 && isMaster ? cbChPick[ID]->currentData().toInt() : ch_index); int index = ( ch_index == -1 && isMaster ? cbChPick[ID]->currentData().toInt() : ch_index);
QString msg; QString msg;
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[ID]->GetSerialNumber()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()) ;
if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index)); if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
msg += " = " + QString::number(spb->value()); msg += " = " + QString::number(spb->value());
if( digi[ID]->WriteValue(para, std::to_string(spb->value()), index)){ if( digi[ID]->WriteValue(para, std::to_string(spb->value()), index)){

View File

@ -134,6 +134,7 @@ private:
//-------------- board settings //-------------- board settings
RComboBox * cbbClockSource[MaxNumberOfDigitizer]; RComboBox * cbbClockSource[MaxNumberOfDigitizer];
RComboBox * cbbEnClockFrontPanel[MaxNumberOfDigitizer];
QCheckBox * ckbStartSource[MaxNumberOfDigitizer][5]; QCheckBox * ckbStartSource[MaxNumberOfDigitizer][5];
QCheckBox * ckbGlbTrgSource[MaxNumberOfDigitizer][5]; QCheckBox * ckbGlbTrgSource[MaxNumberOfDigitizer][5];
RComboBox * cbbTrgOut[MaxNumberOfDigitizer]; RComboBox * cbbTrgOut[MaxNumberOfDigitizer];

View File

@ -101,19 +101,23 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
connect(bnOpenScope, &QPushButton::clicked, this, &MainWindow::OpenScope); 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, &QPushButton::clicked, this, &MainWindow::OpenDigitizers);
bnCloseDigitizers = new QPushButton("Close Digitizers", this); bnCloseDigitizers = new QPushButton("Close Digitizers", this);
bnCloseDigitizers->setEnabled(false); bnCloseDigitizers->setEnabled(false);
connect(bnCloseDigitizers, SIGNAL(clicked()), this, SLOT(CloseDigitizers())); connect(bnCloseDigitizers, &QPushButton::clicked, this, &MainWindow::CloseDigitizers);
bnDigiSettings = new QPushButton("Digitizers Settings", this); bnDigiSettings = new QPushButton("Digitizers Settings", this);
bnDigiSettings->setEnabled(false); bnDigiSettings->setEnabled(false);
connect(bnDigiSettings, SIGNAL(clicked()), this, SLOT(OpenDigitizersSettings())); connect(bnDigiSettings, &QPushButton::clicked, this, &MainWindow::OpenDigitizersSettings);
bnSOLSettings = new QPushButton("SOLARIS Settings", this); bnSOLSettings = new QPushButton("SOLARIS Settings", this);
bnSOLSettings->setEnabled(false); bnSOLSettings->setEnabled(false);
connect(bnSOLSettings, SIGNAL(clicked()), this, SLOT(OpenSOLARISpanel())); connect(bnSOLSettings, &QPushButton::clicked, this, &MainWindow::OpenSOLARISpanel);
bnSyncHelper = new QPushButton("Sync Helper", this);
bnSyncHelper->setEnabled(false);
connect(bnSyncHelper, &QPushButton::clicked, this, &MainWindow::OpenSyncHelper);
QPushButton * bnEventBuilder = new QPushButton("Event Builder", this); QPushButton * bnEventBuilder = new QPushButton("Event Builder", this);
bnEventBuilder->setEnabled(false); bnEventBuilder->setEnabled(false);
@ -129,6 +133,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
layout1->addWidget(lExpName, 0, 2); layout1->addWidget(lExpName, 0, 2);
layout1->addWidget(leExpName, 0, 3); layout1->addWidget(leExpName, 0, 3);
layout1->addWidget(bnSyncHelper, 1, 0);
layout1->addWidget(bnOpenDigitizers, 1, 1); layout1->addWidget(bnOpenDigitizers, 1, 1);
layout1->addWidget(bnCloseDigitizers, 1, 2, 1, 2); layout1->addWidget(bnCloseDigitizers, 1, 2, 1, 2);
@ -172,7 +177,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
leRunID->setStyleSheet("background-color: #F3F3F3;"); leRunID->setStyleSheet("background-color: #F3F3F3;");
chkSaveRun = new QCheckBox("Save Run", this); chkSaveRun = new QCheckBox("Save Run", this);
chkSaveRun->setChecked(true); chkSaveRun->setChecked(false);
chkSaveRun->setEnabled(false); chkSaveRun->setEnabled(false);
connect(chkSaveRun, &QCheckBox::clicked, this, [=]() { cbAutoRun->setEnabled(chkSaveRun->isChecked()); }); connect(chkSaveRun, &QCheckBox::clicked, this, [=]() { cbAutoRun->setEnabled(chkSaveRun->isChecked()); });
@ -190,12 +195,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
cbAutoRun->addItem("Every 5 hrs", -300); cbAutoRun->addItem("Every 5 hrs", -300);
cbAutoRun->setEnabled(false); cbAutoRun->setEnabled(false);
QComboBox * cbDataFormat = new QComboBox(this); cbDataFormat = new QComboBox(this);
cbDataFormat->addItem("Everything", 0); cbDataFormat->addItem("Everything", 0);
cbDataFormat->addItem("1 trace", 1); cbDataFormat->addItem("1 trace", 1);
cbDataFormat->addItem("No trace", 2); cbDataFormat->addItem("No trace", 2);
cbDataFormat->addItem("Minimum", 3); cbDataFormat->addItem("Minimum", 3);
cbDataFormat->setCurrentIndex(1); cbDataFormat->setCurrentIndex(3);
cbDataFormat->setEnabled(false); cbDataFormat->setEnabled(false);
bnStartACQ = new QPushButton("Start ACQ", this); bnStartACQ = new QPushButton("Start ACQ", this);
@ -419,7 +424,9 @@ int MainWindow::StartACQ(){
for( int ch = 0; ch < (int) digi[i]->GetNChannels(); ch ++) oldTimeStamp[i][ch] = 0; for( int ch = 0; ch < (int) digi[i]->GetNChannels(); ch ++) oldTimeStamp[i][ch] = 0;
digi[i]->SetPHADataFormat(1);// only save 1 trace //digi[i]->SetPHADataFormat(1);// only save 1 trace
int dataFormatID = cbDataFormat->currentData().toInt();
digi[i]->SetPHADataFormat(dataFormatID);// only save 1 trace
//Additional settings //Additional settings
digi[i]->WriteValue("/ch/0..63/par/WaveAnalogProbe0", "ADCInput"); digi[i]->WriteValue("/ch/0..63/par/WaveAnalogProbe0", "ADCInput");
@ -507,6 +514,7 @@ void MainWindow::StopACQ(){
digi[i]->StopACQ(); digi[i]->StopACQ();
if( readDataThread[i]->isRunning()){ if( readDataThread[i]->isRunning()){
readDataThread[i]->Stop();
readDataThread[i]->quit(); readDataThread[i]->quit();
readDataThread[i]->wait(); readDataThread[i]->wait();
} }
@ -585,6 +593,7 @@ void MainWindow::AutoRun(){
bnOpenScope->setEnabled(true); bnOpenScope->setEnabled(true);
chkSaveRun->setEnabled(true); chkSaveRun->setEnabled(true);
cbAutoRun->setEnabled(true); cbAutoRun->setEnabled(true);
cbDataFormat->setEnabled(true);
if( digiSetting ) digiSetting->EnableControl(); if( digiSetting ) digiSetting->EnableControl();
}else{ }else{
@ -664,9 +673,9 @@ void MainWindow::OpenDigitizers(){
}else{ }else{
LogMsg("<font style=\"color: red;\">Unable to found setting file <b>" + settingFile + "</b>. </font>"); LogMsg("<font style=\"color: red;\">Unable to found setting file <b>" + settingFile + "</b>. </font>");
digi[i]->SetSettingFileName(""); digi[i]->SetSettingFileName("");
LogMsg("Reset digitizer And set default PHA settings."); //LogMsg("Reset digitizer And set default PHA settings.");
digi[i]->Reset(); //digi[i]->Reset();
digi[i]->ProgramPHA(false); //digi[i]->ProgramPHA(false);
} }
digi[i]->ReadAllSettings(); digi[i]->ReadAllSettings();
@ -693,9 +702,11 @@ void MainWindow::OpenDigitizers(){
bnComment->setEnabled(false); bnComment->setEnabled(false);
bnOpenScope->setEnabled(true); bnOpenScope->setEnabled(true);
chkSaveRun->setEnabled(true); chkSaveRun->setEnabled(true);
bnSyncHelper->setEnabled(true);
bnOpenDigitizers->setEnabled(false); bnOpenDigitizers->setEnabled(false);
bnOpenDigitizers->setStyleSheet(""); bnOpenDigitizers->setStyleSheet("");
cbAutoRun->setEnabled(true); cbAutoRun->setEnabled(true);
cbDataFormat->setEnabled(true);
bnOpenScalar->setEnabled(true); bnOpenScalar->setEnabled(true);
} }
@ -751,6 +762,7 @@ void MainWindow::CloseDigitizers(){
if( readDataThread[i] != NULL ){ if( readDataThread[i] != NULL ){
LogMsg("Waiting for readData Thread ....."); LogMsg("Waiting for readData Thread .....");
readDataThread[i]->Stop();
readDataThread[i]->quit(); readDataThread[i]->quit();
readDataThread[i]->wait(); readDataThread[i]->wait();
delete readDataThread[i]; delete readDataThread[i];
@ -761,7 +773,7 @@ void MainWindow::CloseDigitizers(){
digi = NULL; digi = NULL;
readDataThread = NULL; readDataThread = NULL;
bnSyncHelper->setEnabled(false);
bnOpenDigitizers->setEnabled(true); bnOpenDigitizers->setEnabled(true);
bnOpenDigitizers->setFocus(); bnOpenDigitizers->setFocus();
bnCloseDigitizers->setEnabled(false); bnCloseDigitizers->setEnabled(false);
@ -774,6 +786,7 @@ void MainWindow::CloseDigitizers(){
bnOpenScalar->setEnabled(false); bnOpenScalar->setEnabled(false);
chkSaveRun->setEnabled(false); chkSaveRun->setEnabled(false);
cbAutoRun->setEnabled(false); cbAutoRun->setEnabled(false);
cbDataFormat->setEnabled(false);
bnProgramSettings->setEnabled(true); bnProgramSettings->setEnabled(true);
bnNewExp->setEnabled(true); bnNewExp->setEnabled(true);
@ -782,6 +795,41 @@ void MainWindow::CloseDigitizers(){
} }
void MainWindow::OpenSyncHelper(){
LogMsg("Open <b>Sync Helper</b>.");
QDialog dialog(this);
dialog.setWindowTitle("Sync Helper");
dialog.setWindowFlags(Qt::Dialog | Qt::WindowTitleHint);
QVBoxLayout * layout = new QVBoxLayout(&dialog);
QPushButton * bnNoSync = new QPushButton("No Sync", &dialog);
QPushButton * bnMethod1 = new QPushButton("Software TRG-OUT --> TRG-IN ", &dialog);
QPushButton * bnMethod2 = new QPushButton("Software TRG-OUT --> S-IN ", &dialog);
QPushButton * bnMethod3 = new QPushButton("External TRG-OUT --> S-IN ", &dialog);
layout->addWidget( bnNoSync, 1);
layout->addWidget(bnMethod1, 2);
layout->addWidget(bnMethod2, 3);
layout->addWidget(bnMethod3, 4);
bnNoSync->setFixedHeight(40);
bnMethod1->setFixedHeight(40);
bnMethod2->setFixedHeight(40);
bnMethod3->setFixedHeight(40);
connect(bnNoSync, &QPushButton::clicked, [&](){
for(unsigned int i = 0; i < nDigi; i++){
}
dialog.accept();
});
dialog.exec();
}
//*###################################################################### //*######################################################################
//*###################################################################### Open Scope //*###################################################################### Open Scope
void MainWindow::OpenScope(){ void MainWindow::OpenScope(){
@ -815,11 +863,11 @@ void MainWindow::OpenScope(){
digiSetting->EnableControl(); digiSetting->EnableControl();
} }
scope->StartScope(); //scope->StartScope();
}else{ }else{
scope->show(); scope->show();
scope->StartScope(); //scope->StartScope();
if( digiSetting ) digiSetting->EnableControl(); if( digiSetting ) digiSetting->EnableControl();
} }
} }

View File

@ -24,7 +24,7 @@
#include "ClassDigitizer2Gen.h" #include "ClassDigitizer2Gen.h"
#include "influxdb.h" #include "influxdb.h"
#include "manyThread.h" #include "CustomThreads.h"
#include "digiSettingsPanel.h" #include "digiSettingsPanel.h"
#include "scope.h" #include "scope.h"
@ -47,6 +47,7 @@ private slots:
void OpenScope(); void OpenScope();
void OpenDigitizersSettings(); void OpenDigitizersSettings();
void OpenSyncHelper();
void OpenSOLARISpanel(); void OpenSOLARISpanel();
bool CheckSOLARISpanelOK(); bool CheckSOLARISpanelOK();
@ -105,6 +106,7 @@ private:
QPushButton * bnNewExp; QPushButton * bnNewExp;
QLineEdit * leExpName; QLineEdit * leExpName;
QPushButton * bnSyncHelper;
QPushButton * bnOpenDigitizers; QPushButton * bnOpenDigitizers;
QPushButton * bnCloseDigitizers; QPushButton * bnCloseDigitizers;
@ -133,6 +135,7 @@ private:
QPushButton * bnStopACQ; QPushButton * bnStopACQ;
QCheckBox * chkSaveRun; QCheckBox * chkSaveRun;
QComboBox * cbAutoRun; QComboBox * cbAutoRun;
QComboBox * cbDataFormat;
QLineEdit * leRunID; QLineEdit * leRunID;
QLineEdit * leRawDataPath; QLineEdit * leRawDataPath;
QLineEdit * leRunComment; QLineEdit * leRunComment;

0
makeTest Executable file → Normal file
View File

View File

@ -296,11 +296,12 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
rowID ++; rowID ++;
bnScopeStart = new QPushButton("Start", this); bnScopeStart = new QPushButton("Start", this);
layout->addWidget(bnScopeStart, rowID, 0); layout->addWidget(bnScopeStart, rowID, 0);
bnScopeStart->setEnabled(false); bnScopeStart->setEnabled(true);
connect(bnScopeStart, &QPushButton::clicked, this, [=](){this->StartScope();}); connect(bnScopeStart, &QPushButton::clicked, this, [=](){this->StartScope();});
bnScopeStop = new QPushButton("Stop", this); bnScopeStop = new QPushButton("Stop", this);
layout->addWidget(bnScopeStop, rowID, 1); layout->addWidget(bnScopeStop, rowID, 1);
bnScopeStop->setEnabled(false);
connect(bnScopeStop, &QPushButton::clicked, this, &Scope::StopScope); connect(bnScopeStop, &QPushButton::clicked, this, &Scope::StopScope);
QLabel * lbTriggerRate = new QLabel("Trigger Rate [Hz] : ", this); QLabel * lbTriggerRate = new QLabel("Trigger Rate [Hz] : ", this);
@ -479,6 +480,7 @@ void Scope::StopScope(){
digi[i]->WriteValue(PHA::CH::ChannelEnable, "True", -1); digi[i]->WriteValue(PHA::CH::ChannelEnable, "True", -1);
digiMTX[i].unlock(); digiMTX[i].unlock();
readDataThread[i]->Stop();
readDataThread[i]->quit(); readDataThread[i]->quit();
readDataThread[i]->wait(); readDataThread[i]->wait();
} }
@ -559,15 +561,15 @@ void Scope::ProbeChange(RComboBox * cb[], const int size ){
} }
} }
int ID = cbScopeDigi->currentIndex(); //int ID = cbScopeDigi->currentIndex();
digiMTX[ID].lock(); //digiMTX[ID].lock();
if( size == 2) {// analog probes if( size == 2) {// analog probes
for( int j = 0; j < 2; j++ )dataTrace[j]->setName(cb[j]->currentText()); for( int j = 0; j < 2; j++ )dataTrace[j]->setName(cb[j]->currentText());
} }
if( size == 4){ // digitial probes if( size == 4){ // digitial probes
for( int j = 2; j < 6; j++ )dataTrace[j]->setName(cb[j-2]->currentText()); for( int j = 2; j < 6; j++ )dataTrace[j]->setName(cb[j-2]->currentText());
} }
digiMTX[ID].unlock(); //digiMTX[ID].unlock();
} }

View File

@ -19,7 +19,7 @@
#include "macro.h" #include "macro.h"
#include "ClassDigitizer2Gen.h" #include "ClassDigitizer2Gen.h"
#include "manyThread.h" #include "CustomThreads.h"
#include "CustomWidgets.h" #include "CustomWidgets.h"
class Trace : public QChart{ class Trace : public QChart{

View File

@ -9,7 +9,7 @@
void script(){ void script(){
SolReader * reader = new SolReader("haha_000.sol"); SolReader * reader = new SolReader("/home/ryan/analysis/data_raw/test_000_01_21233_000.sol");
Event * evt = reader->evt; Event * evt = reader->evt;
printf("----------file size: %u Byte\n", reader->GetFileSize()); printf("----------file size: %u Byte\n", reader->GetFileSize());