LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  May 2015

HPS-SVN May 2015

Subject:

r2886 - in /java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger: ShifterTrigPanel.java ShifterTrigWindow.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Sun, 3 May 2015 07:14:13 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (163 lines)

Author: [log in to unmask]
Date: Sun May  3 00:14:01 2015
New Revision: 2886

Log:
Updated the shifter panels for trigger diagnostics. These now, hypothetically, work but need to be added to the monitoring application so that they can be tested more thoroughly. Panel sizing and display is known to be functioning. Panel statistical information should work correctly, but has not been tested yet.

Modified:
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java
    java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigPanel.java	Sun May  3 00:14:01 2015
@@ -9,6 +9,7 @@
 import javax.swing.SpringLayout;
 
 import org.hps.analysis.trigger.data.DiagnosticSnapshot;
+import org.hps.analysis.trigger.util.ComponentUtils;
 
 public class ShifterTrigPanel extends JPanel {
 	private static final Color BG_WARNING = new Color(255, 235, 20);
@@ -171,7 +172,101 @@
 		}
 	}
 	
-	public void updatePanel(DiagnosticSnapshot snapshot) {
-		
+	public void updatePanel(DiagnosticSnapshot stat) {
+		// If the snapshot is null, insert "null" values in the
+		// field panels,
+		if(stat == null) {
+			// Populate the fields with a "null" entry.
+			for(int index = 0; index < fieldValue.length; index++) {
+				fieldValue[index].setText("--- / --- (  N/A  %)");
+			}
+			
+			// No data exists, so no further processing is needed.
+			return;
+		}
+		
+		// Define index constants.
+		int RECON = 0;
+		int SSP = 1;
+		int TRIGGER_0 = 0;
+		int TRIGGER_1 = 1;
+		
+		// Get the tracked values from the snapshot.
+		int seenClusters = stat.getClusterStats().getReconClusterCount();
+		int[][] seenSinglesTriggers = {
+			{ stat.getSingles0Stats().getReconSimulatedTriggers(), stat.getSingles1Stats().getReconSimulatedTriggers() },
+			{ stat.getSingles0Stats().getSSPSimulatedTriggers(), stat.getSingles1Stats().getSSPSimulatedTriggers() }
+		};
+		int[][] seenPairTriggers = {
+                        { stat.getPair0Stats().getReconSimulatedTriggers(), stat.getPair1Stats().getReconSimulatedTriggers() },
+                        { stat.getPair0Stats().getSSPSimulatedTriggers(), stat.getPair1Stats().getSSPSimulatedTriggers() }
+		};
+		int matchedClusters = stat.getClusterStats().getMatches();
+		int[][] matchedSinglesTriggers = {
+                        { stat.getSingles0Stats().getMatchedReconSimulatedTriggers(), stat.getSingles1Stats().getMatchedReconSimulatedTriggers() },
+                        { stat.getSingles0Stats().getMatchedSSPSimulatedTriggers(), stat.getSingles1Stats().getMatchedSSPSimulatedTriggers() }
+		};
+		int[][] matchedPairTriggers = {
+                        { stat.getPair0Stats().getMatchedReconSimulatedTriggers(), stat.getPair1Stats().getMatchedReconSimulatedTriggers() },
+                        { stat.getPair0Stats().getMatchedSSPSimulatedTriggers(), stat.getPair1Stats().getMatchedSSPSimulatedTriggers() }
+		};
+		
+		// Get the largest digit of the tracked values. This should
+		// always be one of the "seen" values.
+		int mostDigits = ComponentUtils.max(seenClusters, seenSinglesTriggers[0][0], seenSinglesTriggers[0][1],
+				seenSinglesTriggers[1][0], seenSinglesTriggers[1][1], seenPairTriggers[0][0], seenPairTriggers[0][1],
+				seenPairTriggers[1][0], seenPairTriggers[1][1]);
+		int spaces = ComponentUtils.getDigits(mostDigits);
+		
+		// Populate the cluster field panel.
+		processEfficiency(seenClusters, matchedClusters, 0, spaces, 0.98, 0.94);
+		
+		// Populate the singles trigger field panels.
+		processEfficiency(seenSinglesTriggers[RECON][TRIGGER_0], matchedSinglesTriggers[RECON][TRIGGER_0], 1, spaces, 0.99, 0.95);
+                processEfficiency(seenSinglesTriggers[SSP][TRIGGER_0],   matchedSinglesTriggers[SSP][TRIGGER_0],   2, spaces, 0.99, 0.95);
+                processEfficiency(seenSinglesTriggers[RECON][TRIGGER_1], matchedSinglesTriggers[RECON][TRIGGER_1], 3, spaces, 0.99, 0.95);
+                processEfficiency(seenSinglesTriggers[SSP][TRIGGER_1],   matchedSinglesTriggers[SSP][TRIGGER_1],   4, spaces, 0.99, 0.95);
+		
+		// Populate the pair trigger field panels.
+		processEfficiency(seenPairTriggers[RECON][TRIGGER_0], matchedPairTriggers[RECON][TRIGGER_0], 5, spaces, 0.99, 0.95);
+                processEfficiency(seenPairTriggers[SSP][TRIGGER_0],   matchedPairTriggers[SSP][TRIGGER_0],   6, spaces, 0.99, 0.95);
+                processEfficiency(seenPairTriggers[RECON][TRIGGER_1], matchedPairTriggers[RECON][TRIGGER_1], 7, spaces, 0.99, 0.95);
+                processEfficiency(seenPairTriggers[SSP][TRIGGER_1],   matchedPairTriggers[SSP][TRIGGER_1],   8, spaces, 0.99, 0.95);
+	}
+	
+	private void processEfficiency(int seen, int matched, int fieldIndex, int spaces, double threshWarning, double threshCritical) {
+		// Calculate the efficiency.
+		double efficiency = 100.0 * matched / seen;
+		
+		// Create the format string.
+		String format = "%" + spaces + "d / %";
+		
+		// If the number of values seen is zero, there is no
+		// percentage that can be calculated.
+		if(seen == 0) {
+			fieldValue[fieldIndex].setText(String.format(format + " (  N/A  %%)", seen, matched));
+		}
+		
+		// Otherwise, include the percentage.
+		else {
+			fieldValue[fieldIndex].setText(String.format(format + " (7.3f%%)", seen, matched, efficiency));
+		}
+		
+		// If the efficiency is below the critical threshold,
+		// change the field background to the critical color.
+		if(efficiency < threshCritical) {
+			fieldValue[fieldIndex].setBackground(BG_CRITICAL);
+			fieldValue[fieldIndex].setForeground(FONT_CRITICAL);
+		}
+		
+		// Otherwise, if the efficiency is below the warning
+		// level, set the field background to the warning color.
+		else if(efficiency < threshWarning) {
+			fieldValue[fieldIndex].setBackground(BG_WARNING);
+			fieldValue[fieldIndex].setForeground(FONT_WARNING);
+		}
+		
+		// Otherwise, use the default component background.
+		else { fieldValue[fieldIndex].setBackground(getBackground()); }
 	}
 }

Modified: java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java
 =============================================================================
--- java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java	(original)
+++ java/trunk/monitoring-util/src/main/java/org/hps/monitoring/trigger/ShifterTrigWindow.java	Sun May  3 00:14:01 2015
@@ -1,15 +1,26 @@
 package org.hps.monitoring.trigger;
+
+import org.hps.analysis.trigger.data.DiagnosticSnapshot;
 
 import java.awt.GridLayout;
 
 import javax.swing.JPanel;
 
-public class ShifterTrigWindow extends JPanel {
+public class ShifterTrigWindow extends JPanel implements DiagnosticUpdatable {
 	private static final long serialVersionUID = 1L;
+	private ShifterTrigPanel localPanel = new ShifterTrigPanel("Instantaneous");
+	private ShifterTrigPanel globalPanel = new ShifterTrigPanel("Run-Integrated");
 	
 	public ShifterTrigWindow() {
 		setLayout(new GridLayout(1, 2));
-		add(new ShifterTrigPanel("Instantaneous"));
-		add(new ShifterTrigPanel("Run-Integrated"));
+		add(localPanel);
+		add(globalPanel);
+	}
+	
+	@Override
+	public void updatePanel(DiagnosticSnapshot runSnapshot, DiagnosticSnapshot localSnapshot) {
+		// Update each panel with the appropriate snapshot.
+		localPanel.updatePanel(localSnapshot);
+		globalPanel.updatePanel(runSnapshot);
 	}
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use