lcsim/src/org/lcsim/recon/tracking/seedtracker
diff -u -r1.2 -r1.3
--- ConstrainHelix.java 9 Oct 2008 17:47:30 -0000 1.2
+++ ConstrainHelix.java 1 Feb 2011 22:20:32 -0000 1.3
@@ -31,30 +31,28 @@
if (_bfield == 0.) throw new RuntimeException("B Field must be set before calling setConstraintChisq method");
- // Retrieve the helix parameters
- double[] params = helix.parameters();
-
double nhchisq = 0.;
// Inflate chi^2 if |curvature| is too large
double curvmax = Constants.fieldConversion * _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));
- }
+ double curv = Math.abs(helix.curvature());
+ double dcurv = helix.covariance().diagonal(HelicalTrackFit.curvatureIndex);
+ if (curv > curvmax) nhchisq += Math.pow(curv - curvmax, 2) / Math.abs(dcurv);
// Inflate chi^2 if |DCA| is too large
double dcamax = strategy.getMaxDCA();
- double dca = Math.abs(params[0]);
+ double dca = Math.abs(helix.dca());
+ double ddca = helix.covariance().diagonal(HelicalTrackFit.dcaIndex);
if (dca > dcamax) {
- nhchisq += Math.pow(dca - dcamax, 2) / Math.abs(helix.covariance().e(0, 0));
+ nhchisq += Math.pow(dca - dcamax, 2) / Math.abs(ddca);
}
// Inflate chi^2 if |z0| is too large
double z0max = strategy.getMaxZ0();
- double z0 = Math.abs(params[3]);
+ double z0 = Math.abs(helix.z0());
+ double dz0 = helix.covariance().diagonal(HelicalTrackFit.z0Index);
if (z0 > z0max) {
- nhchisq += Math.pow(z0 - z0max, 2) / Math.abs(helix.covariance().e(3, 3));
+ nhchisq += Math.pow(z0 - z0max, 2) / Math.abs(dz0);
}
// Add the chi^2 penalty from the cross hits