3 modified files
lcsim/src/org/lcsim/recon/cluster/structural/likelihood
diff -u -r1.1 -r1.2
--- ClumpToClumpDOCA.java 1 Mar 2006 02:45:58 -0000 1.1
+++ ClumpToClumpDOCA.java 26 Apr 2007 17:20:44 -0000 1.2
@@ -5,6 +5,7 @@
import org.lcsim.event.Cluster;
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
public class ClumpToClumpDOCA implements StructuralLikelihoodQuantity
{
@@ -13,17 +14,24 @@
public double evaluate(Cluster clus1, Cluster clus2)
{
// We used to be able to figure out which cluster was
- // pointier from the eigenvaluse, but now we can't (easily).
+ // pointier from the eigenvalues, but now we can't (easily).
// So sad. So now we try it both ways and return the smaller
// of the two DOCAs.
- Hep3Vector position1 = new BasicHep3Vector(clus1.getPosition());
- Hep3Vector position2 = new BasicHep3Vector(clus2.getPosition());
- Trajectory line1 = new Line(position1, clus1.getIPhi(), clus1.getITheta());
- Trajectory line2 = new Line(position2, clus2.getIPhi(), clus2.getITheta());
-
- double doca1 = Math.abs(line1.getDistanceToPoint(position2));
- double doca2 = Math.abs(line2.getDistanceToPoint(position1));
+ Hep3Vector[] posAndDirOfClump1 = MiscUtilities.getPositionAndDirection(clus1);
+ Hep3Vector[] posAndDirOfClump2 = MiscUtilities.getPositionAndDirection(clus2);
+ Line line1 = new Line(posAndDirOfClump1[0], posAndDirOfClump1[1]);
+ Line line2 = new Line(posAndDirOfClump2[0], posAndDirOfClump2[1]);
+ Hep3Vector position1 = posAndDirOfClump1[0];
+ Hep3Vector position2 = posAndDirOfClump2[0];
+
+ // Find the distance s ALONG the line to the POCA
+ double s1 = line1.getDistanceToPoint(position2);
+ double s2 = line2.getDistanceToPoint(position1);
+ Hep3Vector poca1 = line1.getPointAtDistance(s1);
+ Hep3Vector poca2 = line2.getPointAtDistance(s2);
+ double doca1 = VecOp.sub(poca1, position2).magnitude();
+ double doca2 = VecOp.sub(poca2, position1).magnitude();
double doca = Math.min(doca1, doca2);
return doca;
lcsim/src/org/lcsim/recon/cluster/structural/likelihood
diff -u -r1.1 -r1.2
--- TrackToClumpDOCA.java 1 Mar 2006 02:45:58 -0000 1.1
+++ TrackToClumpDOCA.java 26 Apr 2007 17:20:44 -0000 1.2
@@ -5,6 +5,7 @@
import org.lcsim.event.Cluster;
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
public class TrackToClumpDOCA implements StructuralLikelihoodQuantity
{
@@ -12,12 +13,13 @@
public double evaluate(Cluster track, Cluster clump)
{
- Hep3Vector positionTrack = new BasicHep3Vector(track.getPosition());
- Hep3Vector positionClump = new BasicHep3Vector(clump.getPosition());
- Trajectory line = new Line(positionTrack, track.getIPhi(), track.getITheta());
- double doca = Math.abs(line.getDistanceToPoint(positionClump));
+ Line line = MiscUtilities.makeLine(track);
+ Hep3Vector[] posAndDirOfClump = MiscUtilities.getPositionAndDirection(clump);
+ Hep3Vector positionClump = posAndDirOfClump[0];
+ // Find the distance s ALONG the line to the POCA
+ double s = line.getDistanceToPoint(positionClump);
+ Hep3Vector poca = line.getPointAtDistance(s);
+ double doca = VecOp.sub(poca, positionClump).magnitude();
return doca;
}
-
-
}
lcsim/src/org/lcsim/recon/cluster/structural/likelihood
diff -u -r1.2 -r1.3
--- TrackToTrackSmallestDistanceToPOCA.java 29 Mar 2007 19:12:12 -0000 1.2
+++ TrackToTrackSmallestDistanceToPOCA.java 26 Apr 2007 17:20:44 -0000 1.3
@@ -8,6 +8,7 @@
import org.lcsim.recon.cluster.util.TensorClusterPropertyCalculator;
import org.lcsim.recon.cluster.util.BasicCluster;
import org.lcsim.util.swim.Line;
+import org.lcsim.spacegeom.SpacePoint;
/**
* A likelihood quantity used in the structural algorithm.
@@ -23,7 +24,7 @@
* four hits (otherwise the direction is not so meaningful).
*
* @author Mat Charles <[log in to unmask]>
- * @version $Id: TrackToTrackSmallestDistanceToPOCA.java,v 1.2 2007/03/29 19:12:12 mcharles Exp $
+ * @version $Id: TrackToTrackSmallestDistanceToPOCA.java,v 1.3 2007/04/26 17:20:44 mcharles Exp $
*/
public class TrackToTrackSmallestDistanceToPOCA implements StructuralLikelihoodQuantity
@@ -47,7 +48,14 @@
double[] distancesAlongLinesToPOCAs = Line.getPOCAOfLines(line1, line2);
if (distancesAlongLinesToPOCAs != null) {
// Lines not parallel
- return Math.min(Math.abs(distancesAlongLinesToPOCAs[0]), Math.abs(distancesAlongLinesToPOCAs[1]));
+ 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));
+ // Find distance to POCA
+ double distToPoca1 = MiscUtilities.distance(track1, poca);
+ double distToPoca2 = MiscUtilities.distance(track2, poca);
+ return Math.min(Math.abs(distToPoca1), Math.abs(distToPoca2));
} else {
// Lines are parallel -- take shortest hit-hit distance
return (0.5 * MiscUtilities.distance(track1, track2));
CVSspam 0.2.8