lcsim/test/org/lcsim/recon/vertexing/zvtop4
diff -u -r1.3 -r1.4
--- ZvTrackTest.java 26 Jun 2005 04:34:58 -0000 1.3
+++ ZvTrackTest.java 26 Jul 2005 05:57:52 -0000 1.4
@@ -1,8 +1,17 @@
package org.lcsim.recon.vertexing.zvtop4;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
+import java.util.List;
+import org.freehep.record.loop.LoopException;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.Track;
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+import org.lcsim.util.Driver;
import org.lcsim.util.cache.FileCache;
import org.lcsim.util.loop.LCSimLoop;
@@ -136,6 +145,31 @@
public void testMomentum() {
}
+ public void testTransformLocation() {
+ try {
+ loop.add(new MCFast());
+ loop.add(new TransformLocationTest());
+ loop.loop(-1);
+ } catch (LoopException e) {
+ } catch (IOException e) {
+ }
+ }
+
+ private class TransformLocationTest extends Driver {
+ public void process(EventHeader event) {
+ List<Track> tracks = event.getTracks();
+ for (Track iTrack : tracks) {
+ ZvTrack zvItrack = new ZvTrack(iTrack);
+ double[] pV = iTrack.getMomentum();
+ SpacePoint pVector = new CartesianPoint(pV);
+ // check for length
+ assertEquals(pVector.rxyz(), zvItrack.transformLocation(pVector).rxyz(), 0.000001);
+ // check for direction
+ assertEquals(0, zvItrack.transformLocation(pVector).x(), 0.000001);
+ assertEquals(pVector.rxy(), zvItrack.transformLocation(pVector).y(), 0.000001);
+ }
+ }
+ }
/*
* Class under test for void ZvTrack(Track)
*/
lcsim/src/org/lcsim/recon/vertexing/zvtop4
diff -u -r1.11 -r1.12
--- ZvTrack.java 22 Jul 2005 23:07:20 -0000 1.11
+++ ZvTrack.java 26 Jul 2005 05:57:52 -0000 1.12
@@ -17,6 +17,7 @@
import static java.lang.Math.cos;
import static java.lang.Math.sin;
import static java.lang.Math.acos;
+import static java.lang.Math.PI;
/**
* Representation of the Gaussian tubes
@@ -300,7 +301,7 @@
// TODO variables !!!
// ALL WRONG !
public double getTubeValue(SpacePoint location) {
- SpacePoint r = transformLocation(location);
+ SpacePoint r = transformLocation(_referencePoint);
double termA = (r.x() - _referencePoint.x() - _parameters.get(ZvParameterNames.kappa)
* r.y() * r.y())
/ sigmaT;
@@ -316,18 +317,19 @@
}
// Rotate the coordinate system, so that the y axis is parallel to the momentum vector
- private SpacePoint transformLocation(SpacePoint originalPoint) {
+ SpacePoint transformLocation(SpacePoint oldPoint) {
// z stays the same
- double z = originalPoint.z();
+ double z = oldPoint.z();
// rotate only in the x-y plane
- double x = originalPoint.x();
- double y = originalPoint.y();
+ double x = oldPoint.x();
+ double y = oldPoint.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);
+ SpacePoint result = new CartesianPoint(xPrime, yPrime, z);
+ return result;
}
@@ -365,7 +367,10 @@
if (! _refPointIsPCA) {
System.err.println("WARNING ! Reference Point should be PCA");
}
- trackRotationAngle = acos(py/pt);
+ if (px < 0.0)
+ trackRotationAngle = acos(py/pt);
+ else
+ trackRotationAngle = - acos(py/pt);
return;
}
@@ -403,6 +408,6 @@
*/
// TODO implementation
private double[][] convert2TrackErrorMatrix() {
- return new double[5][5];
+ return _errorMatrix;
}
}
lcsim/src/org/lcsim/recon/vertexing/zvtop4
diff -u -r1.13 -r1.14
--- ZvFitter.java 19 Jul 2005 01:26:52 -0000 1.13
+++ ZvFitter.java 26 Jul 2005 05:57:52 -0000 1.14
@@ -26,7 +26,7 @@
* Fitter class based on a least squares method
*
* @author W.Walkowiak, 09/18/00
- * @version $Id: ZvFitter.java,v 1.13 2005/07/19 01:26:52 jstrube Exp $
+ * @version $Id: ZvFitter.java,v 1.14 2005/07/26 05:57:52 jstrube Exp $
*/
/* TODO static members only
@@ -217,7 +217,9 @@
// TODO move swimTo into HelicalSwimmer
// TODO optimizing inserts
if (subtract(location, track.referencePoint()).magnitude() > swimDistMin) {
- trackList.remove(track);
+ if (! trackList.remove(track)) {
+ System.err.println("Could not remove element");
+ }
ZvTrack orgTrack = new ZvTrack(track);
trackList.add(orgTrack);
ZvFitStatus swimStatus = swimmer.swimTo(track, location);