Adding protection
authoralibrary <alibrary@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Oct 2005 17:22:50 +0000 (17:22 +0000)
committeralibrary <alibrary@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Oct 2005 17:22:50 +0000 (17:22 +0000)
STEER/AliFieldMap.cxx

index 8b8dc5c..f6fcb1c 100644 (file)
@@ -225,15 +225,15 @@ void AliFieldMap::Field(Float_t *x, Float_t *b) const
     xl[1] = x[1] - fYbeg;
     xl[2] = x[2] - fZbeg;
     
-    hix=xl[0]*fXdeli;
+    hix=TMath::Max(0.,TMath::Min(xl[0]*fXdeli,fXn-1.0001));
     ratx=hix-int(hix);
     ix=int(hix);
     
-    hiy=xl[1]*fYdeli;
+    hiy=TMath::Max(0.,TMath::Min(xl[1]*fYdeli,fYn-1.0001));
     raty=hiy-int(hiy);
     iy=int(hiy);
     
-    hiz=xl[2]*fZdeli;
+    hiz=TMath::Max(0.,TMath::Min(xl[2]*fZdeli,fZn-1.0001));
     ratz=hiz-int(hiz);
     iz=int(hiz);