FSUDAQ_Qt6/Analyser.cpp

80 lines
1.8 KiB
C++
Raw Normal View History

#include "Analyser.h"
2023-05-26 18:06:37 -04:00
#include <QRandomGenerator>
#include <random>
Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent ): QMainWindow(parent){
2023-05-26 18:06:37 -04:00
this->digi = digi;
this->nDigi = nDigi;
setWindowTitle("Online Analyzer");
setGeometry(0, 0, 1000, 800);
influx = nullptr;
dataBaseName = "";
mb = new MultiBuilder(digi, nDigi);
2023-05-26 18:06:37 -04:00
buildTimerThread = new TimingThread(this);
buildTimerThread->SetWaitTimeinSec(1.0); //^Set event build interval
connect( buildTimerThread, &TimingThread::timeUp, this, &Analyzer::UpdateHistograms);
2023-05-26 18:06:37 -04:00
QWidget * layoutWidget = new QWidget(this);
setCentralWidget(layoutWidget);
layout = new QGridLayout(layoutWidget);
layoutWidget->setLayout(layout);
// QPushButton * bnSetting = new QPushButton("Settings", this);
// layout->addWidget(bnSetting);
}
Analyzer::~Analyzer(){
delete influx;
delete mb;
2023-05-26 18:06:37 -04:00
}
void Analyzer::RedefineEventBuilder(std::vector<int> idList){
delete mb;
mb = new MultiBuilder(digi, idList);
}
void Analyzer::StartThread(){
mb->ClearEvents();
2023-05-30 10:08:39 -04:00
buildTimerThread->start();
2023-05-26 18:06:37 -04:00
}
void Analyzer::StopThread(){
// printf("%s\n", __func__);
2023-05-30 10:08:39 -04:00
buildTimerThread->Stop();
buildTimerThread->quit();
buildTimerThread->wait();
2023-05-26 18:06:37 -04:00
}
void Analyzer::BuildEvents(bool verbose){
unsigned int nData = mb->GetNumOfDigitizer();
std::vector<int> idList = mb->GetDigiIDList();
for( unsigned int i = 0; i < nData; i++ ) digiMTX[idList[i]].lock();
if( isBuildBackward ){
mb->BuildEventsBackWard(maxNumEventBuilt, verbose);
}else{
mb->BuildEvents(0, 0, verbose);
}
for( unsigned int i = 0; i < nData; i++ ) digiMTX[idList[i]].unlock();
2023-05-26 18:06:37 -04:00
2023-06-12 16:32:01 -04:00
}
2023-06-12 16:32:01 -04:00
//^####################################### below are open to customization
2023-05-26 18:06:37 -04:00
2023-06-12 16:32:01 -04:00
void Analyzer::SetUpCanvas(){
2023-05-30 10:08:39 -04:00
2023-05-26 18:06:37 -04:00
}
void Analyzer::UpdateHistograms(){
2023-05-26 18:06:37 -04:00
2023-05-26 18:06:37 -04:00
}