Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN
HPSTrack.java+38-231.2 -> 1.3
Extrapolation now returns the position and momentum (as a Hep3Vector Array)

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSTrack.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- HPSTrack.java	23 Jul 2012 21:45:02 -0000	1.2
+++ HPSTrack.java	23 Jul 2012 22:11:32 -0000	1.3
@@ -83,8 +83,8 @@
         calculateParametersAtDocaY();
         calculateParametersAtDocaZ();
     }
-    
-     public HPSTrack(HelicalTrackFit htf) {
+
+    public HPSTrack(HelicalTrackFit htf) {
         super(htf.parameters(), htf.covariance(), htf.chisq(), htf.ndf(), htf.PathMap(), htf.ScatterMap());
         _detToTrk = new HPSTransformations();
         calculateParametersAtTarget();
@@ -92,6 +92,9 @@
         calculateParametersAtDocaZ();
     }
 
+    /**
+     Get map of the the track trajectory within the uniform bfield
+     */
     public Map<Integer, Double[]> trackTrajectory(double zStart, double zStop, int nSteps) {
         Map<Integer, Double[]> traj = new HashMap<Integer, Double[]>();
         double step = (zStop - zStart) / nSteps;
@@ -110,6 +113,9 @@
         return traj;
     }
 
+    /**
+     Get map of the the track direction within the uniform bfield
+     */
     public Map<Integer, Double[]> trackDirection(double zStart, double zStop, int nSteps) {
         Map<Integer, Double[]> traj = new HashMap<Integer, Double[]>();
         double step = (zStop - zStart) / nSteps;
@@ -170,9 +176,9 @@
 
         double startFringe = start;
         double stopFringe = stop;
- //       _debugForward = false;
- //       if (xFinal > 900)
- //           _debugForward = true;
+        //       _debugForward = false;
+        //       if (xFinal > 900)
+        //           _debugForward = true;
         // if looking upstream, we'll be propagating backwards
         if (xFinal < 0) {
             step = -step;
@@ -239,9 +245,9 @@
 
             double fringeFactor = getFringe(Math.signum(step) * (fringeMid - rTmp.x()), fringeHalfWidth);
 //            double myBField=bField * fringeFactor;
-            double myBField=FieldMap.getFieldFromMap(rTmp.x(),rTmp.y());            
+            double myBField = FieldMap.getFieldFromMap(rTmp.x(), rTmp.y());
             if (_debugForward) {
-                System.out.println("rTmp.x() = " + rTmp.x() + " field = " +myBField);
+                System.out.println("rTmp.x() = " + rTmp.x() + " field = " + myBField);
             }
             setTrack(pTmp, rTmp, q, myBField);
             rTmp = _trajectory.getPointAtDistance(step);
@@ -282,18 +288,26 @@
         }
         return _detToTrk.transformVectorToDetector(pointInTrking);
     }
-    
-    
-     public Hep3Vector getPositionAtZMap(double start, double xFinal,  double step) {
+
+    /**
+     Get the position and direction on the track using B-field map for
+     extrapolation
+
+     @param start = starting z-position of extrapolation
+     @param zFinal = final z-position
+     @param step = step size
+     @return position[0] and direction[1] at Z=zfinal
+     */
+    public Hep3Vector[] getPositionAtZMap(double start, double xFinal, double step) {
 
         double startFringe = start;
-        
+
         _debugForward = false;
-       if (xFinal > 900)
+        if (xFinal > 900)
             _debugForward = true;
         // if looking upstream, we'll be propagating backwards
         if (xFinal < 0) {
-            step = -step;        
+            step = -step;
         }
         if (_debugForward)
             System.out.println(this.toString());
@@ -342,7 +356,7 @@
 
         }
         //follow trajectory while:  in fringe field, before end point, and we don't have a looper
-        while (Math.signum(step) * xtmp < Math.signum(step) * xFinal  && Math.signum(pXOrig * pXTmp) > 0) {
+        while (Math.signum(step) * xtmp < Math.signum(step) * xFinal && Math.signum(pXOrig * pXTmp) > 0) {
             if (_debugForward) {
                 System.out.println("New step in Fringe Field");
                 System.out.println("rTmp = " + rTmp.toString());
@@ -351,9 +365,9 @@
                 System.out.println("OriginalHelix Momentum = " + VecOp.mult(pTot, HelixUtils.Direction(this, totalS)));
             }
 
-            double myBField=FieldMap.getFieldFromMap(rTmp.x(),rTmp.y());            
+            double myBField = FieldMap.getFieldFromMap(rTmp.x(), rTmp.y());
             if (_debugForward) {
-                System.out.println("rTmp.x() = " + rTmp.x() + " field = " +myBField);
+                System.out.println("rTmp.x() = " + rTmp.x() + " field = " + myBField);
             }
             setTrack(pTmp, rTmp, q, myBField);
             rTmp = _trajectory.getPointAtDistance(step);
@@ -367,12 +381,15 @@
             }
             totalS += step;
         }
+
         //ok, done with field.
-        Hep3Vector    pointInTrking = new BasicHep3Vector(rTmp.x(), rTmp.y(), rTmp.z());
-          if (_debugForward) {
-                System.out.println("Position at ECal:  x = " + xFinal + "; y = " + pointInTrking.y() + "; z = " + pointInTrking.z());
-            }
-        return _detToTrk.transformVectorToDetector(pointInTrking);
+        Hep3Vector pointInTrking = new BasicHep3Vector(rTmp.x(), rTmp.y(), rTmp.z());
+        if (_debugForward) {
+            System.out.println("Position xfinal (tracking) :  x = " + xFinal + "; y = " + pointInTrking.y() + "; z = " + pointInTrking.z());
+        }
+        Hep3Vector[] out = {_detToTrk.transformVectorToDetector(pointInTrking), _detToTrk.transformVectorToDetector(pTmp)};
+
+        return out;
     }
 
     private double getPhi(double x, double y, double xc, double yc, double sign) {
@@ -434,6 +451,4 @@
             _trajectory = new Line(r0, phi, lambda);
         }
     }
-
-  
 }
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