Commit in lcsim/src/org/lcsim/recon/tracking/seedtracker on MAIN
SeedTrackFinder.java+36-71.2 -> 1.3
Check for consistent z coordinates of seed

lcsim/src/org/lcsim/recon/tracking/seedtracker
SeedTrackFinder.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- SeedTrackFinder.java	9 Oct 2008 18:19:13 -0000	1.2
+++ SeedTrackFinder.java	10 Jan 2009 01:21:03 -0000	1.3
@@ -11,6 +11,7 @@
 import java.util.List;
 
 import org.lcsim.constants.Constants;
+import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
 import org.lcsim.fit.helicaltrack.HelicalTrackHit;
 import org.lcsim.recon.tracking.seedtracker.diagnostic.ISeedTrackerDiagnostics;
 
@@ -28,6 +29,7 @@
     private ISeedTrackerDiagnostics _diag = null;
     private double _RMin;
     private double _dMax;
+    private double _z0Max;
     private HelicalTrackHit _lasthit;
     
     /**
@@ -64,6 +66,7 @@
         //  Cache the minimum radius of curvature and DCA for use by the HitCheck method
         _RMin = strategy.getMinPT() / (Constants.fieldConversion * bfield);
         _dMax = strategy.getMaxDCA();
+        _z0Max = strategy.getMaxZ0();
         
         //  Initialize counters
         int nfit = 0;
@@ -152,15 +155,41 @@
         double dphi = Math.abs(phi2 - phi1);
         if (dphi > Math.PI) dphi = 2. * Math.PI - dphi;
         if (dphi < 0.) System.out.println("HitCheck: negative dphi = "+dphi);
+
         //  Check that the difference in azimuthal angle is less than the difference in maximum phi deviations
         boolean phicut = dphi <= Math.abs(dphi2mx - dphi1mx);
-//        if (hit1.getMCParticles().contains(hit2.getMCParticles().get(0))) {
-//            System.out.println(" phicut for MC Particle match: "+phicut);
-//            System.out.println("RMin: "+_RMin+" dMax: "+_dMax);
-//            System.out.println("dphi1mx: "+dphi1mx+" dphi2mx: "+dphi2mx+" dphi: "+dphi);
-//        }
-        //  Call the diagnostics if requested and return
+
+        //  Call the diagnostics if requested and return if we fail the cut
         if(_diag!=null) _diag.fireFinderDPhiCut(level, dphi, phicut, hit2);
-        return phicut;
+        if (!phicut) return false;
+
+        //  Get the z limits for the hit1
+        double zlen1 = 0.;
+        if (hit1 instanceof HelicalTrack2DHit) zlen1 = ((HelicalTrack2DHit) hit1).zlen();
+        double zmin1 = hit1.z() - 0.5 * zlen1;
+        double zmax1 = zmin1 + zlen1;
+
+        //  Get the z limits for the hit2
+        double zlen2 = 0.;
+        if (hit2 instanceof HelicalTrack2DHit) zlen2 = ((HelicalTrack2DHit) hit2).zlen();
+        double zmin2 = hit2.z() - 0.5 * zlen2;
+        double zmax2 = zmin2 + zlen2;
+
+        //  Check the z0 limits using the minimum path lengths
+        double s1 = r1 - _dMax;
+        double s2 = r2 - _dMax;
+        if (checkz0(s1, zmin1, zmax1, s2, zmin2, zmax2)) return true;
+
+        //  If we failed, also try checking with the maximum path lengths
+        s1 = 2.0 * _RMin * Math.asin((r1 + _dMax) / (2.0 * _RMin));
+        s2 = 2.0 * _RMin * Math.asin((r2 + _dMax) / (2.0 * _RMin));
+        return checkz0(s1, zmin1, zmax1, s2, zmin2, zmax2);
+    }
+
+    private boolean checkz0(double s1, double zmin1, double zmax1, double s2, double zmin2, double zmax2) {
+        //  Check the minimum and maximum value for z0
+        double z0min = (zmin1*s2 - zmax2*s1) / (s2 - s1);
+        double z0max = (zmax1*s2 - zmin2*s1) / (s2 - s1);
+        return (z0min <= _z0Max) && (z0max >= -_z0Max);
     }
 }
\ No newline at end of file
CVSspam 0.2.8