]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDSignalIndex.cxx
Modifications in AliRoot for re-processing a selected event.
[u/mrichter/AliRoot.git] / TRD / AliTRDSignalIndex.cxx
index b816e4b0579d34906629ec4c19969c2b203650bb..5433f303965bd825f56047857f88ebe5ed80186a 100644 (file)
@@ -183,7 +183,39 @@ AliTRDSignalIndex& AliTRDSignalIndex::operator = (const AliTRDSignalIndex& a)
   // Assignment operator
   //
 
-  if (this != &a) ((AliTRDSignalIndex &) a).Copy(*this);
+  if (this == &a) {
+    return *this;
+  }
+
+  fDet           = a.fDet;
+  fLayer         = a.fLayer;
+  fStack         = a.fStack;
+  fSM            = a.fSM;
+  fMaxLimit      = a.fMaxLimit;
+  fPositionRC    = a.fPositionRC;
+  fCountRC       = a.fCountRC;
+  fSortedWasInit = a.fSortedWasInit;
+  fCurrRow       = a.fCurrRow;
+  fCurrCol       = a.fCurrCol;
+  fCurrTbin      = a.fCurrTbin;
+  fNrows         = a.fNrows;
+  fNcols         = a.fNcols;
+  fNtbins        = a.fNtbins;
+
+  if (fBoolIndex) {
+    delete [] fBoolIndex;
+  }
+  fBoolIndex = new Bool_t[fMaxLimit];
+  memcpy(fBoolIndex, fBoolIndex, fMaxLimit*sizeof(Bool_t));
+
+  if (fSortedIndex) {
+    delete [] fSortedIndex;
+  }
+  fSortedIndex = new RowCol[fMaxLimit+1];
+  memcpy(fSortedIndex, fSortedIndex, (fMaxLimit+1)*sizeof(RowCol));
+
+  ResetCounters();
+
   return *this;
 
 }
@@ -225,6 +257,8 @@ void AliTRDSignalIndex::Allocate(const Int_t nrow, const Int_t ncol, const Int_t
 //_____________________________________________________________________________
 void AliTRDSignalIndex::ResetArrays()
 {
+  if (!IsAllocated())
+    return;
   memset(fBoolIndex,0x00,sizeof(Bool_t)*fMaxLimit);
   memset(fSortedIndex,0xFF,sizeof(RowCol)*fCountRC); 
   fSortedWasInit = kFALSE;
@@ -326,33 +360,24 @@ void AliTRDSignalIndex::ClearAll()
 }
 
 //_____________________________________________________________________________
-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);
+    }
 }
 
 //_____________________________________________________________________________