Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
MIPReassignmentAlgorithm.java+30-81.8 -> 1.9
taking into account daughters of mulitpletrack

lcsim/src/org/lcsim/contrib/uiowa
MIPReassignmentAlgorithm.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- MIPReassignmentAlgorithm.java	12 Jul 2008 01:22:11 -0000	1.8
+++ MIPReassignmentAlgorithm.java	22 Jul 2008 18:52:02 -0000	1.9
@@ -34,7 +34,7 @@
 import hep.aida.ICloud2D;
 import org.lcsim.event.EventHeader;
 
-    public class MIPReassignmentAlgorithm implements ReassignClustersAlgorithm {
+public class MIPReassignmentAlgorithm implements ReassignClustersAlgorithm {
     protected double m_limit;
     protected LocalHelixExtrapolator m_findCluster;
     protected boolean nomip = false;
@@ -44,7 +44,7 @@
     protected double m_degree = 0;
     protected double m_costheta = 0;
     protected double m_trans = 0;
-
+    
     protected ICloud2D m_histo_radian_distance;
     protected ICloud2D m_histo_degree_distance;
     protected ICloud2D m_histo_costheta_distance;
@@ -58,8 +58,8 @@
 	    m_newMapMIP = MapTrkToMIP;
 	    m_histo_radian_distance = histo1;
 	    m_histo_degree_distance = histo2;
-		m_histo_costheta_distance = histo3;
-		m_histo_trans_longi = histo4;
+	    m_histo_costheta_distance = histo3;
+	    m_histo_trans_longi = histo4;
     }
 
     public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP) {
@@ -70,7 +70,29 @@
 
 	 
     public Double computeFigureOfMerit(Track tr, Cluster clus) {
-
+        //For the case that track is multiple track
+	//Check extrapolation for all the tracks and
+	// take the best score among them.
+        if ( tr.getTracks().size() != 0) {
+	    System.out.println("multiple");
+	    Double bestAmongDaughters = null;
+	    for (Track daughterTrack : tr.getTracks()) {
+		Double daughterFigureOfMerit = this.computeFigureOfMerit(daughterTrack, clus);
+		if (daughterFigureOfMerit == null) {
+		    // No valid score for this daughter
+		    continue;
+		} else if (bestAmongDaughters == null) {
+		    // No previous best score => this is the new best
+		    bestAmongDaughters = daughterFigureOfMerit;
+		} else if (daughterFigureOfMerit < bestAmongDaughters) {
+		    // This is the new best (lowest) score
+		    bestAmongDaughters = daughterFigureOfMerit;
+		}
+	    }
+	    // All done
+	    return bestAmongDaughters;
+	}
+     
 	Hep3Vector tangent = new BasicHep3Vector(); //extrapolated direction
 	Hep3Vector tangentUnit = new BasicHep3Vector(); 
 	Hep3Vector clusterPosition = new BasicHep3Vector(); //cluster position
@@ -130,10 +152,10 @@
 	    System.out.print(" Angle= " + m_angle);
 	    System.out.println(" Distance= " + m_distance);
 	}
-		
+	
 	if (m_angle < m_limit) return new Double(m_angle); // return the angle if it is below cone angle.
-                                                                                                                              
-        return null;
+	
+	return null;
     }
 
 }
CVSspam 0.2.8