fix soem display bugs, fix 2D historgram mergin
This commit is contained in:
parent
6652416901
commit
a34bf75d5f
|
@ -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 GetACQStatus() const {return acqStatus;}
|
uint32_t GetACQStatusFromMemory() const {return acqStatus;}
|
||||||
void ReadAndPrintACQStatue();
|
void ReadAndPrintACQStatue();
|
||||||
void ReadACQStatus() { acqStatus = ReadRegister(DPP::AcquisitionStatus_R); }
|
void ReadACQStatus() { acqStatus = ReadRegister(DPP::AcquisitionStatus_R); }
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,7 @@ 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;
|
||||||
|
|
17
FSUDAQ.cpp
17
FSUDAQ.cpp
|
@ -979,9 +979,7 @@ 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;
|
||||||
|
|
||||||
digiMTX[iDigi].lock();
|
uint32_t acqStatus = digi[iDigi]->GetACQStatusFromMemory();
|
||||||
|
|
||||||
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;");
|
||||||
|
@ -989,6 +987,7 @@ 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();
|
||||||
|
@ -1612,6 +1611,18 @@ 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,6 +27,9 @@ 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);
|
||||||
|
@ -183,6 +186,8 @@ 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();
|
||||||
|
@ -196,6 +201,7 @@ public:
|
||||||
colorMap->setGradient(color);
|
colorMap->setGradient(color);
|
||||||
|
|
||||||
colorMap->rescaleDataRange();
|
colorMap->rescaleDataRange();
|
||||||
|
|
||||||
replot();
|
replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,10 +217,20 @@ 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;
|
||||||
|
|
||||||
|
@ -281,13 +297,19 @@ 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;
|
xBin = xbin + 2;
|
||||||
yBin = ybin;
|
yBin = ybin + 2;
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -422,6 +422,7 @@ 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,6 +108,8 @@ 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();
|
||||||
|
@ -244,6 +246,15 @@ 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");
|
||||||
|
@ -292,9 +303,16 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user