Commit in lcsim/src/org/lcsim/recon/cluster/muonfinder on MAIN
MuonFinder3.java+16-131.1 -> 1.2
Fix bug when track has no xtrap positions

lcsim/src/org/lcsim/recon/cluster/muonfinder
MuonFinder3.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- MuonFinder3.java	6 Oct 2010 20:00:22 -0000	1.1
+++ MuonFinder3.java	23 Feb 2011 17:40:06 -0000	1.2
@@ -29,7 +29,7 @@
  * it is required to find good quality mip cluster in muon detector.
  *
  * @author [log in to unmask]
- * @version $Id: MuonFinder3.java,v 1.1 2010/10/06 20:00:22 cassell Exp $
+ * @version $Id: MuonFinder3.java,v 1.2 2011/02/23 17:40:06 cassell Exp $
  */
 
 public class MuonFinder3 {
@@ -161,19 +161,22 @@
                 {
                     if((new BasicHep3Vector(t.getMomentum())).magnitude() > tpcut)
                     {
-                        Hep3Vector tpos = txi.getPositions().get(txi.getPositions().size() -1).getPosition();
-                        Hep3Vector tunit = txi.getPositions().get(txi.getPositions().size() -1).getDirection();
-                        Hep3Vector tmudir = VecOp.sub(fpos,tpos);
-                        Hep3Vector tmuunit = VecOp.unit(tmudir);
-                        // As per TaeJeong, average 3 combinations of 3 directions.
-                        double ct0 = VecOp.dot(tunit, tmuunit);
-                        double ct1 = VecOp.dot(tunit, muunit);
-                        double ct2 = VecOp.dot(tmuunit, muunit);
-                        double cta = (ct0+ct1+ct2)/3.;
-                        if(cta > bestavct)
+                        if(txi.getPositions().size() > 0)
                         {
-                            bestmatch = txi;
-                            bestavct = cta;
+                            Hep3Vector tpos = txi.getPositions().get(txi.getPositions().size() -1).getPosition();
+                            Hep3Vector tunit = txi.getPositions().get(txi.getPositions().size() -1).getDirection();
+                            Hep3Vector tmudir = VecOp.sub(fpos,tpos);
+                            Hep3Vector tmuunit = VecOp.unit(tmudir);
+                            // As per TaeJeong, average 3 combinations of 3 directions.
+                            double ct0 = VecOp.dot(tunit, tmuunit);
+                            double ct1 = VecOp.dot(tunit, muunit);
+                            double ct2 = VecOp.dot(tmuunit, muunit);
+                            double cta = (ct0+ct1+ct2)/3.;
+                            if(cta > bestavct)
+                            {
+                                bestmatch = txi;
+                                bestavct = cta;
+                            }
                         }
                     }
                 }
CVSspam 0.2.8