lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.9 -r1.10
--- FastCheck.java 3 Sep 2009 17:52:29 -0000 1.9
+++ FastCheck.java 4 Sep 2009 23:17:01 -0000 1.10
@@ -1,6 +1,5 @@
package org.lcsim.recon.tracking.seedtracker;
-import java.util.List;
import org.lcsim.constants.Constants;
import org.lcsim.event.MCParticle;
import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
@@ -41,10 +40,7 @@
public boolean CheckHitPair(HelicalTrackHit hit1, HelicalTrackHit hit2, SeedCandidate seed) {
- // Correct the hit positions for stereo hits
- CorrectHitPosition(hit1, seed);
- CorrectHitPosition(hit2, seed);
-
+ // Check if seed and hits are all from a single "True Seed"
boolean match = false;
if (_diag != null && seed.isTrueSeed()) {
for (MCParticle mcp : seed.getMCParticles()) {
@@ -55,6 +51,10 @@
}
}
+ // Correct the hit positions for stereo hits
+ CorrectHitPosition(hit1, seed);
+ CorrectHitPosition(hit2, seed);
+
// Get the polar coordinates for the hits
double r1 = hit1.r();
double r2 = hit2.r();
@@ -99,17 +99,17 @@
if (!zOK) {
if (match) {
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;
+// 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);
}
@@ -124,16 +124,16 @@
// " 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()) {
+// 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;
@@ -150,7 +150,6 @@
public boolean CheckSector(SeedCandidate seed, Sector sector) {
-
boolean match = false;
if (_diag != null && seed.isTrueSeed()) {
for (HelicalTrackHit hit : sector.Hits()) {
@@ -217,6 +216,30 @@
if (match) {
for (MCParticle mcp : seed.getMCParticles()) {
System.out.println("z sector error - p: "+mcp.getMomentum().toString());
+// System.out.println("Sector ID: "+sector.Identifier()+" z0max: "+_z0Max);
+// System.out.println("zlo: "+sector.zlo()+"zhi: "+sector.zhi());
+// System.out.println("smin1: "+smin1+" smax1: "+smax1+" zmin1: "+zmin+" zmax1: "+zmax);
+// System.out.println("smin2: "+smin2+" smax2: "+smax2+" zmin2: "+zmin2+" zmax2: "+zmax2);
+// System.out.println("Hit: "+hit.toString());
+// HelixParamCalculator helmc = new HelixParamCalculator(mcp, seed.getBField());
+// System.out.println("Helix z: "+helmc.getZ0()+" slope: "+helmc.getSlopeSZPlane());
+// double z1 = 0.5 * (zmin + zmax);
+// 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);
+// for (HelicalTrackHit secthit : sector.Hits()) {
+// if (secthit.getMCParticles().contains(mcp)) {
+// System.out.println("Found true hit in sector: "+secthit.toString());
+// }
+// }
}
}
return false;
@@ -304,28 +327,65 @@
private boolean checkz0(double s1min, double s1max, double zmin1, double zmax1,
double s2min, double s2max, double zmin2, double zmax2) {
- // Find the limits on z0 for smin and smax
- double zlim[] = new double[6];
- zlim[0] = (zmin1 * s2min - zmax2 * s1max) / (s2min - s1max);
- zlim[1] = (zmax1 * s2max - zmin2 * s1min) / (s2max - s1min);
- zlim[2] = (zmin1 * s2max - zmax2 * s1min) / (s2max - s1min);
- zlim[3] = (zmax1 * s2min - zmin2 * s1max) / (s2min - s1max);
- zlim[4] = (zmin1 * s2max - zmin2 * s1max) / (s2max - s1max);
- zlim[5] = (zmax1 * s2min - zmax2 * s1min) / (s2min - s1min);
-
- double zmin = zlim[0];
- double zmax = zlim[0];
- for (int i=1; i<6; i++) {
- if (zlim[i] < zmin) zmin = zlim[i];
- if (zlim[i] > zmax) zmax = zlim[i];
- }
-
-// System.out.println("s1min: "+s1min+" s2: "+s2min+" zmin1: "+zmin1+
-// " zmax1: "+zmax1+" zmin2: "+zmin2+" zmax2: "+zmax2);
-// System.out.println("zmin: "+zmin+" zmax: "+zmax+" z0Max: "+_z0Max);
+ double z0[] = new double[2];
+ double z1[] = new double[4];
+ double z2[] = new double[2];
+ double s1[] = new double[4];
+ double s2[] = new double[2];
+
+ // Set limits on z0
+ z0[0] = -_z0Max;
+ z0[1] = _z0Max;
+
+ // Set corners of allowed region for s1, z1
+ z1[0] = zmin1;
+ z1[1] = zmin1;
+ z1[2] = zmax1;
+ z1[3] = zmax1;
+ s1[0] = s1min;
+ s1[1] = s1max;
+ s1[2] = s1min;
+ s1[3] = s1max;
+
+ // Set limits on z2, s2
+ z2[0] = zmin2;
+ z2[1] = zmax2;
+ s2[0] = s2min;
+ s2[1] = s2max;
+
+ // Initialize min/max of s, z at point 2
+ double zmax = -1.0e10;
+ double zmin = 1.0e10;
+ double smax = -1.0e10;
+ double smin = 1.0e10;
+
+ // Loop over z0 limits
+ for (int i=0; i<2; i++) {
+
+ // Loop over corners of s1, z1
+ for (int j=0; j<4; j++) {
+
+ // Calculate slope of line in s-z space from z0 limit to point 1 corner
+ double slope = (z1[j] - z0[i]) / s1[j];
+
+ // Loop over limits on z2, s2
+ for (int k=0; k<2; k++) {
+
+ // Calculate extrapolation of s-z line to the point 2 limit
+ double z = z0[i] + s2[k] * slope;
+ double s = (z2[k] - z0[i]) / slope;
+
+ // Find the min/max values of the extrapolated s, z at point 2
+ if (z > zmax) zmax = z;
+ if (z < zmin) zmin = z;
+ if (s > smax) smax = s;
+ if (s < smin) smin = s;
+ }
+ }
+ }
- // Check to see if the range zmin - zmax is consistent with the z0 limit
- boolean checkz0 = zmax >= -_z0Max && zmin <= _z0Max;
+ // Check to see if the extrapolated points are consistent with measurements
+ boolean checkz0 = (zmin2 <= zmax && zmax2 >= zmin) || (s2min <= smax && s2max >= smin);
return checkz0;
}
lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.7 -r1.8
--- SeedCandidate.java 3 Sep 2009 17:52:29 -0000 1.7
+++ SeedCandidate.java 4 Sep 2009 23:17:01 -0000 1.8
@@ -9,6 +9,7 @@
package org.lcsim.recon.tracking.seedtracker;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -86,7 +87,7 @@
_hits.addAll(seed.getHits());
_helix = seed.getHelix();
_msmap.putAll(seed.getMSMap());
- _scatters = seed.getScatterAngles();
+ _scatters = new ArrayList<ScatterAngle>(seed.getScatterAngles());
setUncheckedLayers(seed.getUncheckedLayers());
_mcpset.addAll(seed.getMCParticles());
}