]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Additional protection
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Aug 2005 08:06:27 +0000 (08:06 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Aug 2005 08:06:27 +0000 (08:06 +0000)
TPC/AliTPCtrackerMI.cxx

index c309267e82c2cd6f0b8f4473aef5906c6f6085b4..f952e99f36136141a4aba887626b47808bf6dfe6 100644 (file)
@@ -6303,10 +6303,16 @@ AliTPCclusterMI * AliTPCtrackerMI::AliTPCRow::FindNearest2(Double_t y, Double_t
   // Return the index of the nearest cluster in z y 
   //-----------------------------------------------------------------------
   Float_t maxdistance = roady*roady + roadz*roadz;
-  Int_t iz1 = TMath::Max(fFastCluster[Int_t(z-roadz+254.5)]-1,0);
-  Int_t iz2 = TMath::Min(fFastCluster[Int_t(z+roadz+255.5)]+1,fN);
-
   AliTPCclusterMI *cl =0;
+
+  //PH Check boundaries. 510 is the size of fFastCluster
+  Int_t iz1 = Int_t(z-roadz+254.5);
+  if (iz1<0 || iz1>=510) return cl;
+  iz1 = TMath::Max(fFastCluster[iz1]-1,0);
+  Int_t iz2 = Int_t(z+roadz+255.5);
+  if (iz2<0 || iz2>=510) return cl;
+  iz2 = TMath::Min(fFastCluster[iz2]+1,fN);
+
   //FindNearest3(y,z,roady,roadz,index);
   //  for (Int_t i=Find(z-roadz); i<fN; i++) {
   for (Int_t i=iz1; i<iz2; i++) {