Commit in lcsim/src/org/lcsim/recon/pfa/identifier on MAIN
SimpleTrackMIPClusterMatcher.java+21-31.1 -> 1.2
Tighten cut code a bit, add some debug info

lcsim/src/org/lcsim/recon/pfa/identifier
SimpleTrackMIPClusterMatcher.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SimpleTrackMIPClusterMatcher.java	10 Aug 2006 22:57:02 -0000	1.1
+++ SimpleTrackMIPClusterMatcher.java	3 Nov 2006 19:02:36 -0000	1.2
@@ -18,13 +18,15 @@
  * on the ECAL inner surface and on the direction of the track at the
  * intercept point.
  *
- * @version $Id: SimpleTrackMIPClusterMatcher.java,v 1.1 2006/08/10 22:57:02 mcharles Exp $ 
+ * @version $Id: SimpleTrackMIPClusterMatcher.java,v 1.2 2006/11/03 19:02:36 mcharles Exp $ 
  */
 
 public class SimpleTrackMIPClusterMatcher extends SimpleTrackClusterMatcher
 {
     protected Cluster findMatchedCluster(Track tr, HelixSwimmer swimmer, double alpha, List<Cluster> mips)     
     {
+	if (m_debug) { System.out.println("DEBUG: SimpleTrackMIPClusterMatched.findMatchedCluster() invoked for a list of "+mips.size()+" clusters."); }
+
 	// Find the track intercept and direction
 	swimmer.setTrack(tr);
 	Hep3Vector trackPoint = swimmer.getPointAtDistance(alpha);
@@ -39,18 +41,34 @@
 	    // Obtain geometrical info:
 	    CalorimeterHit nearestHit = findNearestHit(trackPoint, nearbyMIP);
 	    double separation = proximity(trackPoint, nearestHit);
-	    int firstLayerHit = getLayer(nearestHit);
+	    int layerOfNearestHit = getLayer(nearestHit);
+	    CalorimeterHit firstHitInECAL = findInnermostHitInECAL(nearbyMIP);
 	    double unitDotProduct = findUnitDotProduct(tangent, nearbyMIP);
 	    org.lcsim.geometry.Subdetector subdet = nearestHit.getSubdetector();
 	    // Make cuts:
 	    boolean goodSubDet = (subdet.getName().compareTo("EMBarrel")==0) || (subdet.getName().compareTo("EMEndcap")==0);
-	    boolean goodFirstLayer = (firstLayerHit < 5);
+	    boolean goodFirstLayer = (firstHitInECAL!=null && getLayer(firstHitInECAL) < 5);
 	    boolean goodDotProduct = (Math.abs(unitDotProduct) > 0.85);
 	    boolean goodSeparation = (separation < 50.0);
 	    boolean foundMatch = goodSubDet && goodFirstLayer && goodDotProduct && goodSeparation;
 	    if (foundMatch) {
 		// OK, made a good match
+		if (m_debug) { System.out.println("DEBUG: Matched cluster to MIP since subdet="+subdet.getName()+" and firstlayer="+getLayer(firstHitInECAL)+" and dotProduct="+Math.abs(unitDotProduct)+" and separation="+separation); }
 		return nearbyMIP;
+	    } else {
+		if (m_debug) {
+		    String printme = new String();
+		    printme += "Debug: Didn't match track to MIP cluster since";
+		    printme += " subdet="+subdet.getName()+" ["+goodSubDet+"] and";
+		    if (firstHitInECAL!=null) {
+			printme += " firstlayer="+getLayer(firstHitInECAL)+" ["+goodFirstLayer+"] and";
+		    } else {
+			printme += " firstlayer=null ["+goodFirstLayer+"] and";
+		    }
+		    printme += " dotProduct="+Math.abs(unitDotProduct)+" ["+goodDotProduct+"] and";
+		    printme += " separation="+separation+" ["+goodSeparation+"]";
+		    System.out.println(printme);
+		}
 	    }
 	}
 	// No match
CVSspam 0.2.8