fBoolIndex = new Bool_t[fMaxLimit];
fSortedIndex = new RowCol[fMaxLimit+1];
+ fCountRC = fMaxLimit+1;
+
ResetArrays();
ResetCounters();
//_____________________________________________________________________________
void AliTRDSignalIndex::ResetArrays()
{
+ if (!IsAllocated())
+ return;
memset(fBoolIndex,0x00,sizeof(Bool_t)*fMaxLimit);
- memset(fSortedIndex,0xFF,sizeof(RowCol)*(fMaxLimit+1));
+ memset(fSortedIndex,0xFF,sizeof(RowCol)*fCountRC);
fSortedWasInit = kFALSE;
}
}
//_____________________________________________________________________________
-Bool_t AliTRDSignalIndex::NextRCIndex(Int_t &row, Int_t &col)
+Bool_t AliTRDSignalIndex::CheckSorting(Int_t &row, Int_t &col)
{
//
- // Returns next used RC combination
+ // Check whether array was read to end or it was not sorted until now
//
- if(fSortedIndex[fPositionRC].rc>-1){
- row = fCurrRow = fSortedIndex[fPositionRC].s.row;
- col = fCurrCol = fSortedIndex[fPositionRC].s.col;
- fPositionRC++;
- return kTRUE;
- }
- else {
- if(fSortedWasInit || fCountRC==1)
- { //we already reached the end of the array
- ResetCounters();
- row = fCurrRow;
- col = fCurrCol;
- return kFALSE;
- }
- else
- { //we have not created the sorted array up to now, let's do so
- InitSortedIndex();
- return NextRCIndex(row, col);
- }
- }
-
+ if(fSortedWasInit || fCountRC==1)
+ { //we already reached the end of the array
+ ResetCounters();
+ row = fCurrRow;
+ col = fCurrCol;
+ return kFALSE;
+ }
+ else
+ { //we have not sorted the array up to now, let's do so
+ InitSortedIndex();
+ return NextRCIndex(row, col);
+ }
}
//_____________________________________________________________________________