hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.2 -r1.3
--- HPSShaperAnalyticFitAlgorithm.java 25 Apr 2012 15:23:42 -0000 1.2
+++ HPSShaperAnalyticFitAlgorithm.java 25 Apr 2012 16:23:03 -0000 1.3
@@ -6,7 +6,7 @@
/**
* Fast fitter; currently only fits single hits. Uses Tp from ChannelConstants; fits values and errors for T0 and amplitude.
* @author meeg
- * @version $Id: HPSShaperAnalyticFitAlgorithm.java,v 1.2 2012/04/25 15:23:42 mgraham Exp $
+ * @version $Id: HPSShaperAnalyticFitAlgorithm.java,v 1.3 2012/04/25 16:23:03 meeg Exp $
*/
public class HPSShaperAnalyticFitAlgorithm implements HPSShaperFitAlgorithm {
@@ -16,8 +16,8 @@
HPSShapeFitParameters fit = new HPSShapeFitParameters();
for (int i = 0; i < rth.getADCValues().length - 2; i++) {
double chisq = fitSection(rth, constants, fit, i);
- if (chisq < minChisq) {
- minChisq = chisq / (rth.getADCValues().length - 2 - i); //TODO: p-value would be better here
+ if (chisq < minChisq) {
+ minChisq = chisq;
bestStart = i;
}
}
@@ -81,6 +81,6 @@
chisq += Math.pow((fit_y - y[i]) / constants.getNoise(), 2);
}
- return chisq;
+ return chisq / (length - 2); //TODO: p-value would be better here
}
}