Print

Print


Commit in lcsim/src/org/lcsim/contrib/JanStrube on MAIN
tracking/NewTrack.java+61added 1.1
        /EMap.java+19added 1.1
        /Track.java+51added 1.1
        /HelixSwimmer.java+151added 1.1
        /NewFastMCTrackFactory.java+114added 1.1
vtxFitter/VertexTrackTest.java+34-71.3 -> 1.4
         /VertexTrack.java+19-281.3 -> 1.4
+449-35
5 added + 2 modified, total 7 files
Starting on yet another Track implementation. It will break all kinds of existing code, so it'll live in my contrib area for a while.

lcsim/src/org/lcsim/contrib/JanStrube/tracking
NewTrack.java added at 1.1
diff -N NewTrack.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ NewTrack.java	13 Jul 2006 10:53:58 -0000	1.1
@@ -0,0 +1,61 @@
+/**
+ * @version $Id: NewTrack.java,v 1.1 2006/07/13 10:53:58 jstrube Exp $
+ */
+package org.lcsim.contrib.JanStrube.tracking;
+
+import org.lcsim.spacegeom.SpacePoint;
+
+import Jama.Matrix;
+
+/**
+ * @author jstrube
+ *
+ */
+public class NewTrack implements Track {
+    private EMap _parameters;
+    private Matrix _errorMatrix;
+    private SpacePoint _referencePoint;
+    private int _charge;
+    
+    private NewTrack() {
+        _parameters = new EMap();
+        _errorMatrix = new Matrix(5, 5);
+    }
+    public NewTrack(SpacePoint refPoint, EMap parameters, Matrix errorMatrix, int charge) {
+        this();
+        _referencePoint = refPoint;
+        _parameters = parameters;
+        _charge = charge;
+        _errorMatrix = errorMatrix;
+    }
+    /* (non-Javadoc)
+     * @see org.lcsim.contrib.JanStrube.tracking.Track#getParameter(org.lcsim.contrib.JanStrube.tracking.NewTrack.ParameterName)
+     */
+    public double getParameter(ParameterName name) {
+        return _parameters.get(name);
+    }
+    /* (non-Javadoc)
+     * @see org.lcsim.contrib.JanStrube.tracking.Track#getPt()
+     */
+    public double getPt() {
+        return _parameters.get(ParameterName.pt);
+    }
+    /* (non-Javadoc)
+     * @see org.lcsim.contrib.JanStrube.tracking.Track#getCharge()
+     */
+    public int getCharge() {
+        return _charge;
+    }
+    /* (non-Javadoc)
+     * @see org.lcsim.contrib.JanStrube.tracking.Track#getReferencePoint()
+     */
+    public SpacePoint getReferencePoint() {
+        return _referencePoint;
+    }
+    /* (non-Javadoc)
+     * @see org.lcsim.contrib.JanStrube.tracking.Track#getErrorMatrix()
+     */
+    public Matrix getErrorMatrix() {
+        return _errorMatrix;
+    }
+}

lcsim/src/org/lcsim/contrib/JanStrube/tracking
EMap.java added at 1.1
diff -N EMap.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EMap.java	13 Jul 2006 10:53:58 -0000	1.1
@@ -0,0 +1,19 @@
+/**
+ * @version $Id: EMap.java,v 1.1 2006/07/13 10:53:58 jstrube Exp $
+ */
+package org.lcsim.contrib.JanStrube.tracking;
+
+import org.lcsim.contrib.JanStrube.tracking.Track.ParameterName;
+
+public class EMap {
+    public double[] values;
+    EMap() {
+        values = new double[6];
+    }
+    double get(ParameterName name) {
+        return values[name.ordinal()];
+    }
+    void set(ParameterName name, double val) {
+        values[name.ordinal()] = val;
+    }
+}
\ No newline at end of file

lcsim/src/org/lcsim/contrib/JanStrube/tracking
Track.java added at 1.1
diff -N Track.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Track.java	13 Jul 2006 10:53:58 -0000	1.1
@@ -0,0 +1,51 @@
+/**
+ * @version $Id: Track.java,v 1.1 2006/07/13 10:53:58 jstrube Exp $
+ */
+package org.lcsim.contrib.JanStrube.tracking;
+
+import org.lcsim.spacegeom.SpacePoint;
+
+import Jama.Matrix;
+
+/**
+ * @author jstrube
+ *
+ */
+public interface Track {
+
+    enum ParameterName {
+        d0, phi0, omega, z0, tanLambda, pt 
+    }
+
+    /**
+     * Returns the parameter by name
+     * @param name symbolic name of the parameter
+     * @return the value of the parameter
+     */
+    public abstract double getParameter(ParameterName name);
+
+    /**
+     * Returns the transverse momentum
+     * @return the transverse momentum
+     */
+    public abstract double getPt();
+
+    /**
+     * Returns the charge of the particle that made the track
+     * @return an integral charge
+     */
+    public abstract int getCharge();
+
+    /**
+     * Returns the reference point with respect to which all parameters are defined
+     * @return the point in space at which the parameters are defined
+     */
+    public abstract SpacePoint getReferencePoint();
+
+    /**
+     * Returns a 5x5 measurement error of the track parameters
+     * @return the covariance matrix of the track parameters
+     */
+    public abstract Matrix getErrorMatrix();
+
+}

lcsim/src/org/lcsim/contrib/JanStrube/tracking
HelixSwimmer.java added at 1.1
diff -N HelixSwimmer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HelixSwimmer.java	13 Jul 2006 10:53:58 -0000	1.1
@@ -0,0 +1,151 @@
+package org.lcsim.contrib.JanStrube.tracking;
+
+import org.lcsim.event.Track;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+import org.lcsim.util.swim.Helix;
+import org.lcsim.util.swim.Line;
+import org.lcsim.util.swim.Trajectory;
+
+import static java.lang.Math.abs;
+import static java.lang.Math.sin;
+import static java.lang.Math.cos;
+import static java.lang.Math.sqrt;
+import static java.lang.Math.signum;
+import static org.lcsim.constants.Constants.fieldConversion;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.d0;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.phi0;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.omega;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.z0;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.tanLambda;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.pt;
+
+/**
+ * A simple helix smimmer for use in org.lcsim. Uses standard lcsim units
+ * Tesla, mm, GeV. This swimmer works for charged and neutral tracks.
+ * <p> 
+ * 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.1 2006/07/13 10:53:58 jstrube Exp $
+ */
+public class HelixSwimmer
+{
+   public class SpatialParameters
+   {
+	   public double px;
+	   public double py;
+	   public double pz;
+	   public int charge;
+	   public boolean isInvalid = true;
+       
+       public String toString() {
+           String result = new String("SpatialParameters\n");
+           result += String.format("\tp_x: %f\n\tp_y: %f\n\tp_z: %f\n\tcharge: %d", px, py, pz, charge);
+           return result;
+       }
+  }
+   private double field;
+   private Trajectory trajectory;
+   private SpatialParameters spatialParms;
+   private org.lcsim.contrib.JanStrube.tracking.Track track;
+   /** Creates a new instance of HelixSwimmer
+    * @param B field strength in Tesla; uniform, solenoidal, directed along z-axis
+    */
+   public HelixSwimmer(double B)
+   {
+      field = B*fieldConversion;
+      spatialParms = new SpatialParameters();
+   }
+   /**
+    * Sets parameters for helix swimmmer.
+    *
+    * @param p 3-momentum (px,py,pz)
+    * @param r0 initial position(x0,y0,z0)
+    * @param iq charge iq = q/|e| = +1/0/-1
+    */
+   public void setTrack(SpacePoint p, SpacePoint r0, int iq)
+   {
+      double temp = p.x()*p.x()+p.y()*p.y();
+      double pmom = Math.sqrt(temp + p.z()*p.z());
+      double sin_lambda = p.z()/pmom;
+      double phi = Math.atan2(p.y(),p.x());
+      double lambda = Math.asin(sin_lambda);
+      
+      if (iq != 0 && field != 0)
+      {
+         double p_t = Math.sqrt(temp);
+         double radius = p_t/(iq*field);
+         trajectory = new Helix(r0,radius,phi,lambda);
+      }
+      else
+      {
+         trajectory = new Line(r0, phi, lambda);
+      }
+      spatialParms.isInvalid = true;
+   }
+   
+   public void setTrack(org.lcsim.contrib.JanStrube.tracking.Track t)
+   {
+      double o = t.getParameter(omega);
+      double p = t.getParameter(phi0);
+      double lambda = Math.atan(t.getParameter(tanLambda));
+      
+      // origin of the circle that is the x-y projection of the helix
+      trajectory = new Helix(origin,1/o,p,lambda);
+      spatialParms.isInvalid = true;
+      track=t;
+   }
+   public SpacePoint getPointAtDistance(double alpha)
+   {
+      if (trajectory == null) throw new RuntimeException("Trajectory not set");
+      return trajectory.getPointAtDistance(alpha);
+   }
+   public double getDistanceToRadius(double r)
+   {
+      if (trajectory == null) throw new RuntimeException("Trajectory not set");
+      return trajectory.getDistanceToInfiniteCylinder(r);
+   }
+   public double getDistanceToZ(double z)
+   {
+      if (trajectory == null) throw new RuntimeException("Trajectory not set");
+      double result = trajectory.getDistanceToZPlane(z);
+      if (result<0) result = trajectory.getDistanceToZPlane(-z);
+      return result;
+   }
+   public double getDistanceToCylinder(double r,double z)
+   {
+      double x1 = getDistanceToRadius(r);
+      double x2 = getDistanceToZ(z);
+      return Double.isNaN(x1) ? x2 : Math.min(x1,x2);
+   }
+   
+   /**
+    * Returns the distance along the trajectory to get to the point of closest approach 
+    * @param point The point to swim as close as possible to
+    * @return the length parameter by how much the trajectory has to be swum
+    */
+   public double getDistanceToPoint(SpacePoint point) {
+       return trajectory.getDistanceToPoint(point);
+   }
+   
+   /**
+    * Returns the momentum on a point on the track at a distance from the origin
+    * @param alpha The 3D distance from the origin along the track
+    * @return The components of the momentum in a SpacePoint  
+    */
+   public SpacePoint getMomentumAtDistance(double alpha) {
+       double t = track.getParameter(tanLambda);
+       double cosLambda = 1/sqrt(t*t);
+       double o = track.getParameter(omega);
+       double phi = track.getParameter(phi0) + alpha*cosLambda*o;
+       double p_t = field*track.getCharge()/o;
+       double px = p_t * cos(phi);
+       double py = p_t * sin(phi);
+       double pz = p_t*t;
+       return new CartesianPoint(px, py, pz);
+   }
+   public Trajectory getTrajectory() {
+       return trajectory;
+   }
+}

lcsim/src/org/lcsim/contrib/JanStrube/tracking
NewFastMCTrackFactory.java added at 1.1
diff -N NewFastMCTrackFactory.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ NewFastMCTrackFactory.java	13 Jul 2006 10:53:58 -0000	1.1
@@ -0,0 +1,114 @@
+/**
+ * @version $Id: NewFastMCTrackFactory.java,v 1.1 2006/07/13 10:53:58 jstrube Exp $
+ */
+package org.lcsim.contrib.JanStrube.tracking;
+
+import java.io.IOException;
+import java.util.Random;
+
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.conditions.ConditionsSet;
+import org.lcsim.geometry.Detector;
+import org.lcsim.mc.fast.tracking.ResolutionTable;
+import org.lcsim.mc.fast.tracking.SimpleTables;
+import org.lcsim.mc.fast.tracking.TrackResolutionTables;
+import org.lcsim.spacegeom.SpacePoint;
+
+import Jama.Matrix;
+import static java.lang.Math.abs;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.d0;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.phi0;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.omega;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.z0;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.tanLambda;
+import static org.lcsim.contrib.JanStrube.tracking.Track.ParameterName.pt;
+
+/**
+ * @author jstrube
+ * 
+ */
+public class NewFastMCTrackFactory {
+    private TrackResolutionTables _tables;
+    private SimpleTables _simpleTables;
+    private ConditionsManager _manager;
+    private final static double Bz = 5.;
+    private HelixSwimmer _swimmer;
+
+    public NewFastMCTrackFactory(String detector, boolean beamConstraint) {
+        _manager = ConditionsManager.defaultInstance();
+        try {
+            _manager.setDetector(detector, 0);
+        } catch (ConditionsManager.ConditionsNotFoundException e) {
+        }
+        ConditionsSet trackParameters = _manager.getConditions("TrackParameters");
+        ConditionsSet simpleTrack = _manager.getConditions("SimpleTrack");
+        try {
+            _tables = new TrackResolutionTables(trackParameters, beamConstraint);
+            _simpleTables = new SimpleTables(simpleTrack);
+        } catch (IOException e) {
+        }
+        _swimmer = new HelixSwimmer(Bz);
+    }
+
+    public Track getTrack(
+            SpacePoint momentum
+            , SpacePoint location
+            , SpacePoint referencePoint
+            , int charge
+            , Random random) {
+        _swimmer.setTrack(momentum, location, charge);
+        double alpha = _swimmer.getDistanceToPoint(referencePoint);
+        SpacePoint poca = _swimmer.getPointAtDistance(alpha);
+        SpacePoint momentumAtPoca = _swimmer.getMomentumAtDistance(alpha);
+        EMap parameters = new EMap();
+        parameters.set(d0, 0);
+        parameters.set(phi0, 0);
+        parameters.set(omega, 0);
+        parameters.set(tanLambda, 0);
+        parameters.set(z0, 0);
+        parameters.set(pt, 0);
+        Matrix errorMatrix = new Matrix(5, 5);
+        // this sets the measurement error
+        double cosTheta = abs(momentumAtPoca.cosTheta());
+        double p_mag = momentumAtPoca.magnitude();
+        ResolutionTable table = cosTheta < _tables.getPolarInner() ? _tables.getBarrelTable() : _tables.getEndcapTable();
+        errorMatrix = new Matrix(5, 5);
+        for (int i = 0; i < 5; i++ ) {
+            for (int j = 0; j <= i; j++ ) {
+                double iVal = table.findTable(i, j).interpolateVal(cosTheta, p_mag);
+                errorMatrix.set(i, j, iVal);
+                if (i != j) {
+                    errorMatrix.set(j, i, iVal);
+                }
+            }
+        }
+        return new NewTrack(referencePoint, parameters, errorMatrix, charge);
+    }
+
+    Track getTrack(
+            SpacePoint momentum
+            , SpacePoint location
+            , SpacePoint referencePoint
+            , int charge) {
+        return getTrack(momentum, location, referencePoint, charge, new Random());
+    }
+
+    Track getTrack(
+            SpacePoint momentum
+            , SpacePoint location
+            , int charge
+            , Random random) {
+        return getTrack(momentum, location, new SpacePoint(), charge, random);
+    }
+
+    Track getTrack(
+            SpacePoint momentum
+            , SpacePoint location
+            , int charge) {
+        return getTrack(momentum, location, new SpacePoint(), charge, new Random());
+    }
+
+    public void setNewReferencePoint(Track track, SpacePoint referencePoint) {
+        _swimmer.setTrack(track);
+    }
+}

lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
VertexTrackTest.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- VertexTrackTest.java	8 Jul 2006 10:21:55 -0000	1.3
+++ VertexTrackTest.java	13 Jul 2006 10:53:59 -0000	1.4
@@ -4,6 +4,7 @@
 
 import org.lcsim.event.Track;
 import org.lcsim.mc.fast.tracking.MCFastTrackFactory;
+import org.lcsim.recon.vertexing.zvtop4.VectorArithmetic;
 import org.lcsim.spacegeom.CartesianPoint;
 import org.lcsim.spacegeom.SpacePoint;
 import org.lcsim.util.swim.Helix;
@@ -17,13 +18,16 @@
 	HelixSwimmer helix;
 	MCFastTrackFactory tf;
 	VertexTrack vtxTrack;
+    SpacePoint momentum;
+    SpacePoint location;
+    int charge;
 	protected void setUp() throws Exception {
 		super.setUp();
 		helix = new HelixSwimmer(5);
 		tf = new MCFastTrackFactory();
-		SpacePoint momentum = new CartesianPoint(0.1, 0.01, 0.2);
-		SpacePoint location = new CartesianPoint(1, 2, 3);
-		int charge = 1;
+		momentum = new CartesianPoint(0.7, 0.01, 0.2);
+		location = new CartesianPoint(1, 2, 3);
+		charge = 1;
 		Track t = tf.getMCTrack(momentum, location, charge);
 		helix.setTrack(t);
 		vtxTrack = new VertexTrack(t);
@@ -37,18 +41,41 @@
 	public void testGetPointAtLength() {
 		Hep3Vector p1 = helix.getPointAtDistance(0);
 		double[] p2 = vtxTrack.getPointAtLength(0);
+        System.out.println("Position comparison");
         System.out.println(p1);
-        System.out.printf("%f\t%f\t%f", p2[0], p2[1], p2[2]);
+        System.out.printf("%f\t%f\t%f\n", 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);
+        SpatialParameters mom1 = helix.getSpatialParameters();
+        double[] mom2 = vtxTrack.getMomentumAtLength(0);
+        System.out.println(mom1);
+        System.out.printf("x: %f\ty: %f\tz: %f\n", mom2[0], mom2[1], mom2[2]);
+        assertEquals(mom1.px, mom2[0], 1e-10);
 		assertEquals(mom1.py, mom2[1], 1e-10);
 		assertEquals(mom1.pz, mom2[2], 1e-10);
+        Helix hlx = (Helix) helix.getTrajectory();
+        Hep3Vector mom3 = hlx.getTangentAtDistance(0);
+        System.out.println(mom3);
 	}
+    
+    public void testGetMeasurementVector() {
+        double[] vec = VertexTrack.getMeasurementVector(location.getCartesianArray(), momentum.getCartesianArray(), charge);
+        double[] ref = vtxTrack.getReferencePoint();
+        System.out.printf("%f\t%f\t%f\n", ref[0], ref[1], ref[2]);
+        SpacePoint loc2 = VectorArithmetic.subtract(location, new CartesianPoint(vtxTrack.getReferencePoint()));
+        double[] trackParams = vtxTrack.getTrackParameters();
+        double[] vec2 = VertexTrack.getMeasurementVector(loc2.getCartesianArray(), momentum.getCartesianArray(), charge);
+        System.out.printf("Vec:    %f\t%f\t%f\t%f\t%f\n", vec[0], vec[1], vec[2], vec[3], vec[4]);
+        System.out.printf("Vec2:    %f\t%f\t%f\t%f\t%f\n", vec2[0], vec2[1], vec2[2], vec2[3], vec2[4]);
+        System.out.printf("Params: %f\t%f\t%f\t%f\t%f\n", trackParams[0], trackParams[1], trackParams[2], trackParams[3], trackParams[4]);
+        assertEquals(vec[0], trackParams[0]);
+        assertEquals(vec[1], trackParams[1]);
+        assertEquals(vec[2], trackParams[2]);
+        assertEquals(vec[3], trackParams[3]);
+        assertEquals(vec[4], trackParams[4]);
+    }
 }

lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
VertexTrack.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- VertexTrack.java	8 Jul 2006 10:21:55 -0000	1.3
+++ VertexTrack.java	13 Jul 2006 10:53:59 -0000	1.4
@@ -1,5 +1,5 @@
 /**
- * @version $Id: VertexTrack.java,v 1.3 2006/07/08 10:21:55 jstrube Exp $
+ * @version $Id: VertexTrack.java,v 1.4 2006/07/13 10:53:59 jstrube Exp $
  */
 package org.lcsim.contrib.JanStrube.vtxFitter;
 
@@ -41,27 +41,18 @@
 		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 z0 = _track.getTrackParameter(Track.ParameterName.z0.ordinal());
 		double tanLambda = _track.getTrackParameter(Track.ParameterName.s.ordinal());
 		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);
+        System.out.printf("Reference point: %f\t%f\t%f\n", ref[0], ref[1], ref[2]);
+        Hep3Vector origin = new BasicHep3Vector(ref);
         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) {
@@ -90,26 +81,26 @@
 		double pt0 = sqrt(px0*px0 + py0*py0);
 		double phi = atan2(p[1], p[0]);
 		double phi0 = atan2(py0, px0);
-		double l = (phi-phi0)*pt/(charge*fieldConversion);
+		double l = (phi-phi0)*pt/(charge*Bz);
 		
-		double d0 = (pt0-pt)/(charge*fieldConversion);
+		double d0 = (pt0-pt)/(charge*Bz);
 		// FIXME signed/unsigned ? BaBar convention vs. org.lcsim convention
-		double omega = charge*fieldConversion/pt;
+		double omega = charge*Bz/pt;
 		double z0 = x[2] - l*p[2]/pt;
 		double tanLambda = p[2]/pt;
 		return new double[]{d0, phi0, omega, z0, tanLambda};
 	}
 	
 	public static Matrix getSpatialDerivativeMatrix(double[] x, double[] p, int charge) {
-		double px0 = p[0] + charge*Bz*fieldConversion;
-		double py0 = p[1] - charge*Bz*fieldConversion;
+		double px0 = p[0] + charge*Bz;
+		double py0 = p[1] - charge*Bz;
 		double pt0 = sqrt(px0*px0 + py0*py0);
 				
 		double[] dh_dx = new double[] {
-				-py0/pt0, -charge*fieldConversion*px0/(pt0*pt0), 0, -p[2]*px0/(pt0*pt0), 0
+				-py0/pt0, -charge*Bz*px0/(pt0*pt0), 0, -p[2]*px0/(pt0*pt0), 0
 		};
 		double[] dh_dy = new double[] {
-				px0/pt0, -charge*fieldConversion*py0/(pt0*pt0), 0, -p[2]*px0/(pt0*pt0), 0
+				px0/pt0, -charge*Bz*py0/(pt0*pt0), 0, -p[2]*px0/(pt0*pt0), 0
 		};
 		double[] dh_dz = new double[] {
 				0, 0, 0, 1, 0
@@ -120,25 +111,25 @@
 	
 	public Matrix getMomentumDerivativeMatrix(double[] x, double[] p, int charge) {
 		double pt = sqrt(p[0]*p[0] + p[1]*p[1]);
-		double px0 = p[0] + charge*Bz*fieldConversion;
-		double py0 = p[1] - charge*Bz*fieldConversion;
+		double px0 = p[0] + charge*Bz;
+		double py0 = p[1] - charge*Bz;
 		double pt0 = sqrt(px0*px0 + py0*py0);
 		double phi = atan2(p[1], p[0]);
 		double phi0 = atan2(py0, px0);
-		double l = (phi-phi0)*pt/(charge*fieldConversion);
+		double l = (phi-phi0)*pt/(charge*Bz);
 
 		double[] dh_dpx = new double[] {
-				1/(charge*fieldConversion)*(px0/pt0 - p[0]/pt)
+				1/(charge*Bz)*(px0/pt0 - p[0]/pt)
 				, -py0/(pt0*pt0)
-				, -charge*fieldConversion*p[0]/(pt*pt*pt)
-				, -p[2]/(charge*fieldConversion)*(py0/(pt0*pt0)-p[1]/(pt0*pt0))
+				, -charge*Bz*p[0]/(pt*pt*pt)
+				, -p[2]/(charge*Bz)*(py0/(pt0*pt0)-p[1]/(pt0*pt0))
 				, -p[2]*p[0]/(pt*pt*pt)
 		};
 		double[] dh_dpy = new double[] {
-				1/(charge*fieldConversion)*(py0/pt0 - p[1]/pt)
+				1/(charge*Bz)*(py0/pt0 - p[1]/pt)
 				, -px0/(pt0*pt0)
-				, -charge*fieldConversion*p[1]/(pt*pt*pt)
- 				, -p[2]/(charge*fieldConversion)*(px0/(pt0*pt0)-p[0]/(pt0*pt0))
+				, -charge*Bz*p[1]/(pt*pt*pt)
+ 				, -p[2]/(charge*Bz)*(px0/(pt0*pt0)-p[0]/(pt0*pt0))
  				, -p[2]*p[1]/(pt*pt*pt)
 		};
 		double[] dh_dpz = new double[] {
CVSspam 0.2.8