Commit in lcsim/test/org/lcsim/contrib/JanStrube/tracking on MAIN
HelixSwimmerTrackConsistencyTest.java+34-191.4 -> 1.5
Adding another test of consistency

lcsim/test/org/lcsim/contrib/JanStrube/tracking
HelixSwimmerTrackConsistencyTest.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- HelixSwimmerTrackConsistencyTest.java	19 Jul 2006 23:14:02 -0000	1.4
+++ HelixSwimmerTrackConsistencyTest.java	24 Jul 2006 23:45:41 -0000	1.5
@@ -1,5 +1,5 @@
 /**
- * @version $Id: HelixSwimmerTrackConsistencyTest.java,v 1.4 2006/07/19 23:14:02 jstrube Exp $
+ * @version $Id: HelixSwimmerTrackConsistencyTest.java,v 1.5 2006/07/24 23:45:41 jstrube Exp $
  */
 package org.lcsim.contrib.JanStrube.tracking;
 
@@ -12,6 +12,8 @@
 import org.lcsim.spacegeom.CartesianPoint;
 import org.lcsim.spacegeom.SpacePoint;
 
+import Jama.Matrix;
+
 import static java.lang.Math.atan2;
 import static java.lang.Math.sin;
 import static java.lang.Math.abs;
@@ -94,24 +96,6 @@
         double dist = VectorArithmetic.subtract(origin, t.getReferencePoint()).rxy();
         assertEquals(abs(d0), abs(dist), 1e-6);
         
-        
-//        double phi = atan2(momentum.y(), momentum.x());
-//        double phi_0 = t.getParameter(Track.ParameterName.phi0);
-//        double omega = t.getParameter(Track.ParameterName.omega);
-//        System.out.printf("phi: %f\nphi0: %f\nomega: %f\nalpha: %f\n", phi, phi_0, omega, alpha);
-        // The Track and the helix should be the same, except for being offset by alpha.
-//        System.out.println("Raw:\n" + (Helix)swimmerRaw.getTrajectory());
-//        System.out.println("Track:\n" + (Helix)swimmerTrack.getTrajectory());
-//        double tanLambda = t.getParameter(Track.ParameterName.tanLambda);
-//        double cosLambda = 1 / sqrt(1+tanLambda*tanLambda);
-        
-        
-//        System.out.println(swimmerRaw.getPointAtDistance(alpha/cosLambda));
-//        System.out.println(swimmerTrack.getPointAtDistance(-alpha));
-//        System.out.printf("Pt: %f\n",  t.getPt());
-//        for (Track.ParameterName n : Track.ParameterName.values()) {
-//        	System.out.printf("%s: %f\n", n.name(),  t.getParameter(n));
-//        }
         // The points at these two locations should be the same, too.
         for (int i=-70; i<70; i++) {
             double alpha_i = i/10;
@@ -119,6 +103,37 @@
         }
     }
     
+    /**
+     * Creates a new Track t1 with a momentum and position constructor.
+     * Creates a NewTrack t2 with the 5 parameter vector of t1.
+     * Compares Position and momentum of t2 with t1.
+     * Can't compare with position and momentum that was used to construct t1 directly,
+     * because the helix is swum to the POCA first.
+     */
+    public void testHelix_TrackFactoryConsistency3() {
+    	SpacePoint momentum = new CartesianPoint(-2, 2, 4);
+        SpacePoint location = new CartesianPoint(1, 2, 3);
+        int charge = -1;
+        SpacePoint referencePoint = new SpacePoint();
+        // reference Point is (0, 0, 0)
+        Track t = factory.getTrack(momentum, location, referencePoint, charge, new Random(), false);
+        // track parameters
+        EMap tp = new EMap();
+        tp.pt = t.getPt();
+        tp.set(Track.ParameterName.d0, t.getParameter(Track.ParameterName.d0));
+        tp.set(Track.ParameterName.omega, t.getParameter(Track.ParameterName.omega));
+        tp.set(Track.ParameterName.phi0, t.getParameter(Track.ParameterName.phi0));
+        tp.set(Track.ParameterName.tanLambda, t.getParameter(Track.ParameterName.tanLambda));
+        tp.set(Track.ParameterName.z0, t.getParameter(Track.ParameterName.z0));
+        
+        // we don't need an error matrix for this test
+        NewTrack t1 = new NewTrack(referencePoint, tp, new Matrix(0, 0), charge);
+        swimmerRaw.setTrack(t);
+        swimmerTrack.setTrack(t1);
+        assertEquals(swimmerRaw.getMomentumAtDistance(0), swimmerTrack.getMomentumAtDistance(0));
+        assertEquals(swimmerRaw.getPointAtDistance(0), swimmerTrack.getPointAtDistance(0));
+    }
+    
     /* (non-Javadoc)
      * @see junit.framework.TestCase#tearDown()
      */
CVSspam 0.2.8