fix all code with parallel thread

This commit is contained in:
Ryan Tang 2024-10-22 16:38:01 -04:00
parent fe6bdb82ff
commit 4ab72dc43d
4 changed files with 22 additions and 15 deletions

View File

@ -164,9 +164,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
connect(timer, &QTimer::timeout, histWorker, &HistWorker::FillHistograms); connect(timer, &QTimer::timeout, histWorker, &HistWorker::FillHistograms);
connect( histWorker, &HistWorker::workDone, this, &SingleSpectra::ReplotHistograms); connect( histWorker, &HistWorker::workDone, this, &SingleSpectra::ReplotHistograms);
workerThread->start(); workerThread->start();
} }
@ -252,7 +249,7 @@ void SingleSpectra::FillHistograms(){
timespec ta, tb; timespec ta, tb;
printf("####################### SingleSpectra::%s\n", __func__); printf("####################### SingleSpectra::%s\n", __func__);
qDebug() << __func__ << "| thread:" << QThread::currentThreadId(); // qDebug() << __func__ << "| thread:" << QThread::currentThreadId();
clock_gettime(CLOCK_REALTIME, &ta); clock_gettime(CLOCK_REALTIME, &ta);

View File

@ -31,6 +31,7 @@ public:
public slots: public slots:
void UpdateHistograms(); void UpdateHistograms();
void ReplotHistograms();
private: private:
@ -486,11 +487,6 @@ inline void CoincidentAnalyzer::UpdateHistograms(){
} }
h2D->UpdatePlot();
h1->UpdatePlot();
hMulti->UpdatePlot();
h1g->UpdatePlot();
if( influx ){ if( influx ){
QList<QString> cutNameList = h2D->GetCutNameList(); QList<QString> cutNameList = h2D->GetCutNameList();
for( int p = 0; p < cutList.count(); p ++){ for( int p = 0; p < cutList.count(); p ++){
@ -509,6 +505,13 @@ inline void CoincidentAnalyzer::UpdateHistograms(){
} }
inline void CoincidentAnalyzer::ReplotHistograms(){
h2D->UpdatePlot();
h1->UpdatePlot();
hMulti->UpdatePlot();
h1g->UpdatePlot();
}
inline void CoincidentAnalyzer::SaveSettings(){ inline void CoincidentAnalyzer::SaveSettings(){
QString filePath = QFileDialog::getSaveFileName(this, QString filePath = QFileDialog::getSaveFileName(this,
"Save Settings to File", "Save Settings to File",

View File

@ -59,6 +59,8 @@ public:
public slots: public slots:
void UpdateHistograms(); void UpdateHistograms();
void ReplotHistograms();
private: private:
QVector<int> generateNonRepeatedCombination(int size); QVector<int> generateNonRepeatedCombination(int size);
void SetUpCanvas(); void SetUpCanvas();
@ -210,8 +212,11 @@ inline void NeutronGamma::UpdateHistograms(){
}while(lastFilledIndex[ID][ch] <= digi[ID]->GetData()->GetAbsDataIndex(ch)); }while(lastFilledIndex[ID][ch] <= digi[ID]->GetData()->GetAbsDataIndex(ch));
hist2D->UpdatePlot(); }
inline void NeutronGamma::ReplotHistograms(){
// qDebug() << __func__ << "| thread:" << QThread::currentThreadId();
hist2D->UpdatePlot();
} }
inline QVector<int> NeutronGamma::generateNonRepeatedCombination(int size) { inline QVector<int> NeutronGamma::generateNonRepeatedCombination(int size) {

View File

@ -63,6 +63,7 @@ public:
public slots: public slots:
void UpdateHistograms(); void UpdateHistograms();
void ReplotHistograms();
private: private:
@ -421,11 +422,6 @@ inline void SplitPole::UpdateHistograms(){
} }
} }
hPID->UpdatePlot();
h1->UpdatePlot();
hMulti->UpdatePlot();
h1g->UpdatePlot();
QList<QString> cutNameList = hPID->GetCutNameList(); QList<QString> cutNameList = hPID->GetCutNameList();
for( int p = 0; p < cutList.count(); p ++){ for( int p = 0; p < cutList.count(); p ++){
if( cutList[p].isEmpty() ) continue; if( cutList[p].isEmpty() ) continue;
@ -441,5 +437,11 @@ inline void SplitPole::UpdateHistograms(){
} }
inline void SplitPole::ReplotHistograms(){
hPID->UpdatePlot();
h1->UpdatePlot();
hMulti->UpdatePlot();
h1g->UpdatePlot();
}
#endif #endif