]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSegmentationSlat.cxx
Container for calibration data
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlat.cxx
index 65ccb1de7c452aa7db0d2a0fead5a59347dbe054..78570e3a009d9348e13c290e15ecd386eadaf2d0 100644 (file)
 
 /*
 $Log$
+Revision 1.18  2002/02/20 09:14:37  morsch
+Protection against numerical inprecission for hits on slat boundaries.
+
+Revision 1.17  2001/12/01 20:00:45  hristov
+New protections added
+
+Revision 1.16  2001/10/30 08:25:14  jchudoba
+Small correction to prevent crash when hit is at the edge of a slat
+
+Revision 1.15  2001/09/07 08:38:30  hristov
+Pointers initialised to 0 in the default constructors
+
 Revision 1.14  2001/08/30 09:52:12  hristov
 The operator[] is replaced by At() or AddAt() in case of TObjArray.
 
@@ -72,7 +84,7 @@ Segmentation class for chambers built out of slats.
 #include <TBRIK.h>
 #include <TNode.h>
 #include <TGeometry.h>
-#include <iostream.h>
+#include <Riostream.h>
 
 //___________________________________________
 ClassImp(AliMUONSegmentationSlat)
@@ -163,6 +175,8 @@ void AliMUONSegmentationSlat::GlobalToLocal(
     Float_t zlocal;
     Int_t i;
     Int_t index=-1;
+    Float_t eps = 1.e-4;
+    
 // Transform According to slat plane z-position: negative side is shifted down 
 //                                                 positive side is shifted up
 // by half the overlap
@@ -177,17 +191,20 @@ void AliMUONSegmentationSlat::GlobalToLocal(
 // Find slat number                      
     for (i=ifirst; i<fNSlats; i+=2) {
        index=i;
-       if ((y >= fYPosition[i]) && (y < fYPosition[i]+fSlatY)) break;
+       if ((y >= fYPosition[i]-eps) && (y <= fYPosition[i]+fSlatY+eps)) break;
     }
     
 //
 // Transform to local coordinate system
 
     
-    ylocal = y   -fYPosition[index];
-    xlocal = xabs-fXPosition[index];
-    islat  = index;
-    if (i >= fNSlats) {islat = -1; x=-1; y = -1;}
+    if (index >= fNSlats || index < 0 ) {
+      islat = -1; xlocal=-1; ylocal = -1; }
+    else {
+      ylocal = y   -fYPosition[index];
+      xlocal = xabs-fXPosition[index];
+      islat  = index;
+    }
 }
 
 void AliMUONSegmentationSlat::GlobalToLocal(
@@ -370,13 +387,14 @@ FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, Float_t dx, Float_t dy)
 //
 
 
-
     Int_t islat;
     Float_t xlocal, ylocal;
     GlobalToLocal(xhit, yhit, zhit, islat, xlocal, ylocal);
     fSlatIndex=islat;
-    fCurrentSlat=Slat(islat);
-    fCurrentSlat->FirstPad(xlocal, ylocal, dx, dy);
+    if (islat>-1) {
+      fCurrentSlat=Slat(islat);
+      fCurrentSlat->FirstPad(xlocal, ylocal, dx, dy);
+    }
 
 }