Commit in lcsim/src/org/lcsim/contrib/uiowa/structural/likelihood on MAIN
TrackToTrackPOCAInCalorimeter.java+43-31.3 -> 1.4
Now implemented.

lcsim/src/org/lcsim/contrib/uiowa/structural/likelihood
TrackToTrackPOCAInCalorimeter.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- TrackToTrackPOCAInCalorimeter.java	14 Oct 2005 18:05:18 -0000	1.3
+++ TrackToTrackPOCAInCalorimeter.java	18 Oct 2005 17:41:40 -0000	1.4
@@ -8,13 +8,42 @@
 import org.lcsim.recon.cluster.util.TensorClusterPropertyCalculator;
 import org.lcsim.recon.cluster.util.BasicCluster;
 import org.lcsim.util.swim.Line;
+import org.lcsim.event.EventHeader;
 
-public class TrackToTrackPOCAInCalorimeter implements StructuralLikelihoodQuantity
+/**
+  * This quantity indicates whether the point of closest approach (POCA) of two track-like clusters
+  * is within the calorimeter. In the current implementation, the tracks are treated
+  * as straight lines; their position and direction are determined from the energy
+  * tensory of the cluster. 
+  *
+  * The implementation uses geometry information derived from EventHeader. The
+  * method setEventInfo() MUST be called before evaluate() so that the geometry
+  * information can be cached. In general, setEventInfo() SHOULD be called
+  * at the start of every event.
+  */
+
+public class TrackToTrackPOCAInCalorimeter implements StructuralLikelihoodQuantityWithEventInfo
 {
+    /**
+      * Constructor.
+      */
     public TrackToTrackPOCAInCalorimeter() {
-        // Maybe configure geometry here
     }
 
+    /**
+      * Cache the per-event geometry info.
+      */      
+    public void setEventInfo(EventHeader event) {
+	// Pick up geometry info from event
+	m_det = event.getDetector();
+    }
+
+    /**
+      * Find the POCA of two track-like clusters, and determine whether it's in the
+      * calorimeter (returns 1) or outside the calorimeter (returns 0). Currently,
+      * the calorimeter is defined as the set of all cylindrical subdetectors for which isCalorimeter()
+      * is true, but this definition may be updated later.
+      */
     public double evaluate(Cluster track1, Cluster track2) throws QuantityNotDefinedException
     {
         if (track1.getCalorimeterHits().size()<4 || track2.getCalorimeterHits().size()<4) {
@@ -44,7 +73,18 @@
         }
     }
  
+    /**
+      * Determine whether a point is inside the calorimeter or not.
+      */
     protected boolean isPointInCalorimeter(Hep3Vector point) {
-	throw new AssertionError("Not implemented");
+	org.lcsim.geometry.Subdetector subdet = MiscUtilities.findComponent(point, m_det);
+	return (subdet != null && subdet.isCalorimeter());
     }
+
+    /**
+      * Cached per-event geometry information. Transient since
+      * we do not expect to resume from the same event when serialized.
+      */
+    transient private org.lcsim.geometry.Detector m_det = null;
+
 }
CVSspam 0.2.8