hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.29 -r1.30
--- TrackUtils.java 14 Oct 2013 22:58:03 -0000 1.29
+++ TrackUtils.java 14 Oct 2013 23:50:39 -0000 1.30
@@ -40,7 +40,7 @@
* Re-use as much of HelixUtils as possible.
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: TrackUtils.java,v 1.29 2013/10/14 22:58:03 phansson Exp $
+ * @version $Id: TrackUtils.java,v 1.30 2013/10/14 23:50:39 phansson Exp $
* TODO: Switch to tracking/LCsim coordinates for the extrapolation output!
*/
@@ -52,13 +52,30 @@
private TrackUtils(){
}
+ /**
+ * Extrapolate track to a position along the x-axis. Turn the track into a helix object in order to use HelixUtils.
+ * @param track
+ * @param x
+ * @return
+ */
public static Hep3Vector extrapolateHelixToXPlane(Track track, double x){
return extrapolateHelixToXPlane(getHTF(track),x);
}
+
+ /**
+ * Extrapolate helix to a position along the x-axis. Re-use HelixUtils.
+ * @param track
+ * @param x
+ * @return
+ */
public static Hep3Vector extrapolateHelixToXPlane(HelicalTrackFit htf, double x){
double s = HelixUtils.PathToXPlane(htf, x, 0., 0).get(0);
return HelixUtils.PointOnHelix(htf, s);
}
+
+ // ==========================================================================
+ // Helper functions for track parameters and commonly used derived variables
+
public static double getPhi(Track track, Hep3Vector position){
double x = Math.sin(getPhi0(track)) - (1/getR(track))*(position.x() - getX0(track));
double y = Math.cos(getPhi0(track)) + (1/getR(track))*(position.y() - getY0(track));
@@ -91,13 +108,19 @@
public static double getCosTheta(Track track){
return getTanLambda(track)/Math.sqrt(1 + Math.pow(getTanLambda(track), 2));
}
+ // ==========================================================================
+ /**
+ * Calculate the point of interception between the helix and a plane in space. Uses an iterative procedure.
+ * @param helfit - helix
+ * @param unit_vec_normal_to_plane - unit vector normal to the plane
+ * @param point_on_plane - point on the plane
+ * @param bfield - magnetic field value
+ * @return point at intercept
+ */
public static Hep3Vector getHelixPlaneIntercept(HelicalTrackFit helfit, Hep3Vector unit_vec_normal_to_plane,Hep3Vector point_on_plane, double bfield) {
- /*
- * Use code in WTrack to find the iterative solution to the interception
- */
boolean debug = false;
boolean flipBfield = true; // be careful
Hep3Vector B = new BasicHep3Vector(0,0,flipBfield?-1:1);
@@ -108,6 +131,13 @@
return intercept_point;
}
+ /**
+ * Calculate the point of interception between the helix and a plane in space. Uses an iterative procedure.
+ * @param helfit - helix
+ * @param strip - strip cluster that will define the plane
+ * @param bfield - magnetic field value
+ * @return point at intercept
+ */
public static Hep3Vector getHelixPlaneIntercept(HelicalTrackFit helfit, HelicalTrackStrip strip, double bfield) {
Hep3Vector point_on_plane = strip.origin();
Hep3Vector unit_vec_normal_to_plane = VecOp.cross(strip.u(),strip.v());//strip.w();
@@ -139,14 +169,30 @@
+ /**
+ * Get position of a track extrapolated to the HARP in the HPS test run 2012
+ * @param track
+ * @return position at HARP
+ */
public static Hep3Vector getTrackPositionAtHarp(Track track){
return extrapolateTrack(track, BeamlineConstants.HARP_POSITION);
}
+ /**
+ * Get position of a track extrapolated to the ECAL face in the HPS test run 2012
+ * @param track
+ * @return position at ECAL
+ */
public static Hep3Vector getTrackPositionAtEcal(Track track){
return extrapolateTrack(track, BeamlineConstants.ECAL_FACE);
}
+ /**
+ * Extrapolate track to given position.
+ * @param helix - to be extrapolated
+ * @param track - position along the x-axis of the helix in lcsim coordiantes
+ * @return
+ */
public static Hep3Vector extrapolateTrack(Track track, double z){
Hep3Vector trackPosition = null;
@@ -178,6 +224,12 @@
return new BasicHep3Vector(x, y, z);
}
+ /**
+ * Extrapolate helix to given position
+ * @param helix - to be extrapolated
+ * @param z - position along the x-axis of the helix in lcsim coordiantes
+ * @return
+ */
public static Hep3Vector extrapolateTrack(HelicalTrackFit helix, double z){
SeedTrack trk = new SeedTrack();
//bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0, 0, 0)).y()));
@@ -275,7 +327,6 @@
boolean debug = false;
ITransform3D localToGlobal = sensor.getGeometry().getLocalToGlobal();
- Hep3Vector sensorPos = sensor.getGeometry().getPosition();
Box sensorSolid = (Box) sensor.getGeometry().getLogicalVolume().getSolid();
Polygon3D sensorFace = sensorSolid.getFacesNormalTo(new BasicHep3Vector(0, 0, 1)).get(0);
if(debug){
@@ -644,7 +695,7 @@
if( track.getClass().isInstance(SeedTrack.class) ) {
return ((SeedTrack) track).getSeedCandidate().getHelix();
} else {
- return getHTF(track.getTrackParameters());
+ return getHTF(track.getTrackStates().get(0).getParameters());
}
}