3 modified files
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.12 -r1.13
--- HPSSVTCalibrationConstants.java 24 May 2012 17:08:18 -0000 1.12
+++ HPSSVTCalibrationConstants.java 21 Jun 2012 18:47:07 -0000 1.13
@@ -10,6 +10,8 @@
import java.util.*;
import org.lcsim.conditions.ConditionsManager;
import org.lcsim.conditions.ConditionsSet;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.hps.monitoring.HPSCalibrationListener;
import org.lcsim.hps.util.Pair;
@@ -177,7 +179,7 @@
int channel = Integer.valueOf(lineTok.nextToken());
double amplitude = Double.valueOf(lineTok.nextToken());
double t0 = Double.valueOf(lineTok.nextToken());
- double tp = Double.valueOf(lineTok.nextToken());
+ double tp = Double.valueOf(lineTok.nextToken()) * 24.0 / 25.0; //FIXME: this is a hack to compensate for the calibrations we have that assumed 25 ns APV clock
double chisq = Double.valueOf(lineTok.nextToken());
Pair<Integer, Integer> daqPair = new Pair(hybrid, fpga);
@@ -254,6 +256,82 @@
constants.setTp(53.0);
}
+ IIdentifierHelper helper = sensor.getIdentifierHelper();
+ IIdentifier id = sensor.getIdentifier();
+ int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+ int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
+ switch (module) {
+ case 0:
+ switch (layer) {
+ case 1:
+ value = 1.5;
+ break;
+ case 2:
+ value = 1.6;
+ break;
+ case 3:
+ value = -2.8;
+ break;
+ case 4:
+ value = 2.0;
+ break;
+ case 5:
+ value = -1.9;
+ break;
+ case 6:
+ value = -2.2;
+ break;
+ case 7:
+ value = 1.8;
+ break;
+ case 8:
+ value = 1.2;
+ break;
+ case 9:
+ value = 2.5;
+ break;
+ case 10:
+ value = 0.0;
+ break;
+ }
+ break;
+ case 1:
+ switch (layer) {
+ case 1:
+ value = 1.0;
+ break;
+ case 2:
+ value = 1.3;
+ break;
+ case 3:
+ value = -3.0;
+ break;
+ case 4:
+ value = 3.5;
+ break;
+ case 5:
+ value = 0.0;
+ break;
+ case 6:
+ value = -0.5;
+ break;
+ case 7:
+ value = -0.8;
+ break;
+ case 8:
+ value = -1.1;
+ break;
+ case 9:
+ value = 3.5;
+ break;
+ case 10:
+ value = -2.7;
+ break;
+ }
+ break;
+ }
+ constants.setT0Shift(value);
+
return constants;
}
@@ -263,6 +341,7 @@
private double pedestal = Double.NaN;
private double tp = Double.NaN;
private double noise = Double.NaN;
+ private double t0Shift = Double.NaN;
private double[][] pulseShape = null;
public double getNoise() {
@@ -296,5 +375,13 @@
public void setTp(double tp) {
this.tp = tp;
}
+
+ public double getT0Shift() {
+ return t0Shift;
+ }
+
+ public void setT0Shift(double t0Shift) {
+ this.t0Shift = t0Shift;
+ }
}
}
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.12 -r1.13
--- HPSRawTrackerHitFitterDriver.java 17 May 2012 18:24:10 -0000 1.12
+++ HPSRawTrackerHitFitterDriver.java 21 Jun 2012 18:47:07 -0000 1.13
@@ -22,11 +22,16 @@
private String fittedHitCollectionName = "SVTFittedRawTrackerHits";
private int genericObjectFlags = 1 << LCIOConstants.GOBIT_FIXED;
private int relationFlags = 0;
+ private boolean correctT0Shift = false;
public void setDebug(boolean debug) {
this.debug = debug;
}
+ public void setCorrectT0Shift(boolean correctT0Shift) {
+ this.correctT0Shift = correctT0Shift;
+ }
+
public void setFitAlgorithm(String fitAlgorithm) {
if (fitAlgorithm.equals("Analytic")) {
_shaper = new HPSShaperAnalyticFitAlgorithm();
@@ -56,11 +61,11 @@
@Override
public void process(EventHeader event) {
- if (!event.hasCollection(RawTrackerHit.class, rawHitCollectionName)) {
+ if (!event.hasCollection(RawTrackerHit.class, rawHitCollectionName)) {
System.out.println(rawHitCollectionName + " does not exist; skipping event");
return;
}
-
+
List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawHitCollectionName);
if (rawHits == null) {
throw new RuntimeException("Event is missing SVT hits collection!");
@@ -72,6 +77,9 @@
for (RawTrackerHit hit : rawHits) {
ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants((SiSensor) hit.getDetectorElement(), hit.getIdentifierFieldValue("strip"));
HPSShapeFitParameters fit = _shaper.fitShape(hit, constants);
+ if (correctT0Shift) {
+ fit.setT0(fit.getT0() - constants.getT0Shift());
+ }
if (debug) {
System.out.println(fit);
}
hps-java/src/main/java/org/lcsim/hps/recon/tracking
diff -u -r1.9 -r1.10
--- HPSShaperAnalyticFitAlgorithm.java 18 May 2012 03:48:45 -0000 1.9
+++ HPSShaperAnalyticFitAlgorithm.java 21 Jun 2012 18:47:07 -0000 1.10
@@ -2,6 +2,7 @@
import org.lcsim.event.RawTrackerHit;
import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants.ChannelConstants;
+//import org.lcsim.math.chisq.ChisqProb;
/**
* Fast fitter; currently only fits single hits. Uses Tp from ChannelConstants;
@@ -30,7 +31,7 @@
bestStart = i;
}
}
- fit.setChiSq(fitSection(samples, constants, fit, bestStart));
+ fitSection(samples, constants, fit, bestStart);
// System.out.format("%f\t%f\t%f\t%f\t%f\t%f\n", samples[0] - constants.getPedestal(), samples[1] - constants.getPedestal(), samples[2] - constants.getPedestal(), samples[3] - constants.getPedestal(), samples[4] - constants.getPedestal(), samples[5] - constants.getPedestal());
// System.out.println("start = " + bestStart + ", " + fit);
return fit;
@@ -94,7 +95,8 @@
fit.setChiSq(chisq);
if (A > 0) {
- return chisq / (samples.length - 2); //TODO: p-value would be better here
+// return ChisqProb.gammp(samples.length - 2, chisq);
+ return chisq / (samples.length - 2);
} else {
return Double.POSITIVE_INFINITY;
}
CVSspam 0.2.12