Print

Print


Commit in hps-java on MAIN
scripts/et_monitoring_app.sh+1-11.3 -> 1.4
src/main/java/org/lcsim/hps/monitoring/JobPanel.java+73added 1.1
                                      /MonitoringApplication.java+210added 1.1
                                      /MonitoringExample.java+167added 1.1
                                      /ConnectionPanel.java+121-1641.4 -> 1.5
                                      /ConnectionParameters.java+24-91.4 -> 1.5
                                      /EtConnection.java+2-21.1 -> 1.2
                                      /EventPanel.java+34-1261.1 -> 1.2
                                      /SensorOccupancyPlotsDriver.java+16-251.4 -> 1.5
                                      /MonitoringConsumer.java-1681.4 removed
+648-495
3 added + 1 removed + 6 modified, total 10 files
work on monitoring app

hps-java/scripts
et_monitoring_app.sh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- et_monitoring_app.sh	26 Mar 2012 21:08:20 -0000	1.3
+++ et_monitoring_app.sh	27 Mar 2012 03:18:21 -0000	1.4
@@ -19,7 +19,7 @@
 classpath=`pwd`/target/hps-java-1.1-SNAPSHOT-bin.jar
 
 # Run it.
-prod="java -classpath "$classpath" org.lcsim.hps.monitoring.MonitoringConsumer"
+prod="java -classpath "$classpath" org.lcsim.hps.monitoring.MonitoringExample"
 # -c 100"
 echo $prod
 exec $prod

hps-java/src/main/java/org/lcsim/hps/monitoring
JobPanel.java added at 1.1
diff -N JobPanel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ JobPanel.java	27 Mar 2012 03:18:21 -0000	1.1
@@ -0,0 +1,73 @@
+package org.lcsim.hps.monitoring;
+
+import java.awt.Color;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+class JobPanel extends JPanel {
+	
+	JTextField lcsimSteeringField;
+	JTextField detectorNameField;
+		
+	public JobPanel() {
+		
+		setLayout(new GridBagLayout());
+		
+		GridBagConstraints c = new GridBagConstraints();
+        c.gridx = 0;
+        c.gridy = 0;
+        c.anchor = GridBagConstraints.WEST;
+        JLabel lcsimSteeringLabel = new JLabel("LCSim Steering File:");
+        lcsimSteeringLabel.setHorizontalAlignment(JLabel.LEFT);
+        lcsimSteeringLabel.setToolTipText("Resource in jar pointing to LCSim steering file.");
+        add(lcsimSteeringLabel, c);
+
+        c = new GridBagConstraints();
+        c.gridx = 1;
+        c.gridy = 0;
+        c.anchor = GridBagConstraints.EAST;
+        lcsimSteeringField = new JTextField("", 30);
+        lcsimSteeringField.setHorizontalAlignment(JTextField.RIGHT);
+        lcsimSteeringField.setBackground(Color.WHITE);
+        add(lcsimSteeringField, c);		
+        
+        c = new GridBagConstraints();
+        c.gridx = 0;
+        c.gridy = 1;
+        c.anchor = GridBagConstraints.WEST;
+        JLabel detectorLabel = new JLabel("Detector Name:");
+        detectorLabel.setHorizontalAlignment(JLabel.LEFT);
+        detectorLabel.setToolTipText("Name of detector in LCSim conditions system.");
+        add(detectorLabel, c);
+
+        c = new GridBagConstraints();
+        c.gridx = 1;
+        c.gridy = 1;
+        c.anchor = GridBagConstraints.EAST;
+        detectorNameField = new JTextField("", 20);
+        detectorNameField.setHorizontalAlignment(JTextField.RIGHT);
+        detectorNameField.setBackground(Color.WHITE);
+        add(detectorNameField, c);
+	}
+	
+	public void setSteeringFile(String steeringFile) {
+		lcsimSteeringField.setText(steeringFile);
+	}
+	
+	public void setDetectorName(String detectorName) {
+		detectorNameField.setText(detectorName);
+	}
+	
+	public String getSteeringFile() {
+		return lcsimSteeringField.getText();
+	}
+	
+	public String getDetectorName() {
+		return detectorNameField.getText();
+	}
+}
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/monitoring
MonitoringApplication.java added at 1.1
diff -N MonitoringApplication.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MonitoringApplication.java	27 Mar 2012 03:18:21 -0000	1.1
@@ -0,0 +1,210 @@
+package org.lcsim.hps.monitoring;
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+
+import org.lcsim.job.JobControlManager;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class MonitoringApplication extends JPanel implements ActionListener {
+	
+	private JTabbedPane tabs;
+	
+	private ConnectionPanel connectionPanel;
+	private EventPanel eventPanel;
+	private JobPanel jobPanel;
+	
+	private JMenuBar menuBar;
+	
+	final String connectCmd = "connect";
+	final String disconnectCmd = "disconnect";
+	final String saveConnectionCmd = "saveConnection";
+	final String loadConnectionCmd = "loadConnection";
+	final String resetConnectionSettingsCmd = "resetConnectionSettings";
+	final String resetEventsCmd = "resetEvents";
+	final String savePlotsCmd = "savePlots";
+	final String resetDriversCmd = "resetDrivers";
+	final String exitCmd = "exit";
+	
+	private JobControlManager mgr = null;
+		
+	public MonitoringApplication() {
+		
+		super(new BorderLayout());
+						
+		//
+		// Menu bar.
+		//
+		
+		menuBar = new JMenuBar();
+		
+		JMenu connectionMenu = new JMenu("Connection");
+		menuBar.add(connectionMenu);
+		
+		JMenuItem connectItem = new JMenuItem("Connect");
+		connectItem.setMnemonic(KeyEvent.VK_C);
+		connectItem.setActionCommand(connectCmd);
+		connectItem.addActionListener(this);
+		connectionMenu.add(connectItem);
+		
+		JMenuItem disconnectItem = new JMenuItem("Disconnect");
+		disconnectItem.setMnemonic(KeyEvent.VK_D);
+		disconnectItem.setActionCommand(disconnectCmd);
+		disconnectItem.addActionListener(this);
+		connectionMenu.add(disconnectItem);
+		
+		JMenuItem resetConnectionItem = new JMenuItem("Reset Connection Settings");
+		resetConnectionItem.setMnemonic(KeyEvent.VK_R);
+		resetConnectionItem.setActionCommand(resetConnectionSettingsCmd);
+		resetConnectionItem.addActionListener(this);
+		connectionMenu.add(resetConnectionItem);
+				
+		JMenuItem connectionLoadItem = new JMenuItem("Load Connection...");
+		connectionLoadItem.setMnemonic(KeyEvent.VK_L);
+		connectionLoadItem.setActionCommand(loadConnectionCmd);
+		connectionLoadItem.addActionListener(this);
+		connectionMenu.add(connectionLoadItem);
+		
+		JMenuItem connectionSaveItem = new JMenuItem("Save Connection...");
+		connectionSaveItem.setMnemonic(KeyEvent.VK_S);
+		connectionSaveItem.setActionCommand(saveConnectionCmd);
+		connectionSaveItem.addActionListener(this);
+		connectionMenu.add(connectionSaveItem);
+		
+		JMenuItem exitItem = new JMenuItem("Exit");
+		exitItem.setMnemonic(KeyEvent.VK_X);
+		exitItem.setActionCommand(exitCmd);
+		exitItem.addActionListener(this);
+		connectionMenu.add(exitItem);
+		
+		JMenu eventMenu = new JMenu("Event");
+		menuBar.add(eventMenu);
+		
+		JMenuItem resetEventsItem = new JMenuItem("Reset Event Monitor");
+		resetEventsItem.setMnemonic(KeyEvent.VK_E);
+		resetEventsItem.setActionCommand(resetEventsCmd);
+		resetEventsItem.addActionListener(this);
+		eventMenu.add(resetEventsItem);		
+		
+		JMenu jobMenu = new JMenu("Job");
+		menuBar.add(jobMenu);
+		
+		JMenuItem savePlotsItem = new JMenuItem("Save Plots to AIDA File...");
+		savePlotsItem.setMnemonic(KeyEvent.VK_P);
+		savePlotsItem.setActionCommand("savePlots");
+		savePlotsItem.addActionListener(this);
+		jobMenu.add(savePlotsItem);		
+		
+		JMenuItem resetDriversItem = new JMenuItem("Reset LCSim Drivers");
+		resetDriversItem.setMnemonic(KeyEvent.VK_D);
+		resetDriversItem.setActionCommand("resetDrivers");
+		resetDriversItem.addActionListener(this);
+		jobMenu.add(resetDriversItem);
+		
+		//
+		// Create tabs for panels.
+		//
+		
+		tabs = new JTabbedPane();
+		
+		connectionPanel = new ConnectionPanel();
+		eventPanel = new EventPanel();
+		jobPanel = new JobPanel();
+		
+		tabs.addTab("Connection", connectionPanel);
+		tabs.addTab("Event Monitor", eventPanel);
+		tabs.addTab("Job Settings", jobPanel);
+				
+		add(tabs);
+	}
+	
+	public void setJobControlManager(JobControlManager mgr) {
+		this.mgr = mgr;
+	}
+		
+	synchronized private void savePlots() {
+        JFileChooser fc = new JFileChooser();
+        int r = fc.showSaveDialog(this);
+        if (r == JFileChooser.APPROVE_OPTION) {
+            File fileName = fc.getSelectedFile();
+            try {
+                AIDA.defaultInstance().saveAs(fileName);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+	
+	synchronized private void resetDrivers() {
+		 for (Driver driver : mgr.getDriverExecList()) {
+			 if (driver instanceof Resettable) {
+				 ((Resettable) driver).reset();
+			 }
+		 }
+	 }
+		
+	public void actionPerformed(ActionEvent e) {
+        String cmd = e.getActionCommand();    
+        if (connectCmd.equals(cmd)) {
+            connectionPanel.actionPerformed(e);
+        } else if (disconnectCmd.equals(cmd)) {
+            connectionPanel.actionPerformed(e);
+        } else if (saveConnectionCmd.equals(cmd)) {
+        	connectionPanel.actionPerformed(e);
+        } else if (loadConnectionCmd.equals(cmd)) {
+        	connectionPanel.actionPerformed(e);        	
+        } else if (resetConnectionSettingsCmd.equals(cmd)) {
+        	connectionPanel.actionPerformed(e);        
+        } else if (resetEventsCmd.equals(cmd)) {
+        	eventPanel.actionPerformed(e);        
+        } else if (savePlotsCmd.equals(cmd)) {
+        	savePlots();
+        } else if (resetDriversCmd.equals(cmd)) {
+        	resetDrivers();
+        // Quit.
+        } else if (exitCmd.equals(cmd)) {
+        	exit();
+        }
+    }
+	
+	private void exit() {
+		System.exit(0);
+	}
+			
+	ConnectionPanel getConnectionPanel() {
+		return connectionPanel;
+	}
+	
+	EventPanel getEventPanel() {
+		return eventPanel;
+	}
+	
+	JobPanel getJobPanel() {
+		return jobPanel;
+	}
+			
+	void start() {
+        JFrame frame = new JFrame("HPS Monitoring");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        this.setOpaque(true);
+        frame.setContentPane(this);
+        frame.setJMenuBar(menuBar);
+                       
+        frame.pack();
+        frame.setVisible(true);
+    }
+}
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/monitoring
MonitoringExample.java added at 1.1
diff -N MonitoringExample.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MonitoringExample.java	27 Mar 2012 03:18:21 -0000	1.1
@@ -0,0 +1,167 @@
+package org.lcsim.hps.monitoring;
+
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+
+import javax.swing.SwingUtilities;
+
+import org.freehep.record.loop.event.RecordSuppliedEvent;
+import org.jlab.coda.et.EtAttachment;
+import org.jlab.coda.et.EtEvent;
+import org.jlab.coda.et.EtSystem;
+import org.jlab.coda.et.enums.Mode;
+import org.jlab.coda.et.enums.Modify;
+import org.jlab.coda.et.exception.EtTimeoutException;
+import org.jlab.coda.jevio.EvioEvent;
+import org.jlab.coda.jevio.EvioReader;
+import org.lcsim.event.EventHeader;
+import org.lcsim.hps.evio.LCSimEventBuilder;
+import org.lcsim.hps.monitoring.ConnectionParameters.WaitMode;
+import org.lcsim.job.JobControlManager;
+import org.lcsim.util.DriverAdapter;
+
+/**
+ * This class is an example of an event consumer for an ET system.
+ * 
+ * Based on Carl Timmer's apps.Consumer class from jevio 4.0 release.
+ *
+ * @author Jeremy McCormick
+ */
+// TODO Move the code that wraps Driver and event loop into the JobControlManager.
+// TODO Add connection status field = disconnected | connected | connecting
+public class MonitoringExample {
+    
+    private static final String defaultDetectorName = "HPS-Test-JLAB-v4pt0";
+    private static final String defaultSteeringFile = "/org/lcsim/hps/steering/EtSensorOccupancy.lcsim";
+    
+    private JobControlManager jobMgr; 
+                       
+    public MonitoringExample() 
+    {}
+    
+    public static void main(String [] args) {
+        MonitoringExample app = new MonitoringExample();
+        app.run();        
+    }
+                
+    public void run()
+    {        	
+    	// Start the GUI.
+    	final MonitoringApplication gui = new MonitoringApplication();
+		SwingUtilities.invokeLater(new Runnable() {
+			public void run() {
+				gui.start();
+			}
+		});
+    	
+    	// Set default detector and steering file in job GUI.
+    	JobPanel jobPanel = gui.getJobPanel();
+    	jobPanel.setDetectorName(defaultDetectorName);
+    	jobPanel.setSteeringFile(defaultSteeringFile);
+    	
+        // Wait for connection via GUI.
+        ConnectionPanel connectionPanel = gui.getConnectionPanel();
+        while (!connectionPanel.connectPressed()) {
+        	try { Thread.sleep(1000); } catch (InterruptedException e)  {};
+        }        
+        ConnectionParameters cn = connectionPanel.getConnectionParameters();
+        
+        // Try block is mostly for EtExceptions and friends.
+        try {        	
+        	       
+        	// Setup connection to ET system.
+        	EtConnection et = EtConnection.makeEtConnection(cn);
+        	EtSystem sys = et.getEtSystem();
+        	EtAttachment att = et.getEtAttachment();   
+        	                        
+            // Job manager to run LCSim.
+            String steeringFile = jobPanel.getSteeringFile();
+            jobMgr = new JobControlManager();
+            jobMgr.checkInputFiles(false);
+            InputStream is = this.getClass().getResourceAsStream(steeringFile);
+            jobMgr.setup(is);
+            
+            // Set ref to JobControlManager in GUI so resetting works.
+            gui.setJobControlManager(jobMgr);
+                                    
+            // Make a DriverAdapter for wrapping event loop.
+            DriverAdapter driverAdapter = jobMgr.getDriverAdapter();
+                                    
+            // Call wrapper to startOfData() on DriverAdapter.
+            driverAdapter.configure(null);
+                        
+            // Make the builder for creating LCSim events from EVIO data.
+            String detectorName = jobPanel.getDetectorName();
+            LCSimEventBuilder eventBuilder = new LCSimEventBuilder(detectorName);
+            eventBuilder.setDebug(false);
+                                                
+            // Start job timer.
+            EventPanel eventPanel = gui.getEventPanel();
+            eventPanel.updateJobStartTime();
+
+            // array of events
+            EtEvent[] mevs = null;
+            
+            // EtEvent loop.
+            while (true) { 
+                try {           
+                	// Choose wait or sleep mode depending on connection settings.
+                	if (cn.waitMode == WaitMode.WAIT) {
+                		mevs = sys.getEvents(att, Mode.TIMED, Modify.NOTHING, cn.waitTime, cn.chunk);
+                	} else {
+                		mevs = sys.getEvents(att, Mode.SLEEP, Modify.NOTHING, 0, cn.chunk);
+                	}
+                	
+                    // Loop over retrieved EtEvents.
+                    for (EtEvent mev : mevs) {
+
+                    	// Update GUI's event count.
+                    	eventPanel.updateEventCount();                    
+
+                    	// Get EvioEvent and check for errors.
+                    	ByteBuffer buf = mev.getDataBuffer();
+                    	EvioReader reader = new EvioReader(buf);
+                    	EvioEvent evioEvent = null;
+                    	try {
+                    		evioEvent = reader.parseNextEvent();
+                    	} catch (java.nio.BufferUnderflowException e) {
+                    		// Error will be caught by subsequent check on null event.
+                    	}
+                    	if (evioEvent == null) {
+                    		eventPanel.updateBadEventCount();
+                    		continue;
+                    	}
+
+                    	// Create LCSim event from EVIO data.
+                    	EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
+
+                    	// Make a new event for DriverAdapter.
+                    	RecordSuppliedEvent loopEvent = new RecordSuppliedEvent(new Object(), lcsimEvent);
+
+                    	// Call process methods via Driver Adapter.
+                    	driverAdapter.recordSupplied(loopEvent);
+
+                    	// Update the average event rate.
+                    	eventPanel.updateAverageEventRate();                    
+
+                    	// Update elapsed time.
+                    	eventPanel.updateElapsedTime();
+                }
+                    
+                // Put events back into the ET system.
+                sys.putEvents(att, mevs);   
+                
+                } catch (EtTimeoutException e) {
+                    System.out.println("ET Consumer timed out.");
+                    driverAdapter.finish(null);
+                    System.out.println("Press ENTER to exit ...");
+                    System.console().readLine();
+                    System.exit(0);
+                }
+            }
+        } catch (Exception ex) {
+            System.out.println("Error using ET system as consumer.");
+            ex.printStackTrace();
+        }
+    }      
+}
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/monitoring
ConnectionPanel.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ConnectionPanel.java	26 Mar 2012 21:08:20 -0000	1.4
+++ ConnectionPanel.java	27 Mar 2012 03:18:21 -0000	1.5
@@ -1,8 +1,8 @@
 package org.lcsim.hps.monitoring;
 
+import java.awt.Color;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
-import java.awt.Insets;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.File;
@@ -12,21 +12,21 @@
 import java.io.IOException;
 import java.util.Properties;
 
-import javax.swing.JButton;
 import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
 import javax.swing.JFileChooser;
-import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
-import org.lcsim.util.aida.AIDA;
+import org.lcsim.hps.monitoring.ConnectionParameters.WaitMode;
 
-public class ConnectionPanel extends JPanel implements ActionListener {
+// TODO Add status field of (connected|disconnected|connecting|timed out)
+class ConnectionPanel extends JPanel implements ActionListener {
 
-	private JPanel fieldsPanel;
-	private JPanel buttonsPanel;
+	//private JPanel fieldsPanel;
+	//private JPanel buttonsPanel;
 	
 	private JTextField etNameField;
     private JTextField hostField;
@@ -38,17 +38,11 @@
     private JTextField qSizeField;
     private JTextField positionField;
     private JTextField ppositionField;
-    
-    private JButton connectButton;
-    private JButton disconnectButton;
-    private JButton saveButton;
-    private JButton loadButton;
-    private JButton resetButton;
-            
+    private JComboBox waitComboBox; 
+    private JTextField waitTimeField;
+                    
     private ConnectionParameters connectionParameters;
-    
-    private static ConnectionPanel connectionPanel;
-    
+        
     private boolean connectPressed = false;
 
     ConnectionPanel() {
@@ -59,105 +53,32 @@
         setLayout(new GridBagLayout());
         
         // Panel for labels and values.
-        GridBagConstraints c = new GridBagConstraints();
-        c.gridx = 0;
-        c.gridy = 0;
-        JPanel fieldsPanel = new JPanel();
-        fieldsPanel.setLayout(new GridBagLayout());
-        add(fieldsPanel, c);
-
-        // Panel for control buttons.
-        c = new GridBagConstraints();
-        c.gridx = 0;
-        c.gridy = 1;
-        JPanel buttonsPanel = new JPanel();
-        buttonsPanel.setLayout(new GridBagLayout());
-        add(buttonsPanel, c);       
-        
-        //
-        // Define the buttons.
-        //
-        
-        // Button padding.
-        Insets buttonInsets = new Insets(1, 1, 1, 1);
-        
-        c = new GridBagConstraints();
-        c.gridx = 0;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        connectButton = new JButton("Connect");
-        connectButton.setActionCommand("connect");
-        connectButton.addActionListener(this);
-        connectButton.setToolTipText("Connect to ET System using current parameters.");
-        buttonsPanel.add(connectButton, c);
-        
-        c = new GridBagConstraints();
-        c.gridx = 1;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        disconnectButton = new JButton("Disconnect");
-        disconnectButton.setActionCommand("disconnect");
-        disconnectButton.addActionListener(this);
-        disconnectButton.setToolTipText("Disconnect from current ET session.");
-        disconnectButton.setEnabled(false);
-        buttonsPanel.add(disconnectButton, c);
-        
-        c = new GridBagConstraints();
-        c.gridx = 2;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        saveButton = new JButton("Save");
-        saveButton.setActionCommand("save");
-        saveButton.addActionListener(this);
-        saveButton.setToolTipText("Save connection settings to properties file.");
-        saveButton.setEnabled(true);
-        buttonsPanel.add(saveButton, c);
-        
-        c = new GridBagConstraints();
-        c.gridx = 3;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        loadButton = new JButton("Load");
-        loadButton.setActionCommand("load");
-        loadButton.addActionListener(this);
-        loadButton.setToolTipText("Load connection settings from properties file.");
-        buttonsPanel.add(loadButton, c);
-        
-        c = new GridBagConstraints();
-        c.gridx = 4;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        resetButton = new JButton("Reset");
-        resetButton.setActionCommand("reset");
-        resetButton.addActionListener(this);
-        resetButton.setToolTipText("Resect connection settings to defaults.");
-        buttonsPanel.add(resetButton, c);
-                
+        //GridBagConstraints c = new GridBagConstraints();
+        //c.gridx = 0;
+        //c.gridy = 0;
+        //JPanel fieldsPanel = new JPanel();
+        //fieldsPanel.setLayout(new GridBagLayout());
+        //add(fieldsPanel, c);        
+                     
         //
         // Define the fields.
         //
         
-        c = new GridBagConstraints();
+        GridBagConstraints c = new GridBagConstraints();
         c.gridx = 0;
         c.gridy = 0;
         c.anchor = GridBagConstraints.WEST;
         JLabel etNameLabel = new JLabel("ET Name:");
         etNameLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(etNameLabel, c);
+        add(etNameLabel, c);
 
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 0;
         c.anchor = GridBagConstraints.EAST;
         etNameField = new JTextField("", 20);
-        etNameField.setText(connectionParameters.etName);
         etNameField.setHorizontalAlignment(JTextField.RIGHT);
-        fieldsPanel.add(etNameField, c);
+        add(etNameField, c);
 
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -165,16 +86,15 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel hostLabel = new JLabel("Host:");
         hostLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(hostLabel, c);
+        add(hostLabel, c);
 
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 1;
         c.anchor = GridBagConstraints.EAST;
-        hostField = new JTextField("", 20);
-        hostField.setText(connectionParameters.host);
+        hostField = new JTextField(20);
         hostField.setHorizontalAlignment(JTextField.RIGHT);
-        fieldsPanel.add(hostField, c);
+        add(hostField, c);
 
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -182,15 +102,15 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel portLabel = new JLabel("Port:");
         portLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(portLabel, c);
+        add(portLabel, c);
 
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 2;
         c.anchor = GridBagConstraints.EAST;
-        portField = new JTextField(Integer.toString(connectionParameters.port), 5);
+        portField = new JTextField(5);
         portField.setHorizontalAlignment(JTextField.RIGHT);
-        fieldsPanel.add(portField, c);
+        add(portField, c);
 
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -198,15 +118,14 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel blockingLabel = new JLabel("Blocking:");
         blockingLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(blockingLabel, c);
+        add(blockingLabel, c);
 
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 3;
         c.anchor = GridBagConstraints.EAST;
         blockingField = new JCheckBox();
-        blockingField.setSelected(connectionParameters.blocking);
-        fieldsPanel.add(blockingField, c);
+        add(blockingField, c);
         
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -214,15 +133,14 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel verboseLabel = new JLabel("Verbose:");
         verboseLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(verboseLabel, c);
+        add(verboseLabel, c);
         
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 4;
         c.anchor = GridBagConstraints.EAST;
         verboseField = new JCheckBox();
-        verboseField.setSelected(connectionParameters.verbose);
-        fieldsPanel.add(verboseField, c);
+        add(verboseField, c);
                 
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -230,15 +148,15 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel statNameLabel = new JLabel("Station Name:");
         statNameLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(statNameLabel, c);
+        add(statNameLabel, c);
         
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 5;
         c.anchor = GridBagConstraints.EAST;
-        statNameField = new JTextField(connectionParameters.statName, 10);
+        statNameField = new JTextField(10);
         statNameField.setHorizontalAlignment(JTextField.RIGHT);
-        fieldsPanel.add(statNameField, c);
+        add(statNameField, c);
         
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -247,15 +165,15 @@
         JLabel chunkLabel = new JLabel("Chunk Size:");
         chunkLabel.setToolTipText("Number of events returned in array.");
         chunkLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(chunkLabel, c);
+        add(chunkLabel, c);
         
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 6;
         c.anchor = GridBagConstraints.EAST;
-        chunkField = new JTextField(Integer.toString(connectionParameters.chunk), 3);
+        chunkField = new JTextField(3);
         chunkField.setHorizontalAlignment(JTextField.RIGHT);
-        fieldsPanel.add(chunkField, c);
+        add(chunkField, c);
         
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -263,15 +181,15 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel qSizeLabel = new JLabel("Queue Size:");
         qSizeLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(qSizeLabel, c);
+        add(qSizeLabel, c);
         
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 7;
         c.anchor = GridBagConstraints.EAST;
-        qSizeField = new JTextField(Integer.toString(connectionParameters.qSize), 3);
+        qSizeField = new JTextField(3);
         qSizeField.setHorizontalAlignment(JTextField.RIGHT);
-        fieldsPanel.add(qSizeField, c);
+        add(qSizeField, c);
         
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -279,15 +197,15 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel positionLabel = new JLabel("Station Position:");
         positionLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(positionLabel, c);
+        add(positionLabel, c);
         
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 8;
         c.anchor = GridBagConstraints.EAST;
-        positionField = new JTextField(Integer.toString(connectionParameters.position), 3);
+        positionField = new JTextField(3);
         positionField.setHorizontalAlignment(JLabel.RIGHT);
-        fieldsPanel.add(positionField, c);
+        add(positionField, c);
         
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -295,17 +213,51 @@
         c.anchor = GridBagConstraints.WEST;
         JLabel ppositionLabel = new JLabel("Station Parallel Position:");
         ppositionLabel.setHorizontalAlignment(JLabel.LEFT);
-        fieldsPanel.add(ppositionLabel, c);
+        add(ppositionLabel, c);
         
         c = new GridBagConstraints();
         c.gridx = 1;
         c.gridy = 9;
         c.anchor = GridBagConstraints.EAST;
-        ppositionField = new JTextField(Integer.toString(connectionParameters.pposition), 3);
+        ppositionField = new JTextField(3);
         ppositionField.setHorizontalAlignment(JLabel.RIGHT);
-        fieldsPanel.add(ppositionField, c);
+        add(ppositionField, c);
+        
+        c = new GridBagConstraints();
+        c.gridx = 0;
+        c.gridy = 10;
+        c.anchor = GridBagConstraints.WEST;
+        JLabel waitModeLabel = new JLabel("Wait Mode:");
+        waitModeLabel.setHorizontalAlignment(JLabel.LEFT);
+        add(waitModeLabel, c);
+        
+        c = new GridBagConstraints();
+        c.gridx = 1;
+        c.gridy = 10;
+        c.anchor = GridBagConstraints.EAST;
+        String[] waitStrings = { "SLEEP", "WAIT" };
+        waitComboBox = new JComboBox(waitStrings);
+        add(waitComboBox, c);
+        
+        c = new GridBagConstraints();
+        c.gridx = 0;
+        c.gridy = 11;
+        c.anchor = GridBagConstraints.WEST;
+        JLabel waitTimeLabel = new JLabel("Wait Time [microseconds]:");
+        waitTimeLabel.setHorizontalAlignment(JLabel.LEFT);
+        add(waitTimeLabel, c);
         
-        // TODO Add connection status field = disconnected | connected | connecting
+        c = new GridBagConstraints();
+        c.gridx = 1;
+        c.gridy = 11;
+        c.anchor = GridBagConstraints.EAST;
+        waitTimeField = new JTextField(8);
+        waitTimeField.setBackground(Color.WHITE);
+        waitTimeField.setHorizontalAlignment(JLabel.RIGHT);
+        add(waitTimeField, c);
+        
+        // Set default connection parameters which are pushed to GUI.
+        setConnectionParameters(new ConnectionParameters());
     }
 
     public ConnectionParameters getConnectionParameters() {
@@ -320,10 +272,21 @@
         connectionParameters.qSize = Integer.parseInt(qSizeField.getText());
         connectionParameters.position = Integer.parseInt(positionField.getText());
         connectionParameters.pposition = Integer.parseInt(ppositionField.getText());
+        connectionParameters.waitMode = getWaitMode();
+        connectionParameters.waitTime = Integer.parseInt(waitTimeField.getText());
         return connectionParameters;
     }
     
-    public void setConnectionParameters(ConnectionParameters cn) {
+    private WaitMode getWaitMode() {
+    	WaitMode mode = WaitMode.SLEEP;
+    	String sel = (String)waitComboBox.getSelectedItem();
+    	if ("wait".equals(sel.toLowerCase())) {
+    		mode = WaitMode.WAIT;
+    	}
+    	return mode;
+    }
+    
+    private void setConnectionParameters(ConnectionParameters cn) {
     	etNameField.setText(cn.etName);
     	hostField.setText(cn.host);
     	portField.setText(Integer.toString(cn.port));
@@ -333,7 +296,13 @@
         chunkField.setText(Integer.toString(cn.chunk));
         qSizeField.setText(Integer.toString(cn.qSize));
         positionField.setText(Integer.toString(cn.position));
-        ppositionField.setText(Integer.toString(cn.pposition));   
+        ppositionField.setText(Integer.toString(cn.pposition));
+        if (cn.waitMode == WaitMode.SLEEP) {
+        	waitComboBox.setSelectedIndex(0);
+        } else if (cn.waitMode == WaitMode.WAIT) {
+        	waitComboBox.setSelectedIndex(1);
+        }
+        waitTimeField.setText(Integer.toString(cn.waitTime));
     	this.connectionParameters = cn;
     }
          
@@ -342,30 +311,33 @@
     		connect();
     	} else if ("disconnect".equals(e.getActionCommand())) {
     		disconnect();
-    	} else if ("save".equals(e.getActionCommand())) {
+    	} else if ("saveConnection".equals(e.getActionCommand())) {
     		save();
-    	} else if ("load".equals(e.getActionCommand())) {
+    	} else if ("loadConnection".equals(e.getActionCommand())) {
     		load();
-    	} else if ("reset".equals(e.getActionCommand())) {
+    	} else if ("resetConnectionSettings".equals(e.getActionCommand())) {
     		reset();
     	}
-    	
     }
     
     private void connect() {
     	connectPressed = true;
+    	/*
 		connectButton.setEnabled(false);
 		disconnectButton.setEnabled(true);
 		loadButton.setEnabled(false);
 		resetButton.setEnabled(false);
+		*/
     }
     
     private void disconnect() {
     	connectPressed = false;
+    	/*
 		connectButton.setEnabled(true);
 		disconnectButton.setEnabled(false);
 		loadButton.setEnabled(true);
 		resetButton.setEnabled(true);
+		*/
     }
     
     private void save() {
@@ -385,19 +357,15 @@
     		loadPropertiesFile(file);
     	}
     }
-    
+        
     private void reset() {
-    	this.setConnectionParameters(new ConnectionParameters());
+    	setConnectionParameters(new ConnectionParameters());
     }
         
     public boolean connectPressed() {
     	return this.connectPressed;
     }
-    
-    public static ConnectionPanel getConnectionPanel() {
-    	return connectionPanel;
-    }
-    
+        
     private void writePropertiesFile(File file) {
     	Properties prop = new Properties();
     	prop.setProperty("host", hostField.getText());
@@ -409,6 +377,8 @@
     	prop.setProperty("qSize", qSizeField.getText());
     	prop.setProperty("position", positionField.getText());
     	prop.setProperty("pposition", ppositionField.getText());
+    	prop.setProperty("waitMode", (String)waitComboBox.getSelectedItem());
+    	prop.setProperty("waitTime", waitTimeField.getText());
     	try {
     		prop.store(new FileOutputStream(file), null);
     	} catch (Exception e) {
@@ -416,7 +386,7 @@
     	}
     }
     
-    public void showErrorDialog(String mesg) {
+    private void showErrorDialog(String mesg) {
     	JOptionPane.showMessageDialog(this, mesg);
     }
     
@@ -433,31 +403,18 @@
     		qSizeField.setText(prop.getProperty("qSize"));
     		positionField.setText(prop.getProperty("position"));
     		ppositionField.setText(prop.getProperty("pposition"));
+    		String waitMode = prop.getProperty("waitMode");
+    		if ("sleep".equals(waitMode.toLowerCase())) {
+    			waitComboBox.setSelectedIndex(0);
+    		} else if ("wait".equals(waitMode.toLowerCase())) {
+    			waitComboBox.setSelectedIndex(1);
+    		}
+    		waitTimeField.setText(prop.getProperty("waitTime"));
     	} catch (FileNotFoundException e) {
     		showErrorDialog(e.getLocalizedMessage());
     	} catch (IOException e) {
     		showErrorDialog(e.getLocalizedMessage());
     	}    
     	this.connectionParameters = getConnectionParameters();
-    }
-                         
-    public static void createAndShow() {
-        JFrame frame = new JFrame("ET Connection Dialog");
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
-        connectionPanel = new ConnectionPanel();
-        connectionPanel.setOpaque(true);
-        frame.setContentPane(connectionPanel);
-
-        frame.pack();
-        frame.setVisible(true);
-    }
-
-    public static void main(String[] args) {
-        javax.swing.SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                createAndShow();
-            }
-        });
-    }
+    }                           
 }
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/monitoring
ConnectionParameters.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ConnectionParameters.java	26 Mar 2012 21:08:20 -0000	1.4
+++ ConnectionParameters.java	27 Mar 2012 03:18:21 -0000	1.5
@@ -4,17 +4,12 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
-import org.jlab.coda.et.EtAttachment;
 import org.jlab.coda.et.EtConstants;
-import org.jlab.coda.et.EtStation;
-import org.jlab.coda.et.EtStationConfig;
-import org.jlab.coda.et.EtSystem;
-import org.jlab.coda.et.EtSystemOpenConfig;
 
 /**
  * Connection parameters for ET system consumer.
  */
-public class ConnectionParameters {
+class ConnectionParameters {
 
     public String etName = "ETBuffer";
     public String host = null;
@@ -27,6 +22,13 @@
     public int position = 1;
     public int pposition = 0;
     public int flowMode = EtConstants.stationSerial;
+    public WaitMode waitMode = WaitMode.SLEEP;
+    public int waitTime = 20000000; // wait time in microseconds
+    
+    public enum WaitMode {
+    	SLEEP,
+    	WAIT
+    }
                
     public ConnectionParameters() {
         // Set the default host.
@@ -52,7 +54,9 @@
                 "       -c     number of events in one get/put array\n" +
                 "       -q     queue size if creating nonblocking station\n" +
                 "       -pos   position of created station in station list (1,2,...)\n" +
-                "       -ppos  position of created station within a group of parallel stations (-1=end, -2=head)\n\n" +
+                "       -ppos  position of created station within a group of parallel stations (-1=end, -2=head)\n" +
+                "       -w     wait for events for specified time period in microseconds rather than sleeping" +
+                "       -t     time to wait for events before timing out\n\n" +
                 "        This consumer works by making a direct connection\n" +
                 "        to the ET system's tcp server port.\n");
     }
@@ -130,8 +134,17 @@
 
                 } catch (NumberFormatException ex) {
                     throw new ConnectionParametersException("Did not specify a proper parallel position number.");
-                }
-            } else {
+                }                
+            } else if (args[i].equalsIgnoreCase("-w")) {
+            	waitMode = WaitMode.WAIT;
+            } else if (args[i].equalsIgnoreCase("-t")) {
+            	waitTime = Integer.parseInt(args[++i]);
+            	if (waitTime < 0) {
+            		throw new ConnectionParametersException("Invalid wait time specified.");
+            	}
+            } 
+            
+            else {
                 throw new ConnectionParametersException("Arguments included invalid command line parameter:" + args[i]);
             }
         }
@@ -160,6 +173,8 @@
     	buf.append("position: " + position + '\n');
     	buf.append("pposition: " + pposition + '\n');
     	buf.append("flowMode: " + flowMode + '\n');
+    	buf.append("waitMode: " + waitMode + '\n');
+    	buf.append("waitTime: " + waitTime + '\n');
     	return buf.toString();
     }
 }
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/monitoring
EtConnection.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- EtConnection.java	26 Mar 2012 21:08:20 -0000	1.1
+++ EtConnection.java	27 Mar 2012 03:18:21 -0000	1.2
@@ -11,12 +11,12 @@
  * Create an EtSystem and EtAttachment from ConnectionParameters.
  * @author Jeremy McCormick <[log in to unmask]>
  */
-public class EtConnection {
+class EtConnection {
 	
 	private EtSystem sys;
 	private EtAttachment att;
 	
-	public EtConnection(EtSystem sys, EtAttachment att) {
+	protected EtConnection(EtSystem sys, EtAttachment att) {
 		this.sys = sys;
 		this.att = att;
 	}

hps-java/src/main/java/org/lcsim/hps/monitoring
EventPanel.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- EventPanel.java	26 Mar 2012 21:08:20 -0000	1.1
+++ EventPanel.java	27 Mar 2012 03:18:21 -0000	1.2
@@ -3,42 +3,27 @@
 import java.awt.Color;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
-import java.awt.Insets;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.IOException;
 import java.text.DecimalFormat;
 
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
 import javax.swing.JLabel;
+import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 
-import org.lcsim.job.JobControlManager;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-public class EventPanel extends JPanel implements ActionListener {
+class EventPanel extends JPanel implements ActionListener {
 
     private JTextField eventCounterField;
     private JTextField elapsedTimeField;
     private JTextField avgEventRateField;
     private JTextField refreshField;
     private JTextField badEventsField;
-    private DecimalFormat rateFormat = new DecimalFormat("#.##");
-
-    private JButton resetButton;
-    private JButton saveButton;
-    private JButton quitButton;
     
-    private static JobControlManager jobMgr;    
-    private static EventPanel monitoringGui;
+    private DecimalFormat rateFormat = new DecimalFormat("#.##");
    
-    // Refresh every 1000 events by default.
-    private int eventRefresh = 1000;
+    private static final int defaultEventRefresh = 1000;
+    private int eventRefresh = defaultEventRefresh;
     
     private long jobStartTime;
     private int eventCount;
@@ -47,7 +32,7 @@
     EventPanel() {
 
         setLayout(new GridBagLayout());
-
+        
         GridBagConstraints c = new GridBagConstraints();
 
         // Panel for labels and values.
@@ -69,7 +54,7 @@
         c.gridx = 0;
         c.gridy = 0;
         c.anchor = GridBagConstraints.WEST;
-        JLabel eventLabel = new JLabel("Events Processed: ");
+        JLabel eventLabel = new JLabel("Events Processed:");
         eventLabel.setHorizontalAlignment(JLabel.LEFT);
         fieldsPanel.add(eventLabel, c);
 
@@ -133,6 +118,9 @@
         c.anchor = GridBagConstraints.EAST;
         refreshField = new JTextField(Integer.toString(eventRefresh), 4);
         refreshField.setHorizontalAlignment(JTextField.RIGHT);
+        refreshField.setEditable(true);
+        refreshField.addActionListener(this);
+        refreshField.setActionCommand("eventRefreshEdit");
         fieldsPanel.add(refreshField, c);
         
         c = new GridBagConstraints();
@@ -151,59 +139,15 @@
         badEventsField.setHorizontalAlignment(JTextField.RIGHT);
         badEventsField.setEditable(false);
         badEventsField.setBackground(Color.WHITE);
-        fieldsPanel.add(badEventsField, c);        
-                
-        // Button padding.
-        Insets buttonInsets = new Insets(1, 1, 1, 1);
-
-        c = new GridBagConstraints();
-        c.gridx = 0;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        resetButton = new JButton("Reset");
-        resetButton.setActionCommand("reset");
-        resetButton.addActionListener(this);
-        resetButton.setToolTipText("Reset the GUI and the plots.");
-        buttonsPanel.add(resetButton, c);
-
-        c = new GridBagConstraints();
-        c.gridx = 1;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        saveButton = new JButton("Save Plots");
-        saveButton.setActionCommand("save");
-        saveButton.addActionListener(this);
-        saveButton.setToolTipText("Save the plots to an AIDA file.");
-        buttonsPanel.add(saveButton, c);
-
-        c = new GridBagConstraints();
-        c.gridx = 2;
-        c.gridy = 0;
-        c.fill = GridBagConstraints.BOTH;
-        c.insets = buttonInsets;
-        quitButton = new JButton("Quit");
-        quitButton.setActionCommand("quit");
-        quitButton.addActionListener(this);
-        quitButton.setToolTipText("Quit the job.");
-        buttonsPanel.add(quitButton, c);
+        fieldsPanel.add(badEventsField, c);
     }
-    
-    public static EventPanel getMonitoringGui() {
-        return EventPanel.monitoringGui;
-    }
-   
-    public void setJobControlManager(JobControlManager jobMgr) {
-        EventPanel.jobMgr = jobMgr;
-    }
-    
+           
     public int getEventCount() {
         return eventCount;
     }
     
     public int getEventRefresh() {
-        return Integer.parseInt(refreshField.getText());
+    	return eventRefresh;
     }
     
     public void updateEventCount() {
@@ -251,15 +195,7 @@
     private void resetElapsedTime() {
         elapsedTimeField.setText("0");
     }   
-    
-    private void resetDrivers() {
-        for (Driver driver : jobMgr.getDriverExecList()) {
-            if (driver instanceof Resettable) {
-                ((Resettable) driver).reset();
-            }
-        }
-    }
-    
+        
     private void resetJobStartTime() {
         jobStartTime = System.currentTimeMillis();
     }
@@ -272,63 +208,35 @@
     	this.badEventCount = 0;
     	this.badEventsField.setText("0");
     }
-
-    public static void createAndShow() {
-        JFrame frame = new JFrame("HPS Monitoring GUI");
-        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
-        monitoringGui = new EventPanel();
-        monitoringGui.setOpaque(true);
-        frame.setContentPane(monitoringGui);
-
-        frame.pack();
-        frame.setVisible(true);
-    }
-
+ 
     public void actionPerformed(ActionEvent e) {
         String cmd = e.getActionCommand();
-        if ("reset".equals(cmd)) {
+        if ("resetEvents".equals(cmd)) {
             reset();
-        } else if ("save".equals(cmd)) {
-            save();
-        } else if ("quit".equals(cmd)) {
-            quit();
+        } else if ("eventRefreshEdit".equals(cmd)) {
+        	eventRefreshEdit();
         }
     }
-
-    private void reset() {
-        resetDrivers();
+    
+    private void eventRefreshEdit() {
+    	int newEventRefresh;
+    	try {
+    		newEventRefresh = Integer.parseInt(refreshField.getText());
+    		if (newEventRefresh < 1) 
+    			throw new NumberFormatException();
+    		this.eventRefresh = newEventRefresh;
+    	} catch (NumberFormatException e) {
+    		JOptionPane.showMessageDialog(this, "The value " + refreshField.getText() + " is not valid for this field.");
+    		eventRefresh = defaultEventRefresh;
+    		refreshField.setText(Integer.toString(eventRefresh));
+    	}
+    }
+        
+	synchronized private void reset() {
         resetEventCount();
         resetBadEventCount();
         resetAverageEventRate();
         resetElapsedTime();
         resetJobStartTime();
     }
-
-    private void save() {
-        JFileChooser fc = new JFileChooser();
-        int r = fc.showSaveDialog(EventPanel.this);
-        if (r == JFileChooser.APPROVE_OPTION) {
-            File fileName = fc.getSelectedFile();
-            try {
-                AIDA.defaultInstance().saveAs(fileName);
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        } else {
-            System.out.println("Save operation was cancelled.");
-        }
-    }
-
-    private void quit() {
-        System.exit(0);
-    }
-    
-    public static void main(String[] args) {
-        javax.swing.SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                createAndShow();
-            }
-        });
-    }
 }
\ No newline at end of file

hps-java/src/main/java/org/lcsim/hps/monitoring
SensorOccupancyPlotsDriver.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- SensorOccupancyPlotsDriver.java	25 Mar 2012 08:55:11 -0000	1.4
+++ SensorOccupancyPlotsDriver.java	27 Mar 2012 03:18:21 -0000	1.5
@@ -43,11 +43,16 @@
     public void setEventRefreshRate(int eventRefreshRate) {
         this.eventRefreshRate = eventRefreshRate;
     }
-    /*
-    private int computeRegion(SiSensor sensor, IIdentifierHelper helper) {
-        IIdentifier id = sensor.getIdentifier();
-        int layer = sensor.getIdentifierHelper().getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
-        int module = sensor.getIdentifierHelper().getValue(id, "module"); // 0-1; module number is top or bottom
+    
+    private int computePlotterRegion(SiSensor sensor) {
+    	
+    	IIdentifierHelper helper = sensor.getIdentifierHelper();
+    	IIdentifier id = sensor.getIdentifier();
+        
+        int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
+        int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
+        
+        // Compute the sensor's x and y grid coordinates for 5x4 region layout and then translate to region number.
         int ix = (layer - 1) / 2;
         int iy = 0;
         if (module > 0) {
@@ -56,10 +61,11 @@
         if (layer % 2 == 0) {
             iy += 1;
         }
-        int region = iy * 4 + ix;
+        int region = ix * 4 + iy;
+        //System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg="+region);
         return region;
     }
-    */
+        
     protected void detectorChanged(Detector detector) {
         
         // If called > 1 then destroy plots that might be currently up.
@@ -93,27 +99,12 @@
         // Map a map of sensors to their region numbers in the plotter.
         IIdentifierHelper helper = sensors.get(0).getIdentifierHelper();
         sensorRegionMap = new HashMap<SiSensor,Integer>();
-        for (SiSensor sensor : sensors) {
-            
-            IIdentifier id = sensor.getIdentifier();
-            
-            int layer = helper.getValue(id, "layer"); // 1-10; axial layers are odd layers; stereo layers are even
-            int module = helper.getValue(id, "module"); // 0-1; module number is top or bottom
-            
-            int ix = (layer - 1) / 2;
-            int iy = 0;
-            if (module > 0) {
-                iy += 2;
-            }
-            if (layer % 2 == 0) {
-                iy += 1;
-            }
-            int region = ix * 4 + iy;
-
-            System.out.println(sensor.getName() + "; lyr=" + layer + "; mod=" + module + " -> xy[" + ix + "][" + iy + "] -> reg="+region);
+        for (SiSensor sensor : sensors) {                      
+            int region = computePlotterRegion(sensor);
             sensorRegionMap.put(sensor,region);
         }
                
+        // Reset the data structure that keeps track of strip occupancies.
         resetOccupancyMap();
 
         // Setup the occupancy plots.

hps-java/src/main/java/org/lcsim/hps/monitoring
MonitoringConsumer.java removed after 1.4
diff -N MonitoringConsumer.java
--- MonitoringConsumer.java	26 Mar 2012 21:08:20 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,168 +0,0 @@
-package org.lcsim.hps.monitoring;
-
-import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.List;
-
-import org.freehep.record.loop.event.RecordSuppliedEvent;
-import org.jlab.coda.et.EtAttachment;
-import org.jlab.coda.et.EtEvent;
-import org.jlab.coda.et.EtSystem;
-import org.jlab.coda.et.enums.Mode;
-import org.jlab.coda.et.enums.Modify;
-import org.jlab.coda.et.exception.EtTimeoutException;
-import org.jlab.coda.jevio.EvioEvent;
-import org.jlab.coda.jevio.EvioReader;
-import org.lcsim.event.EventHeader;
-import org.lcsim.hps.evio.LCSimEventBuilder;
-import org.lcsim.job.JobControlManager;
-import org.lcsim.util.Driver;
-import org.lcsim.util.DriverAdapter;
-
-/**
- * This class is an example of an event consumer for an ET system.
- * 
- * Based on Carl Timmer's apps.Consumer class from jevio 4.0 release.
- *
- * @author Jeremy McCormick
- */
-// TODO Move the code that wraps Driver and event loop into the JobControlManager.
-// TODO Integrate the ConnectionPanel so that it can be used for changing connection parameters.
-public class MonitoringConsumer {
-    
-    // TODO Next two should be job options or at least CL options.
-    private static final String detectorName = "HPS-Test-JLAB-v4pt0";
-    //private static final String lcsimXml = "/org/lcsim/hps/steering/EtTest.lcsim";
-    private static final String lcsimXml = "/org/lcsim/hps/steering/EtSensorOccupancy.lcsim";
-
-    private EventPanel gui;
-    //private int eventCount;
-    
-    private JobControlManager jobMgr; 
-                       
-    public MonitoringConsumer() 
-    {}
-    
-    public static void main(String [] args) {
-        MonitoringConsumer app = new MonitoringConsumer();
-        //app.run(args);
-        app.run();        
-    }
-                
-    public void run() {
-                        
-        // Wait for connection settings via GUI.
-        ConnectionPanel.main(new String[]{});
-        try { Thread.sleep(1000); } catch (InterruptedException e) {}
-        ConnectionPanel connectionPanel = ConnectionPanel.getConnectionPanel();
-        while (!connectionPanel.connectPressed()) {
-        	try { Thread.sleep(1000); } catch (InterruptedException e)  {};
-        }        
-        ConnectionParameters cn = connectionPanel.getConnectionParameters();
-        
-        try {        	
-        	
-        	// Setup connection to ET system.
-        	EtConnection et = EtConnection.makeEtConnection(cn);
-        	EtSystem sys = et.getEtSystem();
-        	EtAttachment att = et.getEtAttachment();   
-        	
-            // Show monitoring GUI.
-            EventPanel.main(new String[]{});
-            Thread.sleep(2000);
-            gui = EventPanel.getMonitoringGui();
-            gui.setJobControlManager(jobMgr);             
-                        
-            // Job manager to run LCSim.
-            jobMgr = new JobControlManager();
-            jobMgr.checkInputFiles(false);
-            InputStream is = (new MonitoringConsumer()).getClass().getResourceAsStream(lcsimXml);
-            jobMgr.setup(is);
-            
-            // Get list of Drivers.
-            List<Driver> drivers = jobMgr.getDriverExecList();
-            
-            // Wrap Drivers with DriverAdapter.
-            Driver topDriver = new Driver();
-            for (Driver driver : drivers) {
-                topDriver.add(driver);
-            }
-            DriverAdapter driverAdapter = new DriverAdapter(topDriver);
-                                    
-            // Call wrapper to startOfData() on DriverAdapter.
-            driverAdapter.configure(null);
-                        
-            // Make the builder for creating LCSim events from EVIO data.
-            LCSimEventBuilder eventBuilder = new LCSimEventBuilder(detectorName);
-            eventBuilder.setDebug(false);
-                                                
-            // Start job timer.
-            gui.updateJobStartTime();
-
-            // array of events
-            EtEvent[] mevs = null;
-            //int eventCount = 0;
-            while (true) { // event loop
-                try {
-                    //if (debug)
-                    //    System.out.println("waiting for EtEvents");
-                    //mevs = sys.getEvents(att, Mode.SLEEP, Modify.NOTHING, 0, cn.chunk);                    
-                    mevs = sys.getEvents(att, Mode.TIMED, Modify.NOTHING, 20000000, cn.chunk);
-                    //eventCount += mevs.length;
-                    //if (debug) {
-                    //    System.out.println("event count <" + eventCount + ">");
-                    //    System.out.println("got " + mevs.length + " EtEvents");
-                   // }
-                } catch (EtTimeoutException e) {
-                    System.out.println("ET Consumer timed out.");
-                    driverAdapter.finish(null);
-                    System.out.println("Press ENTER to exit ...");
-                    System.console().readLine();
-                    System.exit(0);
-                }
-                                           
-                // Loop over retrieved EtEvents.
-                for (EtEvent mev : mevs) {
-                    
-                    // Update GUI's event count.
-                    gui.updateEventCount();                    
-                    
-                    // Get EvioEvent and check for errors.
-                    ByteBuffer buf = mev.getDataBuffer();
-                    EvioReader reader = new EvioReader(buf);
-                    EvioEvent evioEvent = null;
-                    try {
-                        evioEvent = reader.parseNextEvent();
-                    } catch (java.nio.BufferUnderflowException e) {
-                    	// Error will be caught by subsequent check on null event.
-                    }
-                    if (evioEvent == null) {
-                    	gui.updateBadEventCount();
-                        continue;
-                    }
-                   
-                    // Create LCSim event from EVIO data.
-                    EventHeader lcsimEvent = eventBuilder.makeLCSimEvent(evioEvent);
-
-                    // Make a new event for DriverAdapter.
-                    RecordSuppliedEvent loopEvent = new RecordSuppliedEvent(new Object(), lcsimEvent);
-
-                    // Call process methods via Driver Adapter.
-                    driverAdapter.recordSupplied(loopEvent);
-
-                    // Update the average event rate.
-                    gui.updateAverageEventRate();                    
-                    
-                    // Update elapsed time.
-                    gui.updateElapsedTime();
-                }
-                // Put events back into the ET system.
-                sys.putEvents(att, mevs);                
-            }
-        }
-        catch (Exception ex) {
-            System.out.println("Error using ET system as consumer.");
-            ex.printStackTrace();
-        }
-    }    
-}
\ No newline at end of file
CVSspam 0.2.12


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