/*
$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.
#include <TBRIK.h>
#include <TNode.h>
#include <TGeometry.h>
-#include <iostream.h>
+#include <Riostream.h>
//___________________________________________
ClassImp(AliMUONSegmentationSlat)
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
// 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(
//
-
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);
+ }
}