First save of working files specific to RAISOR
This commit is contained in:
parent
1af2bd4ce9
commit
c8d5d2d0c4
18
FSUDAQ.cpp
18
FSUDAQ.cpp
|
@ -18,9 +18,12 @@
|
|||
#include "analyzers/CoincidentAnalyzer.h"
|
||||
#include "analyzers/SplitPoleAnalyzer.h"
|
||||
#include "analyzers/EncoreAnalyzer.h"
|
||||
#include "analyzers/RAISOR.h"
|
||||
#include "analyzers/RAISOR1.h"
|
||||
#include "analyzers/RAISOR2.h"
|
||||
#include "analyzers/MCP.h"
|
||||
#include "analyzers/PID.h"
|
||||
|
||||
std::vector<std::string> onlineAnalyzerList = {"Coincident","Splie-Pole", "Encore", "RAISOR"};
|
||||
std::vector<std::string> onlineAnalyzerList = {"Coincident","Splie-Pole", "Encore", "RAISOR1", "MCP", "PID", "RAISOR2" };
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||
DebugPrint("%s", "FSUDAQ");
|
||||
|
@ -1730,7 +1733,10 @@ void MainWindow::OpenAnalyzer(){
|
|||
if( id == 0 ) onlineAnalyzer = new CoincidentAnalyzer(digi, nDigi);
|
||||
if( id == 1 ) onlineAnalyzer = new SplitPole(digi, nDigi);
|
||||
if( id == 2 ) onlineAnalyzer = new Encore(digi, nDigi);
|
||||
if( id == 3 ) onlineAnalyzer = new RAISOR(digi, nDigi);
|
||||
if( id == 3 ) onlineAnalyzer = new RAISOR1(digi, nDigi);
|
||||
if( id == 4 ) onlineAnalyzer = new MCP(digi, nDigi);
|
||||
if( id == 5 ) onlineAnalyzer = new PID(digi, nDigi);
|
||||
if( id == 6 ) onlineAnalyzer = new RAISOR2(digi, nDigi);
|
||||
if( id >= 0 ) onlineAnalyzer->show();
|
||||
}else{
|
||||
|
||||
|
@ -1739,8 +1745,10 @@ void MainWindow::OpenAnalyzer(){
|
|||
if( id == 0 ) onlineAnalyzer = new CoincidentAnalyzer(digi, nDigi);
|
||||
if( id == 1 ) onlineAnalyzer = new SplitPole(digi, nDigi);
|
||||
if( id == 2 ) onlineAnalyzer = new Encore(digi, nDigi);
|
||||
if( id == 3 ) onlineAnalyzer = new RAISOR(digi, nDigi);
|
||||
|
||||
if( id == 3 ) onlineAnalyzer = new RAISOR1(digi, nDigi);
|
||||
if( id == 4 ) onlineAnalyzer = new MCP(digi, nDigi);
|
||||
if( id == 5 ) onlineAnalyzer = new PID(digi, nDigi);
|
||||
if( id == 6 ) onlineAnalyzer = new RAISOR2(digi, nDigi);
|
||||
if( id >= 0 ){
|
||||
onlineAnalyzer->show();
|
||||
onlineAnalyzer->activateWindow();
|
||||
|
|
|
@ -44,7 +44,10 @@ HEADERS += ClassData.h \
|
|||
analyzers/CoincidentAnalyzer.h \
|
||||
analyzers/SplitPoleAnalyzer.h \
|
||||
analyzers/EncoreAnalyzer.h \
|
||||
analyzers/RAISOR.h
|
||||
analyzers/RAISOR1.h \
|
||||
analyzers/RAISOR2.h \
|
||||
analyzers/MCP.h \
|
||||
analyzers/PID.h
|
||||
SOURCES += ClassDigitizer.cpp \
|
||||
DigiSettingsPanel.cpp \
|
||||
FSUDAQ.cpp \
|
||||
|
|
206
analyzers/MCP.h
Normal file
206
analyzers/MCP.h
Normal file
|
@ -0,0 +1,206 @@
|
|||
#ifndef MCP_h
|
||||
#define MCP_h
|
||||
|
||||
/*********************************************
|
||||
* This is online analyzer for MCP, ANL
|
||||
*
|
||||
* Created by Khushi @ 2024-03-27
|
||||
*
|
||||
* ******************************************/
|
||||
#include "Analyser.h"
|
||||
|
||||
|
||||
class MCP : public Analyzer{
|
||||
|
||||
|
||||
|
||||
public:
|
||||
MCP(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr): Analyzer(digi, nDigi, parent){
|
||||
|
||||
|
||||
SetUpdateTimeInSec(1.0);
|
||||
|
||||
RedefineEventBuilder({0}); // only builder for the 0-th digitizer.
|
||||
tick2ns = digi[0]->GetTick2ns();
|
||||
|
||||
SetBackwardBuild(false, 100); // using normal building (acceding in time) or backward building, int the case of backward building, default events to be build is 100.
|
||||
evtbder = GetEventBuilder();
|
||||
evtbder->SetTimeWindow(500);
|
||||
|
||||
//========== use the influx from the Analyzer
|
||||
influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/");
|
||||
dataBaseName = "testing";
|
||||
|
||||
SetUpCanvas(); // see below
|
||||
|
||||
};
|
||||
|
||||
void SetUpCanvas();
|
||||
|
||||
public slots:
|
||||
void UpdateHistograms();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
MultiBuilder *evtbder;
|
||||
|
||||
Histogram2D * hPID;
|
||||
|
||||
Histogram2D * hXX; // X1 versus X2 : e[1] versus e[0]
|
||||
Histogram2D * hYY; // Y1 versus Y2 : e[3] versus e[2]
|
||||
|
||||
Histogram1D * hX; // X position:((e[0]-e[1])/(e[0]+e[1]))
|
||||
Histogram1D * hY; // Y position:((e[2]-e[3])/(e[2]+e[3]))
|
||||
|
||||
Histogram2D * hXY; // 2D position plot: ((e[2]-e[3])/(e[2]+e[3])) versus ((e[0]-e[1])/(e[0]+e[1]))
|
||||
|
||||
Histogram1D * he0; // e0: signal 0
|
||||
Histogram1D * he1; // e1: signal 1
|
||||
Histogram1D * he2; // e2: signal 2
|
||||
Histogram1D * he3; // e3: signal 3
|
||||
|
||||
|
||||
int tick2ns;
|
||||
|
||||
float dE, E;
|
||||
unsigned long long dE_t, E_t;
|
||||
|
||||
float e0, e1, e2, e3;
|
||||
unsigned long long t0, t1, t2, t3;
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline void MCP::SetUpCanvas(){
|
||||
|
||||
setGeometry(0, 0, 2000, 800);
|
||||
|
||||
//============ histograms
|
||||
hPID = new Histogram2D("MCP", "E", "dE", 100, 0, 5000, 100, 0, 5000, this);
|
||||
layout->addWidget(hPID, 0, 0);
|
||||
|
||||
hXY = new Histogram2D("2D position plot", "X position", "Y position", 100, -1, 1, 100, -1, 1, this);
|
||||
layout->addWidget(hXY, 0, 1);
|
||||
|
||||
hXX = new Histogram2D("X1 versus X2", "X2", "X1", 100, 0, 5000, 100, 0, 5000, this);
|
||||
layout->addWidget(hXX, 0, 2);
|
||||
|
||||
hYY = new Histogram2D("Y1 versus Y2", "Y2", "Y1", 100, 0, 3000, 100, 0, 3000, this);
|
||||
layout->addWidget(hYY, 1, 0);
|
||||
|
||||
hX = new Histogram1D("X position", "X", 300, -1, 1, this);
|
||||
layout->addWidget(hX, 1, 1);
|
||||
|
||||
hY = new Histogram1D("Y position", "Y", 300, -1, 1, this);
|
||||
layout->addWidget(hY, 1, 2);
|
||||
/* UNCOMMENT THESE LINES TO SEE INDIVIDUAL SIGNALS
|
||||
he0 = new Histogram1D("Signal 0", "e0", 300, -1, 1, this);
|
||||
layout->addWidget(he0, 0, 3);
|
||||
|
||||
he1 = new Histogram1D("Signal 1", "e1", 300, -1, 1, this);
|
||||
layout->addWidget(he1, 0, 4);
|
||||
|
||||
he2 = new Histogram1D("Signal 2", "e2", 300, -1, 1, this);
|
||||
layout->addWidget(he2, 1, 3);
|
||||
|
||||
he3 = new Histogram1D("Signal 3", "e3", 300, -1, 1, this);
|
||||
layout->addWidget(he3, 1, 4);
|
||||
*/
|
||||
}
|
||||
|
||||
inline void MCP::UpdateHistograms(){
|
||||
|
||||
if( this->isVisible() == false ) return;
|
||||
|
||||
BuildEvents(false); // call the event builder to build events
|
||||
|
||||
//============ Get events, and do analysis
|
||||
long eventBuilt = evtbder->eventBuilt;
|
||||
if( eventBuilt == 0 ) return;
|
||||
|
||||
//============ Get the cut list, if any
|
||||
QList<QPolygonF> cutList = hPID->GetCutList();
|
||||
const int nCut = cutList.count();
|
||||
unsigned long long tMin[nCut] = {0xFFFFFFFFFFFFFFFF}, tMax[nCut] = {0};
|
||||
unsigned int count[nCut]={0};
|
||||
|
||||
//============ Processing data and fill histograms
|
||||
long eventIndex = evtbder->eventIndex;
|
||||
long eventStart = eventIndex - eventBuilt + 1;
|
||||
if(eventStart < 0 ) eventStart += MaxNEvent;
|
||||
|
||||
for( long i = eventStart ; i <= eventIndex; i ++ ){
|
||||
std::vector<Hit> event = evtbder->events[i];
|
||||
//printf("-------------- %ld\n", i);
|
||||
|
||||
if( event.size() == 0 ) return;
|
||||
|
||||
for( int k = 0; k < (int) event.size(); k++ ){
|
||||
//event[k].Print();
|
||||
if( event[k].ch == 0 ) {dE = event[k].energy; dE_t = event[k].timestamp;}
|
||||
if( event[k].ch == 1 ) {E = event[k].energy; E_t = event[k].timestamp;}
|
||||
|
||||
if( event[k].ch == 2 ) {e0 = event[k].energy; t0 = event[k].timestamp;}
|
||||
if( event[k].ch == 3 ) {e1= event[k].energy; t1 = event[k].timestamp;}
|
||||
|
||||
if( event[k].ch == 4 ) {e2 = event[k].energy; t2 = event[k].timestamp;}
|
||||
if( event[k].ch == 5 ) {e3= event[k].energy; t3 = event[k].timestamp;}
|
||||
|
||||
}
|
||||
|
||||
// printf("(E, dE) = (%f, %f)\n", E, dE);
|
||||
hPID->Fill(E + RandomGauss(0, 100), dE+ RandomGauss(0, 100)); // x, y
|
||||
hXX->Fill(e1, e0); //
|
||||
hYY->Fill(e3, e2);
|
||||
hXY->Fill(((e0-e1)/(e0+e1)),((e2-e3)/(e2+e3)));
|
||||
hX->Fill(((e0-e1)/(e0+e1)));
|
||||
hY->Fill(((e2-e3)/(e2+e3)));
|
||||
he0->Fill(e0);
|
||||
he1->Fill(e1);
|
||||
he2->Fill(e2);
|
||||
he3->Fill(e3);
|
||||
|
||||
|
||||
//check events inside any Graphical cut and extract the rate
|
||||
for(int p = 0; p < cutList.count(); p++ ){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
if( cutList[p].containsPoint(QPointF(E, dE), Qt::OddEvenFill) ){
|
||||
if( dE_t < tMin[p] ) tMin[p] = dE_t;
|
||||
if( dE_t > tMax[p] ) tMax[p] = dE_t;
|
||||
count[p] ++;
|
||||
//printf(".... %d \n", count[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hPID->UpdatePlot();
|
||||
hXX->UpdatePlot();//
|
||||
hYY->UpdatePlot();
|
||||
hXY->UpdatePlot();
|
||||
hX->UpdatePlot();
|
||||
hY->UpdatePlot();
|
||||
he0->UpdatePlot();
|
||||
he1->UpdatePlot();
|
||||
he2->UpdatePlot();
|
||||
he3->UpdatePlot();
|
||||
|
||||
|
||||
|
||||
//========== output to Influx
|
||||
QList<QString> cutNameList = hPID->GetCutNameList();
|
||||
for( int p = 0; p < cutList.count(); p ++){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
double dT = (tMax[p]-tMin[p]) * tick2ns / 1e9; // tick to sec
|
||||
double rate = count[p]*1.0/(dT);
|
||||
//printf("%llu %llu, %f %d\n", tMin[p], tMax[p], dT, count[p]);
|
||||
//printf("%10s | %d | %f Hz \n", cutNameList[p].toStdString().c_str(), count[p], rate);
|
||||
|
||||
influx->AddDataPoint("Cut,name=" + cutNameList[p].toStdString()+ " value=" + std::to_string(rate));
|
||||
influx->WriteData(dataBaseName);
|
||||
influx->ClearDataPointsBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
190
analyzers/PID.h
Normal file
190
analyzers/PID.h
Normal file
|
@ -0,0 +1,190 @@
|
|||
#ifndef PID_h
|
||||
#define PID_h
|
||||
|
||||
/*********************************************
|
||||
* This is online analyzer for PID, ANL
|
||||
*
|
||||
* Created by Khushi @ 2024-03-27
|
||||
*
|
||||
* ******************************************/
|
||||
#include "Analyser.h"
|
||||
|
||||
|
||||
class PID : public Analyzer{
|
||||
|
||||
|
||||
|
||||
public:
|
||||
PID(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr): Analyzer(digi, nDigi, parent){
|
||||
|
||||
|
||||
SetUpdateTimeInSec(1.0);
|
||||
|
||||
RedefineEventBuilder({0}); // only builder for the 0-th digitizer.
|
||||
tick2ns = digi[0]->GetTick2ns();
|
||||
|
||||
SetBackwardBuild(false, 100); // using normal building (acceding in time) or backward building, int the case of backward building, default events to be build is 100.
|
||||
evtbder = GetEventBuilder();
|
||||
evtbder->SetTimeWindow(500);
|
||||
|
||||
//========== use the influx from the Analyzer
|
||||
influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/");
|
||||
dataBaseName = "testing";
|
||||
|
||||
SetUpCanvas(); // see below
|
||||
|
||||
};
|
||||
|
||||
void SetUpCanvas();
|
||||
|
||||
public slots:
|
||||
void UpdateHistograms();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
MultiBuilder *evtbder;
|
||||
|
||||
Histogram2D * hPID;
|
||||
|
||||
Histogram1D * hdE; // raw dE (ch=1): ch1
|
||||
Histogram1D * hE; // raw E (ch=4) : ch4
|
||||
Histogram1D * hdT; // raw dT (ch=7): ch7
|
||||
|
||||
Histogram1D * hTotE; // total energy (dE+E): ch1+ch4
|
||||
Histogram1D * hTWin; // coincidence time window TWin: (t4-t1)*1e9
|
||||
|
||||
Histogram2D * hdEE; // dE versus E : ch1 versus ch4
|
||||
Histogram2D * hdEtotE; // dE versus totE : ch1 versus (ch1+ch4)
|
||||
|
||||
Histogram2D * hdEdT; // dE versus TOF: ch1 versus (t7-t1)*1e9
|
||||
|
||||
|
||||
int tick2ns;
|
||||
|
||||
float ch1, ch4, ch7;
|
||||
unsigned long long t1, t4, t7;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline void PID::SetUpCanvas(){
|
||||
|
||||
setGeometry(0, 0, 2000, 1000);
|
||||
|
||||
//============ histograms
|
||||
|
||||
hdEE = new Histogram2D("dE vs E", "E[ch]", "dE[ch]", 100, 0, 7000, 100, 0, 4000, this);
|
||||
layout->addWidget(hdEE, 0, 0, 1, 2);
|
||||
|
||||
hdE = new Histogram1D("raw dE (ch=1)", "dE [ch]", 300, 0, 2500, this);
|
||||
layout->addWidget(hdE, 0, 2);
|
||||
|
||||
hdEdT = new Histogram2D("dE vs TOF", "TOF [ns]", "dE", 100, 0, 500, 100, 0, 4000, this);
|
||||
layout->addWidget(hdEdT, 0, 3);
|
||||
|
||||
hE = new Histogram1D("raw E (ch=4)", "E [ch]", 300, 0, 5000, this);
|
||||
layout->addWidget(hE, 0, 4);
|
||||
|
||||
hdEtotE = new Histogram2D("dE vs TotE", "TotE[ch]", "dE[ch]", 100, 0, 8000, 100, 0, 4000, this);
|
||||
layout->addWidget(hdEtotE, 1, 0, 1, 2);
|
||||
|
||||
hdT = new Histogram1D("raw dT (ch=7)", "dT [ch]", 300, 0, 1000, this);
|
||||
layout->addWidget(hdT, 1, 2);
|
||||
|
||||
hTotE = new Histogram1D("total energy (dE+E)", "TotE [ch]", 300, 0, 7000, this);
|
||||
layout->addWidget(hTotE, 1, 3);
|
||||
|
||||
hTWin = new Histogram1D("coincidence time window", "TWin [ns]", 300, 0, 500, this);
|
||||
layout->addWidget(hTWin, 1, 4);
|
||||
|
||||
}
|
||||
|
||||
inline void PID::UpdateHistograms(){
|
||||
|
||||
if( this->isVisible() == false ) return;
|
||||
|
||||
BuildEvents(false); // call the event builder to build events
|
||||
|
||||
//============ Get events, and do analysis
|
||||
long eventBuilt = evtbder->eventBuilt;
|
||||
if( eventBuilt == 0 ) return;
|
||||
|
||||
//============ Get the cut list, if any
|
||||
QList<QPolygonF> cutList = hPID->GetCutList();
|
||||
const int nCut = cutList.count();
|
||||
unsigned long long tMin[nCut] = {0xFFFFFFFFFFFFFFFF}, tMax[nCut] = {0};
|
||||
unsigned int count[nCut]={0};
|
||||
|
||||
//============ Processing data and fill histograms
|
||||
long eventIndex = evtbder->eventIndex;
|
||||
long eventStart = eventIndex - eventBuilt + 1;
|
||||
if(eventStart < 0 ) eventStart += MaxNEvent;
|
||||
|
||||
for( long i = eventStart ; i <= eventIndex; i ++ ){
|
||||
std::vector<Hit> event = evtbder->events[i];
|
||||
//printf("-------------- %ld\n", i);
|
||||
|
||||
if( event.size() == 0 ) return;
|
||||
|
||||
for( int k = 0; k < (int) event.size(); k++ ){
|
||||
//event[k].Print();
|
||||
if( event[k].ch == 0 ) {ch1 = event[k].energy; t1 = event[k].timestamp;}
|
||||
if( event[k].ch == 1 ) {ch4 = event[k].energy; t4 = event[k].timestamp;}
|
||||
if( event[k].ch == 2 ) {ch7 = event[k].energy; t7 = event[k].timestamp;}
|
||||
|
||||
}
|
||||
|
||||
// printf("(E, dE) = (%f, %f)\n", E, dE);
|
||||
hPID->Fill(ch4 + RandomGauss(0, 100), ch1 + RandomGauss(0, 100)); // x, y
|
||||
hdE->Fill(ch1);
|
||||
hE->Fill(ch4);
|
||||
hdT->Fill(ch7);
|
||||
hTotE->Fill(ch1+ch4);
|
||||
hdEE->Fill(ch4,ch1);
|
||||
hdEtotE->Fill(ch1+ch4+ RandomGauss(0, 100),ch1+ RandomGauss(0, 100));
|
||||
hdEdT->Fill((t7-t1)*1e9,ch1);
|
||||
hTWin->Fill((t4-t1)*1e9);
|
||||
|
||||
//check events inside any Graphical cut and extract the rate
|
||||
for(int p = 0; p < cutList.count(); p++ ){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
if( cutList[p].containsPoint(QPointF(ch4, ch1), Qt::OddEvenFill) ){
|
||||
if( t1 < tMin[p] ) tMin[p] = t1;
|
||||
if( t1 > tMax[p] ) tMax[p] = t1;
|
||||
count[p] ++;
|
||||
//printf(".... %d \n", count[p]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
hPID->UpdatePlot();
|
||||
hdE->UpdatePlot();
|
||||
hE->UpdatePlot();
|
||||
hdT->UpdatePlot();
|
||||
hTotE->UpdatePlot();
|
||||
hdEE->UpdatePlot();
|
||||
hdEtotE->UpdatePlot();
|
||||
hdEdT->UpdatePlot();
|
||||
hTWin->UpdatePlot();
|
||||
|
||||
//========== output to Influx
|
||||
QList<QString> cutNameList = hPID->GetCutNameList();
|
||||
for( int p = 0; p < cutList.count(); p ++){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
double dT = (tMax[p]-tMin[p]) * tick2ns / 1e9; // tick to sec
|
||||
double rate = count[p]*1.0/(dT);
|
||||
//printf("%llu %llu, %f %d\n", tMin[p], tMax[p], dT, count[p]);
|
||||
//printf("%10s | %d | %f Hz \n", cutNameList[p].toStdString().c_str(), count[p], rate);
|
||||
|
||||
influx->AddDataPoint("Cut,name=" + cutNameList[p].toStdString()+ " value=" + std::to_string(rate));
|
||||
influx->WriteData(dataBaseName);
|
||||
influx->ClearDataPointsBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
271
analyzers/RAISOR1.h
Normal file
271
analyzers/RAISOR1.h
Normal file
|
@ -0,0 +1,271 @@
|
|||
#ifndef RASIOR1_h
|
||||
#define RASIOR1_h
|
||||
|
||||
/*********************************************
|
||||
* This is online analyzer for RASIOR, ANL
|
||||
*
|
||||
* Created by Ryan @ 2023-10-16
|
||||
*
|
||||
* ******************************************/
|
||||
#include "Analyser.h"
|
||||
|
||||
|
||||
class RAISOR1 : public Analyzer{
|
||||
|
||||
public:
|
||||
RAISOR1(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr): Analyzer(digi, nDigi, parent){
|
||||
|
||||
|
||||
SetUpdateTimeInSec(1.0);
|
||||
|
||||
RedefineEventBuilder({0}); // only builder for the 0-th digitizer.
|
||||
tick2ns = digi[0]->GetTick2ns();
|
||||
|
||||
SetBackwardBuild(false, 100); // using normal building (acceding in time) or backward building, int the case of backward building, default events to be build is 100.
|
||||
evtbder = GetEventBuilder();
|
||||
evtbder->SetTimeWindow(500);
|
||||
|
||||
//========== use the influx from the Analyzer
|
||||
influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/");
|
||||
dataBaseName = "testing";
|
||||
|
||||
SetUpCanvas(); // see below
|
||||
|
||||
};
|
||||
|
||||
void SetUpCanvas();
|
||||
|
||||
public slots:
|
||||
void UpdateHistograms();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
MultiBuilder *evtbder;
|
||||
|
||||
Histogram2D * hPID;
|
||||
|
||||
Histogram2D * hXX; // X1 versus X2 : e[1] versus e[0]
|
||||
Histogram2D * hYY; // Y1 versus Y2 : e[3] versus e[2]
|
||||
|
||||
Histogram1D * hXE; // X energy: e[0]+e[1]
|
||||
Histogram1D * hYE; // Y energy: e[2]+e[3]
|
||||
|
||||
Histogram2D * hXYE; // 2D energy plot: e[2]+e[3] versus e[0]+e[1]
|
||||
|
||||
Histogram1D * hX; // X position:((e[0]-e[1])/(e[0]+e[1]))
|
||||
Histogram1D * hY; // Y position:((e[2]-e[3])/(e[2]+e[3]))
|
||||
|
||||
Histogram2D * hXY; // 2D position plot: ((e[2]-e[3])/(e[2]+e[3])) versus ((e[0]-e[1])/(e[0]+e[1]))
|
||||
|
||||
|
||||
Histogram2D * hXPE; // X position versus X energy: ((e[0]-e[1])/(e[0]+e[1])) versus (e[0]+e[1])
|
||||
Histogram2D * hYPE; // Y position versus Y energy: ((e[2]-e[3])/(e[2]+e[3])) versus (e[2]+e[3])
|
||||
|
||||
//TH1F * hX1, * hX2, * hY1, *hY2;
|
||||
|
||||
Histogram2D * hXEdE1; //X energy versus dE signal 1
|
||||
Histogram2D * hYEdE1; //Y energy versus dE signal 1
|
||||
|
||||
Histogram2D * hXEdE2; //X energy versus dE signal 2
|
||||
Histogram2D * hYEdE2; //Y energy versus dE signal 2
|
||||
|
||||
Histogram1D * hX1, * hX2, * hY1, * hY2;
|
||||
|
||||
int chX1, chX2; // yellow, Red
|
||||
int chY1, chY2; // Blue, White
|
||||
|
||||
int tick2ns;
|
||||
|
||||
float dE, E;
|
||||
unsigned long long dE_t, E_t;
|
||||
|
||||
float e0, e1, e2, e3, dE1, dE2;
|
||||
unsigned long long t0, t1, t2, t3, dE1_t, dE2_t;
|
||||
//unsigned Int_t * energy;
|
||||
//unsigned long energy;
|
||||
/*
|
||||
chX1 = 0; // left
|
||||
chX2 = 1; // right
|
||||
|
||||
chY1 = 2; // top
|
||||
chY2 = 3; // bottom
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline void RAISOR1::SetUpCanvas(){
|
||||
|
||||
setGeometry(0, 0, 1500, 2000);
|
||||
|
||||
//============ histograms
|
||||
hPID = new Histogram2D("RAISOR", "E", "dE", 100, 0, 5000, 100, 0, 5000, this);
|
||||
layout->addWidget(hPID, 0, 0);
|
||||
|
||||
hXY = new Histogram2D("2D position plot", "X position", "Y position", 100, -1, 1, 100, -1, 1, this);
|
||||
layout->addWidget(hXY, 0, 1);
|
||||
|
||||
hXX = new Histogram2D("X1 versus X2", "X2", "X1", 100, 0, 5000, 100, 0, 5000, this);
|
||||
layout->addWidget(hXX, 0, 2);
|
||||
|
||||
hYY = new Histogram2D("Y1 versus Y2", "Y2", "Y1", 100, 0, 3000, 100, 0, 3000, this);
|
||||
layout->addWidget(hYY, 0, 3);
|
||||
|
||||
hXE = new Histogram1D("X energy", "Ex", 300, 0, 8000, this);
|
||||
layout->addWidget(hXE, 1, 0);
|
||||
|
||||
hYE = new Histogram1D("Y energy", "Ey", 300, 0, 4000, this);
|
||||
layout->addWidget(hYE, 1, 1);
|
||||
|
||||
hX = new Histogram1D("X position", "X", 300, -1, 1, this);
|
||||
layout->addWidget(hX, 1, 2);
|
||||
|
||||
hY = new Histogram1D("Y position", "Y", 300, -1, 1, this);
|
||||
layout->addWidget(hY, 1, 3);
|
||||
|
||||
hXPE = new Histogram2D("X energy versus X position", "X position", "X energy", 100, -1, 1, 100, -2000, 20000, this);
|
||||
layout->addWidget(hXPE, 0, 4);
|
||||
|
||||
hYPE = new Histogram2D("Y energy versus Y position", "Y position", "Y energy", 100, -1, 1, 100, 0, 5000, this);
|
||||
layout->addWidget(hYPE, 1, 4);
|
||||
|
||||
hXEdE1 = new Histogram2D("X energy versus dE signal 1", "Ex", "dE signal 1", 100, -200, 20000, 100, -200, 10000, this);
|
||||
layout->addWidget(hXEdE1, 2, 0);
|
||||
|
||||
hYEdE1 = new Histogram2D("Y energy versus dE signal 1", "Ey", "dE signal 1", 100, 0, 6000, 100, 0, 6000, this);
|
||||
layout->addWidget(hYEdE1, 2, 1);
|
||||
|
||||
hXEdE2 = new Histogram2D("X energy versus dE signal 2", "Ex", "dE signal 2", 100, -500, 20000, 100, -500, 15000, this);
|
||||
layout->addWidget(hXEdE2, 2, 2);
|
||||
|
||||
hYEdE2 = new Histogram2D("Y energy versus dE signal 2", "Ey", "dE signal 2", 100, -500, 5000, 100, -500, 12000, this);
|
||||
layout->addWidget(hYEdE2, 2, 3);
|
||||
|
||||
hXYE = new Histogram2D("2D energy plot", "Ex", "Ey", 100, 0, 10000, 100, 0, 6000, this);
|
||||
layout->addWidget(hXYE, 2, 4);
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline void RAISOR1::UpdateHistograms(){
|
||||
|
||||
if( this->isVisible() == false ) return;
|
||||
|
||||
BuildEvents(false); // call the event builder to build events
|
||||
|
||||
//============ Get events, and do analysis
|
||||
long eventBuilt = evtbder->eventBuilt;
|
||||
if( eventBuilt == 0 ) return;
|
||||
|
||||
//============ Get the cut list, if any
|
||||
QList<QPolygonF> cutList = hPID->GetCutList();
|
||||
const int nCut = cutList.count();
|
||||
unsigned long long tMin[nCut] = {0xFFFFFFFFFFFFFFFF}, tMax[nCut] = {0};
|
||||
unsigned int count[nCut]={0};
|
||||
|
||||
//============ Processing data and fill histograms
|
||||
long eventIndex = evtbder->eventIndex;
|
||||
long eventStart = eventIndex - eventBuilt + 1;
|
||||
if(eventStart < 0 ) eventStart += MaxNEvent;
|
||||
|
||||
for( long i = eventStart ; i <= eventIndex; i ++ ){
|
||||
std::vector<Hit> event = evtbder->events[i];
|
||||
//printf("-------------- %ld\n", i);
|
||||
|
||||
if( event.size() == 0 ) return;
|
||||
/*
|
||||
int E = energy[chX1] +energy[chX2] ;//+ gRandom->Gaus(0, 500);
|
||||
int dE = energy[chY1] + energy[chY2] ;//+ gRandom->Gaus(0, 500);
|
||||
float X = 0;
|
||||
//float Y = 0;
|
||||
if( energy[chX1] !=0 && energy[chX2] !=0) {
|
||||
X = ((float)energy[chX1] - (float)energy[chX2])/((float)energy[chX1] + (float)energy[chX2]);
|
||||
hXX->Fill(energy[chX1],energy[chX2]);
|
||||
//hXE->Fill(E,X);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if( energy[chY1] !=0 && energy[chY2] !=0 ) {
|
||||
Y = ((float)energy[chY1] - (float)energy[chY2])/((float)energy[chY1] + (float)energy[chY2]);
|
||||
hYY->Fill(energy[chY1],energy[chY2]);
|
||||
hYE->Fill(dE,X);
|
||||
}
|
||||
*/
|
||||
for( int k = 0; k < (int) event.size(); k++ ){
|
||||
//event[k].Print();
|
||||
if( event[k].ch == 8 ) {dE = event[k].energy; dE_t = event[k].timestamp;} // Surface Barrier dE detector
|
||||
if( event[k].ch == 9 ) {E = event[k].energy; E_t = event[k].timestamp;} // Surface Barrier E detector
|
||||
|
||||
if( event[k].ch == 10 ) {e0 = event[k].energy; t0 = event[k].timestamp;} //
|
||||
if( event[k].ch == 11 ) {e1= event[k].energy; t1 = event[k].timestamp;} // The 4 output signals from the
|
||||
if( event[k].ch == 12 ) {e2 = event[k].energy; t2 = event[k].timestamp;} // position sensitive E detector
|
||||
if( event[k].ch == 13 ) {e3= event[k].energy; t3 = event[k].timestamp;} //
|
||||
|
||||
if( event[k].ch == 14 ) {dE1 = event[k].energy; dE1_t = event[k].timestamp;} // The 2 output signals from the
|
||||
if( event[k].ch == 15 ) {dE2= event[k].energy; dE2_t = event[k].timestamp;} // square dE detector
|
||||
}
|
||||
|
||||
// printf("(E, dE) = (%f, %f)\n", E, dE);
|
||||
hPID->Fill(E + RandomGauss(0, 100), dE+ RandomGauss(0, 100)); // x, y
|
||||
hXX->Fill(e1, e0); //
|
||||
hYY->Fill(e3, e2);
|
||||
hXY->Fill(((e0-e1)/(e0+e1)),((e2-e3)/(e2+e3)));
|
||||
hXE->Fill(e0+e1);
|
||||
hYE->Fill(e2+e3);
|
||||
hX->Fill(((e0-e1)/(e0+e1)));
|
||||
hY->Fill(((e2-e3)/(e2+e3)));
|
||||
hXPE->Fill(((e0-e1)/(e0+e1)),(e0+e1));
|
||||
hYPE->Fill(((e2-e3)/(e2+e3)),(e2+e3));
|
||||
hXEdE1->Fill((e0+e1),dE1);
|
||||
hYEdE1->Fill(e2+e3,dE1);
|
||||
hXEdE2->Fill(e0+e1,dE2);
|
||||
hYEdE2->Fill(e2+e3,dE2);
|
||||
hXYE->Fill(e0+e1,e2+e3);
|
||||
|
||||
//check events inside any Graphical cut and extract the rate
|
||||
for(int p = 0; p < cutList.count(); p++ ){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
if( cutList[p].containsPoint(QPointF(E, dE), Qt::OddEvenFill) ){
|
||||
if( dE_t < tMin[p] ) tMin[p] = dE_t;
|
||||
if( dE_t > tMax[p] ) tMax[p] = dE_t;
|
||||
count[p] ++;
|
||||
//printf(".... %d \n", count[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hPID->UpdatePlot();
|
||||
hXY->UpdatePlot();
|
||||
hXX->UpdatePlot();
|
||||
hYY->UpdatePlot();
|
||||
hXE->UpdatePlot();
|
||||
hYE->UpdatePlot();
|
||||
hX->UpdatePlot();
|
||||
hY->UpdatePlot();
|
||||
hXPE->UpdatePlot();
|
||||
hYPE->UpdatePlot();
|
||||
hXEdE1->UpdatePlot();
|
||||
hYEdE1->UpdatePlot();
|
||||
hXEdE2->UpdatePlot();
|
||||
hYEdE2->UpdatePlot();
|
||||
hXYE->UpdatePlot();
|
||||
|
||||
//========== output to Influx
|
||||
QList<QString> cutNameList = hPID->GetCutNameList();
|
||||
for( int p = 0; p < cutList.count(); p ++){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
double dT = (tMax[p]-tMin[p]) * tick2ns / 1e9; // tick to sec
|
||||
double rate = count[p]*1.0/(dT);
|
||||
//printf("%llu %llu, %f %d\n", tMin[p], tMax[p], dT, count[p]);
|
||||
//printf("%10s | %d | %f Hz \n", cutNameList[p].toStdString().c_str(), count[p], rate);
|
||||
|
||||
influx->AddDataPoint("Cut,name=" + cutNameList[p].toStdString()+ " value=" + std::to_string(rate));
|
||||
influx->WriteData(dataBaseName);
|
||||
influx->ClearDataPointsBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
271
analyzers/RAISOR2.h
Normal file
271
analyzers/RAISOR2.h
Normal file
|
@ -0,0 +1,271 @@
|
|||
#ifndef RASIOR2_h
|
||||
#define RASIOR2_h
|
||||
|
||||
/*********************************************
|
||||
* This is online analyzer for RASIOR, ANL
|
||||
*
|
||||
* Created by Ryan @ 2023-10-16
|
||||
*
|
||||
* ******************************************/
|
||||
#include "Analyser.h"
|
||||
|
||||
|
||||
class RAISOR2 : public Analyzer{
|
||||
|
||||
public:
|
||||
RAISOR2(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent = nullptr): Analyzer(digi, nDigi, parent){
|
||||
|
||||
|
||||
SetUpdateTimeInSec(1.0);
|
||||
|
||||
RedefineEventBuilder({0}); // only builder for the 0-th digitizer.
|
||||
tick2ns = digi[0]->GetTick2ns();
|
||||
|
||||
SetBackwardBuild(false, 100); // using normal building (acceding in time) or backward building, int the case of backward building, default events to be build is 100.
|
||||
evtbder = GetEventBuilder();
|
||||
evtbder->SetTimeWindow(500);
|
||||
|
||||
//========== use the influx from the Analyzer
|
||||
influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/");
|
||||
dataBaseName = "testing";
|
||||
|
||||
SetUpCanvas(); // see below
|
||||
|
||||
};
|
||||
|
||||
void SetUpCanvas();
|
||||
|
||||
public slots:
|
||||
void UpdateHistograms();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
MultiBuilder *evtbder;
|
||||
|
||||
Histogram2D * hPID;
|
||||
|
||||
Histogram2D * hXX; // X1 versus X2 : e[1] versus e[0]
|
||||
Histogram2D * hYY; // Y1 versus Y2 : e[3] versus e[2]
|
||||
|
||||
Histogram1D * hXE; // X energy: e[0]+e[1]
|
||||
Histogram1D * hYE; // Y energy: e[2]+e[3]
|
||||
|
||||
Histogram2D * hXYE; // 2D energy plot: e[2]+e[3] versus e[0]+e[1]
|
||||
|
||||
Histogram1D * hX; // X position:((e[0]-e[1])/(e[0]+e[1]))
|
||||
Histogram1D * hY; // Y position:((e[2]-e[3])/(e[2]+e[3]))
|
||||
|
||||
Histogram2D * hXY; // 2D position plot: ((e[2]-e[3])/(e[2]+e[3])) versus ((e[0]-e[1])/(e[0]+e[1]))
|
||||
|
||||
|
||||
Histogram2D * hXPE; // X position versus X energy: ((e[0]-e[1])/(e[0]+e[1])) versus (e[0]+e[1])
|
||||
Histogram2D * hYPE; // Y position versus Y energy: ((e[2]-e[3])/(e[2]+e[3])) versus (e[2]+e[3])
|
||||
|
||||
//TH1F * hX1, * hX2, * hY1, *hY2;
|
||||
|
||||
Histogram2D * hXEdE1; //X energy versus dE signal 1
|
||||
Histogram2D * hYEdE1; //Y energy versus dE signal 1
|
||||
|
||||
Histogram2D * hXEdE2; //X energy versus dE signal 2
|
||||
Histogram2D * hYEdE2; //Y energy versus dE signal 2
|
||||
|
||||
Histogram1D * hX1, * hX2, * hY1, * hY2;
|
||||
|
||||
int chX1, chX2; // yellow, Red
|
||||
int chY1, chY2; // Blue, White
|
||||
|
||||
int tick2ns;
|
||||
|
||||
float dE, E;
|
||||
unsigned long long dE_t, E_t;
|
||||
|
||||
float e0, e1, e2, e3, dE1, dE2;
|
||||
unsigned long long t0, t1, t2, t3, dE1_t, dE2_t;
|
||||
//unsigned Int_t * energy;
|
||||
//unsigned long energy;
|
||||
/*
|
||||
chX1 = 0; // left
|
||||
chX2 = 1; // right
|
||||
|
||||
chY1 = 2; // top
|
||||
chY2 = 3; // bottom
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline void RAISOR2::SetUpCanvas(){
|
||||
|
||||
setGeometry(0, 0, 1500, 2000);
|
||||
|
||||
//============ histograms
|
||||
hPID = new Histogram2D("RAISOR2", "E", "dE", 100, 0, 2000, 100, 0, 2000, this);
|
||||
layout->addWidget(hPID, 0, 0);
|
||||
|
||||
hXY = new Histogram2D("2D position plot", "X position", "Y position", 100, -1, 1, 100, -1, 1, this);
|
||||
layout->addWidget(hXY, 0, 1);
|
||||
|
||||
hXX = new Histogram2D("X1 versus X2", "X2", "X1", 100, 0, 5000, 100, 0, 5000, this);
|
||||
layout->addWidget(hXX, 0, 2);
|
||||
|
||||
hYY = new Histogram2D("Y1 versus Y2", "Y2", "Y1", 100, 0, 3000, 100, 0, 3000, this);
|
||||
layout->addWidget(hYY, 0, 3);
|
||||
|
||||
hXE = new Histogram1D("X energy", "Ex", 300, 0, 8000, this);
|
||||
layout->addWidget(hXE, 1, 0);
|
||||
|
||||
hYE = new Histogram1D("Y energy", "Ey", 300, 0, 4000, this);
|
||||
layout->addWidget(hYE, 1, 1);
|
||||
|
||||
hX = new Histogram1D("X position", "X", 300, -1, 1, this);
|
||||
layout->addWidget(hX, 1, 2);
|
||||
|
||||
hY = new Histogram1D("Y position", "Y", 300, -1, 1, this);
|
||||
layout->addWidget(hY, 1, 3);
|
||||
|
||||
hXPE = new Histogram2D("X energy versus X position", "X position", "X energy", 100, -1, 1, 100, -2000, 20000, this);
|
||||
layout->addWidget(hXPE, 0, 4);
|
||||
|
||||
hYPE = new Histogram2D("Y energy versus Y position", "Y position", "Y energy", 100, -1, 1, 100, 0, 5000, this);
|
||||
layout->addWidget(hYPE, 1, 4);
|
||||
|
||||
hXEdE1 = new Histogram2D("X energy versus dE signal 1", "Ex", "dE signal 1", 100, -200, 20000, 100, -200, 10000, this);
|
||||
layout->addWidget(hXEdE1, 2, 0);
|
||||
|
||||
hYEdE1 = new Histogram2D("Y energy versus dE signal 1", "Ey", "dE signal 1", 100, 0, 6000, 100, 0, 6000, this);
|
||||
layout->addWidget(hYEdE1, 2, 1);
|
||||
|
||||
hXEdE2 = new Histogram2D("X energy versus dE signal 2", "Ex", "dE signal 2", 100, -500, 20000, 100, -500, 15000, this);
|
||||
layout->addWidget(hXEdE2, 2, 2);
|
||||
|
||||
hYEdE2 = new Histogram2D("Y energy versus dE signal 2", "Ey", "dE signal 2", 100, -500, 5000, 100, -500, 12000, this);
|
||||
layout->addWidget(hYEdE2, 2, 3);
|
||||
|
||||
hXYE = new Histogram2D("2D energy plot", "Ex", "Ey", 100, 0, 10000, 100, 0, 6000, this);
|
||||
layout->addWidget(hXYE, 2, 4);
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline void RAISOR2::UpdateHistograms(){
|
||||
|
||||
if( this->isVisible() == false ) return;
|
||||
|
||||
BuildEvents(false); // call the event builder to build events
|
||||
|
||||
//============ Get events, and do analysis
|
||||
long eventBuilt = evtbder->eventBuilt;
|
||||
if( eventBuilt == 0 ) return;
|
||||
|
||||
//============ Get the cut list, if any
|
||||
QList<QPolygonF> cutList = hPID->GetCutList();
|
||||
const int nCut = cutList.count();
|
||||
unsigned long long tMin[nCut] = {0xFFFFFFFFFFFFFFFF}, tMax[nCut] = {0};
|
||||
unsigned int count[nCut]={0};
|
||||
|
||||
//============ Processing data and fill histograms
|
||||
long eventIndex = evtbder->eventIndex;
|
||||
long eventStart = eventIndex - eventBuilt + 1;
|
||||
if(eventStart < 0 ) eventStart += MaxNEvent;
|
||||
|
||||
for( long i = eventStart ; i <= eventIndex; i ++ ){
|
||||
std::vector<Hit> event = evtbder->events[i];
|
||||
//printf("-------------- %ld\n", i);
|
||||
|
||||
if( event.size() == 0 ) return;
|
||||
/*
|
||||
int E = energy[chX1] +energy[chX2] ;//+ gRandom->Gaus(0, 500);
|
||||
int dE = energy[chY1] + energy[chY2] ;//+ gRandom->Gaus(0, 500);
|
||||
float X = 0;
|
||||
//float Y = 0;
|
||||
if( energy[chX1] !=0 && energy[chX2] !=0) {
|
||||
X = ((float)energy[chX1] - (float)energy[chX2])/((float)energy[chX1] + (float)energy[chX2]);
|
||||
hXX->Fill(energy[chX1],energy[chX2]);
|
||||
//hXE->Fill(E,X);
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if( energy[chY1] !=0 && energy[chY2] !=0 ) {
|
||||
Y = ((float)energy[chY1] - (float)energy[chY2])/((float)energy[chY1] + (float)energy[chY2]);
|
||||
hYY->Fill(energy[chY1],energy[chY2]);
|
||||
hYE->Fill(dE,X);
|
||||
}
|
||||
*/
|
||||
for( int k = 0; k < (int) event.size(); k++ ){
|
||||
//event[k].Print();
|
||||
if( event[k].ch == 8 ) {dE = event[k].energy; dE_t = event[k].timestamp;} // Surface Barrier dE detector
|
||||
if( event[k].ch == 9 ) {E = event[k].energy; E_t = event[k].timestamp;} // Surface Barrier E detector
|
||||
|
||||
if( event[k].ch == 10 ) {e0 = event[k].energy; t0 = event[k].timestamp;} //
|
||||
if( event[k].ch == 11 ) {e1= event[k].energy; t1 = event[k].timestamp;} // The 4 output signals from the
|
||||
if( event[k].ch == 12 ) {e2 = event[k].energy; t2 = event[k].timestamp;} // position sensitive E detector
|
||||
if( event[k].ch == 13 ) {e3= event[k].energy; t3 = event[k].timestamp;} //
|
||||
|
||||
if( event[k].ch == 14 ) {dE1 = event[k].energy; dE1_t = event[k].timestamp;} // The 2 output signals from the
|
||||
if( event[k].ch == 15 ) {dE2= event[k].energy; dE2_t = event[k].timestamp;} // square dE detector
|
||||
}
|
||||
|
||||
// printf("(E, dE) = (%f, %f)\n", E, dE);
|
||||
hPID->Fill(E + RandomGauss(0, 100), dE+ RandomGauss(0, 100)); // x, y
|
||||
hXX->Fill(e1, e0); //
|
||||
hYY->Fill(e3, e2);
|
||||
hXY->Fill(((e0-e1)/(e0+e1)),((e2-e3)/(e2+e3)));
|
||||
hXE->Fill(e0+e1);
|
||||
hYE->Fill(e2+e3);
|
||||
hX->Fill(((e0-e1)/(e0+e1)));
|
||||
hY->Fill(((e2-e3)/(e2+e3)));
|
||||
hXPE->Fill(((e0-e1)/(e0+e1)),(e0+e1));
|
||||
hYPE->Fill(((e2-e3)/(e2+e3)),(e2+e3));
|
||||
hXEdE1->Fill((e0+e1),dE1);
|
||||
hYEdE1->Fill(e2+e3,dE1);
|
||||
hXEdE2->Fill(e0+e1,dE2);
|
||||
hYEdE2->Fill(e2+e3,dE2);
|
||||
hXYE->Fill(e0+e1,e2+e3);
|
||||
|
||||
//check events inside any Graphical cut and extract the rate
|
||||
for(int p = 0; p < cutList.count(); p++ ){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
if( cutList[p].containsPoint(QPointF(E, dE), Qt::OddEvenFill) ){
|
||||
if( dE_t < tMin[p] ) tMin[p] = dE_t;
|
||||
if( dE_t > tMax[p] ) tMax[p] = dE_t;
|
||||
count[p] ++;
|
||||
//printf(".... %d \n", count[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hPID->UpdatePlot();
|
||||
hXY->UpdatePlot();
|
||||
hXX->UpdatePlot();
|
||||
hYY->UpdatePlot();
|
||||
hXE->UpdatePlot();
|
||||
hYE->UpdatePlot();
|
||||
hX->UpdatePlot();
|
||||
hY->UpdatePlot();
|
||||
hXPE->UpdatePlot();
|
||||
hYPE->UpdatePlot();
|
||||
hXEdE1->UpdatePlot();
|
||||
hYEdE1->UpdatePlot();
|
||||
hXEdE2->UpdatePlot();
|
||||
hYEdE2->UpdatePlot();
|
||||
hXYE->UpdatePlot();
|
||||
|
||||
//========== output to Influx
|
||||
QList<QString> cutNameList = hPID->GetCutNameList();
|
||||
for( int p = 0; p < cutList.count(); p ++){
|
||||
if( cutList[p].isEmpty() ) continue;
|
||||
double dT = (tMax[p]-tMin[p]) * tick2ns / 1e9; // tick to sec
|
||||
double rate = count[p]*1.0/(dT);
|
||||
//printf("%llu %llu, %f %d\n", tMin[p], tMax[p], dT, count[p]);
|
||||
//printf("%10s | %d | %f Hz \n", cutNameList[p].toStdString().c_str(), count[p], rate);
|
||||
|
||||
influx->AddDataPoint("Cut,name=" + cutNameList[p].toStdString()+ " value=" + std::to_string(rate));
|
||||
influx->WriteData(dataBaseName);
|
||||
influx->ClearDataPointsBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user