Commit in lcsim/src/org/lcsim/recon/tracking/seedtracker on MAIN
ConfirmerExtender.java+5-51.12 -> 1.13
FastCheck.java+72-211.7 -> 1.8
SeedCandidate.java+91.5 -> 1.6
SeedSectoring.java+1-11.1 -> 1.2
SeedTrackFinder.java+4-41.12 -> 1.13
+91-31
5 modified files
Fix bug in FastCheck (stereo hit positions weren't being reset) and propagate diagnostic package to FastCheck

lcsim/src/org/lcsim/recon/tracking/seedtracker
ConfirmerExtender.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- ConfirmerExtender.java	19 Aug 2009 22:12:27 -0000	1.12
+++ ConfirmerExtender.java	1 Sep 2009 22:54:58 -0000	1.13
@@ -92,7 +92,7 @@
     private void doTask(SeedCandidate inputseed, Task task, SeedStrategy strategy, double bfield) {
 
         //  Instantiate the fast hit checker
-        FastCheck checker = new FastCheck(strategy, bfield);
+        FastCheck checker = new FastCheck(strategy, bfield, _diag);
 
         //  Calculate the minimum number of hits to succeed
         int minhits = strategy.getMinHits();
@@ -167,10 +167,10 @@
                 test.addHit(hit);
 
                 //  Check that this hit is potentially viable
-                if (!checker.CheckHitSeed(hit, seed)) {
-                    if (_diag != null) _diag.fireCheckHitFailed(hit, test);
-                    continue;
-                }
+//                if (!checker.CheckHitSeed(hit, seed)) {
+//                    if (_diag != null) _diag.fireCheckHitFailed(hit, test);
+//                    continue;
+//                }
 
 
                 //  See if we have a successful fit

lcsim/src/org/lcsim/recon/tracking/seedtracker
FastCheck.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- FastCheck.java	19 Aug 2009 22:12:27 -0000	1.7
+++ FastCheck.java	1 Sep 2009 22:54:58 -0000	1.8
@@ -4,8 +4,14 @@
 import org.lcsim.constants.Constants;
 import org.lcsim.event.MCParticle;
 import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackCross;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
 import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
 import org.lcsim.fit.helicaltrack.HelixParamCalculator;
+import org.lcsim.fit.helicaltrack.HelixUtils;
+import org.lcsim.fit.helicaltrack.TrackDirection;
+import org.lcsim.recon.tracking.seedtracker.diagnostic.ISeedTrackerDiagnostics;
 
 /**
  *
@@ -20,10 +26,12 @@
     private double _dMax;
     private double _z0Max;
     private double _eps = 1.0e-6;
+    private ISeedTrackerDiagnostics _diag;
 
-    public FastCheck(SeedStrategy strategy, double bfield) {
+    public FastCheck(SeedStrategy strategy, double bfield, ISeedTrackerDiagnostics diag) {
         _strategy = strategy;
         _bfield = bfield;
+        _diag = diag;
 
         //  Calculate the minimum radius of curvature, maximum DCA and Maximum z0
         _RMin = strategy.getMinPT() / (Constants.fieldConversion * bfield);
@@ -31,7 +39,11 @@
         _z0Max = strategy.getMaxZ0();
     }
 
-    public boolean CheckHitPair(HelicalTrackHit hit1, HelicalTrackHit hit2) {
+    public boolean CheckHitPair(HelicalTrackHit hit1, HelicalTrackHit hit2, SeedCandidate seed) {
+
+        //  Correct the hit positions for stereo hits
+        CorrectHitPosition(hit1, seed);
+        CorrectHitPosition(hit2, seed);
 
         //  Get the polar coordinates for the hits
         double r1 = hit1.r();
@@ -49,11 +61,11 @@
         boolean phiOK = dphi <= dphimx;
 
         if (!phiOK) {
-//            if (CheckMC(hit1, hit2)) {
-//                System.out.println("Bad Phi check");
-//                System.out.println("dphi: " + dphi + " dphimx: " + dphimx);
-//                System.out.println("r1: " + r1 + " r2: " + r2 + " phi1: " + phi1 + " phi2: " + phi2);
-//            }
+            if (_diag != null && seed.isTrueSeed()) {
+                System.out.println("Bad Phi check");
+                System.out.println("dphi: " + dphi + " dphimx: " + dphimx);
+                System.out.println("r1: " + r1 + " r2: " + r2 + " phi1: " + phi1 + " phi2: " + phi2);
+            }
             return false;
         }
 
@@ -74,19 +86,46 @@
         //  Check the z0 limits using the minimum path lengths
         boolean zOK = checkz0(smin(r1), smax(r1), zmin1, zmax1, smin(r2), smax(r2), zmin2, zmax2);
 
-//        if (!zOK) {
-//            if (CheckMC(hit1, hit2)) {
-//                System.out.println("******* Bad Z Check *******");
-//                System.out.println(" x1: "+hit1.getCorrectedPosition().x()+
-//                                   " y1: "+hit1.getCorrectedPosition().y()+
-//                                   " x2: "+hit2.getCorrectedPosition().x()+
-//                                   " y2: "+hit2.getCorrectedPosition().y());
-//                System.out.println("s1min: " + smin(r1) + " s1max: " + smax(r1) + " zmin1: " + zmin1 +
-//                        " zmax1: " + zmax1);
-//                System.out.println("s2min: " + smin(r2) + " s2max: " + smax(r2) + " zmin2: " + zmin2 +
-//                        " zmax2: " + zmax2);
-//            }
-//        }
+        if (!zOK) {
+            if (_diag != null && seed.isTrueSeed()) {
+                for (MCParticle mcp : seed.getMCParticles()) {
+                    HelixParamCalculator helmc = new HelixParamCalculator(mcp, seed.getBField());
+                    double z1 = 0.5 * (zmin1 + zmax1);
+                    double z2 = 0.5 * (zmin2 + zmax2);
+                    double s1true = (z1 - helmc.getZ0()) / helmc.getSlopeSZPlane();
+                    double s2true = (z2 - helmc.getZ0()) / helmc.getSlopeSZPlane();
+                    double arg1 = s1true * helmc.getMCOmega() / 2.;
+                    double x1true = helmc.getX0() + s1true * Math.sin(arg1) * Math.cos(helmc.getPhi0()-arg1) / arg1;
+                    double y1true = helmc.getY0() + s1true * Math.sin(arg1) * Math.sin(helmc.getPhi0()-arg1) / arg1;
+                    double arg2 = s2true * helmc.getMCOmega() / 2.;
+                    double x2true = helmc.getX0() + s2true * Math.sin(arg2) * Math.cos(helmc.getPhi0()-arg2) / arg2;
+                    double y2true = helmc.getY0() + s2true * Math.sin(arg2) * Math.sin(helmc.getPhi0()-arg2) / arg2;
+                    System.out.println("True s1: "+s1true+" x1: "+x1true+" y1: "+y1true);
+                    System.out.println("True s2: "+s2true+" x2: "+x2true+" y2: "+y2true);
+                }
+                System.out.println("******* Bad Z Check *******");
+                System.out.println(" x1: "+hit1.getCorrectedPosition().x()+
+                                   " y1: "+hit1.getCorrectedPosition().y()+
+                                   " x2: "+hit2.getCorrectedPosition().x()+
+                                   " y2: "+hit2.getCorrectedPosition().y());
+                System.out.println("s1min: " + smin(r1) + " s1max: " + smax(r1) + " zmin1: " + zmin1 +
+                        " zmax1: " + zmax1);
+                System.out.println("s2min: " + smin(r2) + " s2max: " + smax(r2) + " zmin2: " + zmin2 +
+                        " zmax2: " + zmax2);
+                System.out.println("Hit1: "+hit1.toString());
+                System.out.println("Hit 2: "+hit2.toString());
+                if (hit2 instanceof HelicalTrackCross) {
+                    HelicalTrackCross c2 = (HelicalTrackCross) hit2;
+                    for (HelicalTrackStrip strip : c2.getStrips()) {
+                        System.out.println("u: "+strip.u().toString());
+                        System.out.println("v: "+strip.v().toString());
+                        System.out.println("origin: "+strip.origin().toString());
+                        System.out.println("umeas: "+strip.umeas()+" vmin: "+strip.vmin()+" vmax: "+strip.vmax());
+                    }
+
+                }
+            }
+        }
         return zOK;
     }
 
@@ -94,7 +133,7 @@
 
         //  Check the hit against each hit in the seed
         for (HelicalTrackHit hit2 : seed.getHits()) {
-            if (!CheckHitPair(hit, hit2)) return false;
+            if (!CheckHitPair(hit, hit2, seed)) return false;
         }
         return true;
     }
@@ -264,4 +303,16 @@
         return phidif;
     }
 
+    private void CorrectHitPosition(HelicalTrackHit hit, SeedCandidate seed) {
+        if (hit instanceof HelicalTrackCross) {
+            HelicalTrackCross cross = (HelicalTrackCross) hit;
+            HelicalTrackFit helix = seed.getHelix();
+            if (helix != null) {
+                TrackDirection trkdir = HelixUtils.CalculateTrackDirection(helix, helix.PathMap().get(hit));
+                cross.setTrackDirection(trkdir, helix.covariance());
+            } else {
+                cross.resetTrackDirection();
+            }
+        }
+    }
 }
\ No newline at end of file

lcsim/src/org/lcsim/recon/tracking/seedtracker
SeedCandidate.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- SeedCandidate.java	19 Aug 2009 22:12:27 -0000	1.5
+++ SeedCandidate.java	1 Sep 2009 22:54:58 -0000	1.6
@@ -210,9 +210,18 @@
     }
 
     public boolean isTrueSeed() {
+//        boolean hasmuon = false;
+//        for (MCParticle mcp : _mcpset) {
+//            if (Math.abs(mcp.getPDGID()) == 13) hasmuon = true;
+//        }
+//        return _mcpset.size() > 0 && hasmuon;
         return _mcpset.size() > 0;
     }
 
+    public double getBField() {
+        return _bfield;
+    }
+
     private void UpdateMSMap(HelicalTrackHit hit) {
         if (_helix == null) return;
         if (_scatters == null) return;

lcsim/src/org/lcsim/recon/tracking/seedtracker
SeedSectoring.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SeedSectoring.java	20 Jan 2009 19:19:53 -0000	1.1
+++ SeedSectoring.java	1 Sep 2009 22:54:58 -0000	1.2
@@ -16,7 +16,7 @@
 
         _seedsectors = new ArrayList<List<Sector>>();
 
-        FastCheck checker = new FastCheck(strategy, bfield);
+        FastCheck checker = new FastCheck(strategy, bfield, null);
 
         List<Sector> slist0 = hmanager.getSectors(layers.get(0));
         List<Sector> slist1 = hmanager.getSectors(layers.get(1));

lcsim/src/org/lcsim/recon/tracking/seedtracker
SeedTrackFinder.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- SeedTrackFinder.java	19 Aug 2009 22:12:27 -0000	1.12
+++ SeedTrackFinder.java	1 Sep 2009 22:54:58 -0000	1.13
@@ -57,7 +57,7 @@
     public boolean FindTracks(SeedStrategy strategy, double bfield) {
 
         //  Instantiate the fast hit checker
-        FastCheck checker = new FastCheck(strategy, bfield);
+        FastCheck checker = new FastCheck(strategy, bfield, _diag);
 
         //  Create a set of MCParticles that have been found as seeds
         Set<MCParticle> mcp_seeds = new HashSet<MCParticle>();
@@ -87,7 +87,7 @@
                     seed1.addHit(hit2);
 
                     //  Check if the pair of hits is consistent with current strategy
-                    if (!checker.CheckHitPair(hit1, hit2)) {
+                    if (!checker.CheckHitPair(hit1, hit2, seed1)) {
                         if (_diag != null) _diag.fireCheckHitPairFailed(hit1, hit2, seed1);
                         continue;
                     }
@@ -99,11 +99,11 @@
                         seed.addHit(hit3);
 
                         //  Check if the new hit is consistent with the other hits
-                        if (!checker.CheckHitPair(hit1, hit3)) {
+                        if (!checker.CheckHitPair(hit1, hit3, seed)) {
                             if (_diag != null) _diag.fireCheckHitPairFailed(hit1, hit3, seed);
                             continue;
                         }
-                        if (!checker.CheckHitPair(hit2, hit3)) {
+                        if (!checker.CheckHitPair(hit2, hit3, seed)) {
                             if (_diag != null) _diag.fireCheckHitPairFailed(hit2, hit3, seed);
                             continue;
                         }
CVSspam 0.2.8