4 modified files
lcsim/src/org/lcsim/util/swim
diff -u -r1.22 -r1.23
--- Helix.java 8 Jul 2006 10:21:54 -0000 1.22
+++ Helix.java 15 Jul 2006 09:38:56 -0000 1.23
@@ -1,18 +1,19 @@
package org.lcsim.util.swim;
-import static java.lang.Math.asin;
import static java.lang.Math.abs;
-import static java.lang.Math.signum;
+import static java.lang.Math.asin;
import static java.lang.Math.atan2;
import static java.lang.Math.cos;
+import static java.lang.Math.signum;
import static java.lang.Math.sin;
import static java.lang.Math.sqrt;
-import static java.lang.Math.PI;
-
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
import hep.physics.vec.VecOp;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+
/**
* This class represents a helix with its axis aligned along Z.
* All quantities in this class are dimensionless. It has no dependencies
@@ -21,7 +22,7 @@
* For more info on swimming see <a href="doc-files/transport.pdf">this paper</a>
* by Paul Avery.
* @author tonyj
- * @version $Id: Helix.java,v 1.22 2006/07/08 10:21:54 jstrube Exp $
+ * @version $Id: Helix.java,v 1.23 2006/07/15 09:38:56 jstrube Exp $
*/
public class Helix implements Trajectory
{
@@ -36,21 +37,21 @@
* @param phi The polar angle of the helix <em>momentum</em> in x-y plane w/rt positive x-axis at the origin
* @param lambda The dip angle w/rt positive part of the x-y plane
*/
- public Helix(Hep3Vector origin, double radius, double phi, double lambda)
+ public Helix(Hep3Vector org, double r, double p, double lambda)
{
// if (abs(lambda) > PI/2.)
// throw new IllegalArgumentException("lambda = " + lambda + " is outside of -PI/2<lambda<PI/2");
- this.origin = origin;
- this.radius = radius;
- this.phi = phi;
+ origin = org;
+ radius = r;
+ phi = p;
// Calculate some useful quantities
cosPhi = cos(phi);
sinPhi = sin(phi);
cosLambda = cos(lambda);
sinLambda = sin(lambda);
- xCenter = origin.x() + radius*sin(phi);
- yCenter = origin.y() - radius*cos(phi);
+ xCenter = origin.x() + radius*sinPhi;
+ yCenter = origin.y() - radius*cosPhi;
setSpatialParameters();
}
@@ -58,13 +59,13 @@
* returns a point on the Helix at a distance alpha from the origin along
* the trajectory. alpha == 2*PI*radius/cos(lambda) is one rotation in the x-y plane
*/
- public Hep3Vector getPointAtDistance(double alpha)
+ public SpacePoint getPointAtDistance(double alpha)
{
double darg = alpha*cosLambda/radius - phi;
double x = xCenter + radius*sin( darg );
double y = yCenter + radius*cos( darg );
double z = origin.z() + alpha*sinLambda;
- return new BasicHep3Vector(x,y,z);
+ return new CartesianPoint(x,y,z);
}
public double getRadius() {
lcsim/src/org/lcsim/util/swim
diff -u -r1.6 -r1.7
--- Trajectory.java 28 Sep 2005 22:39:57 -0000 1.6
+++ Trajectory.java 15 Jul 2006 09:38:56 -0000 1.7
@@ -1,18 +1,20 @@
package org.lcsim.util.swim;
+import org.lcsim.spacegeom.SpacePoint;
+
import hep.physics.vec.Hep3Vector;
/**
* A particle trajectory (either a Helix or a Line)
* @author tonyj
- * @version $Id: Trajectory.java,v 1.6 2005/09/28 22:39:57 mcharles Exp $
+ * @version $Id: Trajectory.java,v 1.7 2006/07/15 09:38:56 jstrube Exp $
*/
public interface Trajectory
{
/**
* Gets a point after traveling distance alpha from the origin along the trajectory
*/
- Hep3Vector getPointAtDistance(double alpha);
+ SpacePoint getPointAtDistance(double alpha);
/**
* Calculates the distance at which the trajectory first reaches radius R.
* Returns Double.NaN if the trajectory does not intercept the cylinder.
lcsim/src/org/lcsim/util/swim
diff -u -r1.9 -r1.10
--- Line.java 8 Feb 2006 22:37:45 -0000 1.9
+++ Line.java 15 Jul 2006 09:38:56 -0000 1.10
@@ -4,10 +4,13 @@
import hep.physics.vec.Hep3Vector;
import hep.physics.vec.VecOp;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+
/**
* A straight line
* @author tonyj
- * @version $Id: Line.java,v 1.9 2006/02/08 22:37:45 mcharles Exp $
+ * @version $Id: Line.java,v 1.10 2006/07/15 09:38:56 jstrube Exp $
*/
public class Line implements Trajectory
{
@@ -36,13 +39,13 @@
* Gets a point after traveling distance alpha from the trajectory's
* origin point along the trajectory
*/
- public Hep3Vector getPointAtDistance(double alpha)
+ public SpacePoint getPointAtDistance(double alpha)
{
double z = origin.z() + alpha*sinLambda;
double dr = alpha*cosLambda;
double x = origin.x() + dr*cosPhi;
double y = origin.y() + dr*sinPhi;
- return new BasicHep3Vector(x,y,z);
+ return new CartesianPoint(x,y,z);
}
/**
@@ -57,27 +60,25 @@
// This is a special case where the line is parallel to the z-axis.
// There can be no well-defined answer in this case
return Double.NaN;
- } else {
- // Find the intercepts on the cylinder (Cartesian):
- double[] distances = this.findInterceptsOnCylinder(r);
- // Which is the best?
- double bestDistance = -1.0;
- for (int i=0; i<distances.length; i++) {
- if (distances[i] >= 0.0) {
- // Potentially valid -- is it the best so far?
- if (bestDistance<0.0 || distances[i]<bestDistance) {
- // Yes!
- bestDistance = distances[i];
- }
+ }
+ // Find the intercepts on the cylinder (Cartesian):
+ double[] distances = this.findInterceptsOnCylinder(r);
+ // Which is the best?
+ double bestDistance = -1.0;
+ for (int i=0; i<distances.length; i++) {
+ if (distances[i] >= 0.0) {
+ // Potentially valid -- is it the best so far?
+ if (bestDistance<0.0 || distances[i]<bestDistance) {
+ // Yes!
+ bestDistance = distances[i];
}
}
- if (bestDistance < 0.0) {
- // There was no valid (positive) solution
- return Double.NaN;
- } else {
- return bestDistance;
- }
}
+ if (bestDistance < 0.0) {
+ // There was no valid (positive) solution
+ return Double.NaN;
+ }
+ return bestDistance;
}
/**
lcsim/src/org/lcsim/util/swim
diff -u -r1.16 -r1.17
--- HelixSwimmer.java 8 Jul 2006 10:21:54 -0000 1.16
+++ HelixSwimmer.java 15 Jul 2006 09:38:56 -0000 1.17
@@ -4,6 +4,8 @@
import hep.physics.vec.Hep3Vector;
import org.lcsim.constants.Constants;
import org.lcsim.event.Track;
+import org.lcsim.spacegeom.SpacePoint;
+
import static java.lang.Math.abs;
import static java.lang.Math.signum;
@@ -14,7 +16,7 @@
* For more info on swimming see <a href="doc-files/transport.pdf">this paper</a>
* by Paul Avery.
* @author tonyj
- * @version $Id: HelixSwimmer.java,v 1.16 2006/07/08 10:21:54 jstrube Exp $
+ * @version $Id: HelixSwimmer.java,v 1.17 2006/07/15 09:38:56 jstrube Exp $
*/
public class HelixSwimmer
{
@@ -80,7 +82,7 @@
spatialParms.isInvalid = true;
track=t;
}
- public Hep3Vector getPointAtDistance(double alpha)
+ public SpacePoint getPointAtDistance(double alpha)
{
if (trajectory == null) throw new RuntimeException("Trajectory not set");
return trajectory.getPointAtDistance(alpha);
CVSspam 0.2.8