Compare commits
No commits in common. "ab54bbbc094e6b4fc4bd0dd2dfe6f83324761f2a" and "6652416901d8217044256b0e129408d6bc56868f" have entirely different histories.
ab54bbbc09
...
6652416901
|
@ -94,7 +94,7 @@ class Digitizer{
|
||||||
int ReadData();
|
int ReadData();
|
||||||
bool IsRunning() const {return AcqRun;}
|
bool IsRunning() const {return AcqRun;}
|
||||||
Data * GetData() const {return data;}
|
Data * GetData() const {return data;}
|
||||||
uint32_t GetACQStatusFromMemory() const {return acqStatus;}
|
uint32_t GetACQStatus() const {return acqStatus;}
|
||||||
void ReadAndPrintACQStatue();
|
void ReadAndPrintACQStatue();
|
||||||
void ReadACQStatus() { acqStatus = ReadRegister(DPP::AcquisitionStatus_R); }
|
void ReadACQStatus() { acqStatus = ReadRegister(DPP::AcquisitionStatus_R); }
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,6 @@ public:
|
||||||
void Stop() { this->stop = true;}
|
void Stop() { this->stop = true;}
|
||||||
void SetWaitTimeinSec(float sec) {waitTime = sec * 10 ;}
|
void SetWaitTimeinSec(float sec) {waitTime = sec * 10 ;}
|
||||||
float GetWaitTimeinSec() const {return waitTime/10.;}
|
float GetWaitTimeinSec() const {return waitTime/10.;}
|
||||||
void DoOnce() {emit timeUp();};
|
|
||||||
void run(){
|
void run(){
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
stop = false;
|
stop = false;
|
||||||
|
|
23
FSUDAQ.cpp
23
FSUDAQ.cpp
|
@ -739,12 +739,6 @@ void MainWindow::CloseDigitizers(){
|
||||||
histThread = nullptr;
|
histThread = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( onlineAnalyzer ){
|
|
||||||
onlineAnalyzer->close();
|
|
||||||
delete onlineAnalyzer;
|
|
||||||
onlineAnalyzer = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( canvas ){
|
if( canvas ){
|
||||||
canvas->close();
|
canvas->close();
|
||||||
|
@ -985,7 +979,9 @@ void MainWindow::UpdateScalar(){
|
||||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
||||||
if( digi[iDigi]->IsBoardDisabled() ) continue;
|
if( digi[iDigi]->IsBoardDisabled() ) continue;
|
||||||
|
|
||||||
uint32_t acqStatus = digi[iDigi]->GetACQStatusFromMemory();
|
digiMTX[iDigi].lock();
|
||||||
|
|
||||||
|
uint32_t acqStatus = digi[iDigi]->GetACQStatus();
|
||||||
//printf("Digi-%d : acq on/off ? : %d \n", digi[iDigi]->GetSerialNumber(), (acqStatus >> 2) & 0x1 );
|
//printf("Digi-%d : acq on/off ? : %d \n", digi[iDigi]->GetSerialNumber(), (acqStatus >> 2) & 0x1 );
|
||||||
if( ( acqStatus >> 2 ) & 0x1 ){
|
if( ( acqStatus >> 2 ) & 0x1 ){
|
||||||
runStatus[iDigi]->setStyleSheet("background-color : green;");
|
runStatus[iDigi]->setStyleSheet("background-color : green;");
|
||||||
|
@ -993,7 +989,6 @@ void MainWindow::UpdateScalar(){
|
||||||
runStatus[iDigi]->setStyleSheet("");
|
runStatus[iDigi]->setStyleSheet("");
|
||||||
}
|
}
|
||||||
|
|
||||||
digiMTX[iDigi].lock();
|
|
||||||
// printf("### %d ", iDigi);
|
// printf("### %d ", iDigi);
|
||||||
// digi[iDigi]->GetData()->PrintAllData(true, 10);
|
// digi[iDigi]->GetData()->PrintAllData(true, 10);
|
||||||
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();
|
if( chkSaveData->isChecked() ) totalFileSize += digi[iDigi]->GetData()->GetTotalFileSize();
|
||||||
|
@ -1617,18 +1612,6 @@ void MainWindow::UpdateAllPanels(int panelID){
|
||||||
|
|
||||||
if( panelID == 1 ){ // from scope
|
if( panelID == 1 ){ // from scope
|
||||||
if( digiSettings && digiSettings->isVisible() ) digiSettings->UpdatePanelFromMemory();
|
if( digiSettings && digiSettings->isVisible() ) digiSettings->UpdatePanelFromMemory();
|
||||||
if( scalar ) {
|
|
||||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
|
||||||
if( digi[iDigi]->IsBoardDisabled() ) continue;
|
|
||||||
|
|
||||||
uint32_t acqStatus = digi[iDigi]->GetACQStatusFromMemory();
|
|
||||||
if( ( acqStatus >> 2 ) & 0x1 ){
|
|
||||||
runStatus[iDigi]->setStyleSheet("background-color : green;");
|
|
||||||
}else{
|
|
||||||
runStatus[iDigi]->setStyleSheet("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( panelID == 2 ){
|
if( panelID == 2 ){
|
||||||
|
|
|
@ -27,9 +27,6 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isChannelMap = false;
|
|
||||||
tickStep = 1; // only used when isChannelMap = true
|
|
||||||
|
|
||||||
axisRect()->setupFullAxesBox(true);
|
axisRect()->setupFullAxesBox(true);
|
||||||
xAxis->setLabel(xLabel);
|
xAxis->setLabel(xLabel);
|
||||||
yAxis->setLabel(yLabel);
|
yAxis->setLabel(yLabel);
|
||||||
|
@ -186,8 +183,6 @@ public:
|
||||||
void SetYTitle(QString yTitle) { yAxis->setLabel(yTitle); }
|
void SetYTitle(QString yTitle) { yAxis->setLabel(yTitle); }
|
||||||
void Rebin(int xbin, double xmin, double xmax, int ybin, double ymin, double ymax);
|
void Rebin(int xbin, double xmin, double xmax, int ybin, double ymin, double ymax);
|
||||||
|
|
||||||
void SetChannelMap(bool onOff, int tickStep = 1) { isChannelMap = onOff; this->tickStep = tickStep;}
|
|
||||||
|
|
||||||
void UpdatePlot(){
|
void UpdatePlot(){
|
||||||
QCPColorGradient color;
|
QCPColorGradient color;
|
||||||
color.clearColorStops();
|
color.clearColorStops();
|
||||||
|
@ -201,7 +196,6 @@ public:
|
||||||
colorMap->setGradient(color);
|
colorMap->setGradient(color);
|
||||||
|
|
||||||
colorMap->rescaleDataRange();
|
colorMap->rescaleDataRange();
|
||||||
|
|
||||||
replot();
|
replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,20 +211,10 @@ public:
|
||||||
QList<QString> GetCutNameList() const { return cutNameList;}
|
QList<QString> GetCutNameList() const { return cutNameList;}
|
||||||
void PrintCutEntry() const;
|
void PrintCutEntry() const;
|
||||||
|
|
||||||
double GetXNBin() const {return xBin;}
|
|
||||||
double GetXMin() const {return xMin;}
|
|
||||||
double GetXMax() const {return xMax;}
|
|
||||||
double GetYNBin() const {return yBin;}
|
|
||||||
double GetYMin() const {return yMin;}
|
|
||||||
double GetYMax() const {return yMax;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double xMin, xMax, yMin, yMax;
|
double xMin, xMax, yMin, yMax;
|
||||||
int xBin, yBin;
|
int xBin, yBin;
|
||||||
|
|
||||||
bool isChannelMap;
|
|
||||||
int tickStep;
|
|
||||||
|
|
||||||
QCPColorMap * colorMap;
|
QCPColorMap * colorMap;
|
||||||
QCPColorScale *colorScale;
|
QCPColorScale *colorScale;
|
||||||
|
|
||||||
|
@ -297,19 +281,13 @@ inline void Histogram2D::Rebin(int xbin, double xmin, double xmax, int ybin, do
|
||||||
xMax = xmax;
|
xMax = xmax;
|
||||||
yMin = ymin;
|
yMin = ymin;
|
||||||
yMax = ymax;
|
yMax = ymax;
|
||||||
xBin = xbin + 2;
|
xBin = xbin;
|
||||||
yBin = ybin + 2;
|
yBin = ybin;
|
||||||
|
|
||||||
colorMap->data()->clear();
|
colorMap->data()->clear();
|
||||||
colorMap->data()->setSize(xBin, yBin);
|
colorMap->data()->setSize(xBin, yBin);
|
||||||
colorMap->data()->setRange(QCPRange(xMin, xMax), QCPRange(yMin, yMax));
|
colorMap->data()->setRange(QCPRange(xMin, xMax), QCPRange(yMin, yMax));
|
||||||
|
|
||||||
if( isChannelMap ){
|
|
||||||
QCPAxis * xAxis = colorMap->keyAxis();
|
|
||||||
xAxis->ticker()->setTickCount(xbin/tickStep);
|
|
||||||
xAxis->ticker()->setTickOrigin(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for( int i = 0; i < 3; i ++){
|
for( int i = 0; i < 3; i ++){
|
||||||
for( int j = 0; j < 3; j ++){
|
for( int j = 0; j < 3; j ++){
|
||||||
entry[i][j] = 0;
|
entry[i][j] = 0;
|
||||||
|
|
|
@ -255,7 +255,7 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
|
||||||
|
|
||||||
void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
|
void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
|
||||||
|
|
||||||
//skip trace, and only build for maxNumEvent events max
|
//skip trace, and only build for 100 events max
|
||||||
|
|
||||||
// remember the end of DataIndex, prevent over build
|
// remember the end of DataIndex, prevent over build
|
||||||
for( int k = 0; k < nData; k++){
|
for( int k = 0; k < nData; k++){
|
||||||
|
|
|
@ -422,7 +422,6 @@ void Scope::StopScope(){
|
||||||
}
|
}
|
||||||
digiMTX[iDigi].lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->StopACQ();
|
digi[iDigi]->StopACQ();
|
||||||
digi[iDigi]->ReadACQStatus();
|
|
||||||
//digi[iDigi]->GetData()->PrintAllData();
|
//digi[iDigi]->GetData()->PrintAllData();
|
||||||
digiMTX[iDigi].unlock();
|
digiMTX[iDigi].unlock();
|
||||||
|
|
||||||
|
|
|
@ -108,8 +108,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hist2D[i] = new Histogram2D("Digi-" + QString::number(digi[i]->GetSerialNumber()), "Channel", "Raw Energy [ch]", digi[i]->GetNumInputCh(), 0, digi[i]->GetNumInputCh(), nBin, eMin, eMax);
|
hist2D[i] = new Histogram2D("Digi-" + QString::number(digi[i]->GetSerialNumber()), "Channel", "Raw Energy [ch]", digi[i]->GetNumInputCh(), 0, digi[i]->GetNumInputCh(), nBin, eMin, eMax);
|
||||||
hist2D[i]->SetChannelMap(true, digi[i]->GetNumInputCh() < 20 ? 1 : 4);
|
|
||||||
hist2D[i]->Rebin(digi[i]->GetNumInputCh(), -0.5, digi[i]->GetNumInputCh()+0.5, nBin, eMin, eMax);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadSetting();
|
LoadSetting();
|
||||||
|
@ -246,15 +244,6 @@ void SingleSpectra::SaveSetting(){
|
||||||
QString d = QString::number(hist[i][ch]->GetXMax()).rightJustified(6, ' ');
|
QString d = QString::number(hist[i][ch]->GetXMax()).rightJustified(6, ' ');
|
||||||
file.write( QString("%1 %2 %3 %4\n").arg(a).arg(b).arg(c).arg(d).toStdString().c_str() );
|
file.write( QString("%1 %2 %3 %4\n").arg(a).arg(b).arg(c).arg(d).toStdString().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString a = QString::number(digi[i]->GetNumInputCh()).rightJustified(2, ' ');
|
|
||||||
QString b = QString::number(hist2D[i]->GetXNBin()).rightJustified(6, ' ');
|
|
||||||
QString c = QString::number(hist2D[i]->GetXMin()).rightJustified(6, ' ');
|
|
||||||
QString d = QString::number(hist2D[i]->GetXMax()).rightJustified(6, ' ');
|
|
||||||
QString e = QString::number(hist2D[i]->GetYNBin()).rightJustified(6, ' ');
|
|
||||||
QString f = QString::number(hist2D[i]->GetYMin()).rightJustified(6, ' ');
|
|
||||||
QString g = QString::number(hist2D[i]->GetYMax()).rightJustified(6, ' ');
|
|
||||||
file.write( QString("%1 %2 %3 %4 %5 %6 %7\n").arg(a).arg(b).arg(c).arg(d).arg(e).arg(f).arg(g).toStdString().c_str() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file.write("//========== End of file\n");
|
file.write("//========== End of file\n");
|
||||||
|
@ -303,14 +292,7 @@ void SingleSpectra::LoadSetting(){
|
||||||
data.push_back(list[i].toInt());
|
data.push_back(list[i].toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
if( 0 <= data[0] && data[0] < digi[digiID]->GetNumInputCh() ){
|
hist[digiID][data[0]]->Rebin(data[1], data[2], data[3]);
|
||||||
hist[digiID][data[0]]->Rebin(data[1], data[2], data[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( data[0] == digi[digiID]->GetNumInputCh() && data.size() == 7 ){
|
|
||||||
hist2D[digiID]->Rebin(data[1], data[2], data[3], data[4], data[5], data[6]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
line = in.readLine();
|
line = in.readLine();
|
||||||
|
|
|
@ -24,15 +24,8 @@ public:
|
||||||
influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/");
|
influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/");
|
||||||
dataBaseName = "testing";
|
dataBaseName = "testing";
|
||||||
|
|
||||||
allowSignalSlot = false;
|
|
||||||
SetUpCanvas();
|
SetUpCanvas();
|
||||||
|
|
||||||
LoadHistRange();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
~CoincidentAnalyzer(){
|
|
||||||
SaveHistRange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUpCanvas();
|
void SetUpCanvas();
|
||||||
|
@ -47,8 +40,6 @@ private:
|
||||||
|
|
||||||
MultiBuilder *evtbder;
|
MultiBuilder *evtbder;
|
||||||
|
|
||||||
bool allowSignalSlot;
|
|
||||||
|
|
||||||
// declaie histograms
|
// declaie histograms
|
||||||
Histogram2D * h2D;
|
Histogram2D * h2D;
|
||||||
Histogram1D * h1;
|
Histogram1D * h1;
|
||||||
|
@ -73,9 +64,6 @@ private:
|
||||||
RComboBox * aDigi;
|
RComboBox * aDigi;
|
||||||
RComboBox * aCh;
|
RComboBox * aCh;
|
||||||
|
|
||||||
void SaveHistRange();
|
|
||||||
void LoadHistRange();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,206 +78,114 @@ inline void CoincidentAnalyzer::SetUpCanvas(){
|
||||||
boxLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
boxLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||||
box->setLayout(boxLayout);
|
box->setLayout(boxLayout);
|
||||||
|
|
||||||
{
|
chkRunAnalyzer = new QCheckBox("Run Analyzer", this);
|
||||||
chkRunAnalyzer = new QCheckBox("Run Analyzer", this);
|
boxLayout->addWidget(chkRunAnalyzer, 0, 0);
|
||||||
boxLayout->addWidget(chkRunAnalyzer, 0, 0);
|
|
||||||
|
|
||||||
QLabel * lbUpdateTime = new QLabel("Update Period [s]", this);
|
QLabel * lbUpdateTime = new QLabel("Update Period [s]", this);
|
||||||
lbUpdateTime->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
lbUpdateTime->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
boxLayout->addWidget(lbUpdateTime, 0, 1);
|
boxLayout->addWidget(lbUpdateTime, 0, 1);
|
||||||
sbUpdateTime = new RSpinBox(this, 1);
|
sbUpdateTime = new RSpinBox(this, 1);
|
||||||
sbUpdateTime->setMinimum(0.1);
|
sbUpdateTime->setMinimum(0.1);
|
||||||
sbUpdateTime->setMaximum(5);
|
sbUpdateTime->setMaximum(5);
|
||||||
sbUpdateTime->setValue(1);
|
sbUpdateTime->setValue(1);
|
||||||
boxLayout->addWidget(sbUpdateTime, 0, 2);
|
boxLayout->addWidget(sbUpdateTime, 0, 2);
|
||||||
|
|
||||||
connect(sbUpdateTime, &RSpinBox::valueChanged, this, [=](double sec){ SetUpdateTimeInSec(sec); });
|
connect(sbUpdateTime, &RSpinBox::valueChanged, this, [=](double sec){ SetUpdateTimeInSec(sec); });
|
||||||
|
|
||||||
chkBackWardBuilding = new QCheckBox("Use Backward builder", this);
|
chkBackWardBuilding = new QCheckBox("Use Backward builder", this);
|
||||||
boxLayout->addWidget(chkBackWardBuilding, 1, 0);
|
boxLayout->addWidget(chkBackWardBuilding, 1, 0);
|
||||||
|
|
||||||
QLabel * lbBKWindow = new QLabel("Max No. Backward Event", this);
|
QLabel * lbBKWindow = new QLabel("No. Backward Event", this);
|
||||||
lbBKWindow->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
lbBKWindow->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
boxLayout->addWidget(lbBKWindow, 1, 1);
|
boxLayout->addWidget(lbBKWindow, 1, 1);
|
||||||
sbBackwardCount = new RSpinBox(this, 0);
|
sbBackwardCount = new RSpinBox(this, 0);
|
||||||
sbBackwardCount->setMinimum(1);
|
sbBackwardCount->setMinimum(1);
|
||||||
sbBackwardCount->setMaximum(9999);
|
sbBackwardCount->setMaximum(9999);
|
||||||
sbBackwardCount->setValue(100);
|
sbBackwardCount->setValue(100);
|
||||||
boxLayout->addWidget(sbBackwardCount, 1, 2);
|
boxLayout->addWidget(sbBackwardCount, 1, 2);
|
||||||
|
|
||||||
chkBackWardBuilding->setChecked(false);
|
chkBackWardBuilding->setChecked(false);
|
||||||
sbBackwardCount->setEnabled(false);
|
sbBackwardCount->setEnabled(false);
|
||||||
|
|
||||||
connect(chkBackWardBuilding, &QCheckBox::stateChanged, this, [=](int status){
|
connect(chkBackWardBuilding, &QCheckBox::stateChanged, this, [=](int status){
|
||||||
SetBackwardBuild(status, sbBackwardCount->value());
|
SetBackwardBuild(status, sbBackwardCount->value());
|
||||||
sbBackwardCount->setEnabled(status);
|
sbBackwardCount->setEnabled(status);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(sbBackwardCount, &RSpinBox::valueChanged, this, [=](double value){
|
connect(sbBackwardCount, &RSpinBox::valueChanged, this, [=](double value){
|
||||||
SetBackwardBuild(true, value);
|
SetBackwardBuild(true, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
QLabel * lbBuildWindow = new QLabel("Event Window [tick]", this);
|
QLabel * lbBuildWindow = new QLabel("Event Window [tick]", this);
|
||||||
lbBuildWindow->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
lbBuildWindow->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
boxLayout->addWidget(lbBuildWindow, 2, 1);
|
boxLayout->addWidget(lbBuildWindow, 2, 1);
|
||||||
sbBuildWindow = new RSpinBox(this, 0);
|
sbBuildWindow = new RSpinBox(this, 0);
|
||||||
sbBuildWindow->setMinimum(1);
|
sbBuildWindow->setMinimum(1);
|
||||||
sbBuildWindow->setMaximum(9999999999);
|
sbBuildWindow->setMaximum(9999999999);
|
||||||
boxLayout->addWidget(sbBuildWindow, 2, 2);
|
boxLayout->addWidget(sbBuildWindow, 2, 2);
|
||||||
|
|
||||||
connect(sbBuildWindow, &RSpinBox::valueChanged, this, [=](double value){
|
connect(sbBuildWindow, &RSpinBox::valueChanged, this, [=](double value){
|
||||||
evtbder->SetTimeWindow((int)value);
|
evtbder->SetTimeWindow((int)value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QFrame *separator = new QFrame(box);
|
||||||
|
separator->setFrameShape(QFrame::HLine);
|
||||||
|
separator->setFrameShadow(QFrame::Sunken);
|
||||||
|
boxLayout->addWidget(separator, 3, 0, 1, 4);
|
||||||
|
|
||||||
|
QLabel * lbXDigi = new QLabel("X-Digi", this);
|
||||||
|
lbXDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
|
boxLayout->addWidget(lbXDigi, 4, 0);
|
||||||
|
xDigi = new RComboBox(this);
|
||||||
|
for(unsigned int i = 0; i < nDigi; i ++ ){
|
||||||
|
xDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
|
||||||
}
|
}
|
||||||
|
boxLayout->addWidget(xDigi, 4, 1);
|
||||||
|
|
||||||
{
|
QLabel * lbXCh = new QLabel("X-Ch", this);
|
||||||
QFrame *separator = new QFrame(box);
|
lbXCh->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
separator->setFrameShape(QFrame::HLine);
|
boxLayout->addWidget(lbXCh, 4, 2);
|
||||||
separator->setFrameShadow(QFrame::Sunken);
|
xCh = new RComboBox(this);
|
||||||
boxLayout->addWidget(separator, 3, 0, 1, 4);
|
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) xCh->addItem("Ch-" + QString::number(i));
|
||||||
|
boxLayout->addWidget(xCh, 4, 3);
|
||||||
QLabel * lbXDigi = new QLabel("X-Digi", this);
|
|
||||||
lbXDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
|
||||||
boxLayout->addWidget(lbXDigi, 4, 0);
|
|
||||||
xDigi = new RComboBox(this);
|
|
||||||
for(unsigned int i = 0; i < nDigi; i ++ ){
|
|
||||||
xDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
|
|
||||||
}
|
|
||||||
boxLayout->addWidget(xDigi, 4, 1);
|
|
||||||
|
|
||||||
QLabel * lbXCh = new QLabel("X-Ch", this);
|
|
||||||
lbXCh->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
|
||||||
boxLayout->addWidget(lbXCh, 4, 2);
|
|
||||||
xCh = new RComboBox(this);
|
|
||||||
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) xCh->addItem("Ch-" + QString::number(i), i);
|
|
||||||
boxLayout->addWidget(xCh, 4, 3);
|
|
||||||
|
|
||||||
QLabel * lbYDigi = new QLabel("Y-Digi", this);
|
|
||||||
lbYDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
|
||||||
boxLayout->addWidget(lbYDigi, 5, 0);
|
|
||||||
yDigi = new RComboBox(this);
|
|
||||||
for(unsigned int i = 0; i < nDigi; i ++ ){
|
|
||||||
yDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
|
|
||||||
}
|
|
||||||
boxLayout->addWidget(yDigi, 5, 1);
|
|
||||||
|
|
||||||
QLabel * lbYCh = new QLabel("Y-Ch", this);
|
|
||||||
lbYCh->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
|
||||||
boxLayout->addWidget(lbYCh, 5, 2);
|
|
||||||
yCh = new RComboBox(this);
|
|
||||||
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) yCh->addItem("Ch-" + QString::number(i), i);
|
|
||||||
boxLayout->addWidget(yCh, 5, 3);
|
|
||||||
|
|
||||||
connect(xDigi, &RComboBox::currentIndexChanged, this, [=](){
|
|
||||||
allowSignalSlot = false;
|
|
||||||
xCh->clear();
|
|
||||||
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) xCh->addItem("Ch-" + QString::number(i), i);
|
|
||||||
allowSignalSlot = true;
|
|
||||||
|
|
||||||
int bd = xDigi->currentData().toInt();
|
|
||||||
int ch = xCh->currentData().toInt();
|
|
||||||
h2D->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h2D->UpdatePlot();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(xCh, &RComboBox::currentIndexChanged, this, [=](){
|
|
||||||
if( !allowSignalSlot) return;
|
|
||||||
int bd = xDigi->currentData().toInt();
|
|
||||||
int ch = xCh->currentData().toInt();
|
|
||||||
h2D->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h2D->UpdatePlot();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(yDigi, &RComboBox::currentIndexChanged, this, [=](){
|
|
||||||
allowSignalSlot = false;
|
|
||||||
yCh->clear();
|
|
||||||
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) yCh->addItem("Ch-" + QString::number(i), i);
|
|
||||||
allowSignalSlot = true;
|
|
||||||
|
|
||||||
int bd = yDigi->currentData().toInt();
|
|
||||||
int ch = yCh->currentData().toInt();
|
|
||||||
h2D->SetYTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h2D->UpdatePlot();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(yCh, &RComboBox::currentIndexChanged, this, [=](){
|
|
||||||
if( !allowSignalSlot) return;
|
|
||||||
int bd = yDigi->currentData().toInt();
|
|
||||||
int ch = yCh->currentData().toInt();
|
|
||||||
h2D->SetYTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h2D->UpdatePlot();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
QLabel * lbYDigi = new QLabel("Y-Digi", this);
|
||||||
|
lbYDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
|
boxLayout->addWidget(lbYDigi, 5, 0);
|
||||||
|
yDigi = new RComboBox(this);
|
||||||
|
for(unsigned int i = 0; i < nDigi; i ++ ){
|
||||||
|
yDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
|
||||||
}
|
}
|
||||||
|
boxLayout->addWidget(yDigi, 5, 1);
|
||||||
|
|
||||||
{
|
QLabel * lbYCh = new QLabel("Y-Ch", this);
|
||||||
QFrame *separator1 = new QFrame(box);
|
lbYCh->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
separator1->setFrameShape(QFrame::HLine);
|
boxLayout->addWidget(lbYCh, 5, 2);
|
||||||
separator1->setFrameShadow(QFrame::Sunken);
|
yCh = new RComboBox(this);
|
||||||
boxLayout->addWidget(separator1, 6, 0, 1, 4);
|
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) yCh->addItem("Ch-" + QString::number(i));
|
||||||
|
boxLayout->addWidget(yCh, 5, 3);
|
||||||
|
|
||||||
QLabel * lbaDigi = new QLabel("ID-Digi", this);
|
QFrame *separator1 = new QFrame(box);
|
||||||
lbaDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
separator1->setFrameShape(QFrame::HLine);
|
||||||
boxLayout->addWidget(lbaDigi, 7, 0);
|
separator1->setFrameShadow(QFrame::Sunken);
|
||||||
aDigi = new RComboBox(this);
|
boxLayout->addWidget(separator1, 6, 0, 1, 4);
|
||||||
for(unsigned int i = 0; i < nDigi; i ++ ){
|
|
||||||
aDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
|
|
||||||
}
|
|
||||||
boxLayout->addWidget(aDigi, 7, 1);
|
|
||||||
|
|
||||||
QLabel * lbaCh = new QLabel("1D-Ch", this);
|
|
||||||
lbaCh->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
|
||||||
boxLayout->addWidget(lbaCh, 7, 2);
|
|
||||||
aCh = new RComboBox(this);
|
|
||||||
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) aCh->addItem("Ch-" + QString::number(i), i);
|
|
||||||
boxLayout->addWidget(aCh, 7, 3);
|
|
||||||
|
|
||||||
connect(aDigi, &RComboBox::currentIndexChanged, this, [=](){
|
|
||||||
allowSignalSlot = false;
|
|
||||||
aCh->clear();
|
|
||||||
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) aCh->addItem("Ch-" + QString::number(i), i);
|
|
||||||
allowSignalSlot = true;
|
|
||||||
|
|
||||||
int bd = aDigi->currentData().toInt();
|
|
||||||
int ch = aCh->currentData().toInt();
|
|
||||||
h1->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h1->UpdatePlot();
|
|
||||||
h1g->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h1g->UpdatePlot();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(aCh, &RComboBox::currentIndexChanged, this, [=](){
|
|
||||||
if( !allowSignalSlot) return;
|
|
||||||
int bd = aDigi->currentData().toInt();
|
|
||||||
int ch = aCh->currentData().toInt();
|
|
||||||
h1->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h1->UpdatePlot();
|
|
||||||
h1g->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h1g->UpdatePlot();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
QLabel * lbaDigi = new QLabel("ID-Digi", this);
|
||||||
|
lbaDigi->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
|
boxLayout->addWidget(lbaDigi, 7, 0);
|
||||||
|
aDigi = new RComboBox(this);
|
||||||
|
for(unsigned int i = 0; i < nDigi; i ++ ){
|
||||||
|
aDigi->addItem("Digi-" + QString::number(digi[i]->GetSerialNumber()), i);
|
||||||
}
|
}
|
||||||
|
boxLayout->addWidget(yDigi, 7, 1);
|
||||||
|
|
||||||
{
|
QLabel * lbaCh = new QLabel("1D-Ch", this);
|
||||||
QFrame *separator1 = new QFrame(box);
|
lbaCh->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
separator1->setFrameShape(QFrame::HLine);
|
boxLayout->addWidget(lbaCh, 7, 2);
|
||||||
separator1->setFrameShadow(QFrame::Sunken);
|
aCh = new RComboBox(this);
|
||||||
boxLayout->addWidget(separator1, 8, 0, 1, 4);
|
for( int i = 0; i < digi[0]->GetNumInputCh(); i++) aCh->addItem("Ch-" + QString::number(i));
|
||||||
|
boxLayout->addWidget(aCh, 7, 3);
|
||||||
QPushButton * bnClearHist = new QPushButton("Clear All Hist.");
|
|
||||||
boxLayout->addWidget(bnClearHist, 9, 1);
|
|
||||||
|
|
||||||
connect(bnClearHist, &QPushButton::clicked, this, [=](){
|
|
||||||
h2D->Clear();
|
|
||||||
h1->Clear();
|
|
||||||
h1g->Clear();
|
|
||||||
hMulti->Clear();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -303,27 +199,12 @@ inline void CoincidentAnalyzer::SetUpCanvas(){
|
||||||
//layout is inheriatge from Analyzer
|
//layout is inheriatge from Analyzer
|
||||||
layout->addWidget(h2D, 1, 0, 2, 1);
|
layout->addWidget(h2D, 1, 0, 2, 1);
|
||||||
|
|
||||||
int bd = xDigi->currentData().toInt();
|
h1 = new Histogram1D("1D Plot", "XXX", 300, 30, 70, this);
|
||||||
int ch = xCh->currentData().toInt();
|
|
||||||
h2D->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
bd = yDigi->currentData().toInt();
|
|
||||||
ch = yCh->currentData().toInt();
|
|
||||||
h2D->SetYTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h2D->UpdatePlot();
|
|
||||||
|
|
||||||
|
|
||||||
h1 = new Histogram1D("1D Plot", "XXX", 300, 0, 5000, this);
|
|
||||||
h1->SetColor(Qt::darkGreen);
|
h1->SetColor(Qt::darkGreen);
|
||||||
h1->AddDataList("Test", Qt::red); // add another histogram in h1, Max Data List is 10
|
h1->AddDataList("Test", Qt::red); // add another histogram in h1, Max Data List is 10
|
||||||
bd = aDigi->currentData().toInt();
|
|
||||||
ch = aCh->currentData().toInt();
|
|
||||||
h1->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h1->UpdatePlot();
|
|
||||||
layout->addWidget(h1, 1, 1);
|
layout->addWidget(h1, 1, 1);
|
||||||
|
|
||||||
h1g = new Histogram1D("1D Plot (PID gated)", "XXX", 300, 0, 5000, this);
|
h1g = new Histogram1D("1D Plot (PID gated)", "XXX", 300, -2, 10, this);
|
||||||
h1g->SetXTitle("Digi-" + QString::number(digi[bd]->GetSerialNumber()) + ", Ch-" + QString::number(ch));
|
|
||||||
h1g->UpdatePlot();
|
|
||||||
layout->addWidget(h1g, 2, 1);
|
layout->addWidget(h1g, 2, 1);
|
||||||
|
|
||||||
layout->setColumnStretch(0, 1);
|
layout->setColumnStretch(0, 1);
|
||||||
|
@ -348,16 +229,6 @@ inline void CoincidentAnalyzer::UpdateHistograms(){
|
||||||
unsigned long long tMin[nCut] = {0xFFFFFFFFFFFFFFFF}, tMax[nCut] = {0};
|
unsigned long long tMin[nCut] = {0xFFFFFFFFFFFFFFFF}, tMax[nCut] = {0};
|
||||||
unsigned int count[nCut]={0};
|
unsigned int count[nCut]={0};
|
||||||
|
|
||||||
//============ Get the channel to plot
|
|
||||||
int a_bd = aDigi->currentData().toInt();
|
|
||||||
int a_ch = aCh->currentData().toInt();
|
|
||||||
|
|
||||||
int x_bd = xDigi->currentData().toInt();
|
|
||||||
int x_ch = xCh->currentData().toInt();
|
|
||||||
|
|
||||||
int y_bd = yDigi->currentData().toInt();
|
|
||||||
int y_ch = yCh->currentData().toInt();
|
|
||||||
|
|
||||||
//============ Processing data and fill histograms
|
//============ Processing data and fill histograms
|
||||||
long eventIndex = evtbder->eventIndex;
|
long eventIndex = evtbder->eventIndex;
|
||||||
long eventStart = eventIndex - eventBuilt + 1;
|
long eventStart = eventIndex - eventBuilt + 1;
|
||||||
|
@ -365,39 +236,27 @@ inline void CoincidentAnalyzer::UpdateHistograms(){
|
||||||
|
|
||||||
for( long i = eventStart ; i <= eventIndex; i ++ ){
|
for( long i = eventStart ; i <= eventIndex; i ++ ){
|
||||||
std::vector<Hit> event = evtbder->events[i];
|
std::vector<Hit> event = evtbder->events[i];
|
||||||
|
//printf("-------------- %ld\n", i);
|
||||||
|
|
||||||
hMulti->Fill((int) event.size());
|
hMulti->Fill((int) event.size());
|
||||||
|
//if( event.size() < 9 ) return;
|
||||||
if( event.size() == 0 ) return;
|
if( event.size() == 0 ) return;
|
||||||
|
|
||||||
int aE = -1;
|
|
||||||
int xE = -1, yE = -1;
|
|
||||||
unsigned long long xT = 0;
|
|
||||||
for( int k = 0; k < (int) event.size(); k++ ){
|
for( int k = 0; k < (int) event.size(); k++ ){
|
||||||
//event[k].Print();
|
//event[k].Print();
|
||||||
if( event[k].bd == a_bd && event[k].ch == a_ch) {
|
|
||||||
h1->Fill(event[k].energy);
|
|
||||||
aE = event[k].energy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( event[k].bd == x_bd && event[k].ch == x_ch) {
|
|
||||||
xE = event[k].energy;
|
|
||||||
xT = event[k].timestamp;
|
|
||||||
}
|
|
||||||
if( event[k].bd == y_bd && event[k].ch == y_ch) yE = event[k].energy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xE >= 0 && yE >= 0 ) h2D->Fill(xE, yE);
|
//check events inside any Graphical cut and extract the rate, using tSR only
|
||||||
|
|
||||||
//check events inside any Graphical cut and extract the rate
|
|
||||||
for(int p = 0; p < cutList.count(); p++ ){
|
for(int p = 0; p < cutList.count(); p++ ){
|
||||||
if( cutList[p].isEmpty() ) continue;
|
if( cutList[p].isEmpty() ) continue;
|
||||||
if( cutList[p].containsPoint(QPointF(xE, yE), Qt::OddEvenFill) && xE >= 0 && yE >= 0 ){
|
// if( cutList[p].containsPoint(QPointF(hit.eSL, hit.eSR), Qt::OddEvenFill) ){
|
||||||
if( xT < tMin[p] ) tMin[p] = xT;
|
// if( hit.tSR < tMin[p] ) tMin[p] = hit.tSR;
|
||||||
if( xT > tMax[p] ) tMax[p] = xT;
|
// if( hit.tSR > tMax[p] ) tMax[p] = hit.tSR;
|
||||||
count[p] ++;
|
// count[p] ++;
|
||||||
//printf(".... %d \n", count[p]);
|
// //printf(".... %d \n", count[p]);
|
||||||
if( p == 0 && aE >= 0 ) h1g->Fill(aE); // only for the 1st gate
|
// if( p == 0 ) h1g->Fill(hit.eSR);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,9 +265,9 @@ inline void CoincidentAnalyzer::UpdateHistograms(){
|
||||||
hMulti->UpdatePlot();
|
hMulti->UpdatePlot();
|
||||||
h1g->UpdatePlot();
|
h1g->UpdatePlot();
|
||||||
|
|
||||||
// QList<QString> cutNameList = h2D->GetCutNameList();
|
QList<QString> cutNameList = h2D->GetCutNameList();
|
||||||
// for( int p = 0; p < cutList.count(); p ++){
|
for( int p = 0; p < cutList.count(); p ++){
|
||||||
// if( cutList[p].isEmpty() ) continue;
|
if( cutList[p].isEmpty() ) continue;
|
||||||
// double dT = (tMax[p]-tMin[p]) * tick2ns / 1e9; // tick to sec
|
// double dT = (tMax[p]-tMin[p]) * tick2ns / 1e9; // tick to sec
|
||||||
// double rate = count[p]*1.0/(dT);
|
// double rate = count[p]*1.0/(dT);
|
||||||
//printf("%llu %llu, %f %d\n", tMin[p], tMax[p], dT, count[p]);
|
//printf("%llu %llu, %f %d\n", tMin[p], tMax[p], dT, count[p]);
|
||||||
|
@ -417,14 +276,7 @@ inline void CoincidentAnalyzer::UpdateHistograms(){
|
||||||
// influx->AddDataPoint("Cut,name=" + cutNameList[p].toStdString()+ " value=" + std::to_string(rate));
|
// influx->AddDataPoint("Cut,name=" + cutNameList[p].toStdString()+ " value=" + std::to_string(rate));
|
||||||
// influx->WriteData(dataBaseName);
|
// influx->WriteData(dataBaseName);
|
||||||
// influx->ClearDataPointsBuffer();
|
// influx->ClearDataPointsBuffer();
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void CoincidentAnalyzer::SaveHistRange(){
|
|
||||||
|
|
||||||
}
|
|
||||||
inline void CoincidentAnalyzer::LoadHistRange(){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user