fixed histogram fill zero
This commit is contained in:
parent
03c3e79497
commit
3c8229fbfb
|
@ -204,28 +204,39 @@ void SingleSpectra::FillHistograms(){
|
||||||
// DebugPrint("%s", "SingleSpectra");
|
// DebugPrint("%s", "SingleSpectra");
|
||||||
if( !fillHistograms ) return;
|
if( !fillHistograms ) return;
|
||||||
|
|
||||||
|
printf("=====================%s\n", __func__);
|
||||||
|
|
||||||
timespec t0, t1;
|
timespec t0, t1;
|
||||||
|
|
||||||
QVector<int> randomDigiList = generateNonRepeatedCombination(nDigi);
|
QVector<int> randomDigiList = generateNonRepeatedCombination(nDigi);
|
||||||
|
|
||||||
|
// qDebug() << randomDigiList;
|
||||||
|
|
||||||
for( int i = 0; i < nDigi; i++){
|
for( int i = 0; i < nDigi; i++){
|
||||||
int ID = randomDigiList[i];
|
int ID = randomDigiList[i];
|
||||||
|
|
||||||
QVector<int> randomChList = generateNonRepeatedCombination(digi[ID]->GetNumInputCh());
|
QVector<int> randomChList = generateNonRepeatedCombination(digi[ID]->GetNumInputCh());
|
||||||
|
|
||||||
|
// qDebug() << randomChList;
|
||||||
|
|
||||||
digiMTX[ID].lock();
|
digiMTX[ID].lock();
|
||||||
|
|
||||||
|
// digi[ID]->GetData()->PrintAllData();
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &t0);
|
clock_gettime(CLOCK_REALTIME, &t0);
|
||||||
for( int k = 0; k < digi[ID]->GetNumInputCh(); k ++ ){
|
for( int k = 0; k < digi[ID]->GetNumInputCh(); k ++ ){
|
||||||
int ch = randomChList[k];
|
int ch = randomChList[k];
|
||||||
int lastIndex = digi[ID]->GetData()->GetDataIndex(ch);
|
int lastIndex = digi[ID]->GetData()->GetDataIndex(ch);
|
||||||
|
// printf("--- ch %2d | last index %d \n", ch, lastIndex);
|
||||||
if( lastIndex < 0 ) continue;
|
if( lastIndex < 0 ) continue;
|
||||||
|
|
||||||
int loopIndex = digi[ID]->GetData()->GetLoopIndex(ch);
|
int loopIndex = digi[ID]->GetData()->GetLoopIndex(ch);
|
||||||
|
|
||||||
int temp1 = lastIndex + loopIndex * digi[ID]->GetData()->GetDataSize();
|
int temp1 = lastIndex + loopIndex * digi[ID]->GetData()->GetDataSize();
|
||||||
int temp2 = lastFilledIndex[ID][ch] + loopFilledIndex[ID][ch] * digi[ID]->GetData()->GetDataSize();
|
int temp2 = lastFilledIndex[ID][ch] + loopFilledIndex[ID][ch] * digi[ID]->GetData()->GetDataSize() + 1;
|
||||||
|
|
||||||
|
// printf("loopIndx : %d | ID now : %d, ID old : %d \n", loopIndex, temp1, temp2);
|
||||||
|
|
||||||
// printf("%d |%d %d \n", ch, temp2, temp1);
|
|
||||||
if( temp1 <= temp2 ) continue;
|
if( temp1 <= temp2 ) continue;
|
||||||
|
|
||||||
if( temp1 - temp2 > digi[ID]->GetData()->GetDataSize() ) { //DefaultDataSize = 10k
|
if( temp1 - temp2 > digi[ID]->GetData()->GetDataSize() ) { //DefaultDataSize = 10k
|
||||||
|
@ -234,14 +245,21 @@ void SingleSpectra::FillHistograms(){
|
||||||
lastFilledIndex[ID][ch] = loopIndex - 1;
|
lastFilledIndex[ID][ch] = loopIndex - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// printf("ch %d | regulated ID now %d new %d | last fill idx %d\n", ch, temp2, temp1, lastFilledIndex[ID][ch]);
|
||||||
|
|
||||||
for( int j = 0 ; j <= temp1 - temp2; j ++){
|
for( int j = 0 ; j <= temp1 - temp2; j ++){
|
||||||
lastFilledIndex[ID][ch] ++;
|
lastFilledIndex[ID][ch] ++;
|
||||||
if( lastFilledIndex[ID][ch] > digi[ID]->GetData()->GetDataSize() ) {
|
if( lastFilledIndex[ID][ch] > digi[ID]->GetData()->GetDataSize() ) {
|
||||||
lastFilledIndex[ID][ch] = 0;
|
lastFilledIndex[ID][ch] = 0;
|
||||||
loopFilledIndex[ID][ch] ++;
|
loopFilledIndex[ID][ch] ++;
|
||||||
}
|
}
|
||||||
hist[ID][ch]->Fill( digi[ID]->GetData()->GetEnergy(ch, lastFilledIndex[ID][ch]));
|
|
||||||
hist2D[ID]->Fill(ch, digi[ID]->GetData()->GetEnergy(ch, lastFilledIndex[ID][ch]));
|
uShort data = digi[ID]->GetData()->GetEnergy(ch, lastFilledIndex[ID][ch]);
|
||||||
|
|
||||||
|
// printf(" ch: %d, last fill idx : %d | %d \n", ch, lastFilledIndex[ID][ch], data);
|
||||||
|
|
||||||
|
hist[ID][ch]->Fill( data );
|
||||||
|
hist2D[ID]->Fill(ch, data);
|
||||||
}
|
}
|
||||||
if( histVisibility[ID][ch] ) hist[ID][ch]->UpdatePlot();
|
if( histVisibility[ID][ch] ) hist[ID][ch]->UpdatePlot();
|
||||||
if( hist2DVisibility[ID] ) hist2D[ID]->UpdatePlot();
|
if( hist2DVisibility[ID] ) hist2D[ID]->UpdatePlot();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user