Print

Print


Commit in lcsim/src/org/lcsim/fit/helicaltrack on MAIN
HelicalTrackCross.java+17-21.9 -> 1.10
Allow track direction to be specified by a helix fit and cache the helix fit to
avoid recomputing stereo hit position/covariance matrix for the same helix.

lcsim/src/org/lcsim/fit/helicaltrack
HelicalTrackCross.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- HelicalTrackCross.java	21 May 2009 21:48:15 -0000	1.9
+++ HelicalTrackCross.java	28 Feb 2011 19:15:17 -0000	1.10
@@ -34,6 +34,7 @@
 public class HelicalTrackCross extends HelicalTrackHit {
     private HelicalTrackStrip _strip1;
     private HelicalTrackStrip _strip2;
+    private HelicalTrackFit _helix;
     private static int _type = 3;
     
     /**
@@ -45,9 +46,10 @@
         super(HitUtils.PositionFromOrigin(strip1, strip2), HitUtils.CovarianceFromOrigin(strip1, strip2),
                 strip1.dEdx()+strip2.dEdx(), 0.5*(strip1.time() + strip2.time()), _type, null,
                 strip1.detector(), strip1.layer(), strip1.BarrelEndcapFlag());
-        //  Save the strips
+        //  Save the strips and initialize the current helix to null
         _strip1 = strip1;
         _strip2 = strip2;
+        _helix = null;
         
         //  Put the raw hits from the strips into the hit list
         if (strip1.rawhits() != null) {
@@ -90,7 +92,19 @@
         striplist.add(_strip2);
         return striplist;
     }
-    
+
+    public void setTrackDirection(HelicalTrackFit helix) {
+
+        if (helix != null) {
+            if (helix.equals(_helix)) return;
+            TrackDirection trkdir = HelixUtils.CalculateTrackDirection(helix, helix.PathMap().get(this));
+            setTrackDirection(trkdir, helix.covariance());
+            _helix = helix;
+        } else {
+            resetTrackDirection();
+        }
+    }
+
     /**
      * Set the track direction to be used in calculating the corrected position
      * and covariance matrix.  Calling this method will cause the corrected
@@ -136,6 +150,7 @@
         super.setCorrectedPosition(HitUtils.PositionFromOrigin(_strip1, _strip2));
         super.setCorrectedCovMatrix(HitUtils.CovarianceFromOrigin(_strip1, _strip2));
         super.setChisq(0.);
+        _helix = null;
     }
     
     /**
CVSspam 0.2.8