lcsim/src/org/lcsim/util/swim
diff -u -r1.10 -r1.11
--- Helix.java 26 Aug 2005 08:23:26 -0000 1.10
+++ Helix.java 26 Aug 2005 17:37:04 -0000 1.11
@@ -19,7 +19,7 @@
* All quantities in this class are dimensionless. It has no dependencies
* except for Hep3Vector (which could easily be removed).
* @author tonyj
- * @version $Id: Helix.java,v 1.10 2005/08/26 08:23:26 jstrube Exp $
+ * @version $Id: Helix.java,v 1.11 2005/08/26 17:37:04 jstrube Exp $
*/
public class Helix implements Trajectory
{
@@ -37,7 +37,8 @@
this.phi = phi;
// Calculate some useful quantities
-
+ cosPhi = cos(phi);
+ sinPhi = sin(phi);
cosLambda = cos(lambda);
sinLambda = sin(lambda);
xCenter = origin.x() + radius*sin(phi);
@@ -85,8 +86,6 @@
*/
// FIXME works only in the first period apparently. Fix: translate along z into first period.
public double getDistanceFromHelixToPoint(Hep3Vector point) {
- double cosPhi = cos(phi);
- double sinPhi = sin(phi);
double tanLambda = sinLambda/cosLambda;
double px = radius*cosPhi;
double py = radius*sinPhi;
@@ -118,8 +117,6 @@
* @return the distance in mm between the point and the helix at the point of closest approach
*/
public double getSignedClosestDifferenceToPoint(Hep3Vector point) {
- double cosPhi = cos(phi);
- double sinPhi = sin(phi);
double tanLambda = sinLambda/cosLambda;
double px = radius*cosPhi;
double py = radius*sinPhi;
@@ -137,8 +134,8 @@
// Returns the "momentum" at the length s from the starting point.
// This uses the definition in http://www.phys.ufl.edu/~avery/fitting/transport.pdf
Hep3Vector getMomentumAtDistance(double s) {
- double p0x = radius*cos(phi);
- double p0y = radius*sin(phi);
+ double p0x = radius*cosPhi;
+ double p0y = radius*sinPhi;
double p0z = radius*sinLambda/cosLambda;
double rho = -cosLambda/radius;
@@ -154,6 +151,8 @@
private double radius;
private double sinLambda;
private double cosLambda;
+ private double sinPhi;
+ private double cosPhi;
private double phi;
private double phiToCenter;
private double radiusOfCenter;