lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.13 -r1.14
--- FastCheck.java 29 Apr 2010 13:45:41 -0000 1.13
+++ FastCheck.java 16 Nov 2010 15:46:02 -0000 1.14
@@ -1,7 +1,6 @@
package org.lcsim.recon.tracking.seedtracker;
import org.lcsim.constants.Constants;
-import org.lcsim.event.MCParticle;
import org.lcsim.fit.threepointcircle.CircleFit;
import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
import org.lcsim.fit.helicaltrack.HelicalTrack3DHit;
@@ -34,6 +33,7 @@
private static double twopi = 2. * Math.PI;
private double _eps = 1.0e-6;
private ISeedTrackerDiagnostics _diag;
+ private boolean _skipchecks = false;
public FastCheck(SeedStrategy strategy, double bfield, ISeedTrackerDiagnostics diag) {
_strategy = strategy;
@@ -55,23 +55,19 @@
public boolean CheckHitSeed(HelicalTrackHit hit, SeedCandidate seed) {
+ if (_skipchecks) return true;
+
// Check the hit against each hit in the seed
for (HelicalTrackHit hit2 : seed.getHits()) {
if (!TwoPointCircleCheck(hit, hit2, seed)) return false;
}
+
return true;
}
public boolean CheckSector(SeedCandidate seed, Sector sector) {
- boolean match = false;
- if (_diag != null && seed.isTrueSeed()) {
- for (HelicalTrackHit hit : sector.Hits()) {
- for (MCParticle mcp : hit.getMCParticles()) {
- if (seed.getMCParticles().contains(mcp)) match = true;
- }
- }
- }
+ if (_skipchecks) return true;
// Get limits on r, phi, and z for hits in this sector
double rmin = sector.rmin();
@@ -101,14 +97,7 @@
// The maximum dphi is the sum of the track bend and half the sector span
double dphimx = dphitrk + dphisec;
- if (dphi > dphimx) {
- if (match) {
- for (MCParticle mcp : seed.getMCParticles()) {
- System.out.println("phi sector error - p: "+mcp.getMomentum().toString());
- }
- }
- return false;
- }
+ if (dphi > dphimx) return false;
double smin1 = smin(rmin);
double smax1 = smax(rmax);
@@ -126,20 +115,14 @@
// Check the z0 limits
boolean zOK = checkz0(smin1, smax1, zmin, zmax, smin2, smax2, zmin2, zmax2);
- if (!zOK) {
- if (match) {
- for (MCParticle mcp : seed.getMCParticles()) {
- System.out.println("z sector error - p: "+mcp.getMomentum().toString());
- }
- }
- return false;
- }
}
return true;
}
public boolean CheckSectorPair(Sector s1, Sector s2) {
+ if (_skipchecks) return true;
+
// Calculate the maximum change in azimuth
double dphi1 = dphimax(s1.rmin(), s2.rmax());
double dphi2 = dphimax(s1.rmax(), s2.rmin());
@@ -180,6 +163,8 @@
public boolean TwoPointCircleCheck(HelicalTrackHit hit1, HelicalTrackHit hit2, SeedCandidate seed) {
+ if (_skipchecks) return true;
+
// Initialize the hit coordinates for an unknown track direction
CorrectHitPosition(hit1, seed);
CorrectHitPosition(hit2, seed);
@@ -195,7 +180,6 @@
}
catch(Exception x){}
-
// Check for success
if (!success) return false;
@@ -231,20 +215,24 @@
s2min = lfit.s2() - s0;
}
+ // Calculate the allowed variation in hit r and z (not 1 sigma errors!)
+ double dr1 = Math.max(_nsig * hit1.dr(), _dMax);
+ double dr2 = Math.max(_nsig * hit2.dr(), _dMax);
+ double dz1 = dz(hit1);
+ double dz2 = dz(hit2);
+
// Now check for consistent hits in the s-z plane
- // First get the z limits for the hits
- double z1len = 0.;
- double z2len = 0.;
- if (hit1 instanceof HelicalTrack2DHit) {
- z1len = ((HelicalTrack2DHit) hit1).zlen();
- }
- if (hit2 instanceof HelicalTrack2DHit) {
- z2len = ((HelicalTrack2DHit) hit2).zlen();
- }
- double z1min = hit1.z() - 0.5 * z1len;
- double z1max = z1min + z1len;
- double z2min = hit2.z() - 0.5 * z2len;
- double z2max = z2min + z2len;
+ // First expand z ranges by hit z uncertainty
+ double z1min = hit1.z() - dz1;
+ double z1max = hit1.z() + dz1;
+ double z2min = hit2.z() - dz2;
+ double z2max = hit2.z() + dz2;
+
+ // Expand s ranges by hit r uncertainty (r ~ s for r << R_curvature)
+ s1min = Math.max(0., s1min - dr1);
+ s1max = s1max + dr1;
+ s2min = Math.max(0., s2min - dr2);
+ s2max = s2max + dr2;
// Check the z0 limits using the min/max path lengths
boolean zOK = checkz0(s1min, s1max, z1min, z1max, s2min, s2max, z2min, z2max);
@@ -255,6 +243,8 @@
public boolean ThreePointHelixCheck(HelicalTrackHit hit1, HelicalTrackHit hit2, HelicalTrackHit hit3) {
+ if (_skipchecks) return true;
+
// Setup for a 3 point circle fit
double p[][] = new double[3][2];
double[] pos;
@@ -354,7 +344,6 @@
dphi[i] = Math.atan2(p[i][1]-yc, p[i][0]-xc) - phi0;
if (dphi[i] > Math.PI) dphi[i] -= twopi;
if (dphi[i] < -Math.PI) dphi[i] += twopi;
-// System.out.println("dphi = "+dphi[i]+" for hit "+i);
if (Math.abs(dphi[i]) < Math.abs(dphimin)) dphimin = dphi[i];
}
@@ -529,4 +518,16 @@
}
}
}
+
+ private double dz(HelicalTrackHit hit) {
+
+ // Axial strip hits: use half strip length
+ if (hit instanceof HelicalTrack2DHit) {
+ return 0.5 * ((HelicalTrack2DHit) hit).zlen();
+
+ // Otherwise use the z error
+ } else {
+ return _nsig * Math.sqrt(hit.getCorrectedCovMatrix().diagonal(2));
+ }
+ }
}
\ No newline at end of file