diff --git a/SingleSpectra.cpp b/SingleSpectra.cpp index 4532ae5..fa62d8d 100644 --- a/SingleSpectra.cpp +++ b/SingleSpectra.cpp @@ -206,15 +206,21 @@ void SingleSpectra::FillHistograms(){ digiMTX[i].lock(); for( int ch = 0; ch < digi[i]->GetNumInputCh(); ch ++ ){ int lastIndex = digi[i]->GetData()->GetDataIndex(ch); + if( lastIndex < 0 ) continue; + int loopIndex = digi[i]->GetData()->GetLoopIndex(ch); int temp1 = lastIndex + loopIndex * digi[i]->GetData()->GetDataSize(); int temp2 = lastFilledIndex[i][ch] + loopFilledIndex[i][ch] * digi[i]->GetData()->GetDataSize(); // printf("%d |%d %d \n", ch, temp2, temp1); - if( lastIndex < 0 ) continue; - if( temp1 <= temp2 ) continue; + + if( temp1 - temp2 > digi[i]->GetData()->GetDataSize() ) { //DefaultDataSize = 10k + temp2 = temp1 - digi[i]->GetData()->GetDataSize(); + lastFilledIndex[i][ch] = lastIndex; + lastFilledIndex[i][ch] = loopIndex - 1; + } for( int j = 0 ; j <= temp1 - temp2; j ++){ lastFilledIndex[i][ch] ++; @@ -223,9 +229,7 @@ void SingleSpectra::FillHistograms(){ loopFilledIndex[i][ch] ++; } hist[i][ch]->Fill( digi[i]->GetData()->GetEnergy(ch, lastFilledIndex[i][ch])); - hist2D[i]->Fill(ch, digi[i]->GetData()->GetEnergy(ch, lastFilledIndex[i][ch])); - } if( histVisibility[i][ch] ) hist[i][ch]->UpdatePlot(); if( hist2DVisibility[i] ) hist2D[i]->UpdatePlot();