added maxFillTimeMilliSec for filling single spectra
This commit is contained in:
parent
66f3ba2f02
commit
6a55ceb884
|
@ -683,7 +683,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
canvas = new SingleSpectra(digi, nDigi, rawDataPath);
|
canvas = new SingleSpectra(digi, nDigi, rawDataPath);
|
||||||
histThread = new TimingThread(this);
|
histThread = new TimingThread(this);
|
||||||
histThread->SetWaitTimeinSec(0.5);
|
histThread->SetWaitTimeinSec(canvas->GetMaxFillTime()/1000.);
|
||||||
connect(histThread, &TimingThread::timeUp, this, [=](){
|
connect(histThread, &TimingThread::timeUp, this, [=](){
|
||||||
if( canvas == nullptr && !canvas->IsFillHistograms()) return;
|
if( canvas == nullptr && !canvas->IsFillHistograms()) return;
|
||||||
canvas->FillHistograms();
|
canvas->FillHistograms();
|
||||||
|
|
|
@ -13,6 +13,8 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
|
||||||
this->nDigi = nDigi;
|
this->nDigi = nDigi;
|
||||||
this->rawDataPath = rawDataPath;
|
this->rawDataPath = rawDataPath;
|
||||||
|
|
||||||
|
maxFillTimeinMilliSec = 500;
|
||||||
|
|
||||||
isSignalSlotActive = true;
|
isSignalSlotActive = true;
|
||||||
|
|
||||||
setWindowTitle("1-D Histograms");
|
setWindowTitle("1-D Histograms");
|
||||||
|
@ -201,9 +203,13 @@ void SingleSpectra::ChangeHistView(){
|
||||||
void SingleSpectra::FillHistograms(){
|
void SingleSpectra::FillHistograms(){
|
||||||
if( !fillHistograms ) return;
|
if( !fillHistograms ) return;
|
||||||
|
|
||||||
|
unsigned short maxFillTimePerDigi = maxFillTimeinMilliSec/nDigi;
|
||||||
|
timespec t0, t1;
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
|
|
||||||
digiMTX[i].lock();
|
digiMTX[i].lock();
|
||||||
|
clock_gettime(CLOCK_REALTIME, &t0);
|
||||||
for( int ch = 0; ch < digi[i]->GetNumInputCh(); ch ++ ){
|
for( int ch = 0; ch < digi[i]->GetNumInputCh(); ch ++ ){
|
||||||
int lastIndex = digi[i]->GetData()->GetDataIndex(ch);
|
int lastIndex = digi[i]->GetData()->GetDataIndex(ch);
|
||||||
if( lastIndex < 0 ) continue;
|
if( lastIndex < 0 ) continue;
|
||||||
|
@ -233,6 +239,9 @@ void SingleSpectra::FillHistograms(){
|
||||||
}
|
}
|
||||||
if( histVisibility[i][ch] ) hist[i][ch]->UpdatePlot();
|
if( histVisibility[i][ch] ) hist[i][ch]->UpdatePlot();
|
||||||
if( hist2DVisibility[i] ) hist2D[i]->UpdatePlot();
|
if( hist2DVisibility[i] ) hist2D[i]->UpdatePlot();
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_REALTIME, &t1);
|
||||||
|
if( t1.tv_nsec - t0.tv_nsec + (t1.tv_sec - t0.tv_sec)*1e9 > maxFillTimePerDigi * 1e6 ) break;
|
||||||
}
|
}
|
||||||
digiMTX[i].unlock();
|
digiMTX[i].unlock();
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@ public:
|
||||||
void LoadSetting();
|
void LoadSetting();
|
||||||
void SaveSetting();
|
void SaveSetting();
|
||||||
|
|
||||||
|
void SetMaxFillTime(unsigned short milliSec) { maxFillTimeinMilliSec = milliSec;}
|
||||||
|
unsigned short GetMaxFillTime() const {return maxFillTimeinMilliSec;};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void FillHistograms();
|
void FillHistograms();
|
||||||
void ChangeHistView();
|
void ChangeHistView();
|
||||||
|
@ -66,6 +69,8 @@ private:
|
||||||
|
|
||||||
QString rawDataPath;
|
QString rawDataPath;
|
||||||
|
|
||||||
|
unsigned short maxFillTimeinMilliSec;
|
||||||
|
|
||||||
bool isSignalSlotActive;
|
bool isSignalSlotActive;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user