Skip to content

Commit 0bc4c78

Browse files
committed
Also check to make sure there are two peaks found.
1 parent fbdf4f6 commit 0bc4c78

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

evio/src/main/java/org/hps/evio/RfFitterDriver.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,16 @@ private double fitPulse(FADCGenericHit hit) {
143143
}
144144

145145
int jj = 0;
146+
int ik = 1;
146147
// Choose peak closest to center of window (second peak, ik=1)
147-
final int ik = 1;
148+
if( iz >=2 ) {
149+
ik = 1;
150+
}else if( iz == 1){
151+
ik = 0; // Only one peak found.
152+
}else{
153+
return 0;
154+
}
155+
148156
pedVal[ik] = (adcSamples[peakBin[ik] - 6] + adcSamples[peakBin[ik] - 7] + adcSamples[peakBin[ik] - 8] + adcSamples[peakBin[ik] - 9]) / 4.0;
149157
fitThresh[ik] = (adcSamples[peakBin[ik]] + pedVal[ik]) / 3.0;
150158

0 commit comments

Comments
 (0)