In MakeSegmentsPerStation() - protection against division by zero (Ivana)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Apr 2006 13:07:29 +0000 (13:07 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Apr 2006 13:07:29 +0000 (13:07 +0000)
MUON/AliMUONTrackReconstructor.cxx

index 2b894b5..398bd24 100644 (file)
@@ -856,11 +856,17 @@ void AliMUONTrackReconstructor::MakeSegmentsPerStation(Int_t Station)
       distNonBend = TMath::Abs(hit2Ptr->GetNonBendingCoor() - extNonBendCoor);
       if (last2st) {
        // bending slope
-       bendingSlope = (hit1Ptr->GetBendingCoor() - hit2Ptr->GetBendingCoor()) /
-         (hit1Ptr->GetZ() - hit2Ptr->GetZ());
-       // absolute value of impact parameter
-       impactParam =
-         TMath::Abs(hit1Ptr->GetBendingCoor() - hit1Ptr->GetZ() * bendingSlope);
+       if ( hit1Ptr->GetZ() - hit2Ptr->GetZ() != 0.0 ) {
+         bendingSlope = (hit1Ptr->GetBendingCoor() - hit2Ptr->GetBendingCoor()) /
+           (hit1Ptr->GetZ() - hit2Ptr->GetZ());
+         // absolute value of impact parameter
+         impactParam =
+           TMath::Abs(hit1Ptr->GetBendingCoor() - hit1Ptr->GetZ() * bendingSlope);
+        } 
+        else {
+          AliWarning("hit1Ptr->GetZ() = hit2Ptr->GetZ(): impactParam set to maxImpactParam");
+          impactParam = maxImpactParam;   
+        }   
       }
       // check for distances not too large,
       // and impact parameter not too big if stations downstream of the dipole.