lcsim/src/org/lcsim/recon/vertexing/zvtop4
diff -u -r1.6 -r1.7
--- ZvUtil.java 27 Jul 2005 16:16:10 -0000 1.6
+++ ZvUtil.java 30 Jul 2005 19:22:26 -0000 1.7
@@ -35,19 +35,37 @@
}
/**
- * Calculates iteratively the maximum in the overlap of the two tracks
+ * Calculates the location where the product of the two "track probabilities"
+ * is at a maximum
* @param iTrack
* @param jTrack
* @return the location of the maximum
*/
public static SpacePoint twoTrackMax(ZvTrack iTrack, ZvTrack jTrack) {
- // Tracks are divided into nPoints segments and the overlap is calculated
- // only points along the tracks are considered
- int nPoints = 2000;
- for (int i=0; i<nPoints; ++i) {
- iTrack.getTubeValue(new SpacePoint());
+ // until I have a better way :-(
+ return stupidTwoTrackMax(iTrack, jTrack);
+ }
+
+ private static SpacePoint stupidTwoTrackMax(ZvTrack iTrack, ZvTrack jTrack) {
+ SpacePoint maxLocation = new SpacePoint();
+ // limit the region where to look to the vertex detector.
+ double maxX = 100;
+ double maxY = 100;
+ double maxZ = 500;
+ double maxOverlap = 0;
+ for (int x=1; x<=100; ++x) {
+ for (int y=1; y<=100; ++y) {
+ for (int z=1; z<=50; ++z) {
+ SpacePoint location = new CartesianPoint(maxX/x, maxY/y, maxZ/z);
+ double overlap = iTrack.getTubeValue(location)*jTrack.getTubeValue(location);
+ if (overlap > maxOverlap) {
+ maxOverlap = overlap;
+ maxLocation = location;
+ }
+ }
+ }
}
- return new SpacePoint();
+ return maxLocation;
}
/**
lcsim/src/org/lcsim/recon/vertexing/zvtop4
diff -u -r1.13 -r1.14
--- ZvTrack.java 27 Jul 2005 03:03:08 -0000 1.13
+++ ZvTrack.java 30 Jul 2005 19:22:26 -0000 1.14
@@ -33,8 +33,9 @@
int _charge;
boolean _refPointIsPCA;
double[][] _errorMatrix;
- double sigmaT;
- double sigmaL;
+ // FIXME arbitrary values for the sigmas
+ static double sigmaT = 0.1;
+ static double sigmaL = 0.5;
boolean fitSuccess;
Track orgTrack;
@@ -297,6 +298,17 @@
return orgTrack.getType();
}
+ /**
+ * Calculates a Gaussian uncertainty around the track.
+ * A parabolic approximation is made instead of a helical parametrization
+ * The apex is at (x0, 0, z0), which is the POCA in a co-ordinate system that
+ * has been rotated in the x-y plane, so that the track momentum at the POCA
+ * in the x-y plane is parallel to the y-axis.
+ *
+ * @param location The spatial position at which to evaluate the "track probability"
+ * in the lab frame
+ * @return the scalar value at that location
+ */
public double getTubeValue(SpacePoint location) {
SpacePoint r = transformLocation(location);
SpacePoint refPrime = transformLocation(_referencePoint);
@@ -306,9 +318,31 @@
double termB = (r.z() - refPrime.z() - _parameters.get(ZvParameterNames.s)
* r.y())
/ sigmaL;
- return Math.exp(-1 / 2 * (termA * termA + termB * termB));
+ double result = Math.exp(-0.5 * (termA * termA + termB * termB));
+ // System.out.printf("termA: %f\ttermB: %f\tresult: %f", termA, termB, result);
+ return result;
+ }
+
+ /**
+ * Projection of the parabolic approximation of the track into the x-y plane
+ * Useful for visualization
+ * @see getTubeValue
+ * @param location The spatial position at which to evaluate the "track probability"
+ * in the lab frame
+ * @return the scalar value at that location
+ */
+ public double getTubeProjection(SpacePoint location) {
+ SpacePoint r = transformLocation(location);
+ SpacePoint refPrime = transformLocation(_referencePoint);
+ double termA = (r.x() - refPrime.x() - _parameters.get(ZvParameterNames.kappa)
+ * r.y() * r.y())
+ / sigmaT;
+ double result = Math.exp(-0.5 * termA * termA);
+ // System.out.printf("termA: %f\ttermB: %f\tresult: %f", termA, termB, result);
+ return result;
}
+
// TODO implementation
public ZvFitStatus getSwimStatus() {
return ZvFitStatus.FAILED_ON_ENTRY;