Commit in hps-java/src/main/java/org/lcsim/hps/recon/ecal on MAIN | |||
HPSEcalFADCReadoutDriver.java | +44 | -9 | 1.19 -> 1.20 |
HPSEcalReadoutDriver.java | +6 | -1 | 1.20 -> 1.21 |
+50 | -10 |
option to make FADC trigger integral mimic the readout integral
diff -u -r1.19 -r1.20 --- HPSEcalFADCReadoutDriver.java 27 Sep 2012 00:15:27 -0000 1.19 +++ HPSEcalFADCReadoutDriver.java 6 Nov 2012 02:06:13 -0000 1.20 @@ -27,7 +27,7 @@
* Simulates time evolution of preamp output pulse. * * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.19 2012/09/27 00:15:27 meeg Exp $
+ * @version $Id: HPSEcalFADCReadoutDriver.java,v 1.20 2012/11/06 02:06:13 meeg Exp $
*/ public class HPSEcalFADCReadoutDriver extends HPSEcalReadoutDriver<RawCalorimeterHit> {
@@ -78,6 +78,7 @@
// private double gain = 0.5*1000 * 80.0 / 60; private double scaleFactor = 128; private double fixedGain = -1;
+ private boolean constantTriggerWindow = false;
public HPSEcalFADCReadoutDriver() { flags = 0;
@@ -86,6 +87,10 @@
// converter = new HPSEcalConverter(null); }
+ public void setConstantTriggerWindow(boolean constantTriggerWindow) { + this.constantTriggerWindow = constantTriggerWindow; + } +
public void setFixedGain(double fixedGain) { this.fixedGain = fixedGain; }
@@ -179,18 +184,45 @@
Double sum = sumMap.get(cellID); if (sum == null && currentValue > triggerThreshold) { timeMap.put(cellID, readoutCounter);
- sumMap.put(cellID, currentValue);
+ if (constantTriggerWindow) { + double sumBefore = 0; + for (int i = 0; i < numSamplesBefore; i++) { + if (debug) { + System.out.format("trigger %d, %d: %d\n", cellID, i, pipeline.getValue(numSamplesBefore - i - 1)); + } + sumBefore += pipeline.getValue(numSamplesBefore - i - 1) - pedestal; + } + sumMap.put(cellID, sumBefore); + } else { + sumMap.put(cellID, currentValue); + }
} if (sum != null) {
- if (currentValue < triggerThreshold || timeMap.get(cellID) + delay0 == readoutCounter) {
+ if (constantTriggerWindow) { + if (timeMap.get(cellID) + numSamplesAfter >= readoutCounter) { + if (debug) { + System.out.format("trigger %d, %d: %d\n", cellID, readoutCounter - timeMap.get(cellID) + numSamplesBefore - 1, pipeline.getValue(0)); + } + sumMap.put(cellID, sum + pipeline.getValue(0) - pedestal); + } else if (timeMap.get(cellID) + delay0 <= readoutCounter) {
// System.out.printf("sum = %f\n",sum);
- outputQueue.add(new HPSFADCCalorimeterHit(cellID, - (int) Math.round((sum + currentValue) / scaleFactor), - timeMap.get(cellID), - readoutCounter - timeMap.get(cellID) + 1)); - sumMap.remove(cellID);
+ outputQueue.add(new HPSFADCCalorimeterHit(cellID, + (int) Math.round(sum / scaleFactor), + 64 * timeMap.get(cellID), + readoutCounter - timeMap.get(cellID) + 1)); + sumMap.remove(cellID); + }
} else {
- sumMap.put(cellID, sum + currentValue);
+ if (currentValue < triggerThreshold || timeMap.get(cellID) + delay0 == readoutCounter) { +// System.out.printf("sum = %f\n",sum); + outputQueue.add(new HPSFADCCalorimeterHit(cellID, + (int) Math.round((sum + currentValue) / scaleFactor), + 64 * timeMap.get(cellID), + readoutCounter - timeMap.get(cellID) + 1)); + sumMap.remove(cellID); + } else { + sumMap.put(cellID, sum + currentValue); + }
} } eDepBuffer.step();
@@ -297,6 +329,9 @@
if (window != null) { for (int i = 0; i < readoutWindow; i++) { if (numSamplesToRead != 0) {
+ if (debug) { + System.out.format("readout %d, %d: %d\n", cellID, numSamplesBefore + numSamplesAfter - numSamplesToRead, window[i - pointerOffset]); + }
adcSum += window[i - pointerOffset]; numSamplesToRead--; if (numSamplesToRead == 0) {
diff -u -r1.20 -r1.21 --- HPSEcalReadoutDriver.java 27 Aug 2012 21:53:47 -0000 1.20 +++ HPSEcalReadoutDriver.java 6 Nov 2012 02:06:14 -0000 1.21 @@ -13,7 +13,7 @@
* Performs readout of ECal hits. * * @author Sho Uemura <[log in to unmask]>
- * @version $Id: HPSEcalReadoutDriver.java,v 1.20 2012/08/27 21:53:47 meeg Exp $
+ * @version $Id: HPSEcalReadoutDriver.java,v 1.21 2012/11/06 02:06:14 meeg Exp $
*/ public abstract class HPSEcalReadoutDriver<T> extends Driver {
@@ -36,6 +36,7 @@
//readout period counter int readoutCounter; public static boolean readoutBit = false;
+ protected boolean debug = false;
public HPSEcalReadoutDriver() { flags += 1 << LCIOConstants.CHBIT_LONG; //store position
@@ -43,6 +44,10 @@
}
+ public void setDebug(boolean debug) { + this.debug = debug; + } +
public void setEcalReadoutName(String ecalReadoutName) { this.ecalReadoutName = ecalReadoutName; }
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1