2023-06-02 15:41:26 -04:00
|
|
|
#include "Analyser.h"
|
2023-05-26 18:06:37 -04:00
|
|
|
|
|
|
|
#include <QRandomGenerator>
|
|
|
|
#include <random>
|
|
|
|
|
2023-06-02 15:41:26 -04:00
|
|
|
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;
|
|
|
|
|
2023-06-12 15:45:16 -04:00
|
|
|
setWindowTitle("Online Analyzer");
|
|
|
|
setGeometry(0, 0, 1000, 800);
|
|
|
|
|
2023-05-26 18:06:37 -04:00
|
|
|
oeb = new OnlineEventBuilder * [nDigi];
|
|
|
|
for( unsigned int i = 0; i < nDigi; i++ ) oeb[i] = new OnlineEventBuilder(digi[i]);
|
|
|
|
|
|
|
|
buildTimerThread = new TimingThread(this);
|
|
|
|
buildTimerThread->SetWaitTimeinSec(1.0); //^Set event build interval
|
2023-06-02 15:41:26 -04:00
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-06-02 15:41:26 -04:00
|
|
|
Analyzer::~Analyzer(){
|
2023-05-26 18:06:37 -04:00
|
|
|
for( unsigned int i = 0; i < nDigi; i++ ) delete oeb[i];
|
|
|
|
delete [] oeb;
|
|
|
|
}
|
|
|
|
|
2023-06-02 15:41:26 -04:00
|
|
|
void Analyzer::StartThread(){
|
2023-06-12 15:45:16 -04:00
|
|
|
// printf("%s\n", __func__);
|
2023-06-09 13:51:02 -04:00
|
|
|
for( unsigned int i = 0; i < nDigi; i++) oeb[i]->ClearEvents();
|
2023-05-30 10:08:39 -04:00
|
|
|
buildTimerThread->start();
|
2023-05-26 18:06:37 -04:00
|
|
|
}
|
|
|
|
|
2023-06-02 15:41:26 -04:00
|
|
|
void Analyzer::StopThread(){
|
2023-06-12 15:45:16 -04:00
|
|
|
// 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
|
|
|
}
|
|
|
|
|
2023-06-12 16:32:01 -04:00
|
|
|
void Analyzer::BuildEvents(){
|
2023-06-12 15:45:16 -04:00
|
|
|
|
2023-06-12 16:32:01 -04:00
|
|
|
//Set with digitizer to be event build
|
|
|
|
digiMTX[digiID].lock();
|
|
|
|
oeb[digiID]->BuildEvents(100, false);
|
|
|
|
digiMTX[digiID].unlock();
|
2023-05-26 18:06:37 -04:00
|
|
|
|
2023-06-12 16:32:01 -04:00
|
|
|
}
|
2023-06-02 18:13:47 -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
|
|
|
}
|
|
|
|
|
2023-06-02 15:41:26 -04:00
|
|
|
void Analyzer::UpdateHistograms(){
|
2023-05-26 18:06:37 -04:00
|
|
|
|
2023-05-31 17:30:46 -04:00
|
|
|
|
2023-05-26 18:06:37 -04:00
|
|
|
}
|