lcsim/src/org/lcsim/contrib/uiowa/structural/likelihood
diff -u -r1.1 -r1.2
--- TrackToTrackPOCAInCalorimeter.java 29 Sep 2005 21:04:50 -0000 1.1
+++ TrackToTrackPOCAInCalorimeter.java 14 Oct 2005 17:43:30 -0000 1.2
@@ -1,6 +1,13 @@
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 TrackToTrackPOCAInCalorimeter implements StructuralLikelihoodQuantity
{
@@ -10,6 +17,34 @@
public double evaluate(Cluster track1, Cluster track2)
{
+ 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);
+
+ // Find the POCA:
+ double[] distancesAlongLinesToPOCAs = Line.getPOCAOfLines(line1, line2);
+ Hep3Vector nearestPointOnLine1 = line1.getPointAtDistance(distancesAlongLinesToPOCAs[0]);
+ Hep3Vector nearestPointOnLine2 = line2.getPointAtDistance(distancesAlongLinesToPOCAs[1]);
+ // Find the mean of these two points -- that's the POCA
+ Hep3Vector poca = VecOp.mult(0.5, VecOp.add(nearestPointOnLine1, nearestPointOnLine2));
+
+ boolean pocaInCalorimeter = isPointInCalorimeter(poca);
+ if (pocaInCalorimeter) {
+ return 1.0;
+ } else {
+ return 0.0;
+ }
+ }
+
+ protected boolean isPointInCalorimeter(Hep3Vector point) {
throw new AssertionError("Not implemented");
}
}