Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN | |||
SimpleSvtReadout.java | +58 | -10 | 1.7 -> 1.8 |
add noise and noise hits
diff -u -r1.7 -r1.8 --- SimpleSvtReadout.java 1 Mar 2013 21:24:26 -0000 1.7 +++ SimpleSvtReadout.java 1 Mar 2013 22:34:25 -0000 1.8 @@ -16,6 +16,7 @@
import org.lcsim.hps.recon.tracking.apv25.Apv25Constants; import org.lcsim.hps.recon.tracking.apv25.HPSAPV25; import org.lcsim.hps.util.ClockSingleton;
+import org.lcsim.hps.util.RandomGaussian;
import org.lcsim.hps.util.RingBuffer; import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim; import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeData;
@@ -28,7 +29,7 @@
/** * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: SimpleSvtReadout.java,v 1.7 2013/03/01 21:24:26 meeg Exp $
+ * @version $Id: SimpleSvtReadout.java,v 1.8 2013/03/01 22:34:25 meeg Exp $
*/ public class SimpleSvtReadout extends Driver {
@@ -42,16 +43,22 @@
private int readoutCycle = 0; private double timeOffset = 30.0; private boolean noPileup = false;
+ private boolean addNoise = true;
//cut settings private boolean enableThresholdCut = true; private int samplesAboveThreshold = 3; private double noiseThreshold = 2.0; private boolean enablePileupCut = true;
+ private boolean dropBadChannels = true;
public SimpleSvtReadout() { add(readoutDriver); }
+ public void setAddNoise(boolean addNoise) { + this.addNoise = addNoise; + } +
public void setEnablePileupCut(boolean enablePileupCut) { this.enablePileupCut = enablePileupCut; }
@@ -72,6 +79,10 @@
this.noPileup = noPileup; }
+ public void setDropBadChannels(boolean dropBadChannels) { + this.dropBadChannels = dropBadChannels; + } +
/** * */
@@ -86,7 +97,13 @@
if (!noPileup) { for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
- pipelineMap.put(sensor, new APV25Pipeline[HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR]);
+ APV25Pipeline[] pipelines = new APV25Pipeline[HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR]; + pipelineMap.put(sensor, pipelines); + if (addNoise) { + for (int channel = 0; channel < HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR; channel++) { + pipelines[channel] = new APV25Pipeline(); + } + }
} } }
@@ -141,12 +158,16 @@
for (int channel = 0; channel < pipelines.length; channel++) { if (pipelines[channel] != null) { short[] samples = new short[6];
- for (int j = 0; j < 6; j++) { - samples[j] = (short) (pipelines[channel].getValue(j) + HPSSVTCalibrationConstants.getPedestal(sensor, channel)); -// System.out.println(samples[j]);
+ if (addNoise) { + double[] noise = makeNoise(sensor, channel); + for (int i = 0; i < 6; i++) { + samples[i] = (short) Math.round(pipelines[channel].getValue(i) + HPSSVTCalibrationConstants.getPedestal(sensor, channel) + noise[i]); + } + } else { + for (int i = 0; i < 6; i++) { + samples[i] = (short) Math.round(pipelines[channel].getValue(i) + HPSSVTCalibrationConstants.getPedestal(sensor, channel)); + }
}
-// System.out.println(); -
long cell_id = SvtUtils.makeCellID(sensor, channel); RawTrackerHit hit = new BaseRawTrackerHit(0, cell_id, samples, null, sensor);
@@ -172,11 +193,20 @@
double amplitude = stripHit.amplitude; short[] samples = new short[6];
- for (int i = 0; i < 6; i++) { - double time = i * Apv25Constants.SAMPLING_INTERVAL - timeOffset; - samples[i] = (short) Math.round(amplitude * pulseAmplitude(time, HPSSVTCalibrationConstants.getTShaping(sensor, channel)) + HPSSVTCalibrationConstants.getPedestal(sensor, channel));
+ if (addNoise) { + double[] noise = makeNoise(sensor, channel); + for (int i = 0; i < 6; i++) { + double time = i * Apv25Constants.SAMPLING_INTERVAL - timeOffset; + samples[i] = (short) Math.round(amplitude * pulseAmplitude(time, HPSSVTCalibrationConstants.getTShaping(sensor, channel)) + HPSSVTCalibrationConstants.getPedestal(sensor, channel) + noise[i]); + } + } else { + for (int i = 0; i < 6; i++) { + double time = i * Apv25Constants.SAMPLING_INTERVAL - timeOffset; + samples[i] = (short) Math.round(amplitude * pulseAmplitude(time, HPSSVTCalibrationConstants.getTShaping(sensor, channel)) + HPSSVTCalibrationConstants.getPedestal(sensor, channel)); + }
}
+
long cell_id = SvtUtils.makeCellID(sensor, channel); RawTrackerHit hit = new BaseRawTrackerHit(0, cell_id, samples, null, sensor);
@@ -238,6 +268,15 @@
return stripHits; }
+ private double[] makeNoise(SiSensor sensor, int channel) { + double[] samples = new double[6]; + double noise = HPSSVTCalibrationConstants.getNoise(sensor, channel); + for (int i = 0; i < 6; i++) { + samples[i] = RandomGaussian.getGaussian(0, noise); + } + return samples; + } +
private boolean readoutCuts(RawTrackerHit hit) { if (enableThresholdCut && !samplesAboveThreshold(hit)) { return false;
@@ -245,9 +284,18 @@
if (enablePileupCut && !pileupCut(hit)) { return false; }
+ if (dropBadChannels && !badChannelCut(hit)) { + return false; + }
return true; }
+ private boolean badChannelCut(RawTrackerHit hit) { + SiSensor sensor = (SiSensor) hit.getDetectorElement(); + int channel = hit.getIdentifierFieldValue("strip"); + return !HPSSVTCalibrationConstants.isBadChannel(sensor, channel); + } +
private boolean pileupCut(RawTrackerHit hit) { short[] samples = hit.getADCValues(); return (samples[2] > samples[1] || samples[3] > samples[2]);
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