Print

Print


Commit in lcsim/src/org/lcsim/recon/vertexing/zvtop4 on MAIN
ZvTrack.java+25-151.10 -> 1.11
Implemented rotation of co-ordinate system of ZvTrack. y axis is parallel with momentum at POCA (rotation in x-y plane)

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvTrack.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- ZvTrack.java	22 Jun 2005 05:25:21 -0000	1.10
+++ ZvTrack.java	22 Jul 2005 23:07:20 -0000	1.11
@@ -6,7 +6,6 @@
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
 
-import java.util.EnumMap;
 import java.util.List;
 
 import org.lcsim.event.Track;
@@ -14,9 +13,10 @@
 import org.lcsim.spacegeom.CartesianPoint;
 import org.lcsim.spacegeom.SpacePoint;
 
-import Jama.Matrix;
-
 import static java.lang.Math.sqrt;
+import static java.lang.Math.cos;
+import static java.lang.Math.sin;
+import static java.lang.Math.acos;
 
 /**
  * Representation of the Gaussian tubes
@@ -38,7 +38,7 @@
 
     // FIXME this parameter is never set
     double z0 = 0.;
-
+    double trackRotationAngle;
     // package wide constructor ensures I don't have to worry about anybody
     // creating invalid ZvTracks.
     // Only used to create Track-IP
@@ -315,36 +315,42 @@
         return ZvFitStatus.FAILED_ON_ENTRY;
     }
 
-    // TODO Implementation
-    // Rotate the coordinate system as in the paper
+    // Rotate the coordinate system, so that the y axis is parallel to the momentum vector
     private SpacePoint transformLocation(SpacePoint originalPoint) {
-        SpacePoint newPoint = new SpacePoint();
-        return newPoint;
+        // z stays the same
+        double z = originalPoint.z();
+        // rotate only in the x-y plane
+        
+        double x = originalPoint.x();
+        double y = originalPoint.y();
+        double theta = trackRotationAngle;
+        
+        double xPrime = x*cos(theta) + y*sin(theta);
+        double yPrime = - x*sin(theta) + y*cos(theta);
+        return new CartesianPoint(xPrime, yPrime, z);
     }
 
-    // TODO implementation
+    
     public SpacePoint referencePoint() {
         updateRefPoint();
         return _referencePoint;
     }
 
-    // TODO implementation
     public Hep3Vector momentum() {
         updateMomentum();
         return _momentum;
     }
 
-    // TODO implementation
     public ZvTrack(Track t) {
         fitSuccess = t.fitSuccess();
         orgTrack = t;
         _charge = t.getCharge();
         _refPointIsPCA = t.isReferencePointPCA();
         _errorMatrix = t.getErrorMatrix();
-        double x = t.getPX();
-        double y = t.getPY();
-        double pt = sqrt(x * x + y * y);
-
+        double px = t.getPX();
+        double py = t.getPY();
+        double pt = sqrt(px * px + py * py);
+        
         _parameters = new ZvParameters();
         _parameters.kappa = 1 / pt;
         // FIXME hardcoded order - dangerous
@@ -356,6 +362,10 @@
         _parameters.z = t.getReferencePointZ();
         updateMomentum();
         updateRefPoint();
+        if (! _refPointIsPCA) {
+            System.err.println("WARNING ! Reference Point should be PCA");
+        }
+        trackRotationAngle = acos(py/pt);
         return;
     }
     
CVSspam 0.2.8