lcsim/src/org/lcsim/contrib/seedtracker
diff -u -r1.2 -r1.3
--- ConstrainHelix.java 9 May 2008 01:14:35 -0000 1.2
+++ ConstrainHelix.java 17 Jun 2008 00:41:35 -0000 1.3
@@ -7,7 +7,10 @@
package org.lcsim.contrib.seedtracker;
+import java.util.List;
+
import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
/**
*
@@ -24,34 +27,39 @@
_bfield = bfield;
}
- public void setConstraintChisq(SeedStrategy strategy, HelicalTrackFit helix) {
+ public void setConstraintChisq(SeedStrategy strategy, HelicalTrackFit helix, List<HelicalTrackHit> hits) {
// Retrieve the helix parameters
double[] params = helix.parameters();
double nhchisq = 0.;
- // Inflate chisq if |curvature| is too large
+ // Inflate chi^2 if |curvature| is too large
double curvmax = 0.0003 * _bfield / strategy.getMinPT();
double curv = Math.abs(params[2]);
if (curv > curvmax) {
nhchisq += Math.pow(curv - curvmax, 2) / Math.abs(helix.covariance().e(2, 2));
}
- // Inflate chisq if |DCA| is too large
+ // Inflate chi^2 if |DCA| is too large
double dcamax = strategy.getMaxDCA();
double dca = Math.abs(params[0]);
if (dca > dcamax) {
nhchisq += Math.pow(dca - dcamax, 2) / Math.abs(helix.covariance().e(0, 0));
}
- // Inflate chisq if |z0| is too large
+ // Inflate chi^2 if |z0| is too large
double z0max = strategy.getMaxZ0();
double z0 = Math.abs(params[3]);
if (z0 > z0max) {
nhchisq += Math.pow(z0 - z0max, 2) / Math.abs(helix.covariance().e(3, 3));
}
+ // Add the chi^2 penalty from the cross hits
+ for (HelicalTrackHit hit : hits) {
+ nhchisq += hit.chisq();
+ }
+
// Set the non-holenomic chi squared term in the helix
helix.setnhchisq(nhchisq);
lcsim/src/org/lcsim/contrib/seedtracker
diff -u -r1.8 -r1.9
--- HelixFitter.java 10 Jun 2008 19:36:10 -0000 1.8
+++ HelixFitter.java 17 Jun 2008 00:41:35 -0000 1.9
@@ -57,6 +57,9 @@
// Initialize fit results to null objects
_helix = null;
+
+ // Set the tolerance in the fitter
+ _fitter.setTolerance(Math.sqrt(strategy.getMaxChisq()));
// Retrieve list of hits to be fit
List<HelicalTrackHit> hitlist = seed.getHits();
@@ -90,7 +93,8 @@
Map<HelicalTrackHit, Double> pathmap = oldhelix.PathMap();
for (HelicalTrackHit hit : hitlist) {
if (hit instanceof HelicalTrackCross) {
- ((HelicalTrackCross) hit).setTrackDirection(_helixutils.getTrackDirection(oldhelix, pathmap.get(hit)), oldhelix);
+ TrackDirection trkdir = _helixutils.CalculateTrackDirection(oldhelix, pathmap.get(hit));
+ ((HelicalTrackCross) hit).setTrackDirection(trkdir, oldhelix.covariance());
}
}
@@ -106,17 +110,7 @@
_helix = _fitter.getFit();
// Set the non-holonomic constraint chi square
- _constrain.setConstraintChisq(strategy, _helix);
-
-// System.out.println(" circle chisq "+helix.chisq()[0]);
-// System.out.println(" line fit chisq "+helix.chisq()[1]);
-// System.out.println(" total chisq "+chisq);
-// System.out.println(" dca "+helix.dca());
-// System.out.println(" phi0 "+helix.phi0());
-// System.out.println(" curvatures "+helix.curvature());
-// System.out.println(" z0 "+helix.z0());
-// System.out.println(" slope "+helix.slope());
-// System.out.println(" pT "+helix.pT(_bfield));
+ _constrain.setConstraintChisq(strategy, _helix, hitlist);
boolean success = _helix.chisqtot() <= strategy.getMaxChisq();
if(diag!=null) diag.fireFitterFitMade(seed, _helix, _circlefit, _linefit, _zsegmentfit, _status, success);