it seems that all bugs are fixed for online analyzser
This commit is contained in:
parent
21f19b6ff7
commit
2dc0f494b3
25
Analyser.cpp
25
Analyser.cpp
|
@ -8,6 +8,9 @@ Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent )
|
|||
this->digi = digi;
|
||||
this->nDigi = nDigi;
|
||||
|
||||
setWindowTitle("Online Analyzer");
|
||||
setGeometry(0, 0, 1000, 800);
|
||||
|
||||
oeb = new OnlineEventBuilder * [nDigi];
|
||||
for( unsigned int i = 0; i < nDigi; i++ ) oeb[i] = new OnlineEventBuilder(digi[i]);
|
||||
|
||||
|
@ -15,9 +18,6 @@ Analyzer::Analyzer(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent )
|
|||
buildTimerThread->SetWaitTimeinSec(1.0); //^Set event build interval
|
||||
connect( buildTimerThread, &TimingThread::timeUp, this, &Analyzer::UpdateHistograms);
|
||||
|
||||
setWindowTitle("Online Analyzer");
|
||||
setGeometry(0, 0, 1000, 800);
|
||||
|
||||
QWidget * layoutWidget = new QWidget(this);
|
||||
setCentralWidget(layoutWidget);
|
||||
layout = new QGridLayout(layoutWidget);
|
||||
|
@ -35,18 +35,20 @@ Analyzer::~Analyzer(){
|
|||
}
|
||||
|
||||
void Analyzer::StartThread(){
|
||||
// printf("%s\n", __func__);
|
||||
for( unsigned int i = 0; i < nDigi; i++) oeb[i]->ClearEvents();
|
||||
buildTimerThread->start();
|
||||
}
|
||||
|
||||
void Analyzer::StopThread(){
|
||||
|
||||
// printf("%s\n", __func__);
|
||||
buildTimerThread->Stop();
|
||||
buildTimerThread->quit();
|
||||
buildTimerThread->wait();
|
||||
|
||||
}
|
||||
|
||||
//^####################################### below are open to customization
|
||||
|
||||
void Analyzer::SetUpCanvas(){
|
||||
|
||||
setGeometry(0, 0, 1600, 800);
|
||||
|
@ -57,17 +59,6 @@ void Analyzer::SetUpCanvas(){
|
|||
h1 = new Histogram1D("testing", "x", 400, 0, 10000, this);
|
||||
layout->addWidget(h1, 0, 1);
|
||||
|
||||
// std::random_device rd;
|
||||
// std::mt19937 gen(rd());
|
||||
// std::normal_distribution<double> distribution(2000.0, 1000);
|
||||
// for( int i = 0; i < 1000 ; i++ ){
|
||||
// double x = distribution(gen);
|
||||
// double y = distribution(gen);
|
||||
// h2->Fill(x, y);
|
||||
// h1->Fill(x);
|
||||
// }
|
||||
// h1->UpdatePlot();
|
||||
|
||||
}
|
||||
|
||||
void Analyzer::UpdateHistograms(){
|
||||
|
@ -77,7 +68,7 @@ void Analyzer::UpdateHistograms(){
|
|||
oeb[0]->BuildEvents(100, false);
|
||||
digiMTX[0].unlock();
|
||||
|
||||
oeb[0]->PrintStat();
|
||||
//oeb[0]->PrintStat();
|
||||
|
||||
//============ Get events, and do analysis
|
||||
long eventBuilt = oeb[0]->eventBuilt;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "CAENDigitizerType.h"
|
||||
#include "macro.h"
|
||||
|
||||
#define MaxNData 50 /// store 10k events per channels
|
||||
#define MaxNData 10000 /// store 10k events per channels
|
||||
|
||||
class Data{
|
||||
|
||||
|
|
|
@ -47,9 +47,12 @@ public:
|
|||
QCPColorGradient color;
|
||||
color.clearColorStops();
|
||||
color.setColorStopAt( 0.0, QColor("white" ));
|
||||
color.setColorStopAt( 0.3, QColor("blue"));
|
||||
color.setColorStopAt( 0.4, QColor("green"));
|
||||
color.setColorStopAt( 1.0, QColor("yellow"));
|
||||
color.setColorStopAt( 0.0001, QColor("purple" ));
|
||||
color.setColorStopAt( 0.2, QColor("blue"));
|
||||
color.setColorStopAt( 0.4, QColor("cyan"));
|
||||
color.setColorStopAt( 0.6, QColor("green"));
|
||||
color.setColorStopAt( 0.8, QColor("yellow"));
|
||||
color.setColorStopAt( 1.0, QColor("red"));
|
||||
colorMap->setGradient(color);
|
||||
|
||||
double xPosStart = 0.02;
|
||||
|
@ -165,11 +168,13 @@ public:
|
|||
yAxis->setRangeUpper(yMax);
|
||||
replot();
|
||||
usingMenu = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if( selectedAction == a2 ) {
|
||||
Clear();
|
||||
usingMenu = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if( selectedAction == a3 ){
|
||||
|
@ -181,11 +186,13 @@ public:
|
|||
}
|
||||
replot();
|
||||
usingMenu = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if( selectedAction == a4){
|
||||
rightMouseClickRebin();
|
||||
usingMenu = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if( selectedAction == a5 ){
|
||||
|
@ -194,6 +201,7 @@ public:
|
|||
isDrawCut= true;
|
||||
usingMenu = false;
|
||||
numCut ++;
|
||||
return;
|
||||
}
|
||||
|
||||
if( selectedAction && numCut > 0 && selectedAction->text().contains("Delete ") ){
|
||||
|
@ -230,27 +238,12 @@ public:
|
|||
cutNameList.clear();
|
||||
cutEntryList.clear();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( selectedAction && numCut > 0 && selectedAction->text().contains("Clear all Cuts") ){
|
||||
numCut = 0;
|
||||
tempCutID = -1;
|
||||
lastPlottableID = -1;
|
||||
cutList.clear();
|
||||
cutIDList.clear();
|
||||
for( int i = cutTextIDList.count() - 1; i >= 0 ; i--){
|
||||
if( cutTextIDList[i] < 0 ) continue;
|
||||
removeItem(cutTextIDList[i]);
|
||||
removePlottable(plottableIDList[i]);
|
||||
}
|
||||
replot();
|
||||
|
||||
cutTextIDList.clear();
|
||||
plottableIDList.clear();
|
||||
cutNameList.clear();
|
||||
cutEntryList.clear();
|
||||
|
||||
ClearAllCuts();
|
||||
return;
|
||||
}
|
||||
|
||||
if( selectedAction && numCut > 0 && selectedAction->text().contains("Add/Edit names to Cuts") ){
|
||||
|
@ -276,6 +269,7 @@ public:
|
|||
});
|
||||
}
|
||||
dialog.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
}///================= end of right click
|
||||
|
@ -357,6 +351,7 @@ public:
|
|||
txt[i][j]->setText("0");
|
||||
}
|
||||
}
|
||||
colorMap->data()->clear();
|
||||
UpdatePlot();
|
||||
}
|
||||
|
||||
|
@ -414,6 +409,25 @@ public:
|
|||
//qDebug() << "Plottable count : " << plottableCount() << ", cutList.count :" << cutList.count() << ", cutID :" << lastPlottableID;
|
||||
}
|
||||
|
||||
void ClearAllCuts(){
|
||||
numCut = 0;
|
||||
tempCutID = -1;
|
||||
lastPlottableID = -1;
|
||||
cutList.clear();
|
||||
cutIDList.clear();
|
||||
for( int i = cutTextIDList.count() - 1; i >= 0 ; i--){
|
||||
if( cutTextIDList[i] < 0 ) continue;
|
||||
removeItem(cutTextIDList[i]);
|
||||
removePlottable(plottableIDList[i]);
|
||||
}
|
||||
replot();
|
||||
|
||||
cutTextIDList.clear();
|
||||
plottableIDList.clear();
|
||||
cutNameList.clear();
|
||||
cutEntryList.clear();
|
||||
}
|
||||
|
||||
QList<QPolygonF> GetCutList() const{return cutList;} // this list may contain empty element
|
||||
QList<int> GetCutEntryList() const{ return cutEntryList;}
|
||||
void PrintCutEntry() const{
|
||||
|
|
|
@ -14,7 +14,7 @@ Use another class to hold the event data and methods.
|
|||
#include "macro.h"
|
||||
#include "ClassDigitizer.h"
|
||||
|
||||
#define MaxNEvent 30
|
||||
#define MaxNEvent 5000
|
||||
|
||||
struct dataPoint{
|
||||
unsigned short ch;
|
||||
|
|
Loading…
Reference in New Issue
Block a user