hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.4 -r1.5
--- TrackUtils.java 27 Aug 2012 20:02:04 -0000 1.4
+++ TrackUtils.java 28 Sep 2012 22:07:28 -0000 1.5
@@ -3,14 +3,22 @@
//--- hep ---//
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+import java.util.List;
//--- org.lcsim ---//
import org.lcsim.event.Track;
+import org.lcsim.event.TrackState;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
+import org.lcsim.fit.helicaltrack.HelixUtils;
+import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
+import org.lcsim.recon.tracking.seedtracker.SeedTrack;
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: TrackUtils.java,v 1.4 2012/08/27 20:02:04 meeg Exp $
+ * @version $Id: TrackUtils.java,v 1.5 2012/09/28 22:07:28 phansson Exp $
* TODO: Switch to JLab coordinates
*/
@@ -194,6 +202,63 @@
return new BasicHep3Vector(x, y, z);
}
+
+
+ public double calculateHelixInterceptXPlane(HelicalTrackFit helfit, HelicalTrackStrip strip) {
+ /*
+ * Calculate the interception path length on the helix
+ * where the track fit and the plane (where the strip is located) intercepts
+ */
+ boolean _DEBUG = false;
+
+ HelicalTrackFit cfit = helfit;
+ if(cfit==null) {
+ SeedTrack st = (SeedTrack) track;
+ SeedCandidate seed = st.getSeedCandidate();
+ cfit = seed.getHelix();
+ }
+ if(_DEBUG) {
+ System.out.println(this.getClass().getSimpleName() + ": calculateHelixIntercept ---");
+ System.out.println(this.getClass().getSimpleName() + ": Track curvatute " + cfit.curvature() + " phi0 " + cfit.phi0());
+ }
+ //Get the origin of the plane
+ Hep3Vector org = strip.origin();
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": origin of plane " + org.toString());
+
+ //Get the point on the helix at the origin
+ double xint = org.x();
+ double s = HelixUtils.PathToXPlane(cfit, xint,0,0).get(0);
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": xint " + xint + " s " + s );
+
+ //Calculate that point in space
+ Hep3Vector pos_xint = HelixUtils.PointOnHelix(cfit, s);
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": xint position " + pos_xint.toString());
+
+ //Create a vector that points from the origin to that point
+ Hep3Vector vec_xint = VecOp.sub(pos_xint, org);
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": vec_xint " + vec_xint.toString());
+
+ //Get the v in global coordinates
+ // v tells how the unmeasured coordinate is oriented in the tracking frame
+ Hep3Vector v = strip.v();
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": v " + v.toString());
+
+ // We are basically looking for the point where v and track intercepts in the x-y plane
+ // Assuming that the track travels parallel to the x axis we can calculate the
+ // the correction to xint by scaling
+ // NEED TO TAKE INTO ACCOUNT THE REAL TRACK TRAJECTORY!!
+ double x_corr = vec_xint.y() * v.x()/v.y();
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": vy " + vec_xint.y() + " vx/vy " + v.x()/v.y() + " -> " + "x_corr " + x_corr);
+ double xint_new = xint + x_corr;
+ if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": final xint_new " + xint_new);
+
+ return xint_new;
+
+
+ }
+
+
+
/**
*
*/