change MainWindow Class to FSUDAQ Class. fix bug on histThread, fix bug on CoincidentAnalyzer.h

This commit is contained in:
Ryan Tang 2024-06-26 16:40:40 -04:00
parent 6fcebf0c06
commit 5f2a7f067d
7 changed files with 87 additions and 76 deletions

View File

@ -64,13 +64,14 @@ void keyPressCommand(){
if( RegList[i].GetRWType() == RW::ReadONLY ) typeStr = "R "; if( RegList[i].GetRWType() == RW::ReadONLY ) typeStr = "R ";
if( RegList[i].GetRWType() == RW::WriteONLY ) typeStr = " W"; if( RegList[i].GetRWType() == RW::WriteONLY ) typeStr = " W";
unsigned int value = digi->GetSettingFromMemory(RegList[i], 0);
printf("%2d | 0x%04X %30s %s 0x%08X = %u\n", i, printf("%2d | 0x%04X %30s %s 0x%08X = %10u\n", i,
RegList[i].GetAddress(), RegList[i].GetAddress(),
RegList[i].GetNameChar(), RegList[i].GetNameChar(),
typeStr.c_str(), typeStr.c_str(),
digi->GetSettingFromMemory(RegList[i], 0), value,
digi->GetSettingFromMemory(RegList[i], 0)); value);
} }
std::string input = "-1"; std::string input = "-1";
@ -143,12 +144,15 @@ void keyPressCommand(){
RegList[i].ActualAddress(ch); RegList[i].ActualAddress(ch);
printf("%2d | 0x%04X %30s %s 0x%08X = %u\n", i, unsigned int value = digi->GetSettingFromMemory(RegList[i], ch);
printf("%2d | 0x%04X %30s %s 0x%08X = %10u : %d\n", i,
RegList[i].GetAddress(), RegList[i].GetAddress(),
RegList[i].GetNameChar(), RegList[i].GetNameChar(),
typeStr.c_str(), typeStr.c_str(),
digi->GetSettingFromMemory(RegList[i], ch), value,
digi->GetSettingFromMemory(RegList[i], ch)); value,
value * abs(RegList[i].GetPartialStep()));
} }
do{ do{

View File

@ -119,6 +119,7 @@ public:
waitTime = 20; // multiple of 100 mili sec waitTime = 20; // multiple of 100 mili sec
stop = false; stop = false;
} }
bool isStopped() const {return stop;}
void Stop() { this->stop = true;} void Stop() { this->stop = true;}
void SetWaitTimeinSec(float sec) {waitTime = sec * 10 ;} void SetWaitTimeinSec(float sec) {waitTime = sec * 10 ;}
float GetWaitTimeinSec() const {return waitTime/10.;} float GetWaitTimeinSec() const {return waitTime/10.;}

View File

@ -22,7 +22,7 @@
std::vector<std::string> onlineAnalyzerList = {"Coincident","Splie-Pole", "Encore", "RAISOR"}; std::vector<std::string> onlineAnalyzerList = {"Coincident","Splie-Pole", "Encore", "RAISOR"};
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ FSUDAQ::FSUDAQ(QWidget *parent) : QMainWindow(parent){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
setWindowTitle("FSU DAQ"); setWindowTitle("FSU DAQ");
setGeometry(500, 100, 1100, 600); setGeometry(500, 100, 1100, 600);
@ -34,6 +34,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
scope = nullptr; scope = nullptr;
digiSettings = nullptr; digiSettings = nullptr;
canvas = nullptr; canvas = nullptr;
histThread = nullptr;
onlineAnalyzer = nullptr; onlineAnalyzer = nullptr;
runTimer = new QTimer(); runTimer = new QTimer();
breakAutoRepeat = true; breakAutoRepeat = true;
@ -61,7 +62,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
//cbOpenDigitizers->addItem("Open Digitizers via USB", 3); //cbOpenDigitizers->addItem("Open Digitizers via USB", 3);
cbOpenDigitizers->addItem("Open Digitizers via A4818(s)", 4); cbOpenDigitizers->addItem("Open Digitizers via A4818(s)", 4);
layout->addWidget(cbOpenDigitizers, 0, 0); layout->addWidget(cbOpenDigitizers, 0, 0);
connect(cbOpenDigitizers, &RComboBox::currentIndexChanged, this, &MainWindow::OpenDigitizers); connect(cbOpenDigitizers, &RComboBox::currentIndexChanged, this, &FSUDAQ::OpenDigitizers);
cbOpenMethod = new RComboBox(this); cbOpenMethod = new RComboBox(this);
cbOpenMethod->addItem("w/o settings", 0); cbOpenMethod->addItem("w/o settings", 0);
@ -71,29 +72,29 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
bnCloseDigitizers = new QPushButton("Close Digitizers", this); bnCloseDigitizers = new QPushButton("Close Digitizers", this);
layout->addWidget(bnCloseDigitizers, 2, 0); layout->addWidget(bnCloseDigitizers, 2, 0);
connect(bnCloseDigitizers, &QPushButton::clicked, this, &MainWindow::CloseDigitizers); connect(bnCloseDigitizers, &QPushButton::clicked, this, &FSUDAQ::CloseDigitizers);
bnDigiSettings = new QPushButton("Digitizers Settings", this); bnDigiSettings = new QPushButton("Digitizers Settings", this);
layout->addWidget(bnDigiSettings, 0, 1); layout->addWidget(bnDigiSettings, 0, 1);
connect(bnDigiSettings, &QPushButton::clicked, this, &MainWindow::OpenDigiSettings); connect(bnDigiSettings, &QPushButton::clicked, this, &FSUDAQ::OpenDigiSettings);
bnOpenScope = new QPushButton("Open Scope", this); bnOpenScope = new QPushButton("Open Scope", this);
layout->addWidget(bnOpenScope, 1, 1); layout->addWidget(bnOpenScope, 1, 1);
connect(bnOpenScope, &QPushButton::clicked, this, &MainWindow::OpenScope); connect(bnOpenScope, &QPushButton::clicked, this, &FSUDAQ::OpenScope);
cbAnalyzer = new RComboBox(this); cbAnalyzer = new RComboBox(this);
layout->addWidget(cbAnalyzer, 0, 2); layout->addWidget(cbAnalyzer, 0, 2);
cbAnalyzer->addItem("Choose Online Analyzer", -1); cbAnalyzer->addItem("Choose Online Analyzer", -1);
for( int i = 0; i < (int) onlineAnalyzerList.size() ; i++) cbAnalyzer->addItem(onlineAnalyzerList[i].c_str(), i); for( int i = 0; i < (int) onlineAnalyzerList.size() ; i++) cbAnalyzer->addItem(onlineAnalyzerList[i].c_str(), i);
connect(cbAnalyzer, &RComboBox::currentIndexChanged, this, &MainWindow::OpenAnalyzer); connect(cbAnalyzer, &RComboBox::currentIndexChanged, this, &FSUDAQ::OpenAnalyzer);
bnCanvas = new QPushButton("Online 1D Histograms", this); bnCanvas = new QPushButton("Online 1D Histograms", this);
layout->addWidget(bnCanvas, 1, 2); layout->addWidget(bnCanvas, 1, 2);
connect(bnCanvas, &QPushButton::clicked, this, &MainWindow::OpenCanvas); connect(bnCanvas, &QPushButton::clicked, this, &FSUDAQ::OpenCanvas);
bnSync = new QPushButton("Sync Boards", this); bnSync = new QPushButton("Sync Boards", this);
layout->addWidget(bnSync, 2, 1); layout->addWidget(bnSync, 2, 1);
connect(bnSync, &QPushButton::clicked, this, &MainWindow::SetSyncMode); connect(bnSync, &QPushButton::clicked, this, &FSUDAQ::SetSyncMode);
} }
@ -141,7 +142,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
leElogName->setReadOnly(true); leElogName->setReadOnly(true);
layout->addWidget(leElogName, rowID, 4); layout->addWidget(leElogName, rowID, 4);
connect(bnLock, &QPushButton::clicked, this, &MainWindow::SetAndLockInfluxElog); connect(bnLock, &QPushButton::clicked, this, &FSUDAQ::SetAndLockInfluxElog);
} }
@ -157,10 +158,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
leDataPath = new QLineEdit(this); leDataPath = new QLineEdit(this);
leDataPath->setReadOnly(true); leDataPath->setReadOnly(true);
QPushButton * bnSetDataPath = new QPushButton("Set Path", this); QPushButton * bnSetDataPath = new QPushButton("Set Path", this);
connect(bnSetDataPath, &QPushButton::clicked, this, &MainWindow::OpenDataPath); connect(bnSetDataPath, &QPushButton::clicked, this, &FSUDAQ::OpenDataPath);
QPushButton * bnOpenRecord = new QPushButton("Open Record", this); QPushButton * bnOpenRecord = new QPushButton("Open Record", this);
connect(bnOpenRecord, &QPushButton::clicked, this, &MainWindow::OpenRecord); connect(bnOpenRecord, &QPushButton::clicked, this, &FSUDAQ::OpenRecord);
layout->addWidget(lbDataPath, rowID, 0); layout->addWidget(lbDataPath, rowID, 0);
layout->addWidget(leDataPath, rowID, 1, 1, 5); layout->addWidget(leDataPath, rowID, 1, 1, 5);
@ -176,7 +177,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
connect(lePrefix, &QLineEdit::textChanged, this, [=](){ connect(lePrefix, &QLineEdit::textChanged, this, [=](){
lePrefix->setStyleSheet("color:blue;"); lePrefix->setStyleSheet("color:blue;");
}); });
connect(lePrefix, &QLineEdit::returnPressed, this, &MainWindow::SaveLastRunFile); connect(lePrefix, &QLineEdit::returnPressed, this, &FSUDAQ::SaveLastRunFile);
QLabel * lbRunID = new QLabel("Run No. :", this); QLabel * lbRunID = new QLabel("Run No. :", this);
lbRunID->setAlignment(Qt::AlignRight | Qt::AlignCenter); lbRunID->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -202,7 +203,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
cbAutoRun->setEnabled(false); cbAutoRun->setEnabled(false);
bnStartACQ = new QPushButton("Start ACQ", this); bnStartACQ = new QPushButton("Start ACQ", this);
connect( bnStartACQ, &QPushButton::clicked, this, &MainWindow::AutoRun); connect( bnStartACQ, &QPushButton::clicked, this, &FSUDAQ::AutoRun);
bnStopACQ = new QPushButton("Stop ACQ", this); bnStopACQ = new QPushButton("Stop ACQ", this);
connect( bnStopACQ, &QPushButton::clicked, this, [=](){ connect( bnStopACQ, &QPushButton::clicked, this, [=](){
if( runTimer->isActive() ){ if( runTimer->isActive() ){
@ -234,7 +235,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
leComment->setReadOnly(true); leComment->setReadOnly(true);
bnOpenScaler = new QPushButton("Scalar", this); bnOpenScaler = new QPushButton("Scalar", this);
connect(bnOpenScaler, &QPushButton::clicked, this, &MainWindow::OpenScalar); connect(bnOpenScaler, &QPushButton::clicked, this, &FSUDAQ::OpenScalar);
layout->addWidget(lbComment, rowID, 0); layout->addWidget(lbComment, rowID, 0);
layout->addWidget(leComment, rowID, 1, 1, 6); layout->addWidget(leComment, rowID, 1, 1, 6);
@ -297,7 +298,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
} }
MainWindow::~MainWindow(){ FSUDAQ::~FSUDAQ(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( scalar ) { if( scalar ) {
scalarThread->Stop(); scalarThread->Stop();
@ -312,10 +313,13 @@ MainWindow::~MainWindow(){
if( scope ) delete scope; if( scope ) delete scope;
if( histThread){ if( histThread ){
histThread->Stop();
histThread->quit(); if( !histThread->isStopped() ){
histThread->wait(); histThread->Stop();
histThread->quit();
histThread->wait();
}
delete histThread; delete histThread;
} }
@ -336,7 +340,7 @@ MainWindow::~MainWindow(){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::OpenDataPath(){ void FSUDAQ::OpenDataPath(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QFileDialog fileDialog(this); QFileDialog fileDialog(this);
fileDialog.setFileMode(QFileDialog::Directory); fileDialog.setFileMode(QFileDialog::Directory);
@ -359,7 +363,7 @@ void MainWindow::OpenDataPath(){
} }
void MainWindow::OpenRecord(){ void FSUDAQ::OpenRecord(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QString filePath = leDataPath->text() + "/RunTimeStamp.dat"; QString filePath = leDataPath->text() + "/RunTimeStamp.dat";
@ -391,7 +395,7 @@ void MainWindow::OpenRecord(){
} }
void MainWindow::UpdateRecord(){ void FSUDAQ::UpdateRecord(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( !runRecord ) return; if( !runRecord ) return;
@ -422,7 +426,7 @@ void MainWindow::UpdateRecord(){
tableView->scrollToBottom(); tableView->scrollToBottom();
} }
void MainWindow::LoadProgramSettings(){ void FSUDAQ::LoadProgramSettings(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
LogMsg("Loading <b>" + programSettingsFilePath + "</b> for Program Settings."); LogMsg("Loading <b>" + programSettingsFilePath + "</b> for Program Settings.");
QFile file(programSettingsFilePath); QFile file(programSettingsFilePath);
@ -485,7 +489,7 @@ void MainWindow::LoadProgramSettings(){
} }
void MainWindow::SaveProgramSettings(){ void FSUDAQ::SaveProgramSettings(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
rawDataPath = leDataPath->text(); rawDataPath = leDataPath->text();
@ -508,7 +512,7 @@ void MainWindow::SaveProgramSettings(){
} }
void MainWindow::LoadLastRunFile(){ void FSUDAQ::LoadLastRunFile(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QFile file(rawDataPath + "/lastRun.sh"); QFile file(rawDataPath + "/lastRun.sh");
@ -549,7 +553,7 @@ void MainWindow::LoadLastRunFile(){
} }
void MainWindow::SaveLastRunFile(){ void FSUDAQ::SaveLastRunFile(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QFile file(rawDataPath + "/lastRun.sh"); QFile file(rawDataPath + "/lastRun.sh");
@ -569,7 +573,7 @@ void MainWindow::SaveLastRunFile(){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::OpenDigitizers(){ void FSUDAQ::OpenDigitizers(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( cbOpenDigitizers->currentIndex() == 0 ) return; if( cbOpenDigitizers->currentIndex() == 0 ) return;
@ -723,7 +727,7 @@ void MainWindow::OpenDigitizers(){
digi[i]->ReadAllSettingsFromBoard(true); digi[i]->ReadAllSettingsFromBoard(true);
readDataThread[i] = new ReadDataThread(digi[i], i); readDataThread[i] = new ReadDataThread(digi[i], i);
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg); connect(readDataThread[i], &ReadDataThread::sendMsg, this, &FSUDAQ::LogMsg);
QCoreApplication::processEvents(); //to prevent Qt said application not responding. QCoreApplication::processEvents(); //to prevent Qt said application not responding.
} }
@ -756,8 +760,8 @@ void MainWindow::OpenDigitizers(){
} }
void MainWindow::CloseDigitizers(){ void FSUDAQ::CloseDigitizers(){
LogMsg("MainWindow::Closing Digitizer(s)...."); LogMsg("FSUDAQ::Closing Digitizer(s)....");
if( scope ) { if( scope ) {
scope->close(); scope->close();
@ -826,11 +830,11 @@ void MainWindow::CloseDigitizers(){
bnStartACQ->setStyleSheet(""); bnStartACQ->setStyleSheet("");
bnStopACQ->setStyleSheet(""); bnStopACQ->setStyleSheet("");
printf("End of MainWindow::%s\n", __func__); printf("End of FSUDAQ::%s\n", __func__);
} }
void MainWindow::WaitForDigitizersOpen(bool onOff){ void FSUDAQ::WaitForDigitizersOpen(bool onOff){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
// bnOpenDigitizers->setEnabled(onOff); // bnOpenDigitizers->setEnabled(onOff);
@ -855,7 +859,7 @@ void MainWindow::WaitForDigitizersOpen(bool onOff){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::SetupScalar(){ void FSUDAQ::SetupScalar(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
// printf("%s\n", __func__); // printf("%s\n", __func__);
@ -883,7 +887,7 @@ void MainWindow::SetupScalar(){
scalarThread = new TimingThread(scalar); scalarThread = new TimingThread(scalar);
scalarThread->SetWaitTimeinSec(1.0); scalarThread->SetWaitTimeinSec(1.0);
connect(scalarThread, &TimingThread::timeUp, this, &MainWindow::UpdateScalar); connect(scalarThread, &TimingThread::timeUp, this, &FSUDAQ::UpdateScalar);
unsigned short maxNChannel = 0; unsigned short maxNChannel = 0;
for( unsigned int k = 0; k < nDigi; k ++ ){ for( unsigned int k = 0; k < nDigi; k ++ ){
@ -1004,7 +1008,7 @@ void MainWindow::SetupScalar(){
} }
void MainWindow::CleanUpScalar(){ void FSUDAQ::CleanUpScalar(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( scalar == nullptr) return; if( scalar == nullptr) return;
@ -1033,12 +1037,12 @@ void MainWindow::CleanUpScalar(){
} }
void MainWindow::OpenScalar(){ void FSUDAQ::OpenScalar(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
scalar->show(); scalar->show();
} }
void MainWindow::UpdateScalar(){ void FSUDAQ::UpdateScalar(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( digi == nullptr ) return; if( digi == nullptr ) return;
if( scalar == nullptr ) return; if( scalar == nullptr ) return;
@ -1116,7 +1120,7 @@ void MainWindow::UpdateScalar(){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::StartACQ(){ void FSUDAQ::StartACQ(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( digi == nullptr ) return; if( digi == nullptr ) return;
@ -1203,7 +1207,7 @@ void MainWindow::StartACQ(){
} }
void MainWindow::StopACQ(){ void FSUDAQ::StopACQ(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QCoreApplication::processEvents(); QCoreApplication::processEvents();
@ -1303,7 +1307,7 @@ void MainWindow::StopACQ(){
} }
void MainWindow::AutoRun(){ void FSUDAQ::AutoRun(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
runTimer->disconnect(runTimerConnection); runTimer->disconnect(runTimerConnection);
if( chkSaveData->isChecked() == false){ if( chkSaveData->isChecked() == false){
@ -1375,7 +1379,7 @@ void MainWindow::AutoRun(){
} }
void MainWindow::SetSyncMode(){ void FSUDAQ::SetSyncMode(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QDialog dialog; QDialog dialog;
dialog.setWindowTitle("Board Synchronization"); dialog.setWindowTitle("Board Synchronization");
@ -1471,7 +1475,7 @@ void MainWindow::SetSyncMode(){
} }
void MainWindow::SetAndLockInfluxElog(){ void FSUDAQ::SetAndLockInfluxElog(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( leInfluxIP->isReadOnly() ){ if( leInfluxIP->isReadOnly() ){
bnLock->setText("Lock and Set"); bnLock->setText("Lock and Set");
@ -1591,7 +1595,7 @@ void MainWindow::SetAndLockInfluxElog(){
} }
} }
bool MainWindow::CommentDialog(bool isStartRun){ bool FSUDAQ::CommentDialog(bool isStartRun){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( isStartRun ) runID ++; if( isStartRun ) runID ++;
QString runIDStr = QString::number(runID).rightJustified(3, '0'); QString runIDStr = QString::number(runID).rightJustified(3, '0');
@ -1672,7 +1676,7 @@ bool MainWindow::CommentDialog(bool isStartRun){
} }
void MainWindow::WriteRunTimestamp(bool isStartRun){ void FSUDAQ::WriteRunTimestamp(bool isStartRun){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QFile file(rawDataPath + "/RunTimeStamp.dat"); QFile file(rawDataPath + "/RunTimeStamp.dat");
@ -1710,12 +1714,12 @@ void MainWindow::WriteRunTimestamp(bool isStartRun){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::OpenScope(){ void FSUDAQ::OpenScope(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QCoreApplication::processEvents(); QCoreApplication::processEvents();
if( scope == nullptr ) { if( scope == nullptr ) {
scope = new Scope(digi, nDigi, readDataThread); scope = new Scope(digi, nDigi, readDataThread);
connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg); connect(scope, &Scope::SendLogMsg, this, &FSUDAQ::LogMsg);
connect(scope, &Scope::CloseWindow, this, [=](){ connect(scope, &Scope::CloseWindow, this, [=](){
bnStartACQ->setEnabled(true); bnStartACQ->setEnabled(true);
bnStartACQ->setStyleSheet("background-color: green;"); bnStartACQ->setStyleSheet("background-color: green;");
@ -1753,7 +1757,7 @@ void MainWindow::OpenScope(){
} }
}); });
connect(scope, &Scope::UpdateScaler, this, &MainWindow::UpdateScalar); connect(scope, &Scope::UpdateScaler, this, &FSUDAQ::UpdateScalar);
connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanels(1); }); connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanels(1); });
@ -1773,11 +1777,11 @@ void MainWindow::OpenScope(){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::OpenDigiSettings(){ void FSUDAQ::OpenDigiSettings(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( digiSettings == nullptr ) { if( digiSettings == nullptr ) {
digiSettings = new DigiSettingsPanel(digi, nDigi, rawDataPath); digiSettings = new DigiSettingsPanel(digi, nDigi, rawDataPath);
//connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg); //connect(scope, &Scope::SendLogMsg, this, &FSUDAQ::LogMsg);
connect(digiSettings, &DigiSettingsPanel::UpdateOtherPanels, this, [=](){ UpdateAllPanels(2); }); connect(digiSettings, &DigiSettingsPanel::UpdateOtherPanels, this, [=](){ UpdateAllPanels(2); });
digiSettings->show(); digiSettings->show();
@ -1789,7 +1793,7 @@ void MainWindow::OpenDigiSettings(){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::OpenCanvas(){ void FSUDAQ::OpenCanvas(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( canvas == nullptr ) { if( canvas == nullptr ) {
canvas = new SingleSpectra(digi, nDigi, rawDataPath); canvas = new SingleSpectra(digi, nDigi, rawDataPath);
@ -1802,7 +1806,7 @@ void MainWindow::OpenCanvas(){
} }
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::OpenAnalyzer(){ void FSUDAQ::OpenAnalyzer(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
int id = cbAnalyzer->currentData().toInt(); int id = cbAnalyzer->currentData().toInt();
@ -1837,7 +1841,7 @@ void MainWindow::OpenAnalyzer(){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::UpdateAllPanels(int panelID){ void FSUDAQ::UpdateAllPanels(int panelID){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
//panelID is the source panel that call //panelID is the source panel that call
// scope = 1; // scope = 1;
@ -1898,7 +1902,7 @@ void MainWindow::UpdateAllPanels(int panelID){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::SetUpInflux(){ void FSUDAQ::SetUpInflux(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( influxIP == "" ) { if( influxIP == "" ) {
LogMsg("<font style=\"color : red;\">Influx missing inputs. skip.</font>"); LogMsg("<font style=\"color : red;\">Influx missing inputs. skip.</font>");
@ -1962,7 +1966,7 @@ void MainWindow::SetUpInflux(){
} }
void MainWindow::CheckElog(){ void FSUDAQ::CheckElog(){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
LogMsg("---- Checking elog... please wait...."); LogMsg("---- Checking elog... please wait....");
printf("---- Checking elog... please wait....\n"); printf("---- Checking elog... please wait....\n");
@ -1995,7 +1999,7 @@ void MainWindow::CheckElog(){
} }
void MainWindow::WriteElog(QString htmlText, QString subject, QString category, int runNumber){ void FSUDAQ::WriteElog(QString htmlText, QString subject, QString category, int runNumber){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
//if( elogID < 0 ) return; //if( elogID < 0 ) return;
if( elogName == "" ) return; if( elogName == "" ) return;
@ -2024,7 +2028,7 @@ void MainWindow::WriteElog(QString htmlText, QString subject, QString category,
} }
void MainWindow::AppendElog(QString appendHtmlText){ void FSUDAQ::AppendElog(QString appendHtmlText){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
if( elogID < 1 ) return; if( elogID < 1 ) return;
if( elogName == "" ) return; if( elogName == "" ) return;
@ -2061,7 +2065,7 @@ void MainWindow::AppendElog(QString appendHtmlText){
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::LogMsg(QString msg){ void FSUDAQ::LogMsg(QString msg){
DebugPrint("%s", "FSUDAQ"); DebugPrint("%s", "FSUDAQ");
QString outputStr = QStringLiteral("[%1] %2").arg(QDateTime::currentDateTime().toString("MM.dd hh:mm:ss"), msg); QString outputStr = QStringLiteral("[%1] %2").arg(QDateTime::currentDateTime().toString("MM.dd hh:mm:ss"), msg);
if( logMsgHTMLMode ){ if( logMsgHTMLMode ){

View File

@ -1,5 +1,5 @@
#ifndef MAINWINDOW_H #ifndef FSUDAQ_H
#define MAINWINDOW_H #define FSUDAQ_H
#include <QMainWindow> #include <QMainWindow>
#include <QWidget> #include <QWidget>
@ -20,12 +20,12 @@
#include "ClassInfluxDB.h" #include "ClassInfluxDB.h"
#include "analyzers/Analyser.h" #include "analyzers/Analyser.h"
//^#===================================================== MainWindow //^#===================================================== FSUDAQ
class MainWindow : public QMainWindow{ class FSUDAQ : public QMainWindow{
Q_OBJECT Q_OBJECT
public: public:
MainWindow(QWidget *parent = nullptr); FSUDAQ(QWidget *parent = nullptr);
~MainWindow(); ~FSUDAQ();
void closeEvent(QCloseEvent * event){ void closeEvent(QCloseEvent * event){
if( scope ) { if( scope ) {

View File

@ -11,9 +11,9 @@ QT += core widgets charts printsupport
LIBS += -lCAENDigitizer -lcurl LIBS += -lCAENDigitizer -lcurl
#==== for enable GDB debug #==== for enable GDB debug
#QMAKE_CXXFLAGS += -g QMAKE_CXXFLAGS += -g
#QMAKE_CXXFLAGS_RELEASE = -O0 QMAKE_CXXFLAGS_RELEASE = -O0
#QMAKE_CFLAGS_RELEASE = -O0 QMAKE_CFLAGS_RELEASE = -O0
# 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.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.

View File

@ -25,9 +25,12 @@ public:
dataBaseName = "testing"; dataBaseName = "testing";
allowSignalSlot = false; allowSignalSlot = false;
printf("------------------- dasjkdsaldj\n");
SetUpCanvas(); SetUpCanvas();
printf("------------------- dasjkdsaldj###########\n");
LoadHistRange(); LoadHistRange();
printf("------------------- dasjkdsaldj##&&&&&&&&&#\n");
} }
@ -251,7 +254,7 @@ inline void CoincidentAnalyzer::SetUpCanvas(){
boxLayout->addWidget(lbaDigi, 7, 0); boxLayout->addWidget(lbaDigi, 7, 0);
aDigi = new RComboBox(this); aDigi = new RComboBox(this);
for(unsigned int i = 0; i < nDigi; i ++ ){ for(unsigned int i = 0; i < nDigi; i ++ ){
aDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), digi[i]->GetSerialNumber()); aDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
} }
boxLayout->addWidget(aDigi, 7, 1); boxLayout->addWidget(aDigi, 7, 1);
@ -307,7 +310,6 @@ inline void CoincidentAnalyzer::SetUpCanvas(){
} }
} }
//============ histograms //============ histograms
@ -327,12 +329,12 @@ inline void CoincidentAnalyzer::SetUpCanvas(){
h2D->SetYTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch)); h2D->SetYTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
h2D->UpdatePlot(); h2D->UpdatePlot();
h1 = new Histogram1D("1D Plot", "XXX", 300, 0, 5000, this); h1 = new Histogram1D("1D Plot", "XXX", 300, 0, 5000, this);
h1->SetColor(Qt::darkGreen); h1->SetColor(Qt::darkGreen);
h1->AddDataList("Test", Qt::red); // add another histogram in h1, Max Data List is 10 h1->AddDataList("Test", Qt::red); // add another histogram in h1, Max Data List is 10
bd = aDigi->currentData().toInt(); bd = aDigi->currentData().toInt();
ch = aCh->currentData().toInt(); ch = aCh->currentData().toInt();
printf("%d\n", digi[bd]->GetSerialNumber());
h1->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch)); h1->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
h1->UpdatePlot(); h1->UpdatePlot();
layout->addWidget(h1, 1, 1); layout->addWidget(h1, 1, 1);

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[]){
pidFile.write( QString::number(QCoreApplication::applicationPid() ).toStdString().c_str() ); pidFile.write( QString::number(QCoreApplication::applicationPid() ).toStdString().c_str() );
pidFile.close(); pidFile.close();
MainWindow w; FSUDAQ w;
w.show(); w.show();
return a.exec(); return a.exec();
} }