lcsim/src/org/lcsim/contrib/seedtracker
diff -u -r1.1 -r1.2
--- SortHits.java 4 Apr 2008 23:41:33 -0000 1.1
+++ SortHits.java 27 Aug 2008 17:25:08 -0000 1.2
@@ -21,18 +21,19 @@
private double _xc;
private double _yc;
private double _R;
-
+ private double _R2;
/** Creates a new instance of SortHits */
public SortHits(HelicalTrackFit helix) {
// Find the helix center, radius, error
_xc = helix.xc();
_yc = helix.yc();
_R = helix.R();
+ _R2 = _R*_R;
}
public int compare(HelicalTrackHit a, HelicalTrackHit b) {
- double difa = Math.pow(a.x() - _xc, 2) + Math.pow(a.y() - _yc, 2) - _R * _R;
- double difb = Math.pow(b.x() - _xc, 2) + Math.pow(b.y() - _yc, 2) - _R * _R;
+ double difa = (a.x() - _xc)*(a.x() - _xc) + (a.y() - _yc)*(a.y() - _yc) - _R2;
+ double difb = (b.x() - _xc)*(b.x() - _xc) + (b.y() - _yc)*(b.y() - _yc) - _R2;
if (difa * difa > difb * difb) return 1;
if (difa * difa == difb * difb) return 0;
return -1;