Commit in java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal on MAIN
io/EventManager.java+8480 -> 481
  /TextManager.java+4480 -> 481
lcsim/EventDisplayOutputDriver.java-144480 removed
ui/FileViewer.java+13-4480 -> 481
  /Viewer.java+11-7480 -> 481
+36-155
1 removed + 4 modified, total 5 files
Minor event display updates.

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/io
EventManager.java 480 -> 481
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/io/EventManager.java	2014-04-13 02:46:31 UTC (rev 480)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/io/EventManager.java	2014-04-13 18:43:17 UTC (rev 481)
@@ -23,6 +23,14 @@
      **/
 	public void close() throws IOException;
 	
+	/**
+	 * <b>getEventNumber</b><br/><br/>
+     * <code>public int <b>getEventNumber</b>()</code><br/><br/>
+     * Gets the ordinal number for the currently displayed event.
+	 * @return Returns the current event's ordinal number.
+	 */
+	public int getEventNumber();
+	
     /**
      * <b>getClusters</b><br/><br/>
      * <code>public ArrayList<Cluster> <b>getClusters</b>()</code><br/><br/>

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/io
TextManager.java 480 -> 481
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/io/TextManager.java	2014-04-13 02:46:31 UTC (rev 480)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/io/TextManager.java	2014-04-13 18:43:17 UTC (rev 481)
@@ -65,6 +65,10 @@
         open = false;
     }
     
+    public int getEventNumber() {
+    	return curEvent;
+    }
+    
     public ArrayList<Cluster> getClusters() {
         if (!open) { return null; }
         else { return clusterList; }

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/lcsim
EventDisplayOutputDriver.java removed after 480
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/lcsim/EventDisplayOutputDriver.java	2014-04-13 02:46:31 UTC (rev 480)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/lcsim/EventDisplayOutputDriver.java	2014-04-13 18:43:17 UTC (rev 481)
@@ -1,144 +0,0 @@
-package org.hps.monitoring.ecal.lcsim;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.EventHeader;
-import org.hps.recon.ecal.HPSEcalCluster;
-import org.hps.recon.ecal.HPSCalorimeterHit;
-import org.lcsim.util.Driver;
-
-/**
- * <code>EventDisplayOutputDriver</code> writes the results from clustering
- * and hit reconstruction into a text format that can be read offline by the
- * event display.
- *
- * @author Kyle McCarty
- */
-public class EventDisplayOutputDriver extends Driver {
-    private FileWriter writer;
-    private int eventNum = 0;
-    String ecalCollectionName = "EcalHits";
-    String clusterCollectionName = "EcalClusters";
-    String outputFileName = "cluster-hit.txt";
-    
-    public void setEcalCollectionName(String ecalCollectionName) {
-        this.ecalCollectionName = ecalCollectionName;
-    }
-    
-    public void setClusterCollectionName(String clusterCollectionName) {
-        this.clusterCollectionName = clusterCollectionName;
-    }
-    
-    public void setOutputFileName(String outputFileName) {
-        this.outputFileName = outputFileName;
-    }
-    
-    public void startOfData() {
-        try {
-            // Initialize the writer.
-            writer = new FileWriter(outputFileName);
-            
-            // Clear the file.
-            writer.write("");
-        } catch(IOException e) {
-            System.err.println("Error initializing output file for event display.");
-        }
-    }
-    
-    public void endOfData() {
-        try {
-            // Close the file writer.
-            writer.close();
-        } catch (IOException e) {
-            System.err.println("Error closing output file for event display.");
-        }
-    }
-    
-    public void process(EventHeader event) {
-        // Get the list of clusters.
-        List<HPSEcalCluster> clusters;
-
-        // If no cluster collection is present, then make an
-        // empty list instead to avoid crashes.
-        try {
-            clusters = event.get(HPSEcalCluster.class, clusterCollectionName);
-            if (clusters == null) {
-                throw new RuntimeException("Missing cluster collection!");
-            }
-        }
-        catch(IllegalArgumentException e) {
-            clusters = new ArrayList<HPSEcalCluster>(0);
-        }
-        
-        // Get the list of calorimeter hits.
-        List<CalorimeterHit> hits;
-        
-        // If no hit collection is present, then make an empty
-        // list instead to avoid crahses.
-        try {
-            hits = event.get(CalorimeterHit.class, ecalCollectionName);
-            if (hits == null) {
-                throw new RuntimeException("Missing hit collection!");
-            }
-        }
-        catch(IllegalArgumentException e) {
-            hits = new ArrayList<CalorimeterHit>(0);
-        }
-        
-        try {
-            if(hits.size() != 0) {//if(clusters.size() != 0) {
-                // Increment the event number.
-                eventNum++;
-                
-                // Write the event header.
-                writer.append("Event\t" + eventNum + "\n");
-                
-                // Process the calorimeter hits.
-                for (CalorimeterHit hit : hits) {
-                    // Get the x/y coordinates for the current hit.
-                    int ix = hit.getIdentifierFieldValue("ix");
-                    int iy = hit.getIdentifierFieldValue("iy");
-                    double energy = hit.getRawEnergy();
-                    double time = hit.getTime();
-                    
-                    // Write the hit to the output file.
-                    writer.append(String.format("EcalHit\t%d\t%d\t%f\t%f%n", ix, iy, energy, time));
-                }
-                
-                // Process the clusters.
-                for (HPSEcalCluster cluster : clusters) {
-                    // Get the seed hit for the cluster.
-                    HPSCalorimeterHit seedHit = (HPSCalorimeterHit)cluster.getSeedHit();
-                    int ix = seedHit.getIdentifierFieldValue("ix");
-                    int iy = seedHit.getIdentifierFieldValue("iy");
-                    double time = seedHit.getTime();
-                    
-                    // Get the cluster's total energy.
-                    double energy = cluster.getEnergy();
-                    
-                    // Write the seed hit to start a cluster.
-                    writer.append(String.format("Cluster\t%d\t%d\t%f\t%f%n", ix, iy, energy, time));
-                    
-                    // Write the component hits to the cluster.
-                    for (CalorimeterHit hit : cluster.getCalorimeterHits()) {
-                        // Get each component hit's x/y coordinates.
-                        ix = hit.getIdentifierFieldValue("ix");
-                        iy = hit.getIdentifierFieldValue("iy");
-                        
-                        // Write them as component hits.
-                        writer.append(String.format("CompHit\t%d\t%d%n", ix, iy));
-                    }
-                }
-                
-                // Append the end of event indicator.
-                writer.append("EndEvent\n");
-            }
-        } catch(IOException e) {
-            System.err.println("Error writing to output for event display.");
-        }
-    }
-}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/ui
FileViewer.java 480 -> 481
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/ui/FileViewer.java	2014-04-13 02:46:31 UTC (rev 480)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/ui/FileViewer.java	2014-04-13 18:43:17 UTC (rev 481)
@@ -25,7 +25,12 @@
     // Map cluster location to a cluster object.
     private HashMap<Point, Cluster> clusterMap = new HashMap<Point, Cluster>();
     // Additional status display field names for this data type.
-    private static final String[] fieldNames = { "Shared Hits", "Component Hits", "Cluster Energy" };
+    private static final String[] fieldNames = { "Event Number", "Shared Hits", "Component Hits", "Cluster Energy" };
+    // Indices for the field values.
+    private static final int EVENT_NUMBER = 0;
+    private static final int SHARED_HITS = 1;
+    private static final int COMPONENT_HITS = 2;
+    private static final int CLUSTER_ENERGY = 3;
     
 	/**
 	 * <b>FileViewer</b><br/><br/>
@@ -49,6 +54,7 @@
     public void displayPreviousEvent() throws IOException { getEvent(false); }
     
     protected void updateStatusPanel() {
+    	// Update the superclass status fields.
     	super.updateStatusPanel();
     	
 		// Get the currently selected crystal.
@@ -67,8 +73,8 @@
 			// Otherwise, define the fields based on the cluster.
 			else {
 				// Get the shared and component hit counts.
-				setStatusField(fieldNames[0], Integer.toString(activeCluster.getSharedHitCount()));
-				setStatusField(fieldNames[1], Integer.toString(activeCluster.getComponentHitCount()));
+				setStatusField(fieldNames[SHARED_HITS], Integer.toString(activeCluster.getSharedHitCount()));
+				setStatusField(fieldNames[COMPONENT_HITS], Integer.toString(activeCluster.getComponentHitCount()));
 				
 				// Format the cluster energy, or account for it if it
 				// doesn't exist.
@@ -78,11 +84,14 @@
 					energy = formatter.format(activeCluster.getClusterEnergy());
 				}
 				else { energy = "---"; }
-				setStatusField(fieldNames[2], energy);
+				setStatusField(fieldNames[CLUSTER_ENERGY], energy);
 			}
 		}
 		// Otherwise, clear the field values.
 		else { for(String field : fieldNames) { setStatusField(field, StatusPanel.NULL_VALUE); } }
+    	
+    	// Set the event number.
+    	setStatusField(fieldNames[EVENT_NUMBER], Integer.toString(em.getEventNumber()));
     }
     
 	/**

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/ui
Viewer.java 480 -> 481
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/ui/Viewer.java	2014-04-13 02:46:31 UTC (rev 480)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/ui/Viewer.java	2014-04-13 18:43:17 UTC (rev 481)
@@ -35,6 +35,10 @@
     private ArrayList<CrystalListener> listenerList = new ArrayList<CrystalListener>();
     // The default field names.
     private static final String[] defaultFields = { "x Index", "y Index", "Cell Value" };
+    // Indices for the field values.
+    private static final int X_INDEX = 0;
+    private static final int Y_INDEX = 1;
+    private static final int CELL_VALUE = 2;
     
     /**
      * <b><statusPanel/b><br/><br/>
@@ -79,13 +83,13 @@
         super();
         
         // Define the status panel fields and map them to indices.
-        String[] fields = new String[statusFields.length + 3];
+        String[] fields = new String[statusFields.length + defaultFields.length];
         for(int i = 0; i < defaultFields.length; i++) {
         	fields[i] = defaultFields[i];
         	fieldMap.put(defaultFields[i], i);
         }
         for(int i = 0; i < statusFields.length; i++) {
-        	int index = i + 3;
+        	int index = i + defaultFields.length;
         	fields[index] = statusFields[i];
         	fieldMap.put(statusFields[i], index);
         }
@@ -94,8 +98,8 @@
         statusPanel = new StatusPanel(fields);
         
         // Set the scaling settings.
-        ecalPanel.setScaleMinimum(0.0001);
-        ecalPanel.setScaleMaximum(3000);
+        ecalPanel.setScaleMinimum(0.00001);
+        ecalPanel.setScaleMaximum(3);
         ecalPanel.setScalingLogarithmic();
         
         // Disable the crystals in the calorimeter panel along the beam gap.
@@ -285,11 +289,11 @@
 		
 		// Otherwise, write the crystal's data to the panel.
 		else {
-			setStatusField(defaultFields[0], String.valueOf(toEcalX(crystal.x)));
-			setStatusField(defaultFields[1], String.valueOf(toEcalY(crystal.y)));
+			setStatusField(defaultFields[X_INDEX], String.valueOf(toEcalX(crystal.x)));
+			setStatusField(defaultFields[Y_INDEX], String.valueOf(toEcalY(crystal.y)));
 			DecimalFormat formatter = new DecimalFormat("0.####E0");
 			String energy = formatter.format(ecalPanel.getCrystalEnergy(crystal.x, crystal.y));
-			setStatusField(defaultFields[2], energy);
+			setStatusField(defaultFields[CELL_VALUE], energy);
 		}
 	}
     
SVNspam 0.1