Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
MIPReassignmentAlgorithm.java+26-221.13 -> 1.14
fix bug in track extrapolation

lcsim/src/org/lcsim/contrib/uiowa
MIPReassignmentAlgorithm.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- MIPReassignmentAlgorithm.java	13 Aug 2008 00:40:38 -0000	1.13
+++ MIPReassignmentAlgorithm.java	15 Aug 2008 18:01:37 -0000	1.14
@@ -52,23 +52,30 @@
     private int m_shape;
 
     private Map<Track, BasicCluster> m_newMapMIP;	
+    private HistReassignment m_Hist = null;
 
-    public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, int shape) {
+    public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, int shape, HistReassignment Hist) {
+            m_limit = limit;
+            m_extrap = findCluster;
+            m_newMapMIP = MapTrkToMIP;
+            m_shape = shape;
+            m_Hist = Hist;
+    }
 
-	    m_limit = limit;
-	    m_extrap = findCluster;
-	    m_newMapMIP = MapTrkToMIP;
-	    m_shape = shape;
+    public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP, int shape) {
+            m_limit = limit;
+            m_extrap = findCluster;
+            m_newMapMIP = MapTrkToMIP;
+            m_shape = shape;
     }
 
     public MIPReassignmentAlgorithm(double limit, LocalHelixExtrapolator findCluster, Map<Track, BasicCluster> MapTrkToMIP) {
-		m_limit = limit;
-		m_extrap = findCluster;
-		m_newMapMIP = MapTrkToMIP;
-                m_shape = 7;
+            m_limit = limit;
+            m_extrap = findCluster;
+            m_newMapMIP = MapTrkToMIP;
+            m_shape = 7;
     }
 
-	 
     public Double computeFigureOfMerit(Track tr, Cluster clus) {
         //For the case that track is multiple track
 	//Check extrapolation for all the tracks and
@@ -92,6 +99,7 @@
 	    return bestAmongDaughters;
 	}
 
+        Hep3Vector interceptPoint = m_extrap.performExtrapolation(tr);
         Hep3Vector last0pos = new BasicHep3Vector();
 	Hep3Vector tangent = new BasicHep3Vector(); //extrapolated direction
         Hep3Vector P = new BasicHep3Vector(tr.getMomentum());
@@ -99,21 +107,15 @@
 	BasicCluster newmip = m_newMapMIP.get(tr);
 	List<Hep3Vector> lastTwoPositions = new ArrayList<Hep3Vector>();
 
-	if(newmip.getCalorimeterHits().size() < 3){ //These is no mip close to track. There should at least two hits.
-            last0pos = m_extrap.performExtrapolation(tr);
+	if(newmip.getCalorimeterHits().size() < 2){ //There should be at least two hits.
+            last0pos = interceptPoint;
 	    if (last0pos != null) {
 		tangent = m_extrap.getTangent(last0pos,tr); //tangent obtained using extrapolated track.
             } else {
 		// Track didn't reach calorimeter
-		if (newmip.getCalorimeterHits().size()>=2) {
-		    // 2+ hits => use last two hits to get position & direction
-		    Hep3Vector last1pos = new BasicHep3Vector(newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-2).getPosition());
-		    last0pos = new BasicHep3Vector(newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-1).getPosition());
-		    tangent = VecOp.sub(last0pos, last1pos);
-		} else if (newmip.getCalorimeterHits().size()==1) {
-		    Hep3Vector last1pos = new BasicHep3Vector(0,0,0);
+		if (newmip.getCalorimeterHits().size()==1) {
 		    last0pos = new BasicHep3Vector(newmip.getCalorimeterHits().get(newmip.getCalorimeterHits().size()-1).getPosition());
-		    tangent = VecOp.sub(last0pos, last1pos);
+		    tangent = m_extrap.getTangent(last0pos, tr);;
 		} else {
 		    // We don't have any information on the track position or intercept at all
 		    return null;
@@ -152,7 +154,9 @@
 	m_degree=m_angle*180/Math.PI;
 	m_trans = displacement.magnitude()*Math.sin(m_angle);
 	m_costheta = VecOp.dot(tangentUnit, displacementUnit);
- 
+
+        if( m_Hist != null) m_Hist.Hist2D(displacement, tangent, tr, clus);
+   
         if ( P.magnitude() < 5 ) m_height = 200;
 	if ( P.magnitude() >= 5 && P.magnitude() < 30 ) m_height = 600;
 	if ( P.magnitude() >= 30) m_height = 1200;
@@ -191,7 +195,7 @@
         case 12://Complex_backward
             if ((m_angle < m_limit && m_longi < m_height && m_trans < 200) || (m_trans < 100 && m_longi > -200 && m_longi < 0)) return new Double(m_angle);
 	}
-	
+
         return null;
     }
 
CVSspam 0.2.8