Commit in hps-java/src/main/java/org/lcsim/hps/users/omoreno on MAIN | |||
ExtendTrack.java | -251 | 1.5 removed |
ExtendTrack - Deprecated
diff -N ExtendTrack.java --- ExtendTrack.java 4 Sep 2012 22:55:18 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,251 +0,0 @@
-package org.lcsim.hps.users.omoreno; - -//--- hep ---// -import hep.physics.vec.BasicHep3Vector; -import hep.physics.vec.Hep3Vector; - -//--- org.lcsim ---// -import hep.physics.vec.VecOp; -import org.lcsim.event.Track; - -/** - * - * @author Omar Moreno <[log in to unmask]> - * @version $Id: ExtendTrack.java,v 1.5 2012/09/04 22:55:18 meeg Exp $ - */ -public class ExtendTrack { - - public static final double ECAL_FACE = 1450; // mm - public static final double DIPOLE_EDGE = 914; // mm - Track track; - double[] trackParameters; - boolean debug = true; - - /** - * - */ - public ExtendTrack() { - track = null; - } - - /** - * - */ - public void setTrack(Track track) { - this.track = track; - trackParameters = new double[9]; - this.setTrackParameters(track); - } - - /** - * - */ - public void setTrackParameters(Track track) { - - // All track parameters are in LCSim coordinates system - trackParameters[0] = track.getTrackParameter(0); // DOCA - trackParameters[1] = track.getTrackParameter(1); // phi0 - trackParameters[2] = 1 / track.getTrackParameter(2); // R - trackParameters[3] = -this.getDoca() * Math.sin(this.getPhi0()); // x0 - trackParameters[4] = this.getDoca() * Math.cos(this.getPhi0()); // y0 - trackParameters[5] = track.getTrackParameter(3); // z0 - trackParameters[6] = track.getTrackParameter(4); // tan(Lambda) - trackParameters[7] = (this.getR() - this.getDoca()) * Math.sin(this.getPhi0()); // xc - trackParameters[8] = -(this.getR() - this.getDoca()) * Math.cos(this.getPhi0()); // yc - } - - /** - * - */ - public double getDoca() { - return trackParameters[0]; - } - - /** - * - */ - public double getPhi0() { - return trackParameters[1]; - } - - /** - * - */ - public double getR() { - return trackParameters[2]; - } - - /** - * - */ - public double getX0() { - return trackParameters[3]; - } - - /** - * - */ - public double getY0() { - return trackParameters[4]; - } - - /** - * - */ - public double getZ0() { - return trackParameters[5]; - } - - /** - * - */ - public double getTanLambda() { - return trackParameters[6]; - } - - /** - * - */ - public double getXC() { - return trackParameters[7]; - } - - /** - * - */ - public double getYC() { - return trackParameters[8]; - } - - /** - * - */ - public void printTrackParameters() { - System.out.println(" DOCA: " + this.getDoca() - + " phi0: " + this.getPhi0() - + " R: " + this.getR() - + " x0: " + this.getX0() - + " y0: " + this.getY0() - + " z0: " + this.getZ0() - + " tan(Lambda): " + this.getTanLambda() - + " xc: " + this.getXC() - + " yc: " + this.getYC()); - - } - - /** - * - */ - public double getXOnHelixProjection(double y) { - - // Check if a track has been set - if (track == null) { - throw new RuntimeException("Track has not been set!"); - } - - // Find the x position - return this.getXC() - + Math.signum(this.getR()) * Math.sqrt(this.getR() * this.getR() - Math.pow(y - this.getYC(), 2)); - } - - /** - * - */ - public double getYOnHelixProjection(double x) { - - // Check if a track has been set - if (track == null) { - throw new RuntimeException("Track has not been set!"); - } - - return this.getYC() - + Math.signum(this.getR()) * Math.sqrt(this.getR() * this.getR() - Math.pow(x - this.getXC(), 2)); - - } - - /** - * - */ - public double arcLength(double x, double y) { - - double phi0 = Math.atan2(this.getY0() - this.getYC(), this.getX0() - this.getXC()); - double phi = Math.atan2(y - this.getYC(), x - this.getXC()); - double dphi = phi - phi0; - - if (dphi > Math.PI) { - dphi -= 2. * Math.PI; - } - if (dphi < -Math.PI) { - dphi += 2. * Math.PI; - } - - return -this.getR() * dphi; - } - - /** - * - */ - public Hep3Vector positionAtEcal() { - - // Check if a track has been set - if (track == null) { - throw new RuntimeException("Track has not been set!"); - } - - return this.extrapolateTrack(ECAL_FACE); - } - - /** - * - */ - public Hep3Vector extrapolateTrack(double x) { - - if (x > DIPOLE_EDGE) { - -// double yDipole = this.getYOnHelixProjection(DIPOLE_EDGE); -// double s = this.arcLength(DIPOLE_EDGE, yDipole); -// double zDipole = this.getZ0() + s*this.getTanLambda(); -// double phi = this.getPhi0() - s/this.getR(); - - double phi = phiAtX(DIPOLE_EDGE); - Hep3Vector posAtDipole = extrapolateTrack(DIPOLE_EDGE); - Hep3Vector velAtDipole = new BasicHep3Vector(Math.cos(phi), Math.sin(phi), this.getTanLambda()); - double dx = x - DIPOLE_EDGE; - Hep3Vector delta = VecOp.mult(dx / velAtDipole.x(), velAtDipole); - return VecOp.add(posAtDipole, delta); -// double r = dx/(Math.cos(phi)*(1/Math.sqrt(1 + Math.pow(this.getTanLambda(), 2)))); -// double dy = r*Math.sin(phi)*(1/Math.sqrt(1 + Math.pow(this.getTanLambda(), 2))); -// double dz = r*(this.getTanLambda()/Math.sqrt(1 + Math.pow(this.getTanLambda(), 2))); -// -// double y = yDipole + dy; -// double z = zDipole + dz; - - } else if (x < 0) { - double phi = phiAtX(0); - Hep3Vector posAtDipole = extrapolateTrack(0); - Hep3Vector velAtDipole = new BasicHep3Vector(Math.cos(phi), Math.sin(phi), this.getTanLambda()); - double dx = x - 0; - Hep3Vector delta = VecOp.mult(dx / velAtDipole.x(), velAtDipole); - return VecOp.add(posAtDipole, delta); - -// double dx = x - this.getX0(); -// double r = dx/(Math.cos(this.getPhi0())*(1/Math.sqrt(1 + Math.pow(this.getTanLambda(), 2)))); -// double dy = r*Math.sin(this.getPhi0())*(1/Math.sqrt(1 + Math.pow(this.getTanLambda(), 2))); -// double dz = r*(this.getTanLambda()/Math.sqrt(1 + Math.pow(this.getTanLambda(), 2))); -// -// double y = this.getY0() + dy; -// double z = this.getZ0() + dz; -// -// return new BasicHep3Vector(x, y, z); - } else { - double phi = phiAtX(x); - double y = this.getYC() + this.getR() * Math.cos(phi); - double z = this.getZ0() - this.getR() * (phi - this.getPhi0()) * this.getTanLambda(); - return new BasicHep3Vector(x, y, z); - } - } - - public double phiAtX(double x) { - return Math.asin((this.getXC() - x) / this.getR()); //always chooses phi between -pi/2 and pi/2 (so track is going in +x direction) - } -}
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