]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDchamberTimeBin.cxx
Corrected loop in method Clear
[u/mrichter/AliRoot.git] / TRD / AliTRDchamberTimeBin.cxx
index c59b66998f2ea388ff61afde89aae260eceb9588..f1cbee91dc386299c6dcc14cc1ce06fa9c9ef9df 100644 (file)
@@ -43,8 +43,6 @@
 #include "AliTRDchamberTimeBin.h"
 #include "AliTRDrecoParam.h"
 #include "AliTRDReconstructor.h"
-#include "AliTRDtrackerV1.h"
-
 
 ClassImp(AliTRDchamberTimeBin)
 
@@ -109,9 +107,9 @@ AliTRDchamberTimeBin &AliTRDchamberTimeBin::operator=(const AliTRDchamberTimeBin
 //_____________________________________________________________________________
 void AliTRDchamberTimeBin::Clear(const Option_t *) 
 { 
-  for(AliTRDcluster **cit = &fClusters[0]; (*cit); cit++){
-    if(IsOwner()) delete (*cit);
-    (*cit) = NULL;
+  for(Int_t it = 0; it<kMaxClustersLayer; it++){
+    if(IsOwner()) delete fClusters[it];
+    fClusters[it] = NULL;
   } 
   fN = 0; 
 }
@@ -248,7 +246,7 @@ void AliTRDchamberTimeBin::BuildIndices(Int_t iter)
   // Select clusters that belong to the Stack
   Int_t nClStack = 0;                                  // Internal counter
   for(Int_t i = 0; i < fN; i++){
-    if(fClusters[i]->IsUsed()){
+    if(fClusters[i]->IsUsed() || fClusters[i]->IsShared()){
       fClusters[i] = 0x0;
       fIndex[i] = 0xffff;
     } else nClStack++;
@@ -320,7 +318,7 @@ void AliTRDchamberTimeBin::BuildIndices(Int_t iter)
     
     // Debug Streaming
     if(fReconstructor->GetStreamLevel(AliTRDReconstructor::kTracker) >= 3){
-      TTreeSRedirector &cstream = *AliTRDtrackerV1::DebugStreamer();
+      TTreeSRedirector &cstream = *fReconstructor->GetDebugStream(AliTRDReconstructor::kTracker);
       cstream << "BuildIndices"
       << "Plane="    << fPlane
       << "Stack="    << fStack
@@ -591,7 +589,10 @@ void AliTRDchamberTimeBin::GetClusters(Double_t *cond, Int_t *index, Int_t& ncl,
   PrintClusters();
   AliInfo(Form("zlo[%f] zhi[%f]", zvals[0], zvals[1]));
   AliInfo(Form("zlo[%d] zhi[%d]", zlo, zhi));*/
-  
+
+  Double_t ylo = cond[0] - cond[2],
+           yhi = cond[0] + cond[2];
+  //printf("CTB : ylo[%f] yhi[%f]\n", ylo, yhi);
   //Preordering in Direction z saves a lot of loops (boundary checked)
   for(UChar_t z = zlo; z <= zhi; z++){
     UInt_t upper = (z < fNRows-1) ? fPositions[z+1] : fN;
@@ -602,8 +603,8 @@ void AliTRDchamberTimeBin::GetClusters(Double_t *cond, Int_t *index, Int_t& ncl,
         return;        //Buffer filled
       }
       
-      if(fClusters[y]->GetY() > (cond[0] + cond[2])) break;                    // Abbortion conditions!!!
-      if(fClusters[y]->GetY() < (cond[0] - cond[2])) continue; // Too small
+      if(fClusters[y]->GetY() > yhi) break;                    // Abbortion conditions!!!
+      if(fClusters[y]->GetY() < ylo) continue; // Too small
       if(((Int_t)((fClusters[y]->GetZ())*1000) < (Int_t)(zvals[0]*1000)) || ((Int_t)((fClusters[y]->GetZ())*1000) > (Int_t)(zvals[1]*1000))){/*printf("exit z\n"); TODO*/ continue;}
       index[ncl] = y;
       ncl++;