lcsim/src/org/lcsim/recon/cluster/structural/likelihood
diff -u -r1.2 -r1.3
--- TrackToTrackDOCA.java 29 Mar 2007 19:12:12 -0000 1.2
+++ TrackToTrackDOCA.java 2 Jan 2008 23:20:39 -0000 1.3
@@ -21,7 +21,7 @@
* four hits (otherwise the direction is not so meaningful).
*
* @author Mat Charles <[log in to unmask]>
- * @version $Id: TrackToTrackDOCA.java,v 1.2 2007/03/29 19:12:12 mcharles Exp $
+ * @version $Id: TrackToTrackDOCA.java,v 1.3 2008/01/02 23:20:39 mcharles Exp $
*/
public class TrackToTrackDOCA implements StructuralLikelihoodQuantity
@@ -48,7 +48,18 @@
Line line2 = MiscUtilities.makeLine(track2);
double[] distancesAlongLinesToPOCAs = Line.getPOCAOfLines(line1, line2);
+
+ // The POCA-finding code breaks down if the lines are parallel. Check for that:
+ boolean linesAreParallel = false;
if (distancesAlongLinesToPOCAs == null) {
+ // They are exactly parallel
+ linesAreParallel = true;
+ } else if (Double.isInfinite(distancesAlongLinesToPOCAs[0]) || Double.isInfinite(distancesAlongLinesToPOCAs[1])) {
+ // Another symptom of parallel lines.
+ linesAreParallel = true;
+ }
+
+ if (linesAreParallel) {
// Lines are parallel!
// Find a point on each line
SpacePoint pointOnLine1 = line1.getPointAtDistance(0.0);