Commit in lcsim/src/org/lcsim/recon/cluster/structural on MAIN
HaloAssigner.java+10-81.2 -> 1.3
MJC: Handle special case where zero skeletons are found

lcsim/src/org/lcsim/recon/cluster/structural
HaloAssigner.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- HaloAssigner.java	21 Jun 2006 00:44:44 -0000	1.2
+++ HaloAssigner.java	11 Oct 2007 00:28:49 -0000	1.3
@@ -17,7 +17,7 @@
  * Assign hits which are not part of a Cluster to a nearby Cluster.
  *
  * @author Mat Charles <[log in to unmask]>
- * @version $Id: HaloAssigner.java,v 1.2 2006/06/21 00:44:44 mcharles Exp $
+ * @version $Id: HaloAssigner.java,v 1.3 2007/10/11 00:28:49 mcharles Exp $
  */
 
 public class HaloAssigner extends Driver
@@ -62,14 +62,16 @@
 	Map<Cluster, List<CalorimeterHit>> foundAssignments = new HashMap<Cluster, List<CalorimeterHit>>();
 	for (CalorimeterHit hit : inputHitMap.values()) {
 	    Cluster bestMatch = findBestCluster(hit, inputSkeletons);
-	    List<CalorimeterHit> matchedHits = foundAssignments.get(bestMatch);
-	    if (matchedHits == null) {
-		matchedHits = new Vector<CalorimeterHit>();
-		foundAssignments.put(bestMatch, matchedHits);
+	    if (bestMatch != null) {
+		List<CalorimeterHit> matchedHits = foundAssignments.get(bestMatch);
+		if (matchedHits == null) {
+		    matchedHits = new Vector<CalorimeterHit>();
+		    foundAssignments.put(bestMatch, matchedHits);
+		}
+		// Assigned => add to matchedHits; remove from output hitmap
+		outputHitMap.remove(hit.getCellID());
+		matchedHits.add(hit);
 	    }
-	    // Assigned => add to matchedHits; remove from output hitmap
-	    outputHitMap.remove(hit.getCellID());
-	    matchedHits.add(hit);
 	}
 
 	// Second pass: create expanded clusters
CVSspam 0.2.8