Print

Print


Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/util/swim on MAIN
Helix.java+4-171.4 -> 1.5
Bug fix in PCA XY computation

lcsim-contrib/src/main/java/org/lcsim/contrib/onoprien/util/swim
Helix.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- Helix.java	23 Feb 2009 03:44:19 -0000	1.4
+++ Helix.java	24 Feb 2009 02:59:34 -0000	1.5
@@ -9,7 +9,7 @@
  * Helical {@link Trajectory} with its axis parallel to Z.
  *
  * @author D. Onoprienko
- * @version $Id: Helix.java,v 1.4 2009/02/23 03:44:19 onoprien Exp $
+ * @version $Id: Helix.java,v 1.5 2009/02/24 02:59:34 onoprien Exp $
  */
 public class Helix extends AbstractTrajectory {
   
@@ -39,7 +39,7 @@
     Z0,
 
     /** Tangent of the dip angle (dZ/sqrt(dX**2+dY**2)). */
-    LAMBDA
+    TAN_LAMBDA
   }
   
   /** Emumeration of helix parameters in V-representation. */
@@ -96,7 +96,7 @@
     _phi0 = parameters.get(CRep.PHI0);
     _c = parameters.get(CRep.C);
     _z0 = parameters.get(CRep.Z0);
-    _tan = parameters.get(CRep.LAMBDA);
+    _tan = parameters.get(CRep.TAN_LAMBDA);
     repCtoV();
   }
 
@@ -196,22 +196,15 @@
    * Sets the reference point for VRep-representation of the helix parameters.
    */
   public void setReferencePoint(Hep3Vector referencePoint) {
-//    System.out.println("");
-//    System.out.println("Setting reference point for "+ this);
-//    System.out.println("Ref point "+ referencePoint);
-//    System.out.println("Helix: origin "+ _orig +" dir "+ _dir +" curvature "+ _c);
-//    System.out.println("Center "+ getCenter().x() +" "+ getCenter().y() +"  Radius "+ getRadius());
     _ref = (referencePoint instanceof ConstHep3Vector) ? (ConstHep3Vector)referencePoint : new ConstHep3Vector(referencePoint);
     Intersection inter = intersect(new PocaXY(referencePoint));
     if (!inter.hasNext()) inter.stepBack();
     Hep3Vector pos = inter.getPosition();
-//    System.out.println("POCA for "+ _ro +" : "+ pos);
     Hep3Vector d = inter.getDirection();
     _phi0 = Math.atan2(d.y(), d.x());
     _d0 = (pos.y()-_ref.y())*Math.cos(_phi0) - (pos.x()-_ref.x())*Math.sin(_phi0);
     _z0 = pos.z();
     _tan = _dir.z()/Math.hypot(_dir.x(), _dir.y());
-//    System.out.println("Phi0 "+ _phi0 +" d0 "+ _d0 +" _z0 "+ _z0 +" tanLambda "+ _tan);
   }
   
 // -- Position at the given point :  -------------------------------------------
@@ -285,16 +278,12 @@
    * Z coordinate of the specified reference point is ignored - might want to change this behavior later.
    */
   public Intersection intersect(PocaXY poca) {
-//    System.out.println("");
-//    System.out.println("Finding intersection");
     Hep3Vector point = poca.getPoint();
     double deltaX = _orig.x() - point.x();
     double deltaY = _orig.y() - point.y();
-    double a1 = 1. - _dir.z()*_dir.z() - _ro*(_dir.y()*deltaX-_dir.x()*deltaY);
+    double a1 = 1. - _dir.z()*_dir.z() + _ro*(_dir.y()*deltaX-_dir.x()*deltaY);
     double a2 = _dir.x()*deltaX + _dir.y()*deltaY;
     double a12 = Math.sqrt(a1*a1 + _ro*_ro*a2*a2);
-    //double d2 = _dir.x()*_dir.x() + _dir.y() + _dir.y();
-    //double a12 = Math.sqrt(_ro*_ro*d2*(deltaX*deltaX+deltaY*deltaY)+2.*_ro*d2*(_dir.y()*deltaX-_dir.x()*deltaY)+d2*d2);
     double cos = a1/a12;
     double sin = - (_ro*a2)/a12;
     double s = getLength(sin,cos);
@@ -303,8 +292,6 @@
     double ny = _dir.y()/_ro;
     double x = _orig.x() + nx * sin + ny * (1-cos);
     double y = _orig.y() + ny * sin - nx * (1-cos);
-//    System.out.println("Found "+ x +" "+ y);
-//    System.out.println("Found s = "+ s +" to point "+ getPosition(s));
     return new IntersectionSingle(s, this, poca);
   }
 
CVSspam 0.2.8