Commit in lcsim/src/org/lcsim/recon/vertexing/zvtop4 on MAIN
ZvUtil.java+8-601.9 -> 1.10
ZvTrack.java+8-71.16 -> 1.17
ZvTop.java+21-121.10 -> 1.11
ZvSwimmer.java+1-11.9 -> 1.10
ZvParameters.java+4-41.4 -> 1.5
ZvFitter.java+2-21.14 -> 1.15
+44-86
6 modified files
various changes due to debugging

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvUtil.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- ZvUtil.java	1 Aug 2005 20:59:51 -0000	1.9
+++ ZvUtil.java	2 Aug 2005 17:55:23 -0000	1.10
@@ -45,16 +45,15 @@
      * @return the location of the maximum
      */
     public static SpacePoint twoTrackMax(ZvTrack iTrack, ZvTrack jTrack) {
-        // until I have a better way :-(
-        return stupidTwoTrackMax(iTrack, jTrack);
+        return parabolaPocaTwoTrackMax(iTrack, jTrack);
     }
     
-    private static SpacePoint stupidTwoTrackMax(ZvTrack iTrack, ZvTrack jTrack) {
+    private static SpacePoint parabolaPocaTwoTrackMax(ZvTrack iTrack, ZvTrack jTrack) {
         SpacePoint maxLocation = new SpacePoint();
         // limit the region where to look to the vertex detector.
         // FIXME look at the real dimensions
-        final double maxRad = 5;
-        final double maxZ = 15;
+        final double maxRad = 50;
+        final double maxZ = 150;
         final int maxStep = 1000;
         double maxOverlap = 0;
         // cut the Track into maxStep steps and calculate the distance
@@ -67,7 +66,7 @@
             SpacePath t = new SpacePath();
             t.setOrigin(thisITrackPoint);
             t.setEndPoint(closestJTrackPoint);
-            for(int iPoint=1; iPoint<=100; ++iPoint) {
+            for(int iPoint=1; iPoint<=50; ++iPoint) {
                 SpacePoint checkPoint = t.getPointAtLength(1/iPoint);
                 double overlap = iTrack.getTubeValue(checkPoint) * jTrack.getTubeValue(checkPoint); 
                 if (overlap > maxOverlap) {
@@ -134,67 +133,16 @@
         }
         return sig2;
     }
-       
-    /**
-     * Calculates the distance of a Track to a SpacePath object
-     * @param t
-     * @param vec
-     * @return the scalar distance between Track t and SpacePath vec
-     * at the POCA
-     */
-    // TODO
-    // check algorithms --  seems weird !
-    public static double distanceTrack2Path(Track t, SpacePath vec) {
-//        Hep3Vector trackPVec = t.getMomentum();
-//        double trackPMag = trackPVec.magnitude();
-//        double trackPMagSquared = trackPMag*trackPMag;
-//        SpacePoint trackPos = t.getReferencePoint();
-//        double transDist;
-//        double longDist;
-//        double angle;
-//        
-//        Hep3Vector vdxt = subtract(trackPos, vec.getOrigin());
-//
-//        if ( trackPMag * vec.rxyz() != 0. ) {
-//            double trackVecDot = dot(trackPVec, vec.getDirection());
-//            double cosA = trackVecDot/(trackPMag * vec.rxyz());
-//            double d = trackVecDot*trackVecDot/trackPMagSquared - vec.rxyz()*vec.rxyz();
-//            
-//            double la = 0.;
-//            double mu = 0.;
-//          
-//            if ( d == 0. ) {
-//            la = 0.; 
-//            mu = dot(vdxt, trackPVec) / trackPMagSquared;
-//            } else {
-//            la = ( dot(vdxt, trackPVec)*trackVecDot / trackPMagSquared
-//                   - dot(vdxt, vec.getDirection()) ) /d ;
-//            mu = ( la*trackVecDot-dot(vdxt, trackPVec) ) / trackPMagSquared;
-//            }
-//            Hep3Vector vxu = add(vec.getOrigin(), multiply(la, vec));
-//            Hep3Vector vxt = add(trackPVec, multiply(mu, trackPVec));
-//
-//            transDist = Math.abs(subtract(vxu,vxt).magnitude());
-//            if ( d == 0 )
-//            longDist = -1000.;
-//            else {
-//            longDist = Math.abs(subtract(vxu, vec.getOrigin()).mag());
-//            longDist *= dot(subtract(vxu, vec.getOrigin()), vec) < 0 ? -1 : 1;
-//            }
-//            angle = Math.acos(cosA);
-//        }
-        return 0;
-    }
-    
+           
     /**
      * calculate p/tangent unit vector
      */
     public static Hep3Vector getUnitTangent(ZvParameters hlxPar)
     {
-        double norm = Math.sqrt(1.+hlxPar.s*hlxPar.s);
+        double norm = Math.sqrt(1.+hlxPar.tanLambda*hlxPar.tanLambda);
         double x = Math.cos(hlxPar.phi)/norm;
         double y = Math.sin(hlxPar.phi)/norm;
-        double z = hlxPar.s/norm;
+        double z = hlxPar.tanLambda/norm;
         return new BasicHep3Vector(x, y, z);
     }
     // conversion constant 

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvTrack.java 1.16 -> 1.17
diff -u -r1.16 -r1.17
--- ZvTrack.java	1 Aug 2005 20:59:51 -0000	1.16
+++ ZvTrack.java	2 Aug 2005 17:55:23 -0000	1.17
@@ -37,8 +37,8 @@
     boolean _refPointIsPCA;
     double[][] _errorMatrix;
     // FIXME arbitrary values for the sigmas
-    static double sigmaT = 0.1;
-    static double sigmaL = 0.5;
+    static double sigmaT = 0.01;
+    static double sigmaL = 0.1;
     boolean fitSuccess;
     Track orgTrack;
 
@@ -395,7 +395,7 @@
         double theta = trackRotationAngle;
         double yPrime = lengthParameter;
         double xPrime = startingPoint.x() + _parameters.kappa * yPrime * yPrime;
-        double zPrime = startingPoint.z() + _parameters.s * yPrime;
+        double zPrime = startingPoint.z() + _parameters.tanLambda * yPrime;
         double x = xPrime * cos(theta) - yPrime * sin(theta);
         double y = yPrime * cos(theta) + xPrime * sin(theta);
         return new CartesianPoint(x, y, zPrime);
@@ -447,8 +447,9 @@
         _parameters.kappa = 1 / pt;
         // FIXME hardcoded order - dangerous
         // ZvTrack.phi == Track.phi0 :-(
+        // FIXME phi == trackRotationAngle ?
         _parameters.phi = t.getTrackParameter(1);
-        _parameters.s = t.getTrackParameter(4);
+        _parameters.tanLambda = t.getTrackParameter(4);
         _parameters.x = t.getReferencePointX();
         _parameters.y = t.getReferencePointY();
         _parameters.z = t.getReferencePointZ();
@@ -471,7 +472,7 @@
         double pt = 1 / _parameters.kappa;
         double px = pt * Math.cos(_parameters.phi);
         double py = pt * Math.sin(_parameters.phi);
-        double pz = pt * _parameters.s;
+        double pz = pt * _parameters.tanLambda;
         _momentum = new BasicHep3Vector(px, py, pz);
 
     }
@@ -508,7 +509,7 @@
         double y1 = point.y();
         double z1 = point.z();
         double kappa = _parameters.kappa;
-        double tanLambda = _parameters.s;
+        double tanLambda = _parameters.tanLambda;
         double theta = trackRotationAngle;
         double x0 = rotateLocation(_referencePoint).x();
         double z0 = _referencePoint.z();
@@ -611,7 +612,7 @@
         double y1 = point.y();
         double z1 = point.z();
         double kappa = _parameters.kappa;
-        double tanLambda = _parameters.s;
+        double tanLambda = _parameters.tanLambda;
         double theta = trackRotationAngle;
         double x0 = rotateLocation(_referencePoint).x();
         double z0 = _referencePoint.z();

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvTop.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- ZvTop.java	1 Aug 2005 18:09:50 -0000	1.10
+++ ZvTop.java	2 Aug 2005 17:55:23 -0000	1.11
@@ -4,6 +4,7 @@
 package org.lcsim.recon.vertexing.zvtop4;
 
 import static org.lcsim.recon.vertexing.zvtop4.VectorArithmetic.add;
+import static org.lcsim.recon.vertexing.zvtop4.VectorArithmetic.dot;
 import static org.lcsim.recon.vertexing.zvtop4.VectorArithmetic.multiply;
 import static org.lcsim.recon.vertexing.zvtop4.VectorArithmetic.subtract;
 import static org.lcsim.recon.vertexing.zvtop4.VectorArithmetic.unit;
@@ -47,29 +48,34 @@
     private double ipWeight = 1;
     // Special weight for the angle of the spatial point (argument of overlap) 
     // wrt. the jet axis
-    private double angularWeight = 0;
+    private double angularWeight = 10;
     private double resolvedCut = 0;
     private double chiSquareCut = 0;
-    
+    private double _maxDistFromIP = 25;
     //  Number of points to check along the line from point 1 to point 2
     int iterationMax = 3000;
     
     private double sigmaT;
     private double sigmaL;
     
-    void setIpWeight(double w) {
+    
+    public void setMaxDistFromIP(double d) {
+        _maxDistFromIP = d;
+    }
+    
+    public void setIpWeight(double w) {
         ipWeight = w;
     }
     
-    void setAngularWeight(double w) {
+    public void setAngularWeight(double w) {
         angularWeight = w;
     }
     
-    void setResolvedCut(double c) {
+    public void setResolvedCut(double c) {
         resolvedCut = c;
     }
     
-    void setChiSquareCut(double c) {
+    public void setChiSquareCut(double c) {
         chiSquareCut = c;
     }
     
@@ -124,8 +130,8 @@
      */
     public ZvTop(Hep3Vector jetAxisValue, ZvFitter f) {
         // FIXME Using arbitrary values for the measurement errors
-        sigmaT = 0.1;
-        sigmaL = 0.5;
+        sigmaT = 0.01;
+        sigmaL = 0.1;
         _jetAxis = jetAxisValue;
         maximumMatrix = new ZvMaximumMatrix(new MaxComp());
         isResolvedFromMap = new HashMap<ZvMaximum, Set<ZvMaximum>>();
@@ -185,11 +191,14 @@
         vec2Location.setOrigin(new CartesianPoint(origin[0], origin[1], origin[2]));
         double angle = angle(_jetAxis, vec2Location);
         double angularFactor = Math.exp(-angularWeight*angle*angle);
-        double ipFactor = ipWeight * trackList.get(0).getTubeValue(location);
-        
+        if (dot(unit(_jetAxis), vec2Location) > _maxDistFromIP) {
+            return 0;
+        }
+        // FIXME dealing with IP 
+        double ipFactor = 0; //ipWeight * trackList.get(0).getTubeValue(location);
         denominator += ipFactor;
-        numerator += ipFactor * trackList.get(0).getTubeValue(location);
-        for (int i=1; i<trackList.size(); ++i) {
+        numerator += 0; //ipFactor * trackList.get(0).getTubeValue(location);
+        for (int i=0; i<trackList.size(); ++i) {
             ZvTrack iTrack = trackList.get(i);
             double iTubeVal = iTrack.getTubeValue(location);
             numerator += iTubeVal*iTubeVal;

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvSwimmer.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- ZvSwimmer.java	18 Jul 2005 02:34:12 -0000	1.9
+++ ZvSwimmer.java	2 Aug 2005 17:55:23 -0000	1.10
@@ -167,7 +167,7 @@
             hlxPar.phi += 2. * Math.PI; // phi
         double cosL = Math.sqrt(1. - tangentUnit.z() * tangentUnit.z());
         hlxPar.kappa = 1. / (pTot * cosL); // kappa
-        hlxPar.s = tangentUnit.z() / cosL; // tan(lambda)
+        hlxPar.tanLambda = tangentUnit.z() / cosL; // tan(lambda)
         hlxPar.x  = vCurPos.x(); // x
         hlxPar.y = vCurPos.y(); // y
         hlxPar.z = vCurPos.z(); // z

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvParameters.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ZvParameters.java	22 Jun 2005 05:25:21 -0000	1.4
+++ ZvParameters.java	2 Aug 2005 17:55:23 -0000	1.5
@@ -9,7 +9,7 @@
 class ZvParameters {
     public double phi;
     public double kappa;
-    public double s;
+    public double tanLambda;
     public double x;
     public double y;
     public double z;
@@ -18,7 +18,7 @@
     ZvParameters() {
         phi = 0;
         kappa = 0;
-        s = 0;
+        tanLambda = 0;
         x = 0;
         y = 0;
         z = 0;
@@ -31,7 +31,7 @@
     ZvParameters(ZvParameters parms) {
         phi = parms.phi;
         kappa = parms.kappa;
-        s = parms.s;
+        tanLambda = parms.tanLambda;
         x = parms.x;
         y = parms.y;
         z = parms.z;
@@ -40,7 +40,7 @@
         switch (zvName) {
         case phi: return phi;
         case kappa: return kappa;
-        case s: return s;
+        case s: return tanLambda;
         case x: return x;
         case y: return y;
         case z: return z;

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvFitter.java 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- ZvFitter.java	26 Jul 2005 05:57:52 -0000	1.14
+++ ZvFitter.java	2 Aug 2005 17:55:23 -0000	1.15
@@ -26,7 +26,7 @@
  * Fitter class based on a least squares method
  * 
  * @author W.Walkowiak, 09/18/00
- * @version $Id: ZvFitter.java,v 1.14 2005/07/26 05:57:52 jstrube Exp $
+ * @version $Id: ZvFitter.java,v 1.15 2005/08/02 17:55:23 jstrube Exp $
  */
 
 /* TODO static members only
@@ -239,7 +239,7 @@
             trackParameters[i] = new ZvParameters(track.zvParameters());
             trackParameters[i].phi = 0.;
             trackParameters[i].kappa = 0.;
-            trackParameters[i].s = 0.;
+            trackParameters[i].tanLambda = 0.;
             
             tDee[i] = track.referencePoint();
                 
CVSspam 0.2.8