Author: [log in to unmask]
Date: Thu Apr 23 16:28:54 2015
New Revision: 2804
Log:
Add ability to look at the occupancies in a given window.
Modified:
java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java
Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java
=============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java (original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SensorOccupancyPlotsDriver.java Thu Apr 23 16:28:54 2015
@@ -57,6 +57,8 @@
String rootFile = null;
+ private int maxSamplePosition = -1;
+ private int timeWindowWeight = 1;
private int eventCount = 0;
private int eventRefreshRate = 1;
private int runNumber = -1;
@@ -76,6 +78,14 @@
public void setEnablePositionPlots(boolean enablePositionPlots) {
this.enablePositionPlots = enablePositionPlots;
+ }
+
+ public void setMaxSamplePosition(int maxSamplePosition) {
+ this.maxSamplePosition = maxSamplePosition;
+ }
+
+ public void setTimeWindowWeight(int timeWindowWeight) {
+ this.timeWindowWeight = timeWindowWeight;
}
private int computePlotterRegion(HpsSiSensor sensor) {
@@ -186,7 +196,25 @@
// Increment strip hit count.
for (RawTrackerHit rawHit : rawHits) {
- occupancyMap.get((HpsSiSensor) rawHit.getDetectorElement())[rawHit.getIdentifierFieldValue("strip")]++;
+ // Obtain the raw ADC samples for each of the six samples readout
+ short[] adcValues = rawHit.getADCValues();
+
+ // Find the sample that has the largest amplitude. This should
+ // correspond to the peak of the shaper signal if the SVT is timed
+ // in correctly. Otherwise, the maximum sample value will default
+ // to 0.
+ int maxAmplitude = 0;
+ int maxSamplePositionFound = -1;
+ for (int sampleN = 0; sampleN < 6; sampleN++) {
+ if (adcValues[sampleN] > maxAmplitude) {
+ maxAmplitude = adcValues[sampleN];
+ maxSamplePositionFound = sampleN;
+ }
+ }
+
+ if (maxSamplePosition == -1 || maxSamplePosition == maxSamplePositionFound) {
+ occupancyMap.get((HpsSiSensor) rawHit.getDetectorElement())[rawHit.getIdentifierFieldValue("strip")]++;
+ }
}
// Plot strip occupancies.
@@ -197,6 +225,7 @@
if (enablePositionPlots) occupancyVPositionPlots.get(sensor).reset();
for (int channel = 0; channel < strips.length; channel++) {
double stripOccupancy = (double) strips[channel] / (double) eventCount;
+ stripOccupancy /= this.timeWindowWeight;
occupancyPlots.get(sensor).fill(channel, stripOccupancy);
if (enablePositionPlots) {
|