java/trunk/tracking/src/main/java/org/hps/recon/tracking
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/RawTrackerHitFitterDriver.java 2014-08-29 01:29:26 UTC (rev 925)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/RawTrackerHitFitterDriver.java 2014-08-29 02:05:02 UTC (rev 926)
@@ -63,8 +63,10 @@
_shaper = new ShaperAnalyticFitAlgorithm();
} else if (fitAlgorithm.equals("Linear")) {
_shaper = new ShaperLinearFitAlgorithm(1);
+ } else if (fitAlgorithm.equals("PileupAlways")) {
+ _shaper = new ShaperPileupFitAlgorithm(1.0);
} else if (fitAlgorithm.equals("Pileup")) {
- _shaper = new ShaperLinearFitAlgorithm(2);
+ _shaper = new ShaperPileupFitAlgorithm();
} else {
throw new RuntimeException("Unrecognized fitAlgorithm: " + fitAlgorithm);
}
java/trunk/tracking/src/main/java/org/hps/recon/tracking
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/ShapeFitParameters.java 2014-08-29 01:29:26 UTC (rev 925)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/ShapeFitParameters.java 2014-08-29 02:05:02 UTC (rev 926)
@@ -105,7 +105,7 @@
// }
public static double getChiProb(GenericObject object) {
- return object.getDoubleVal(6);
+ return object.getDoubleVal(4);
}
@Override
java/trunk/tracking/src/main/java/org/hps/recon/tracking
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java (rev 0)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/ShaperPileupFitAlgorithm.java 2014-08-29 02:05:02 UTC (rev 926)
@@ -0,0 +1,43 @@
+package org.hps.recon.tracking;
+
+import java.util.Collection;
+import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
+import org.lcsim.event.RawTrackerHit;
+
+/**
+ *
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: $
+ */
+public class ShaperPileupFitAlgorithm implements ShaperFitAlgorithm {
+
+ ShaperLinearFitAlgorithm onePulseFitter = new ShaperLinearFitAlgorithm(1);
+ ShaperLinearFitAlgorithm twoPulseFitter = new ShaperLinearFitAlgorithm(2);
+ private boolean debug = false;
+ private double refitThreshold = 0.1;
+
+ public ShaperPileupFitAlgorithm() {
+ }
+
+ public ShaperPileupFitAlgorithm(double threshold) {
+ refitThreshold = threshold;
+ }
+
+ public Collection<ShapeFitParameters> fitShape(RawTrackerHit rth, HPSSVTCalibrationConstants.ChannelConstants constants) {
+ Collection<ShapeFitParameters> fittedPulses = onePulseFitter.fitShape(rth, constants);
+ double singlePulseChiProb = fittedPulses.iterator().next().getChiProb();
+ if (singlePulseChiProb < refitThreshold) {
+ Collection<ShapeFitParameters> doublePulse = twoPulseFitter.fitShape(rth, constants);
+ double doublePulseChiProb = doublePulse.iterator().next().getChiProb();
+ if (doublePulseChiProb > singlePulseChiProb) {
+ fittedPulses = doublePulse;
+ }
+ }
+ return fittedPulses;
+ }
+
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+
+}