Print

Print


Commit in lcsim/src/org/lcsim on MAIN
util/swim/Helix.java+2-21.21 -> 1.22
         /HelixSwimmer.java+4-41.15 -> 1.16
contrib/JanStrube/vtxFitter/VertexTrackTest.java+11-91.2 -> 1.3
                           /VertexTrack.java+26-101.2 -> 1.3
mc/fast/tracking/DocaTrackParameters.java+2-21.5 -> 1.6
+45-27
5 modified files
fixing a blatant mistake in the calculation of phi in DocaTrackParamters.
Remains to be understood why getReferencePoint does not in fact return the internal representation double[] _ref.

With this fix and the fact that getReferencePoint does not return the reference point (which is in fact (0, 0, 0) ) the Track Parameterization can be shown to be consistent with the BaBar Track Parameterization.

lcsim/src/org/lcsim/util/swim
Helix.java 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- Helix.java	4 Jul 2006 01:41:47 -0000	1.21
+++ Helix.java	8 Jul 2006 10:21:54 -0000	1.22
@@ -21,7 +21,7 @@
  * For more info on swimming see <a href="doc-files/transport.pdf">this paper</a>
  * by Paul Avery.
  * @author tonyj
- * @version $Id: Helix.java,v 1.21 2006/07/04 01:41:47 jstrube Exp $
+ * @version $Id: Helix.java,v 1.22 2006/07/08 10:21:54 jstrube Exp $
  */
 public class Helix implements Trajectory
 {
@@ -33,7 +33,7 @@
     * @param radius The <em>signed</em> radius of curvature of the helix.
     *               The conventions is such that for <em>positive</em> radii,
     *               the direction is <em>clockwise</em>.
-    * @param phi The azimuthal angle of the helix <em>momentum</em> in x-y plane w/rt positive x-axis at the origin
+    * @param phi The polar angle of the helix <em>momentum</em> in x-y plane w/rt positive x-axis at the origin
     * @param lambda The dip angle w/rt positive part of the x-y plane
     */
    public Helix(Hep3Vector origin, double radius, double phi, double lambda)

lcsim/src/org/lcsim/util/swim
HelixSwimmer.java 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- HelixSwimmer.java	4 Jul 2006 01:41:47 -0000	1.15
+++ HelixSwimmer.java	8 Jul 2006 10:21:54 -0000	1.16
@@ -14,7 +14,7 @@
  * For more info on swimming see <a href="doc-files/transport.pdf">this paper</a>
  * by Paul Avery.
  * @author tonyj
- * @version $Id: HelixSwimmer.java,v 1.15 2006/07/04 01:41:47 jstrube Exp $
+ * @version $Id: HelixSwimmer.java,v 1.16 2006/07/08 10:21:54 jstrube Exp $
  */
 public class HelixSwimmer
 {
@@ -70,13 +70,13 @@
    {
       double omega = t.getTrackParameter(2);
       double z0 = t.getTrackParameter(3);
-      double phi = t.getTrackParameter(1);
+      double phi0 = t.getTrackParameter(1);
       double lambda = Math.atan(t.getTrackParameter(4));
       double d0 = t.getTrackParameter(0);
       double[] ref = t.getReferencePoint();
       // origin of the circle that is the x-y projection of the helix
-      Hep3Vector origin = new BasicHep3Vector( ref[0] -d0 * Math.sin(phi), ref[1] + d0 * Math.cos(phi), ref[2] + z0);
-      trajectory = new Helix(origin,1/omega,phi,lambda);
+      Hep3Vector origin = new BasicHep3Vector( ref[0] -d0 * Math.sin(phi0), ref[1] + d0 * Math.cos(phi0), ref[2] + z0);
+      trajectory = new Helix(origin,1/omega,phi0,lambda);
       spatialParms.isInvalid = true;
       track=t;
    }

lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
VertexTrackTest.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- VertexTrackTest.java	4 Jul 2006 06:59:01 -0000	1.2
+++ VertexTrackTest.java	8 Jul 2006 10:21:55 -0000	1.3
@@ -21,9 +21,9 @@
 		super.setUp();
 		helix = new HelixSwimmer(5);
 		tf = new MCFastTrackFactory();
-		SpacePoint momentum = new CartesianPoint(1, 1, 1);
-		SpacePoint location = new CartesianPoint(0, 0, 0);
-		int charge = -1;
+		SpacePoint momentum = new CartesianPoint(0.1, 0.01, 0.2);
+		SpacePoint location = new CartesianPoint(1, 2, 3);
+		int charge = 1;
 		Track t = tf.getMCTrack(momentum, location, charge);
 		helix.setTrack(t);
 		vtxTrack = new VertexTrack(t);
@@ -35,18 +35,20 @@
 	}
 
 	public void testGetPointAtLength() {
-		Hep3Vector p1 = helix.getPointAtDistance(0.5);
-		double[] p2 = vtxTrack.getPointAtLength(0.5);
-//		assertEquals(p1.x(), p2[0], 1e-10);
-//		assertEquals(p1.y(), p2[1], 1e-10);
+		Hep3Vector p1 = helix.getPointAtDistance(0);
+		double[] p2 = vtxTrack.getPointAtLength(0);
+        System.out.println(p1);
+        System.out.printf("%f\t%f\t%f", p2[0], p2[1], p2[2]);
+		assertEquals(p1.x(), p2[0], 1e-10);
+		assertEquals(p1.y(), p2[1], 1e-10);
 		assertEquals(p1.z(), p2[2], 1e-10);
 	}
 
 	public void testGetMomentumAtLength() {
 		SpatialParameters mom1 = helix.getSpatialParameters();
 		double[] mom2 = vtxTrack.getMomentumAtLength(0);
-//		assertEquals(mom1.px, mom2[0], 1e-10);
-//		assertEquals(mom1.py, mom2[1], 1e-10);
+		assertEquals(mom1.px, mom2[0], 1e-10);
+		assertEquals(mom1.py, mom2[1], 1e-10);
 		assertEquals(mom1.pz, mom2[2], 1e-10);
 	}
 }

lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
VertexTrack.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- VertexTrack.java	4 Jul 2006 06:59:02 -0000	1.2
+++ VertexTrack.java	8 Jul 2006 10:21:55 -0000	1.3
@@ -1,5 +1,5 @@
 /**
- * @version $Id: VertexTrack.java,v 1.2 2006/07/04 06:59:02 jstrube Exp $
+ * @version $Id: VertexTrack.java,v 1.3 2006/07/08 10:21:55 jstrube Exp $
  */
 package org.lcsim.contrib.JanStrube.vtxFitter;
 
@@ -7,8 +7,13 @@
 import static java.lang.Math.cos;
 import static java.lang.Math.sin;
 import static java.lang.Math.sqrt;
+import static java.lang.Math.sqrt;
+import static java.lang.Math.atan;
 import static org.lcsim.constants.Constants.fieldConversion;
 
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
 import java.util.List;
 
 import org.lcsim.event.Track;
@@ -32,20 +37,31 @@
 		_track = t;
 	}
 
-	public double[] getPointAtLength(double s) {
+	public double[] getPointAtLength(double alpha) {
 		double phi0 = _track.getTrackParameter(Track.ParameterName.phi0.ordinal());
 		double omega = _track.getTrackParameter(Track.ParameterName.omega.ordinal());
 		double r = 1/omega;
-		double d0 = _track.getTrackParameter(Track.ParameterName.d0.ordinal());
+        double d0 = _track.getTrackParameter(Track.ParameterName.d0.ordinal());
 		double z0 = _track.getTrackParameter(Track.ParameterName.z0.ordinal());
 		double tanLambda = _track.getTrackParameter(Track.ParameterName.s.ordinal());
-		double phi = phi0 + omega*s;
-		
-		return new double[] {
-				r*sin(phi) - (r+d0)*sin(phi0)
-				, -r*cos(phi) + (r+d0)*cos(phi0)
-				, z0 + s*tanLambda
-		};
+		double lambda = atan(tanLambda);
+        double phi = omega*alpha*cos(lambda) - phi0;
+        double[] ref = _track.getReferencePoint();
+        Hep3Vector origin = new BasicHep3Vector( ref[0] -d0 * Math.sin(phi0), ref[1] + d0 * Math.cos(phi0), ref[2] + z0);
+        double xCenter = origin.x() + r*sin(phi0);
+        double yCenter = origin.y() - r*cos(phi0);
+        double darg = alpha*cos(lambda)/r - phi0;
+        double x = xCenter + r*sin( darg );
+        double y = yCenter + r*cos( darg );
+        double z = origin.z() + alpha*sin(lambda);     
+        System.out.printf("%f\t%f\t%f\n", cos(lambda), r, d0);
+        System.out.printf("%f\t%f\t%f\n", ref[0], ref[1], ref[2]);
+        return new double[] {x, y, z}; 
+//        return new double[] {
+//				r*sin(phi) - (-r+d0)*sin(phi0)
+//				, r*cos(phi) + (-r+d0)*cos(phi0)
+//				, z0 + alpha*sin(lambda)
+//		};
 	}
 	
 	public double[] getMomentumAtLength(double s) {

lcsim/src/org/lcsim/mc/fast/tracking
DocaTrackParameters.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- DocaTrackParameters.java	20 Aug 2005 23:24:14 -0000	1.5
+++ DocaTrackParameters.java	8 Jul 2006 10:21:55 -0000	1.6
@@ -15,7 +15,7 @@
  * with a MC truth particle. <br>
  *
  * @author  Tony Johnson, Wolfgang Walkowiak
- * @version $Id: DocaTrackParameters.java,v 1.5 2005/08/20 23:24:14 tonyj Exp $
+ * @version $Id: DocaTrackParameters.java,v 1.6 2006/07/08 10:21:55 jstrube Exp $
  */
 class DocaTrackParameters implements TrackParameters
 {
@@ -479,7 +479,7 @@
       double z0 = m_parm[3];
       double tanl = m_parm[4];
 
-      double phi = phi0 + omega;
+      double phi = phi0 + l*omega;
       double rho = 1 / omega;
 
       double x = (rho * Math.sin(phi)) - ((rho + d0) * Math.sin(phi0));
CVSspam 0.2.8