lcsim/src/org/lcsim/contrib/uiowa/structural/likelihood
diff -u -r1.1 -r1.2
--- TrackToTrackSmallestDistanceToPOCA.java 29 Sep 2005 21:04:50 -0000 1.1
+++ TrackToTrackSmallestDistanceToPOCA.java 14 Oct 2005 17:40:25 -0000 1.2
@@ -1,13 +1,34 @@
package structural.likelihood; // package org.lcsim.recon.cluster.structural.likelihood;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+
import org.lcsim.event.Cluster;
+import org.lcsim.recon.cluster.util.TensorClusterPropertyCalculator;
+import org.lcsim.recon.cluster.util.BasicCluster;
+import org.lcsim.util.swim.Line;
public class TrackToTrackSmallestDistanceToPOCA implements StructuralLikelihoodQuantity
{
public TrackToTrackSmallestDistanceToPOCA() {}
- public double evaluate(Cluster track1, Cluster track2)
+ public double evaluate(Cluster track1, Cluster track2) throws QuantityNotDefinedException
{
- throw new AssertionError("Not implemented");
+ if (track1.getCalorimeterHits().size()<4 || track2.getCalorimeterHits().size()<4) {
+ throw new QuantityNotDefinedException("Need 4+ hits in each cluster to get direction, but they have "
+ +track1.getCalorimeterHits().size()
+ +" and "
+ +track2.getCalorimeterHits().size()
+ +" respectively.");
+ }
+
+ // Need to find directions of the two clusters.
+ Line line1 = MiscUtilities.makeLine(track1);
+ Line line2 = MiscUtilities.makeLine(track2);
+
+ double[] distancesAlongLinesToPOCAs = Line.getPOCAOfLines(line1, line2);
+
+ return Math.min(Math.abs(distancesAlongLinesToPOCAs[0]), Math.abs(distancesAlongLinesToPOCAs[1]));
}
}