snapshot
This commit is contained in:
parent
5b58083fb3
commit
c8a2912182
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -152,6 +152,7 @@
|
||||||
"variant": "cpp",
|
"variant": "cpp",
|
||||||
"qmainwindow": "cpp",
|
"qmainwindow": "cpp",
|
||||||
"qchartview": "cpp",
|
"qchartview": "cpp",
|
||||||
"qthread": "cpp"
|
"qthread": "cpp",
|
||||||
|
"qrandomgenerator": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -836,6 +836,8 @@ void MainWindow::StartACQ(){
|
||||||
bnStopACQ->setEnabled(true);
|
bnStopACQ->setEnabled(true);
|
||||||
bnOpenScope->setEnabled(false);
|
bnOpenScope->setEnabled(false);
|
||||||
|
|
||||||
|
if( onlineAnalyzer ) onlineAnalyzer->StartThread();
|
||||||
|
|
||||||
{//^=== elog and database
|
{//^=== elog and database
|
||||||
if( influx ){
|
if( influx ){
|
||||||
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
influx->AddDataPoint("RunID value=" + std::to_string(runID));
|
||||||
|
@ -888,6 +890,8 @@ void MainWindow::StopACQ(){
|
||||||
scalarThread->wait();
|
scalarThread->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( onlineAnalyzer ) onlineAnalyzer->StopThread();
|
||||||
|
|
||||||
if( histThread->isRunning()){
|
if( histThread->isRunning()){
|
||||||
histThread->Stop();
|
histThread->Stop();
|
||||||
histThread->quit();
|
histThread->quit();
|
||||||
|
|
|
@ -6,13 +6,11 @@ TEMPLATE = app
|
||||||
TARGET = FSUDAQ_Qt6
|
TARGET = FSUDAQ_Qt6
|
||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
|
|
||||||
|
#QT += core widgets charts webenginewidgets
|
||||||
QT += core widgets charts
|
QT += core widgets charts
|
||||||
|
|
||||||
#QMAKE_CXXFLAGS += `root-config --cflags --glibs`
|
QMAKE_CXXFLAGS += -g `root-config --cflags --glibs`
|
||||||
#LIBS += -lCAENDigitizer `root-config --cflags --glibs`
|
LIBS += -lCAENDigitizer -lcurl `root-config --cflags --glibs`
|
||||||
|
|
||||||
QMAKE_CXXFLAGS += -g
|
|
||||||
LIBS += -lCAENDigitizer -lcurl
|
|
||||||
|
|
||||||
# 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.
|
||||||
|
|
|
@ -38,30 +38,38 @@ OnlineAnalyzer::~OnlineAnalyzer(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnlineAnalyzer::StartThread(){
|
void OnlineAnalyzer::StartThread(){
|
||||||
|
buildTimerThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnlineAnalyzer::StopThread(){
|
void OnlineAnalyzer::StopThread(){
|
||||||
|
|
||||||
|
buildTimerThread->Stop();
|
||||||
|
buildTimerThread->quit();
|
||||||
|
buildTimerThread->wait();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnlineAnalyzer::SetUpCanvas(){
|
void OnlineAnalyzer::SetUpCanvas(){
|
||||||
|
|
||||||
//TODO a simple way to set it at once
|
//TODO a simple way to set it at once
|
||||||
Histogram2D * h2 = new Histogram2D("testing", -10, 10, -10, 10);
|
h2 = new Histogram2D("testing", 0, 4000, 0, 4000);
|
||||||
RChartView * h2View = new RChartView(h2->GetChart());
|
RChartView * h2View = new RChartView(h2->GetChart());
|
||||||
h2View->SetVRange(-10, 10); // this only set the reset key 'r'
|
h2->SetMarkerSize(2);
|
||||||
h2View->SetHRange(-10, 10);
|
h2View->SetVRange(0, 4000); // this only set the reset key 'r'
|
||||||
|
h2View->SetHRange(0, 4000);
|
||||||
|
|
||||||
layout->addWidget(h2View);
|
layout->addWidget(h2View);
|
||||||
|
|
||||||
std::random_device rd;
|
|
||||||
std::mt19937 gen(rd());
|
|
||||||
std::normal_distribution<double> distribution(0.0, 2.0);
|
|
||||||
|
|
||||||
for( int i = 0; i < 1000 ; i++ ){
|
//Histogram * h1 = new Histogram("h1", 0, 5000, 200);
|
||||||
h2->Fill(distribution(gen), distribution(gen));
|
|
||||||
}
|
|
||||||
|
// std::random_device rd;
|
||||||
|
// std::mt19937 gen(rd());
|
||||||
|
// std::normal_distribution<double> distribution(0.0, 2.0);
|
||||||
|
// for( int i = 0; i < 1000 ; i++ ){
|
||||||
|
// h2->Fill(distribution(gen), distribution(gen));
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,10 +77,34 @@ void OnlineAnalyzer::UpdateHistograms(){
|
||||||
|
|
||||||
//Set with digitizer to be event build
|
//Set with digitizer to be event build
|
||||||
digiMTX[0].lock();
|
digiMTX[0].lock();
|
||||||
oeb[0]->BuildEvents(100);
|
//digi[0]->GetData()->PrintAllData();
|
||||||
|
oeb[0]->BuildEvents(100, true);
|
||||||
digiMTX[0].unlock();
|
digiMTX[0].unlock();
|
||||||
|
|
||||||
//============ Get events, and do analysis
|
//============ Get events, and do analysis
|
||||||
|
long eventBuilt = oeb[0]->eventbuilt;
|
||||||
|
printf("------------- eventBuilt %ld \n", eventBuilt);
|
||||||
|
if( eventBuilt == 0 ) return;
|
||||||
|
|
||||||
|
long eventIndex = oeb[0]->eventIndex;
|
||||||
|
|
||||||
|
long eventStart = eventIndex - eventBuilt + 1;
|
||||||
|
if(eventStart < 0 ) eventStart += MaxNEvent;
|
||||||
|
|
||||||
|
unsigned short e1 = 0, e2 = 0;
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
for( long i = eventStart ; i <= eventIndex; i ++ ){
|
||||||
|
std::vector<dataPoint> event = oeb[0]->events[i];
|
||||||
|
|
||||||
|
for( int k = 0; k < (int) event.size(); k++ ){
|
||||||
|
if( event[k].ch == 3 ) e1 = event[k].energy;
|
||||||
|
if( event[k].ch == 4 ) e2 = event[k].energy;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2->Fill(e1, e2);
|
||||||
|
count ++;
|
||||||
|
if( count > 500 ) break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -34,7 +34,7 @@ derivative class should define the SetUpCanvas() and UpdateHistogram();
|
||||||
|
|
||||||
//^==============================================
|
//^==============================================
|
||||||
//^==============================================
|
//^==============================================
|
||||||
class Histogram2D{
|
class Histogram2D{ //TODO, cannot handle more then 3000 datapoint
|
||||||
public:
|
public:
|
||||||
Histogram2D(QString title, double xMin, double xMax, double yMin, double yMax){
|
Histogram2D(QString title, double xMin, double xMax, double yMin, double yMax){
|
||||||
|
|
||||||
|
@ -114,5 +114,8 @@ private:
|
||||||
|
|
||||||
QGridLayout * layout;
|
QGridLayout * layout;
|
||||||
|
|
||||||
|
//======================== custom histograms
|
||||||
|
Histogram2D * h2;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
|
@ -79,11 +79,15 @@ void OnlineEventBuilder::BuildEvents(unsigned short timeWindow, bool verbose){
|
||||||
|
|
||||||
if( earlistCh == -1 || nExhaushedCh == nCh) return; /// no data
|
if( earlistCh == -1 || nExhaushedCh == nCh) return; /// no data
|
||||||
|
|
||||||
|
eventbuilt = 0;
|
||||||
|
|
||||||
//======= Start building event
|
//======= Start building event
|
||||||
do{
|
do{
|
||||||
|
|
||||||
eventIndex ++;
|
eventIndex ++;
|
||||||
if( eventIndex >= MaxNEvent ) eventIndex = 0;
|
if( eventIndex >= MaxNEvent ) eventIndex = 0;
|
||||||
|
|
||||||
|
eventbuilt ++;
|
||||||
|
|
||||||
unsigned long long dT =0;
|
unsigned long long dT =0;
|
||||||
dataPoint dp = {0, 0, 0};
|
dataPoint dp = {0, 0, 0};
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
void BuildEvents(unsigned short timeWindow, bool verbose = false);
|
void BuildEvents(unsigned short timeWindow, bool verbose = false);
|
||||||
|
|
||||||
long eventIndex;
|
long eventIndex;
|
||||||
|
long eventbuilt;
|
||||||
std::vector<dataPoint> events[MaxNEvent]; // should be a cirular memory, store energy
|
std::vector<dataPoint> events[MaxNEvent]; // should be a cirular memory, store energy
|
||||||
|
|
||||||
unsigned short GetTimeWindow() const { return timeWindow;}
|
unsigned short GetTimeWindow() const { return timeWindow;}
|
||||||
|
|
|
@ -16,12 +16,14 @@ CAENCOmm_v1.5.3
|
||||||
|
|
||||||
CAENDigitizer_v2.17.1
|
CAENDigitizer_v2.17.1
|
||||||
|
|
||||||
`sudo apt install qt6-base-dev libcurl4-openssl-dev libqt6charts6-dev elog`
|
`sudo apt install qt6-base-dev libcurl4-openssl-dev libqt6charts6-dev qt6-webengine-dev elog`
|
||||||
|
|
||||||
The elog installed using apt is 3.1.3. If a higher version is needed. Please go to https://elog.psi.ch/elog/
|
The elog installed using apt is 3.1.3. If a higher version is needed. Please go to https://elog.psi.ch/elog/
|
||||||
|
|
||||||
The libcurl4 is need for pushing data to InfluxDB v1.8
|
The libcurl4 is need for pushing data to InfluxDB v1.8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
|
|
||||||
use `qmake6 -project ` to generate the *.pro
|
use `qmake6 -project ` to generate the *.pro
|
||||||
|
|
Loading…
Reference in New Issue
Block a user