Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
LocalHelixExtrapolationTrackClusterMatcher.java+16-11.2 -> 1.3
MJC: Add a bunch of optional debug output

lcsim/src/org/lcsim/contrib/uiowa
LocalHelixExtrapolationTrackClusterMatcher.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- LocalHelixExtrapolationTrackClusterMatcher.java	10 May 2007 00:33:33 -0000	1.2
+++ LocalHelixExtrapolationTrackClusterMatcher.java	16 May 2007 17:53:55 -0000	1.3
@@ -61,30 +61,42 @@
       * acceptable match.
       */
     public Cluster matchTrackToCluster(Track tr, List<Cluster> clusters) {
+	if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+" trying to match track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" to a list of "+clusters.size()+" clusters."); }
 	Hep3Vector point = performExtrapolation(tr);
 	if (point != null) {
 	    // Extrapolated to ECAL OK.
+	    if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": extrapolated track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" to r="+(Math.sqrt(point.x()*point.x()+point.y()*point.y()))+", z="+point.z()); }
 	    // Look through clusters, starting with the nearest ones:
 	    List<Cluster> nearestClusters = findNearestClusters(point, clusters);
 	    for (Cluster nearbyCluster : nearestClusters) {
 		double separation = proximity(point, nearbyCluster);
+		if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": comparing track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" to a cluster of "+nearbyCluster.getCalorimeterHits().size()+" hits at a separation of "+separation); }
 		if (separation > m_cutSeparation) {
 		    // This cluster (and therefore all subsequent ones) are too far away to pass
+		    if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": for track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+", remaining clusters are too far away (cut="+m_cutSeparation+") => no match."); }
 		    break;
 		} else {
 		    // Separation OK. Next, check that the cluster has a hit in the first n layers of the ECAL:
 		    CalorimeterHit firstHitInECAL = findInnermostHitInECAL(nearbyCluster);
 		    if (firstHitInECAL != null && getLayer(firstHitInECAL) < m_cutFirstLayer) {
+			if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": comparing track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" to a cluster of "+nearbyCluster.getCalorimeterHits().size()+" hits at a separation of "+separation+": First hit in ECAL is in layer "+getLayer(firstHitInECAL)+" -- OK!"); }
 			// First hit layer OK.
 			if (m_extraCut == null || m_extraCut.valid(tr,nearbyCluster) ) {
 			    // Extra cut not specified or passed
 			    // All cuts passed.
+			    if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": comparing track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" to a cluster of "+nearbyCluster.getCalorimeterHits().size()+" hits at a separation of "+separation+": All cuts passed => accept"); }
 			    return nearbyCluster;
+			} else {
+			    if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": comparing track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" to a cluster of "+nearbyCluster.getCalorimeterHits().size()+" hits at a separation of "+separation+": Failed extra cut ("+m_extraCut.getClass().getName()+")"); }
 			}
+		    } else {
+			if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": comparing track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" to a cluster of "+nearbyCluster.getCalorimeterHits().size()+" hits at a separation of "+separation+": Failed to find hit in ECAL layer < "+m_cutFirstLayer); }
 		    }
 		}
 	    }
-	}	
+	} else {
+	    if (m_debug) { System.out.println("DEBUG: "+this.getClass().getName()+": failed to extrapolate track => no match"); }
+	}
 	// No valid match
 	return null;
     }
@@ -387,5 +399,8 @@
 	}
 	return hitsMatched;
     }
+
+    protected boolean m_debug = false;
+    public void setDebug(boolean debug) { m_debug = debug ; }
 }
 
CVSspam 0.2.8