lcsim/sandbox/RobKutschke/TRFTests/v1
diff -N VTUtil.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ VTUtil.java 18 Sep 2007 17:54:53 -0000 1.1
@@ -0,0 +1,81 @@
+import org.lcsim.recon.tracking.trfbase.VTrack;
+import org.lcsim.recon.tracking.trfbase.Surface;
+
+import org.lcsim.recon.tracking.trfcyl.SurfCylinder;
+import org.lcsim.recon.tracking.trfzp.SurfZPlane;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.BasicHep3Vector;
+
+/**
+ *
+ * Compute various derived quantities from a VTrack.
+ * Still under construction.
+ *
+ *@author $Author: kutschke $
+ *@version $Id: VTUtil.java,v 1.1 2007/09/18 17:54:53 kutschke Exp $
+ *
+ * Date $Date: 2007/09/18 17:54:53 $
+ *
+ */
+
+
+public class VTUtil {
+
+ public VTUtil( VTrack v){
+ this.v = v;
+ Surface s = v.surface();
+
+ if ( s.pureType().equals( SurfCylinder.staticType()) ){
+ DoCylinder();
+ } else{
+ DoNull();
+ }
+ }
+
+ public double momentum(){
+ return p;
+ }
+
+ public Hep3Vector asHep3Vector(){
+ double px = pt*Math.cos(phi);
+ double py = pt*Math.sin(phi);
+ double pz = p *costh;
+ return new BasicHep3Vector(px,py,pz);
+ }
+
+ public double costh(){
+ return costh;
+ }
+
+ public double sinth(){
+ return sinth;
+ }
+
+ private VTrack v = null;
+ private double costh;
+ private double sinth;
+ private double cotth;
+ private double pt;
+ private double p;
+ private double phi;
+ private double phi0;
+
+ private void DoCylinder(){
+ cotth = v.vector(SurfCylinder.ITLM);
+ sinth = 1./Math.sqrt( 1. + cotth*cotth );
+ costh = cotth*sinth;
+ pt = 1./Math.abs(v.vector(SurfCylinder.IQPT));
+ p = pt/sinth;
+ phi = v.vector(SurfCylinder.IPHI)+v.vector(SurfCylinder.IALF);
+ }
+ private void DoNull(){
+ cotth = 0.;
+ costh = 0.;
+ sinth = 0.;
+ pt = 0.;
+ p = 0.;
+ phi = 0.;
+ }
+
+
+}