Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/users/omoreno on MAIN
ExtendTrack.java+131added 1.1
Methods to Extend Track to Ecal

hps-java/src/main/java/org/lcsim/hps/users/omoreno
ExtendTrack.java added at 1.1
diff -N ExtendTrack.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ExtendTrack.java	9 May 2012 11:41:32 -0000	1.1
@@ -0,0 +1,131 @@
+package org.lcsim.hps.users.omoreno;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import org.lcsim.recon.tracking.seedtracker.SeedTrack;
+
+/**
+ * 
+ * @author Omar Moreno <[log in to unmask]>
+ * @version $Id: ExtendTrack.java,v 1.1 2012/05/09 11:41:32 omoreno Exp $
+ */
+
+public class ExtendTrack {
+	
+	
+	public static final double ECAL_POSITION = 1470; // mm
+	public static final double DIPOLE_EDGE = 914.4; // mm
+	
+	/**
+	 * 
+	 */
+	public ExtendTrack(){ 
+	}
+
+	/**
+	 * 
+	 */
+	public static double arcLengthToYPlane(SeedTrack track, double y){
+		
+		// Get the track parameters
+		double doca = track.getTrackParameter(0);   
+		double phi0 = track.getTrackParameter(1);
+		double R    = 1/track.getTrackParameter(2);
+		
+		// Get the coordinates of the distance of closest approach
+		double x0 = -doca*Math.sin(phi0);
+		double y0 = doca*Math.cos(phi0);
+	
+		// Get the coordinates of the helix center
+		double xc = (R - doca)*Math.sin(phi0);
+		double yc = -(R - doca)*Math.cos(phi0);
+		
+		System.out.println("x0: " + x0 + " y0: " + y0);
+		System.out.println("Phi0: " + track.getTrackParameter(1));
+		System.out.println("xc: " + xc + " yc: " + yc);
+		
+		// Find the x-coor dinate 
+		double x = xc + Math.signum(R)*Math.sqrt(R*R - Math.pow(y-yc, 2));
+		
+		System.out.println("X Position: " + x);
+		
+		return arcLength(R, x0, y0, x, y, xc, yc);
+	}
+	
+	/**
+	 * 
+	 */
+	public static double arcLength(double R,  double x1, double y1, double x2, double y2,
+								   double xc, double yc){
+		
+        //  Find the angle between these points measured wrt the circle center
+        double phi1 = Math.atan2(y1 - yc, x1 - xc);
+		System.out.println("Phi 1: " + phi1);
+        
+        double phi2 = Math.atan2(y2 - yc, x2 - xc);
+        System.out.println("Phi 2: " + phi2);
+        double dphi = phi2 - phi1;
+        
+        //  Make sure dphi is in the valid range (-pi, pi)
+        if (dphi >  Math.PI) dphi -= 2. * Math.PI;
+        if (dphi < -Math.PI) dphi += 2. * Math.PI;
+        
+        System.out.println("phi: " + dphi);
+        
+        //  Return the arc length
+        return -R * dphi;
+	}
+
+	/**
+	 * 
+	 */
+	public static Hep3Vector positionOnHelix(SeedTrack track, double s){
+		
+		// Get the track parameters
+		double doca = track.getTrackParameter(0);   
+		double phi0 = track.getTrackParameter(1);
+		double R    = 1/track.getTrackParameter(2);
+		double z0 = track.getTrackParameter(3);
+		double tanLambda = track.getTrackParameter(4);
+		
+		// Find the azimuthal angle at this position
+		double phi = phi0 - s/R;
+		
+		// Get the coordinates of the helix center
+		double xc = (R - doca)*Math.sin(phi0);
+		double yc = -(R - doca)*Math.cos(phi0);
+		
+		// Find the position on the helix
+		double x = xc - R*Math.sin(phi);
+		double y = yc - R*Math.cos(phi);
+		double z = z0 + s*tanLambda;
+	
+		return new BasicHep3Vector(x, y, z);
+	}
+	
+	/**
+	 * 
+	 */
+	public static Hep3Vector positionAtEcal(SeedTrack track){
+		
+		double arcLengthDPEdge = arcLengthToYPlane(track, DIPOLE_EDGE);
+		Hep3Vector position = positionOnHelix(track, arcLengthDPEdge);
+		
+		// Get the track parameters
+		double phi0 = track.getTrackParameter(1);
+		double R    = 1/track.getTrackParameter(2);
+		double tanTheta = 1/track.getTrackParameter(4);
+		
+		// Find the azimuthal angle at this position
+		double phi = phi0 - arcLengthDPEdge/R;
+		
+		double xEcal = position.x() + (ECAL_POSITION - DIPOLE_EDGE)/Math.tan(phi);
+		double zEcal = position.z() + (ECAL_POSITION - DIPOLE_EDGE)/tanTheta;
+		
+		return new BasicHep3Vector(xEcal, ECAL_POSITION, zEcal);
+	}
+	
+	public static  Hep3Vector position
+
+}
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1