Author: [log in to unmask]
Date: Thu Apr 2 10:07:10 2015
New Revision: 2657
Log:
Updated diagnostic monitoring tables to use the new data system and updated the efficiency table format.
Modified:
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java
java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTablePanel.java Thu Apr 2 10:07:10 2015
@@ -55,7 +55,7 @@
add(localTable);
// Set the panels to their null starting values.
- updatePanel(null);
+ updatePanel(null, null);
// Define the panel layout.
setLayout(null);
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTriggerTablePanel.java Thu Apr 2 10:07:10 2015
@@ -1,7 +1,7 @@
package org.hps.monitoring.trigger;
-import org.hps.analysis.trigger.DiagSnapshot;
-import org.hps.analysis.trigger.event.TriggerStatModule;
+import org.hps.analysis.trigger.data.DiagnosticSnapshot;
+import org.hps.analysis.trigger.data.TriggerStatModule;
import org.hps.analysis.trigger.util.ComponentUtils;
/**
@@ -19,6 +19,11 @@
// Internal variables.
private final int numCuts;
+ private final boolean singles;
+
+ // Store reference index variables for local and run values.
+ private static final int GLOBAL = 0;
+ private static final int LOCAL = 1;
// Reference variables to the default table rows.
protected static final int ROW_RECON_COUNT = 0;
@@ -35,19 +40,22 @@
* indicated cut names.
* @param cutNames
*/
- public AbstractTriggerTablePanel(String[] cutNames) {
+ public AbstractTriggerTablePanel(String[] cutNames, boolean isSingles) {
// Instantiate the superclass.
super(makeTitle(cutNames));
// Store the number of cuts.
numCuts = cutNames.length;
- updatePanel(null);
+ updatePanel(null, null);
+
+ // Store whether this is a singles or pair trigger panel.
+ singles = isSingles;
}
@Override
- public void updatePanel(DiagSnapshot snapshot) {
+ public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
// If the snapshot is null, all values should be "N/A."
- if(snapshot == null) {
+ if(runSnapshot == null || localSnapshot == null) {
// Output cluster count data.
String scalerNullValue = "---";
setLocalRowValue(ROW_RECON_COUNT, scalerNullValue);
@@ -73,67 +81,84 @@
}
} else {
// Get the local and run trigger statistics from the snapshot.
- TriggerStatModule lstat = getLocalModule(snapshot);
- TriggerStatModule rstat = getRunModule(snapshot);
+ DiagnosticSnapshot[] stat = new DiagnosticSnapshot[2];
+ stat[GLOBAL] = runSnapshot;
+ stat[LOCAL] = localSnapshot;
+
+ // Get the appropriate trigger statistical modules.
+ TriggerStatModule[][] triggerStats = new TriggerStatModule[2][2];
+ if(singles) {
+ triggerStats[LOCAL][0] = stat[LOCAL].getSingles0Stats();
+ triggerStats[LOCAL][1] = stat[LOCAL].getSingles1Stats();
+ triggerStats[GLOBAL][0] = stat[GLOBAL].getSingles0Stats();
+ triggerStats[GLOBAL][1] = stat[GLOBAL].getSingles1Stats();
+ } else {
+ triggerStats[LOCAL][0] = stat[LOCAL].getPair0Stats();
+ triggerStats[LOCAL][1] = stat[LOCAL].getPair1Stats();
+ triggerStats[GLOBAL][0] = stat[GLOBAL].getPair0Stats();
+ triggerStats[GLOBAL][1] = stat[GLOBAL].getPair1Stats();
+ }
+
+ // Get the total number of triggers of each type.
+ int[] sspSimTriggers = new int[2];
+ int[] sspBankTriggers = new int[2];
+ int[] reconSimTriggers = new int[2];
+ int[] sspMatchedTriggers = new int[2];
+ int[] reconMatchedTriggers = new int[2];
+
+ for(int i = 0; i < 2; i++) {
+ sspSimTriggers[i] = triggerStats[i][0].getSSPSimulatedTriggers() + triggerStats[i][1].getSSPSimulatedTriggers();
+ sspBankTriggers[i] = triggerStats[i][0].getReportedTriggers() + triggerStats[i][1].getReportedTriggers();
+ sspBankTriggers[i] = triggerStats[i][0].getReconSimulatedTriggers() + triggerStats[i][1].getReconSimulatedTriggers();
+ sspMatchedTriggers[i] = triggerStats[i][0].getMatchedSSPSimulatedTriggers() + triggerStats[i][1].getMatchedSSPSimulatedTriggers();
+ reconMatchedTriggers[i] = triggerStats[i][0].getMatchedReconSimulatedTriggers() + triggerStats[i][1].getMatchedReconSimulatedTriggers();
+ }
// Determine the most spaces needed to display the values.
// Get the largest number of digits in any of the values.
- int mostDigits = ComponentUtils.max(lstat.getReconTriggerCount(), lstat.getSSPBankTriggerCount(),
- lstat.getSSPSimTriggerCount(), rstat.getReconTriggerCount(), rstat.getSSPBankTriggerCount(),
- rstat.getSSPSimTriggerCount());
+ int mostDigits = ComponentUtils.max(reconSimTriggers[LOCAL], sspBankTriggers[LOCAL],
+ sspSimTriggers[LOCAL], reconSimTriggers[GLOBAL], sspBankTriggers[GLOBAL],
+ sspSimTriggers[GLOBAL]);
int spaces = ComponentUtils.getDigits(mostDigits);
// Update the single-value counters.
String countFormat = "%" + spaces + "d";
- setLocalRowValue(ROW_RECON_COUNT, String.format(countFormat, lstat.getReconTriggerCount()));
- setLocalRowValue(ROW_SSP_SIM_COUNT, String.format(countFormat, lstat.getSSPSimTriggerCount()));
- setLocalRowValue(ROW_SSP_BANK_COUNT, String.format(countFormat, lstat.getSSPBankTriggerCount()));
- setGlobalRowValue(ROW_RECON_COUNT, String.format(countFormat, rstat.getReconTriggerCount()));
- setGlobalRowValue(ROW_SSP_SIM_COUNT, String.format(countFormat, rstat.getSSPSimTriggerCount()));
- setGlobalRowValue(ROW_SSP_BANK_COUNT, String.format(countFormat, rstat.getSSPBankTriggerCount()));
+ setLocalRowValue(ROW_RECON_COUNT, String.format(countFormat, reconSimTriggers[LOCAL]));
+ setLocalRowValue(ROW_SSP_SIM_COUNT, String.format(countFormat, sspSimTriggers[LOCAL]));
+ setLocalRowValue(ROW_SSP_BANK_COUNT, String.format(countFormat, sspBankTriggers[LOCAL]));
+ setGlobalRowValue(ROW_RECON_COUNT, String.format(countFormat, reconSimTriggers[GLOBAL]));
+ setGlobalRowValue(ROW_SSP_SIM_COUNT, String.format(countFormat, sspSimTriggers[GLOBAL]));
+ setGlobalRowValue(ROW_SSP_BANK_COUNT, String.format(countFormat, sspBankTriggers[GLOBAL]));
// Update the percentage counters.
String percentFormat = "%" + spaces + "d / %" + spaces + "d (%7.3f)";
- setLocalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, lstat.getMatchedSSPTriggers(),
- lstat.getSSPSimTriggerCount(), (100.0 * lstat.getMatchedSSPTriggers() / lstat.getSSPSimTriggerCount())));
- setLocalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, lstat.getMatchedReconTriggers(),
- lstat.getReconTriggerCount(), (100.0 * lstat.getMatchedReconTriggers() / lstat.getReconTriggerCount())));
- setGlobalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, rstat.getMatchedSSPTriggers(),
- rstat.getSSPSimTriggerCount(), (100.0 * rstat.getMatchedSSPTriggers() / rstat.getSSPSimTriggerCount())));
- setGlobalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, lstat.getMatchedReconTriggers(),
- rstat.getReconTriggerCount(), (100.0 * rstat.getMatchedReconTriggers() / rstat.getReconTriggerCount())));
+ setLocalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, sspMatchedTriggers[LOCAL],
+ sspSimTriggers[LOCAL], (100.0 * sspMatchedTriggers[LOCAL] / sspSimTriggers[LOCAL])));
+ setLocalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, reconMatchedTriggers[LOCAL],
+ reconSimTriggers[LOCAL], (100.0 * reconMatchedTriggers[LOCAL] / reconSimTriggers[LOCAL])));
+ setGlobalRowValue(ROW_SSP_EFFICIENCY, String.format(percentFormat, sspMatchedTriggers[GLOBAL],
+ sspSimTriggers[GLOBAL], (100.0 * sspMatchedTriggers[GLOBAL] / sspSimTriggers[GLOBAL])));
+ setGlobalRowValue(ROW_TRIGGER_EFFICIENCY, String.format(percentFormat, reconMatchedTriggers[GLOBAL],
+ reconSimTriggers[GLOBAL], (100.0 * reconMatchedTriggers[GLOBAL] / reconSimTriggers[GLOBAL])));
int ROW_SECOND_TRIGGER_CUT = ROW_FIRST_TRIGGER_CUT + numCuts + 2;
- int[] total = { lstat.getSSPSimTriggerCount() / 2, rstat.getSSPSimTriggerCount() / 2 };
for(int cutRow = 0; cutRow < numCuts; cutRow++) {
- setLocalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat, lstat.getCutFailures(0, cutRow),
- total[0], (100.0 * lstat.getCutFailures(0, cutRow) / total[0])));
- setLocalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat, lstat.getCutFailures(1, cutRow),
- total[0], (100.0 * lstat.getCutFailures(1, cutRow) / total[0])));
- setGlobalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat, lstat.getCutFailures(0, cutRow),
- total[1], (100.0 * lstat.getCutFailures(0, cutRow) / total[1])));
- setGlobalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat, lstat.getCutFailures(1, cutRow),
- total[1], (100.0 * lstat.getCutFailures(1, cutRow) / total[1])));
+ setLocalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat,
+ triggerStats[LOCAL][0].getSSPCutFailures(cutRow), triggerStats[LOCAL][0].getSSPSimulatedTriggers(),
+ (100.0 * triggerStats[LOCAL][0].getSSPCutFailures(cutRow) / triggerStats[LOCAL][0].getSSPSimulatedTriggers())));
+ setLocalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat,
+ triggerStats[LOCAL][1].getSSPCutFailures(cutRow), triggerStats[LOCAL][1].getSSPSimulatedTriggers(),
+ (100.0 * triggerStats[LOCAL][1].getSSPCutFailures(cutRow) / triggerStats[LOCAL][1].getSSPSimulatedTriggers())));
+ setGlobalRowValue(cutRow + ROW_FIRST_TRIGGER_CUT, String.format(percentFormat,
+ triggerStats[GLOBAL][0].getSSPCutFailures(cutRow), triggerStats[GLOBAL][0].getSSPSimulatedTriggers(),
+ (100.0 * triggerStats[GLOBAL][0].getSSPCutFailures(cutRow) / triggerStats[GLOBAL][0].getSSPSimulatedTriggers())));
+ setGlobalRowValue(cutRow + ROW_SECOND_TRIGGER_CUT, String.format(percentFormat,
+ triggerStats[GLOBAL][1].getSSPCutFailures(cutRow), triggerStats[GLOBAL][1].getSSPSimulatedTriggers(),
+ (100.0 * triggerStats[GLOBAL][1].getSSPCutFailures(cutRow) / triggerStats[GLOBAL][1].getSSPSimulatedTriggers())));
}
}
}
-
- /**
- * Gets the statistical module from which local statistics should
- * be drawn.
- * @param snapshot - The snapshot containing the modules.
- * @return Returns the module containing local statistical data.
- */
- protected abstract TriggerStatModule getLocalModule(DiagSnapshot snapshot);
-
- /**
- * Gets the statistical module from which run statistics should
- * be drawn.
- * @param snapshot - The snapshot containing the modules.
- * @return Returns the module containing run statistical data.
- */
- protected abstract TriggerStatModule getRunModule(DiagSnapshot snapshot);
/**
* Creates the table appropriate table rows from the argument cut
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/AbstractTwoColumnTablePanel.java Thu Apr 2 10:07:10 2015
@@ -1,6 +1,10 @@
package org.hps.monitoring.trigger;
+import java.awt.Font;
+
+import javax.swing.JLabel;
import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
/**
* Class <code>AbstractTwoColumnTablePanel</code> is an implementation
@@ -51,7 +55,11 @@
localModel.setValueAt(rowNames[i], i, COL_TITLE);
globalModel.setValueAt(rowNames[i], i, COL_TITLE);
}
- updatePanel(null);
+ updatePanel(null, null);
+
+ // Make a cell renderer.
+ DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
+ centerRenderer.setHorizontalAlignment(JLabel.CENTER);
// Create JTable objects to display the data.
JTable localTable = new JTable(localModel);
@@ -59,12 +67,20 @@
localTable.setColumnSelectionAllowed(false);
localTable.setCellSelectionEnabled(false);
localTable.setShowVerticalLines(false);
+ localTable.getColumnModel().getColumn(0).setMinWidth(200);
+ localTable.getColumnModel().getColumn(0).setMaxWidth(200);
+ localTable.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
+ localTable.setFont(new Font("monospaced", localTable.getFont().getStyle(), localTable.getFont().getSize()));
JTable globalTable = new JTable(globalModel);
globalTable.setRowSelectionAllowed(false);
globalTable.setColumnSelectionAllowed(false);
globalTable.setCellSelectionEnabled(false);
globalTable.setShowVerticalLines(false);
+ globalTable.getColumnModel().getColumn(0).setMinWidth(200);
+ globalTable.getColumnModel().getColumn(0).setMaxWidth(200);
+ globalTable.getColumnModel().getColumn(1).setCellRenderer(centerRenderer);
+ globalTable.setFont(new Font("monospaced", globalTable.getFont().getStyle(), globalTable.getFont().getSize()));
// Return the two tables.
return new JTable[] { localTable, globalTable };
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ClusterTablePanel.java Thu Apr 2 10:07:10 2015
@@ -1,7 +1,7 @@
package org.hps.monitoring.trigger;
-import org.hps.analysis.trigger.DiagSnapshot;
-import org.hps.analysis.trigger.event.ClusterStatModule;
+import org.hps.analysis.trigger.data.ClusterStatModule;
+import org.hps.analysis.trigger.data.DiagnosticSnapshot;
import org.hps.analysis.trigger.util.ComponentUtils;
/**
@@ -33,9 +33,9 @@
public ClusterTablePanel() { super(TABLE_TITLES); }
@Override
- public void updatePanel(DiagSnapshot snapshot) {
+ public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
// If the snapshot is null, all values should be "N/A."
- if(snapshot == null) {
+ if(localSnapshot == null || runSnapshot == null) {
// Output cluster count data.
String scalerNullValue = "---";
setLocalRowValue(ROW_RECON_COUNT, scalerNullValue);
@@ -58,8 +58,8 @@
// Otherwise, populate the table with the diagnostic data.
else {
// Get the cluster statistical banks.
- ClusterStatModule lstat = snapshot.clusterLocalStatistics;
- ClusterStatModule rstat = snapshot.clusterRunStatistics;
+ ClusterStatModule lstat = localSnapshot.getClusterStats();
+ ClusterStatModule rstat = runSnapshot.getClusterStats();
// Get the largest number of digits in any of the values.
int mostDigits = ComponentUtils.max(lstat.getReconClusterCount(), lstat.getSSPClusterCount(), lstat.getMatches(),
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/DiagnosticUpdatable.java Thu Apr 2 10:07:10 2015
@@ -1,6 +1,7 @@
package org.hps.monitoring.trigger;
import org.hps.analysis.trigger.DiagSnapshot;
+import org.hps.analysis.trigger.data.DiagnosticSnapshot;
/**
* Interface <code>DiagnosticUpdatable</code> defines a class of objects
@@ -18,5 +19,5 @@
* @param snapshot - The snapshot containing information with which
* to update the object.
*/
- public void updatePanel(DiagSnapshot snapshot);
+ public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot);
}
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/EfficiencyTablePanel.java Thu Apr 2 10:07:10 2015
@@ -1,11 +1,14 @@
package org.hps.monitoring.trigger;
+import java.awt.Font;
+
+import javax.swing.JLabel;
import javax.swing.JTable;
-
-import org.hps.analysis.trigger.DiagSnapshot;
-import org.hps.analysis.trigger.event.TriggerEfficiencyModule;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import org.hps.analysis.trigger.data.DiagnosticSnapshot;
+import org.hps.analysis.trigger.data.TriggerStatModule;
import org.hps.analysis.trigger.util.ComponentUtils;
-import org.hps.analysis.trigger.util.TriggerDiagnosticUtil;
public class EfficiencyTablePanel extends AbstractTablePanel implements DiagnosticUpdatable {
// Static variables.
@@ -14,6 +17,41 @@
// Table models.
private TableTextModel localModel;
private TableTextModel globalModel;
+
+ // Column/row reference variables.
+ private static final int ROWS = 7;
+ private static final int COLUMNS = 6;
+ /* private static final int COL_HEADER = 0;
+ private static final int COL_SINGLES_0 = 1;
+ private static final int COL_SINGLES_1 = 2;
+ private static final int COL_PAIR_0 = 3;
+ private static final int COL_PAIR_1 = 4; */
+ private static final int COL_COUNT = 5;
+ /* private static final int ROW_HEADER = 0;
+ private static final int ROW_PULSER = 1;
+ private static final int ROW_COSMIC = 2;
+ private static final int ROW_SINGLES_0 = 3;
+ private static final int ROW_SINGLES_1 = 4;
+ private static final int ROW_PAIR_0 = 5;
+ private static final int ROW_PAIR_1 = 6; */
+
+ // Global/local reference variables.
+ private static final int GLOBAL = 0;
+ private static final int LOCAL = 1;
+
+ // Trigger type reference variables.
+ private static final int TYPE_SINGLES_0 = TriggerStatModule.SINGLES_0;
+ private static final int TYPE_SINGLES_1 = TriggerStatModule.SINGLES_1;
+ private static final int TYPE_PAIR_0 = TriggerStatModule.PAIR_0;
+ private static final int TYPE_PAIR_1 = TriggerStatModule.PAIR_1;
+
+ // Column/row header names.
+ private static final String[] COL_NAMES = {
+ "", "Singles 0", "Singles 1", "Pair 0", "Pair 1", "Count"
+ };
+ private static final String[] ROW_NAMES = {
+ "", "Random", "Cosmic", "Singles 0", "Singles 1", "Pair 0", "Pair 1"
+ };
/**
* Instantiates a new <code>EfficiencyTablePanel</code>.
@@ -27,74 +65,117 @@
}
@Override
- public void updatePanel(DiagSnapshot snapshot) {
+ public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
// If there is no snapshot, the tables should all display an
// empty value.
- if(snapshot == null) {
- for(int eventTriggerID = 0; eventTriggerID < 6; eventTriggerID++) {
- for(int seenTriggerID = 0; seenTriggerID < 6; seenTriggerID++) {
- localModel.setValueAt("--- / ---", eventTriggerID + 1, seenTriggerID + 1);
- globalModel.setValueAt("--- / ---", eventTriggerID + 1, seenTriggerID + 1);
+ if(runSnapshot == null || localSnapshot == null) {
+ for(int row = 1; row < ROWS; row++) {
+ for(int col = 1; col < COLUMNS; col++) {
+ localModel.setValueAt("---", row, col);
+ globalModel.setValueAt("---", row, col);
}
}
}
// Otherwise, update the table cells from the snapshot data.
else {
- // Get the efficiency modules.
- TriggerEfficiencyModule rmod = snapshot.efficiencyRunStatistics;
- TriggerEfficiencyModule lmod = snapshot.efficiencyLocalStatistics;
+ // Get the efficiency modules.
+ DiagnosticSnapshot[] stat = new DiagnosticSnapshot[2];
+ stat[GLOBAL] = runSnapshot;
+ stat[LOCAL] = localSnapshot;
+
+ // Get the trigger count for each trigger type for both the
+ // local and global snapshots.
+ int[][][] matched = new int[2][4][6];
+ int[][][] triggers = new int[2][4][6];
+ for(int i = 0; i < 2; i++) {
+ for(int triggerType = 0; triggerType < 6; triggerType++) {
+ // Get the total triggers seen for each type.
+ triggers[i][TYPE_SINGLES_0][triggerType] = stat[i].getSingles0Stats().getSSPSimulatedTriggers(triggerType);
+ triggers[i][TYPE_SINGLES_1][triggerType] = stat[i].getSingles1Stats().getSSPSimulatedTriggers(triggerType);
+ triggers[i][TYPE_PAIR_0][triggerType] = stat[i].getPair0Stats().getSSPSimulatedTriggers(triggerType);
+ triggers[i][TYPE_PAIR_1][triggerType] = stat[i].getPair1Stats().getSSPSimulatedTriggers(triggerType);
+
+ // Get the total triggers matched for each type.
+ matched[i][TYPE_SINGLES_0][triggerType] = stat[i].getSingles0Stats().getMatchedSSPSimulatedTriggers(triggerType);
+ matched[i][TYPE_SINGLES_1][triggerType] = stat[i].getSingles1Stats().getMatchedSSPSimulatedTriggers(triggerType);
+ matched[i][TYPE_PAIR_0][triggerType] = stat[i].getPair0Stats().getMatchedSSPSimulatedTriggers(triggerType);
+ matched[i][TYPE_PAIR_1][triggerType] = stat[i].getPair1Stats().getMatchedSSPSimulatedTriggers(triggerType);
+ }
+ }
// Determine the spacing needed to display the largest numerical
// cell value.
int numWidth = -1;
- for(int eventTriggerID = 0; eventTriggerID < 6; eventTriggerID++) {
- for(int seenTriggerID = 0; seenTriggerID < 6; seenTriggerID++) {
- int rSize = ComponentUtils.getDigits(rmod.getTriggersSeen(eventTriggerID, seenTriggerID));
- int lSize = ComponentUtils.getDigits(lmod.getTriggersSeen(eventTriggerID, seenTriggerID));
+ for(int tiTriggerType = 0; tiTriggerType < 6; tiTriggerType++) {
+ for(int seenTriggerType = 0; seenTriggerType < 4; seenTriggerType++) {
+ int rSize = ComponentUtils.getDigits(triggers[GLOBAL][seenTriggerType][tiTriggerType]);
+ int lSize = ComponentUtils.getDigits(triggers[LOCAL][seenTriggerType][tiTriggerType]);
numWidth = ComponentUtils.max(numWidth, rSize, lSize);
}
}
// Generate the format string for the cells.
- String nullText = String.format("%s / %s", ComponentUtils.getChars('-', numWidth),
- ComponentUtils.getChars('-', numWidth));
String format = "%" + numWidth + "d / %" + numWidth + "d";
// Update the table.
- for(int eventTriggerID = 0; eventTriggerID < 6; eventTriggerID++) {
- for(int seenTriggerID = 0; seenTriggerID < 6; seenTriggerID++) {
- if(eventTriggerID == seenTriggerID) {
- localModel.setValueAt(nullText, eventTriggerID + 1, seenTriggerID + 1);
+ for(int tiTriggerType = 0; tiTriggerType < 6; tiTriggerType++) {
+ // Fill the row/column combinations that hold trigger
+ // statistical information.
+ for(int seenTriggerType = 0; seenTriggerType < 4; seenTriggerType++) {
+ // Fill the local table cell.
+ String localText = String.format(format, matched[LOCAL][seenTriggerType][tiTriggerType],
+ triggers[LOCAL][seenTriggerType][tiTriggerType]);
+ if(triggers[LOCAL][seenTriggerType][tiTriggerType] == 0) {
+ localText = localText + " ( N/A %)";
} else {
- localModel.setValueAt(String.format(format, lmod.getTriggersMatched(eventTriggerID, seenTriggerID),
- lmod.getTriggersSeen(eventTriggerID, seenTriggerID)), eventTriggerID + 1, seenTriggerID + 1);
- globalModel.setValueAt(String.format(format, rmod.getTriggersMatched(eventTriggerID, seenTriggerID),
- rmod.getTriggersSeen(eventTriggerID, seenTriggerID)), eventTriggerID + 1, seenTriggerID + 1);
+ localText = String.format("%s (%7.3f%%)", localText,
+ (100.0 * matched[LOCAL][seenTriggerType][tiTriggerType] / triggers[LOCAL][seenTriggerType][tiTriggerType]));
}
- }
+ localModel.setValueAt(localText, tiTriggerType + 1, seenTriggerType + 1);
+
+ // Fill the global table cell.
+ String globalText = String.format(format, matched[GLOBAL][seenTriggerType][tiTriggerType],
+ triggers[GLOBAL][seenTriggerType][tiTriggerType]);
+ if(triggers[GLOBAL][seenTriggerType][tiTriggerType] == 0) {
+ globalText = globalText + " ( N/A %)";
+ } else {
+ globalText = String.format("%s (%7.3f%%)", globalText,
+ (100.0 * matched[LOCAL][seenTriggerType][tiTriggerType] / triggers[GLOBAL][seenTriggerType][tiTriggerType]));
+ }
+ globalModel.setValueAt(globalText, tiTriggerType + 1, seenTriggerType + 1);
+ }
+
+ // Populate the count column.
+ localModel.setValueAt("" + stat[LOCAL].getTITriggers(tiTriggerType, true), tiTriggerType + 1, COL_COUNT);
+ globalModel.setValueAt("" + stat[GLOBAL].getTITriggers(tiTriggerType, true), tiTriggerType + 1, COL_COUNT);
}
}
}
@Override
protected JTable[] initializeTables(Object... args) {
- // Get a shorter reference to the trigger name list.
- String[] triggerNames = TriggerDiagnosticUtil.TRIGGER_NAME;
-
// Initialize the table models. There should be one row and
// one column for each type of trigger plus an additional one
// of each for headers.
- localModel = new TableTextModel(triggerNames.length + 1, triggerNames.length + 1);
- globalModel = new TableTextModel(triggerNames.length + 1, triggerNames.length + 1);
-
- // Set the column and row headers.
- for(int triggerType = 0; triggerType < triggerNames.length; triggerType++) {
- localModel.setValueAt(triggerNames[triggerType], triggerType + 1, 0);
- localModel.setValueAt(triggerNames[triggerType], 0, triggerType + 1);
- globalModel.setValueAt(triggerNames[triggerType], triggerType + 1, 0);
- globalModel.setValueAt(triggerNames[triggerType], 0, triggerType + 1);
- }
+ localModel = new TableTextModel(ROWS, COLUMNS);
+ globalModel = new TableTextModel(ROWS, COLUMNS);
+
+ // Set the column headers.
+ for(int col = 0; col < COLUMNS; col++) {
+ localModel.setValueAt(COL_NAMES[col], 0, col);
+ globalModel.setValueAt(COL_NAMES[col], 0, col);
+ }
+
+ // Set the row headers.
+ for(int row = 0; row < ROWS; row++) {
+ localModel.setValueAt(ROW_NAMES[row], row, 0);
+ globalModel.setValueAt(ROW_NAMES[row], row, 0);
+ }
+
+ // Make a cell renderer.
+ DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
+ centerRenderer.setHorizontalAlignment(JLabel.CENTER);
// Create JTable objects to display the data.
JTable localTable = new JTable(localModel);
@@ -102,12 +183,24 @@
localTable.setColumnSelectionAllowed(false);
localTable.setCellSelectionEnabled(false);
localTable.setShowVerticalLines(false);
+ localTable.getColumnModel().getColumn(0).setMaxWidth(150);
+ localTable.getColumnModel().getColumn(COL_COUNT).setMaxWidth(150);
+ for(int col = 1; col < COLUMNS; col++) {
+ localTable.getColumnModel().getColumn(col).setCellRenderer(centerRenderer);
+ }
+ localTable.setFont(new Font("monospaced", localTable.getFont().getStyle(), localTable.getFont().getSize()));
JTable globalTable = new JTable(globalModel);
globalTable.setRowSelectionAllowed(false);
globalTable.setColumnSelectionAllowed(false);
globalTable.setCellSelectionEnabled(false);
globalTable.setShowVerticalLines(false);
+ globalTable.getColumnModel().getColumn(0).setMaxWidth(150);
+ globalTable.getColumnModel().getColumn(COL_COUNT).setMaxWidth(150);
+ for(int col = 1; col < COLUMNS; col++) {
+ globalTable.getColumnModel().getColumn(col).setCellRenderer(centerRenderer);
+ }
+ globalTable.setFont(new Font("monospaced", globalTable.getFont().getStyle(), globalTable.getFont().getSize()));
// Return the tables.
return new JTable[] { localTable, globalTable };
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/PairTablePanel.java Thu Apr 2 10:07:10 2015
@@ -1,7 +1,4 @@
package org.hps.monitoring.trigger;
-
-import org.hps.analysis.trigger.DiagSnapshot;
-import org.hps.analysis.trigger.event.TriggerStatModule;
/**
* Class <code>PairTablePanel</code> displays statistical information
@@ -12,22 +9,12 @@
public class PairTablePanel extends AbstractTriggerTablePanel {
// Static variables.
private static final long serialVersionUID = 0L;
- private static final String[] CUT_NAMES = { " Energy Sum:",
- " Energy Difference:", " Energy Slope:", " Coplanarity:" };
+ private static final String[] CUT_NAMES = { " Energy Sum:",
+ " Energy Difference:", " Energy Slope:", " Coplanarity:" };
/**
* Instantiates a <code>PairTablePanel</code>.
*/
- public PairTablePanel() { super(CUT_NAMES); }
-
- @Override
- protected TriggerStatModule getLocalModule(DiagSnapshot snapshot) {
- return snapshot.pairLocalStatistics;
- }
-
- @Override
- protected TriggerStatModule getRunModule(DiagSnapshot snapshot) {
- return snapshot.pairRunStatistics;
- }
+ public PairTablePanel() { super(CUT_NAMES, false); }
}
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/SinglesTablePanel.java Thu Apr 2 10:07:10 2015
@@ -1,7 +1,4 @@
package org.hps.monitoring.trigger;
-
-import org.hps.analysis.trigger.DiagSnapshot;
-import org.hps.analysis.trigger.event.TriggerStatModule;
/**
* Class <code>SinglesTablePanel</code> displays statistical information
@@ -12,22 +9,12 @@
public class SinglesTablePanel extends AbstractTriggerTablePanel {
// Static variables.
private static final long serialVersionUID = 0L;
- private static final String[] CUT_NAMES = { " Cluster Energy (Low):",
- " Cluster Energy (High):", " Hit Count:" };
+ private static final String[] CUT_NAMES = { " Cluster Energy (Low):",
+ " Cluster Energy (High):", " Hit Count:" };
/**
* Instantiates a <code>SinglesTablePanel</code>.
*/
- public SinglesTablePanel() { super(CUT_NAMES); }
-
- @Override
- protected TriggerStatModule getLocalModule(DiagSnapshot snapshot) {
- return snapshot.singlesLocalStatistics;
- }
-
- @Override
- protected TriggerStatModule getRunModule(DiagSnapshot snapshot) {
- return snapshot.singlesRunStatistics;
- }
+ public SinglesTablePanel() { super(CUT_NAMES, true); }
}
Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java
=============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java (original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/TriggerDiagnosticGUIDriver.java Thu Apr 2 10:07:10 2015
@@ -4,7 +4,7 @@
import javax.swing.JFrame;
-import org.hps.analysis.trigger.DiagSnapshot;
+import org.hps.analysis.trigger.data.DiagnosticSnapshot;
import org.lcsim.event.EventHeader;
import org.lcsim.util.Driver;
@@ -31,18 +31,19 @@
public void process(EventHeader event) {
// Updates are only performed if a diagnostic snapshot object
// exists. Otherwise, do nothing.
- if(event.hasCollection(DiagSnapshot.class, diagnosticCollectionName)) {
+ if(event.hasCollection(DiagnosticSnapshot.class, diagnosticCollectionName)) {
// Get the snapshot collection.
- List<DiagSnapshot> snapshotList = event.get(DiagSnapshot.class, diagnosticCollectionName);
+ List<DiagnosticSnapshot> snapshotList = event.get(DiagnosticSnapshot.class, diagnosticCollectionName);
// Get the snapshot. There will only ever be one.
- DiagSnapshot snapshot = snapshotList.get(0);
+ DiagnosticSnapshot runSnapshot = snapshotList.get(1);
+ DiagnosticSnapshot localSnapshot = snapshotList.get(0);
// Feed it to the table.
- //clusterTable.updatePanel(snapshot);
- singlesTable.updatePanel(snapshot);
- pairTable.updatePanel(snapshot);
- efficiencyTable.updatePanel(snapshot);
+ clusterTable.updatePanel(runSnapshot, localSnapshot);
+ singlesTable.updatePanel(runSnapshot, localSnapshot);
+ pairTable.updatePanel(runSnapshot, localSnapshot);
+ efficiencyTable.updatePanel(runSnapshot, localSnapshot);
}
}
|