Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN | |||
TrackUtils.java | +58 | -1 | 1.21 -> 1.22 |
Added analytical Xplane interception with helix.
diff -u -r1.21 -r1.22 --- TrackUtils.java 12 Jul 2013 20:58:55 -0000 1.21 +++ TrackUtils.java 25 Aug 2013 21:41:44 -0000 1.22 @@ -28,7 +28,7 @@
/** * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: TrackUtils.java,v 1.21 2013/07/12 20:58:55 phansson Exp $
+ * @version $Id: TrackUtils.java,v 1.22 2013/08/25 21:41:44 phansson Exp $
* TODO: Switch to JLab coordinates */
@@ -287,6 +287,63 @@
}
+ + /* + * Calculates the point on the helix in the x-y plane at the intercept with plane + * The normal of the plane is in the same x-y plane as the circle. + * + * @param helix + * @param vector normal to plane + * @param origin of plane + * @return point in the x-y plane of the intercept + * + */ + public static Hep3Vector getHelixXPlaneIntercept(HelicalTrackFit helix, Hep3Vector w, Hep3Vector origin) { + // FInd the intercept point x_int,y_int, between the circle and sensor, which becomes a line in the x-y plane in this case. + // y_int = k*x_int + m + // R^2 = (y_int-y_c)^2 + (x_int-x_c)^2 + // solve for x_int + double R = helix.R(); + double d0 = helix.dca(); + double sinPhi0 = Math.sin(helix.phi0()); + double cosPhi0 = Math.cos(helix.phi0()); + //double x_0 = -d0*sinPhi0; // POCA + //double y_0 = d0*cosPhi0; // POCA + double x_c = (R-d0)*sinPhi0; // center of circle + double y_c = -1*(R-d0)*cosPhi0; // center of circle + double k = -1*w.x()/w.y(); // dy/dx slope of line, note change of sign + double m = origin.y() - k * origin.x(); // intercept + + double k2 = k*k; + double R2 = R*R; + double m2 = m*m; + double A = k2*(m+y_c); + double B = Math.sqrt( k2*( -m2 + (1+k2)*R2 +x_c*x_c + k2*x_c*x_c - 2*m*y_c - y_c*y_c ) ); + double C = k+k*k*k; + + double xint1 = (A - B)/C; + double xint2 = (A + B)/C; + + xint1 *= -1.; + xint2 *= -1.; + + //if(Double.isInfinite(xint1) || Double.isNaN(xint1)) { + //System.out.printf("xint1 = %f xint2 = %f\n",xint1,xint2); + double xint; + if(xint1>0 && xint2>0) { + xint = xint1<xint2 ? xint1 : xint2; // chose smaller one + } else if(xint1<0 && xint2<0) { + System.out.printf("problemxint1 = %f xint2 = %f\n",xint1,xint2); + xint = xint1; + } else { + xint = xint1>0 ? xint1 : xint2; + } + double s = HelixUtils.PathToXPlane(helix, xint, 0, 0).get(0); + Hep3Vector pointOnHelix = HelixUtils.PointOnHelix(helix, s); + //double[] point = {xint,k*xint+m}; + return pointOnHelix; + } +
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1