Print

Print


Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
CheckSkeletonsForMultipleTracks.java+6-21.2 -> 1.3
MJC: Deal with a pathological case with multiple tracks for skeleton

lcsim/src/org/lcsim/contrib/uiowa
CheckSkeletonsForMultipleTracks.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- CheckSkeletonsForMultipleTracks.java	21 Sep 2007 01:01:18 -0000	1.2
+++ CheckSkeletonsForMultipleTracks.java	13 Oct 2007 20:10:04 -0000	1.3
@@ -330,8 +330,12 @@
 	for (Track tr : tracks) {
 	    if (tr == null) { throw new AssertionError("Null track!"); }
 	    Cluster matchedCluster = extrap.matchTrackToCluster(tr, clusters);
-	    if (mapClustersToTracks.get(matchedCluster) == null) { mapClustersToTracks.put(matchedCluster, new Vector<Track>()); }
-	    mapClustersToTracks.get(matchedCluster).add(tr);
+	    // Cluster can be null if track isn't matched to anything.
+	    // This shouldn't happen often, but can.
+	    if (matchedCluster != null) {
+		if (mapClustersToTracks.get(matchedCluster) == null) { mapClustersToTracks.put(matchedCluster, new Vector<Track>()); }
+		mapClustersToTracks.get(matchedCluster).add(tr);
+	    }
 	}
 	for (Cluster clus : mapClustersToTracks.keySet()) {
 	    if (clus == null) { throw new AssertionError("Null cluster!"); }
CVSspam 0.2.8