Print

Print


Commit in java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal on MAIN
ColorScale.java+48-92140 -> 141
Datum.java+33-70140 -> 141
EcalHit.java+20-35140 -> 141
EventManager.java+49-64140 -> 141
GradientScale.java+35-63140 -> 141
Main.java+20-14140 -> 141
MultiGradientScale.java+37-61140 -> 141
Viewer.java+24-52140 -> 141
+266-451
8 modified files
Updated single event display documentation.

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
ColorScale.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/ColorScale.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/ColorScale.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -21,148 +21,104 @@
     protected double lMin = 0.0;
     // An efficiency variable used for logarithmic mapping.
     protected double lMax = 1.0;
-
+    
     /**
-     * <b>setMinimum</b><br/>
-     * <br/>
-     * <code>public void <b>setMinimum</b>(double minimum)</code><br/>
-     * <br/>
+     * <b>setMinimum</b><br/><br/>
+     * <code>public void <b>setMinimum</b>(double minimum)</code><br/><br/>
      * Sets the value under which no color scaling will be performed.
-     * 
-     * @param minimum
-     *            - The lowest value for which color scaling will be performed.
+     * @param minimum - The lowest value for which color scaling will be performed.
      **/
     public void setMinimum(double minimum) {
         min = minimum;
         revalidate();
     }
-
+    
     /**
-     * <b>setMaximum</b><br/>
-     * <br/>
-     * <code>public void <b>setMaximum</b>(double maximum)</code><br/>
-     * <br/>
+     * <b>setMaximum</b><br/><br/>
+     * <code>public void <b>setMaximum</b>(double maximum)</code><br/><br/>
      * Sets the value over which no color scaling will be performed.
-     * 
-     * @param maximum
-     *            - The highest value for which color scaling will be performed.
+     * @param maximum - The highest value for which color scaling will be performed.
      **/
     public void setMaximum(double maximum) {
         max = maximum;
         revalidate();
     }
-
+    
     /**
-     * <b>getMinimum</b><br/>
-     * <br/>
-     * <code>public double <b>getMinimum</b>()</code><br/>
-     * <br/>
+     * <b>getMinimum</b><br/><br/>
+     * <code>public double <b>getMinimum</b>()</code><br/><br/>
      * Gets the lowest value for which color scaling is performed.
-     * 
-     * @return Returns the minimum value for color scaling as a
-     *         <code>double</code>.
+     * @return Returns the minimum value for color scaling as a <code>double</code>.
      **/
-    public double getMinimum() {
-        return min;
-    }
-
+    public double getMinimum() { return min; }
+    
     /**
-     * <b>getMaximum</b><br/>
-     * <br/>
-     * <code>public double <b>getMaximum</b>()</code><br/>
-     * <br/>
+     * <b>getMaximum</b><br/><br/>
+     * <code>public double <b>getMaximum</b>()</code><br/><br/>
      * Gets the highest value for which color scaling is performed.
-     * 
-     * @return Returns the maximum value for color scaling as a
-     *         <code>double</code>.
+     * @return Returns the maximum value for color scaling as a <code>double</code>.
      **/
-    public double getMaximum() {
-        return max;
-    }
-
+    public double getMaximum() { return max; }
+    
     /**
-     * <b>setScalingLinear</b><br/>
-     * <br/>
-     * <code>public void <b>setScalingLinear</b>()</code><br/>
-     * <br/>
+     * <b>setScalingLinear</b><br/><br/>
+     * <code>public void <b>setScalingLinear</b>()</code><br/><br/>
      * Sets the scaling behavior to linear.
      **/
     public void setScalingLinear() {
         linear = true;
         revalidate();
     }
-
+    
     /**
-     * <b>isLinearScale</b><br/>
-     * <br/>
-     * <code>public boolean <b>isLinearScale</b>()</code><br/>
-     * <br/>
+     * <b>isLinearScale</b><br/><br/>
+     * <code>public boolean <b>isLinearScale</b>()</code><br/><br/>
      * Indicates whether this color mapping is linear or not.
-     * 
-     * @return Returns <code>true</code> if this is a linear mapping and
-     *         <code>false</code> otherwise.
+     * @return Returns <code>true</code> if this is a linear mapping and <code>false
+     * </code> otherwise.
      **/
-    public boolean isLinearScale() {
-        return linear;
-    }
-
+    public boolean isLinearScale() { return linear; }
+    
     /**
-     * <b>isLogarithmicScale</b><br/>
-     * <br/>
-     * <code>public boolean <b>isLogarithmicScale</b>()</code><br/>
-     * <br/>
+     * <b>isLogarithmicScale</b><br/><br/>
+     * <code>public boolean <b>isLogarithmicScale</b>()</code><br/><br/>
      * Indicates whether this color mapping is logarithmic or not.
-     * 
-     * @return Returns <code>true</code> if this is a logarithmic mapping and
-     *         <code>false</code> if it is not.
+     * @return Returns <code>true</code> if this is a logarithmic mapping and <code>
+     * false</code> if it is not.
      **/
-    public boolean isLogairthmicScale() {
-        return !linear;
-    }
-
+    public boolean isLogairthmicScale() { return !linear; }
+    
     /**
-     * <b>setScalingLogarithmic</b><br/>
-     * <br/>
-     * <code>public void <b>setScalingLogarithmic</b>()</code><br/>
-     * <br/>
+     * <b>setScalingLogarithmic</b><br/><br/>
+     * <code>public void <b>setScalingLogarithmic</b>()</code><br/><br/>
      * Sets the scaling behavior to logarithmic.
      **/
     public void setScalingLogarithmic() {
         linear = false;
         revalidate();
     }
-
+    
     /**
-     * <b>getColor</b><br/>
-     * <br/>
-     * <code>public Color <b>getColor</b>(double value)</code><br/>
-     * <br/>
+     * <b>getColor</b><br/><br/>
+     * <code>public Color <b>getColor</b>(double value)</code><br/><br/>
      * Determines the color representing the indicated value.
-     * 
-     * @param value
-     *            - The value to relate to a color.
-     * @return Returns a <code>Color</code> object associated with the argument
-     *         value.
+     * @param value - The value to relate to a color.
+     * @return Returns a <code>Color</code> object associated with the argument value.
      **/
     public abstract Color getColor(double value);
-
+    
     /**
-     * <b>revalidate</b><br/>
-     * <br/>
-     * <code>protected void <b>revalidate</b>()</code><br/>
-     * <br/>
+     * <b>revalidate</b><br/><br/>
+     * <code>protected void <b>revalidate</b>()</code><br/><br/>
      * Makes any necessary changes whenever a critical value is changed.
      **/
     protected void revalidate() {
         // Ensure that the minimum is not zero in the case of log scaling.
         if (!linear && min == 0) {
-            if (max < 0.01) {
-                min = max / 100.0;
-            } else {
-                min = 0.01;
-            }
+            if (max < 0.01) { min = max / 100.0; }
+            else { min = 0.01; }
         }
-
+        
         // We only need to revalidate if we are using a logarithmic scale.
         if (!linear) {
             // Determine the scaling variable for logarithmic results.
@@ -173,7 +129,7 @@
                 steps++;
             }
             scale = Math.pow(10, steps);
-
+            
             // Revalidate the logarithmic variables.
             lMax = Math.log10(scale * max);
             lMin = Math.log10(scale * min);

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
Datum.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/Datum.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/Datum.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -4,107 +4,70 @@
 
 /**
  * The <code>Datum</code> class contains a point representing a crystal in the
- * calorimeter display panel.
+ * calorimeter display panel. This is used for storing information when reading
+ * from a file. HPS objects should be used when reading from LCIO.
  * 
  * @author Kyle McCarty
  **/
 public class Datum {
     // The coordinate on the calorimeter panel.
     protected Point loc;
-
+    
     /**
-     * <b>Datum</b><br/>
-     * <br/>
-     * <code>public <b>Datum</b>()</code><br/>
-     * <br/>
+     * <b>Datum</b><br/><br/>
+     * <code>public <b>Datum</b>()</code><br/><br/>
      * Initializes an empty <code>Datum</code>. Note that it will have an
      * invalid coordinate.
      **/
-    public Datum() {
-        this(-1, -1);
-    }
+    public Datum() { this(-1, -1); }
 
     /**
-     * <b>Datum</b><br/>
-     * <br/>
-     * <code>public <b>Datum</b>(int x, int y)</code><br/>
-     * <br/>
+     * <b>Datum</b><br/><br/>
+     * <code>public <b>Datum</b>(int x, int y)</code><br/><br/>
      * Initializes a new <code>Datum</code> at the indicated coordinate.
-     * 
-     * @param x
-     *            - The x-coordinate of the object.
-     * @param y
-     *            - The y-coordinate of the object.
+     * @param x - The x-coordinate of the object.
+     * @param y - The y-coordinate of the object.
      **/
-    public Datum(int x, int y) {
-        loc = new Point(x, y);
-    }
-
+    public Datum(int x, int y) { loc = new Point(x, y); }
+    
     /**
-     * <b>getX</b><br/>
-     * <br/>
-     * <code>public int <b>getX</b>()</code><br/>
-     * <br/>
+     * <b>getX</b><br/><br/>
+     * <code>public int <b>getX</b>()</code><br/><br/>
      * Indicates the x-coordinate of the object.
-     * 
      * @return Returns the x-cooridinate as an <code>int</code>.
      **/
-    public int getX() {
-        return loc.x;
-    }
-
+    public int getX() { return loc.x; }
+    
     /**
-     * <b>getY</b><br/>
-     * <br/>
-     * <code>public int <b>getY</b>()</code><br/>
-     * <br/>
+     * <b>getY</b><br/><br/>
+     * <code>public int <b>getY</b>()</code><br/><br/>
      * Indicates the y-coordinate of the object.
-     * 
      * @return Returns the y-coordiate as an <code>int</code>.
      **/
-    public int getY() {
-        return loc.y;
-    }
-
+    public int getY() { return loc.y; }
+    
     /**
-     * <b>getLocation</b><br/>
-     * <br/>
-     * <code>public Point <b>getLocation</b>()</code><br/>
-     * <br/>
+     * <b>getLocation</b><br/><br/>
+     * <code>public Point <b>getLocation</b>()</code><br/><br/>
      * Indicates the location of the object.
-     * 
      * @return Returns the object's location as a <code>Point
      * </code> object.
      **/
-    public Point getLocation() {
-        return loc;
-    }
-
+    public Point getLocation() { return loc; }
+    
     /**
-     * <b>setX</b><br/>
-     * <br/>
-     * <code>public void <b>setX</b>(int x)</code><br/>
-     * <br/>
+     * <b>setX</b><br/><br/>
+     * <code>public void <b>setX</b>(int x)</code><br/><br/>
      * Sets the object's x-coordinate.
-     * 
-     * @param x
-     *            - The new x-coordinate.
+     * @param x - The new x-coordinate.
      **/
-    public void setX(int x) {
-        loc.x = x;
-    }
-
+    public void setX(int x) { loc.x = x; }
+    
     /**
-     * <b>setY</b><br/>
-     * <br/>
-     * <code>public void <b>setY</b>(int y)</code><br/>
-     * <br/>
+     * <b>setY</b><br/><br/>
+     * <code>public void <b>setY</b>(int y)</code><br/><br/>
      * Sets the obejct's y-coordinate.
-     * 
-     * @param y
-     *            - The new y-coordinate.
+     * @param y - The new y-coordinate.
      **/
-    public void setY(int y) {
-        loc.y = y;
-    }
+    public void setY(int y) { loc.y = y; }
 }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
EcalHit.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/EcalHit.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/EcalHit.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -1,56 +1,41 @@
 package org.hps.monitoring.ecal;
 
 /**
- * The class <code>EcalHit</code> is an extension of <code>Datum
- * </code> that stores an energy.
+ * The class <code>EcalHit</code> is an extension of <code>Datum</code>
+ * that stores an energy. This is used for reading input from a text
+ * file. <code>CalorimeterHit</code> should be used when reading from
+ * an LCIO file.
  **/
 public final class EcalHit extends Datum {
     // The (raw) energy of this hit.
     private double energy = 0.0;
-
+    
     /**
-     * <b>EcalHit</b><br/>
-     * <br/>
-     * <code>public <b>EcalHit</b>(int x, int y, double energy)</code><br/>
-     * <br/>
+     * <b>EcalHit</b><br/><br/>
+     * <code>public <b>EcalHit</b>(int x, int y, double energy)</code><br/><br/>
      * Initializes a calorimeter hit object.
-     * 
-     * @param x
-     *            - The x-coordinate of the hit.
-     * @param y
-     *            - The y-coordinate of the hit.
-     * @param energy
-     *            - The raw energy of the hit.
+     * @param x - The x-coordinate of the hit.
+     * @param y - The y-coordinate of the hit.
+     * @param energy - The raw energy of the hit.
      **/
     public EcalHit(int x, int y, double energy) {
         super(x, y);
         this.energy = energy;
     }
-
+    
     /**
-     * <b>getEnergy</b><br/>
-     * <br/>
-     * <code>public double <b>getEnergy</b>()</code><br/>
-     * <br/>
-     * Indicates the raw energy of this ht.
-     * 
+     * <b>getEnergy</b><br/><br/>
+     * <code>public double <b>getEnergy</b>()</code><br/><br/>
+     * Indicates the raw energy of this hit.
      * @return Returns the raw energy as a <code>double</code>.
      **/
-    public double getEnergy() {
-        return energy;
-    }
-
+    public double getEnergy() { return energy; }
+    
     /**
-     * <b>setEnergy</b><br/>
-     * <br/>
-     * <code>public void <b>setEnergy</b>(double energy)</code><br/>
-     * <br/>
+     * <b>setEnergy</b><br/><br/>
+     * <code>public void <b>setEnergy</b>(double energy)</code><br/><br/>
      * Sets the energy of the hit to the indicated value.
-     * 
-     * @param energy
-     *            - The new energy of the hit.
+     * @param energy - The new energy of the hit.
      **/
-    public void setEnergy(double energy) {
-        this.energy = energy;
-    }
+    public void setEnergy(double energy) { this.energy = energy; }
 }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
EventManager.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/EventManager.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/EventManager.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -8,8 +8,20 @@
 
 /**
  * The class <code>EventManager</code> handles loading hits and clusters from a
- * text file to populate the calorimeter panel.
+ * text file to populate the calorimeter panel. Input should be of the form
+ * Event
+ * Indicates the start of a new event.
  * 
+ * EcalHit [X] [Y] [Energy]
+ * Represents a calorimeter hit at coordinates ([X], [Y]) and with energy
+ * [Energy]. Coordinates should be in calorimeter form (x = [-23, 23] and
+ * y = [-5, 5]) and must integers. Energy can be a decimal value. Brackets
+ * should not be included in the line.
+ * 
+ * Cluster [X] [Y]
+ * Represents the location of a cluster at coordinates ([X], [Y]). Brackets
+ * should not be included in the line.
+ * 
  * @author Kyle McCarty
  **/
 public class EventManager {
@@ -22,55 +34,44 @@
     private ArrayList<Datum> clusterList = new ArrayList<Datum>();
     // Whether the event manager has an open file.
     private boolean open = true;
-
+    
     /**
-     * <b>EventManager</b><br/>
-     * <br/>
-     * <code>public <b>EventManager</b>(String filename)</code><br/>
-     * <br/>
+     * <b>EventManager</b><br/><br/>
+     * <code>public <b>EventManager</b>(String filename)</code><br/><br/>
      * Initializes an event manager that will read from the indicated file.
-     * 
-     * @param filename
-     *            - The path to the file containing hit information.
+     * @param filename - The path to the file containing hit information.
      **/
     public EventManager(String filename) throws IOException {
         fr = new FileReader(filename);
         reader = new BufferedReader(fr);
     }
-
+    
     /**
-     * <b>readEvent</b><br/>
-     * <br/>
-     * <code>public boolean <b>readEvent</b>()</code><br/>
-     * <br/>
+     * <b>readEvent</b><br/><br/>
+     * <code>public boolean <b>readEvent</b>()</code><br/><br/>
      * Populates the event manager with hits and clusters from the next event.
-     * 
-     * @return Returns <code>true</code> if an event was read and
-     *         <code>false</code> if it was not.
+     * @return Returns <code>true</code> if an event was read and <code>false
+     * </code> if it was not.
      **/
     public boolean readEvent() throws IOException {
         // We can only read of the reader is open.
-        if (!open) {
-            return false;
-        }
-
+        if (!open) { return false; }
+        
         // Clear the data lists.
         hitList.clear();
         clusterList.clear();
-
+        
         // Store the current line.
         String curLine = reader.readLine();
-
+        
         // Keep sorting until we hit a null or an event header.
         while (curLine != null && curLine.compareTo("Event") != 0) {
             curLine = reader.readLine();
         }
-
+        
         // If we hit a null, we are at the end of the file.
-        if (curLine == null) {
-            return false;
-        }
-
+        if (curLine == null) { return false; }
+        
         // Otherwise, we have read an event header and must populate
         // the data lists.
         curLine = reader.readLine();
@@ -80,73 +81,57 @@
             String name = st.nextToken();
             int ix = Integer.parseInt(st.nextToken());
             int iy = Integer.parseInt(st.nextToken());
-
+            
             // Convert it to an object.
             if (name.compareTo("Cluster") == 0) {
                 clusterList.add(new Datum(ix, iy));
-            } else if (name.compareTo("EcalHit") == 0) {
+            }
+            else if (name.compareTo("EcalHit") == 0) {
                 double energy = Double.parseDouble(st.nextToken());
                 hitList.add(new EcalHit(ix, iy, energy));
             }
-
+            
             // Get the next line.
             curLine = reader.readLine();
         }
-
+        
         // Indicate that an event was processed.
         return true;
     }
-
+    
     /**
-     * <b>close</b><br/>
-     * <br/>
-     * <code>public void <b>close</b>()</code><br/>
-     * <br/>
+     * <b>close</b><br/><br/>
+     * <code>public void <b>close</b>()</code><br/><br/>
      * Closes the event manager. Once this is performed, no additional events
      * may be read.
-     * 
-     * @throws IOException
-     *             Occurs if there is an error closing the file stream.
+     * @throws IOException Occurs if there is an error closing the file stream.
      **/
     public void close() throws IOException {
         reader.close();
         fr.close();
         open = false;
     }
-
+    
     /**
-     * <b>getHits</b><br/>
-     * <br/>
-     * <code>public ArrayList<EcalHit> <b>getHits</b>()</code><br/>
-     * <br/>
+     * <b>getHits</b><br/><br/>
+     * <code>public ArrayList<EcalHit> <b>getHits</b>()</code><br/><br/>
      * Allows access to the current event's list of hits.
-     * 
-     * @return Returns the current hits as an <code>ArrayList
-     * </code> object.
+     * @return Returns the current hits as an <code>ArrayList</code> object.
      **/
     public ArrayList<EcalHit> getHits() {
-        if (!open) {
-            return null;
-        } else {
-            return hitList;
-        }
+        if (!open) { return null; }
+        else { return hitList; }
     }
-
+    
     /**
-     * <b>getClusters</b><br/>
-     * <br/>
-     * <code>public ArrayList<Datum> <b>getClusters</b></code><br/>
-     * <br/>
+     * <b>getClusters</b><br/><br/>
+     * <code>public ArrayList<Datum> <b>getClusters</b></code><br/><br/>
      * Allows access to the current event's list of clusters.
-     * 
      * @return Returns the current clusters as an <code>ArrayList
      * </code> object.
      **/
     public ArrayList<Datum> getClusters() {
-        if (!open) {
-            return null;
-        } else {
-            return clusterList;
-        }
+        if (!open) { return null; }
+        else { return clusterList; }
     }
 }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
GradientScale.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/GradientScale.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/GradientScale.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -20,72 +20,56 @@
     // Efficiency variable holding the rgb difference between the two
     // colors. This is used to prevent recalculation when mapping values.
     private int[] drgb = { 255, 255, 255 };
-
+    
     /**
-     * <b>setHotColor</b><br/>
-     * <br/>
-     * <code>public void <b>setHotColor</b>(Color c)</code><br/>
-     * <br/>
+     * <b>setHotColor</b><br/><br/>
+     * <code>public void <b>setHotColor</b>(Color c)</code><br/><br/>
      * Sets the color associated with the maximum value.
-     * 
-     * @param c
-     *            - The new color to use.
+     * @param c - The new color to use.
      **/
     public void setHotColor(Color c) {
         hotColor = c;
         revalidateColor();
     }
-
+    
     /**
-     * <b>setColdColor</b><br/>
-     * <br/>
-     * <code>public void <b>setColdColor</b>(Color c)</code><br/>
-     * <br/>
+     * <b>setColdColor</b><br/><br/>
+     * <code>public void <b>setColdColor</b>(Color c)</code><br/><br/>
      * Sets the color assocaited with the minimum value.
-     * 
-     * @param c
-     *            - The color to use.
+     * @param c - The color to use.
      **/
     public void setColdColor(Color c) {
         coldColor = c;
         revalidateColor();
     }
-
+    
     public Color getColor(double value) {
         // If the value is less than the minimum, return the cold color.
-        if (value < min) {
-            return coldColor;
-        }
-
+        if (value < min) { return coldColor; }
+        
         // If the value is greater than the maximum, return the hot color.
-        if (value > max) {
-            return hotColor;
-        }
-
+        if (value > max) { return hotColor; }
+        
         // Otherwise, calculate how far along the gradient the value is.
         double percent;
-        if (linear) {
-            percent = (value - min) / (max - min);
-        } else {
+        if (linear) { percent = (value - min) / (max - min); }
+        else {
             double lValue = Math.log10(scale * value);
             percent = (lValue - lMin) / (lMax - lMin);
         }
-
+        
         // Scale the color.
         int dr = (int) Math.round(percent * drgb[0]);
         int dg = (int) Math.round(percent * drgb[1]);
         int db = (int) Math.round(percent * drgb[2]);
-
+        
         // Return the result.
-        return new Color(coldColor.getRed() + dr, coldColor.getGreen() + dg,
-                coldColor.getBlue() + db);
+        return new Color(coldColor.getRed() + dr, coldColor.getGreen() + dg, coldColor.getBlue() + db);
     }
-
+    
     /**
-     * <b>revalidateColor</b><br/>
-     * <br/>
-     * <code>private void <b>revalidateColor</b>()</code><br/>
-     * <br/>
+     * <b>revalidateColor</b><br/><br/>
+     * <code>private void <b>revalidateColor</b>()</code><br/><br/>
      * Calculates the differences between the hot and cold colors and sets the
      * class related class variables.
      **/
@@ -94,46 +78,34 @@
         drgb[1] = hotColor.getGreen() - coldColor.getGreen();
         drgb[2] = hotColor.getBlue() - coldColor.getBlue();
     }
-
+    
     /**
-     * <b>makeGreyScale</b><br/>
-     * <br/>
-     * <code>public static GradientScale <b>makeGreyScale</b>(double minimum, double maximum)</code>
-     * <br/>
-     * <br/>
+     * <b>makeGreyScale</b><br/><br/>
+     * <code>public static GradientScale <b>makeGreyScale</b>(double minimum, double maximum)</code><br/><br/>
      * Creates a color scale that ranges from black (cold) to white (hot) with
      * the indicated maximum and minimum.
-     * 
-     * @param minimum
-     *            - The lowest value for color scaling.
-     * @param maximum
-     *            - The highest value for color scaling.
+     * @param minimum - The lowest value for color scaling.
+     * @param maximum - The highest value for color scaling.
      * @return Returns a <code>GradientScale</code> that maps to grey scale over
-     *         the indicated range.
+     * the indicated range.
      **/
     public static GradientScale makeGreyScale(double minimum, double maximum) {
         GradientScale gs = new GradientScale();
         gs.setMinimum(minimum);
         gs.setMaximum(maximum);
-
+        
         return gs;
     }
-
+    
     /**
-     * <b>makeHeatScale</b><br/>
-     * <br>
-     * <code>public static GradientScale <b>makeHeatScale</b>(double minimum, double maximum)</code>
-     * <br/>
-     * <br/>
+     * <b>makeHeatScale</b><br/><br>
+     * <code>public static GradientScale <b>makeHeatScale</b>(double minimum, double maximum)</code><br/><br/>
      * Creates a color scale that ranges from black (cold) to red (hot) with the
      * indicated maximum and minimum.
-     * 
-     * @param minimum
-     *            - The lowest value for color scaling.
-     * @param maximum
-     *            - The highest value for color scaling.
+     * @param minimum - The lowest value for color scaling.
+     * @param maximum - The highest value for color scaling.
      * @return Returns a <code>GradientScale</code> that maps to a black- to-red
-     *         gradient over the indicated range.
+     * gradient over the indicated range.
      **/
     public static GradientScale makeHeatScale(double minimum, double maximum) {
         GradientScale hs = new GradientScale();
@@ -141,7 +113,7 @@
         hs.setColdColor(Color.BLACK);
         hs.setMinimum(minimum);
         hs.setMaximum(maximum);
-
+        
         return hs;
     }
 }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
Main.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/Main.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/Main.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -6,60 +6,65 @@
 import java.io.IOException;
 import java.util.Random;
 
+/**
+ * The class <code>Main</code> can be used to create an event display that
+ * reads from file. By default it reads from "cluster-hit.txt" at the class
+ * path root. This can be changed by altering the line<br/>
+ * <code>window.setDataSource("cluster-hit.txt")</code><br/>
+ **/
 public class Main {
     private static final Viewer window = new Viewer();
-
+    
     public static void main(String[] args) throws IOException {
         // Get screen size of primary monitor
-        GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment()
-                .getDefaultScreenDevice();
+        GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
         int screenWidth = gd.getDisplayMode().getWidth();
         int screenHeight = gd.getDisplayMode().getHeight();
-
+        
         // Set the viewer location and make it visible
         window.setLocation((screenWidth - window.getPreferredSize().width) / 2,
                 (screenHeight - window.getPreferredSize().height) / 2);
         window.setDataSource("cluster-hit.txt");
         window.displayNextEvent();
         window.setVisible(true);
-
+        
         // makeData();
     }
-
+    
     static void makeData() {
         // Generate a random test input file.
         Random rng = new Random();
         try {
             // Make a file writer to write the results.
             FileWriter writer = new FileWriter("cluster-hit.txt");
-
+            
             // Make 10 - 100 events.
             int events = 10 + rng.nextInt(91);
-
+            
             // For each events, generate some data.
             for (int e = 0; e < events; e++) {
                 // Write the event header.
                 writer.append("Event\n");
-
+                
                 // Make 3 - 15 hits.
                 int hits = 3 + rng.nextInt(13);
                 for (int h = 0; h < hits; h++) {
                     // Write identifier.
                     writer.append("EcalHit\t");
-
+                    
                     // Make a random address.
                     // x = [0, 46); y = [0, 11)
                     int ix = rng.nextInt(46);
                     int iy = rng.nextInt(11);
                     writer.append(ix + "\t" + iy + "\n");
                 }
-
+                
                 // Make 0 - 4 clusters.
                 int clusters = rng.nextInt(5);
                 for (int c = 0; c < clusters; c++) {
                     // Write identifier.
                     writer.append("Cluster\t");
-
+                    
                     // Make a random address.
                     // x = [0, 46); y = [0, 11)
                     int ix = rng.nextInt(46);
@@ -67,10 +72,11 @@
                     writer.append(ix + "\t" + iy + "\n");
                 }
             }
-
+            
             // Close the writer.
             writer.close();
-        } catch (IOException e) {
+        }
+        catch (IOException e) {
             System.err.println(e.getStackTrace());
             System.exit(1);
         }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
MultiGradientScale.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/MultiGradientScale.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/MultiGradientScale.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -16,34 +16,26 @@
     private ArrayList<Color> colorList = new ArrayList<Color>();
     // Stores the component mapping scales.
     private ArrayList<GradientScale> scaleList = new ArrayList<GradientScale>();
-
+    
     /**
-     * <b>addColor</b><br/>
-     * <br/>
-     * <code>public void <b>addColor</b>(Color c)</code><br/>
-     * <br/>
+     * <b>addColor</b><br/><br/>
+     * <code>public void <b>addColor</b>(Color c)</code><br/><br/>
      * Adds a new color to the mapping scale. The first color will be the
      * coldest with subsequent colors being more and more hot.
-     * 
-     * @param c
-     *            - The color to add.
+     * @param c - The color to add.
      **/
     public void addColor(Color c) {
         colorList.add(c);
         revalidate();
     }
-
+    
     /**
-     * <b>removeColor</b><br/>
-     * <br/>
-     * <code>public boolean <b>removeColor</b>(int colorIndex)</code><br/>
-     * <br/>
+     * <b>removeColor</b><br/><br/>
+     * <code>public boolean <b>removeColor</b>(int colorIndex)</code><br/><br/>
      * Removes the nth color from the mapping scale.
-     * 
-     * @param colorIndex
-     *            - The index of the color to be removed.
+     * @param colorIndex - The index of the color to be removed.
      * @return Returns <code>true</code> if the color was removed and
-     *         <code>false</code> if it was not.
+     * <code>false</code> if it was not.
      **/
     public boolean removeColor(int colorIndex) {
         // Only remove the value if the index is valid.
@@ -51,71 +43,62 @@
             colorList.remove(colorIndex);
             revalidate();
             return true;
-        } else {
-            return false;
         }
+        else { return false; }
     }
-
+    
     public Color getColor(double value) {
         // Get the number of colors and scales.
         int colors = colorList.size();
         int scales = scaleList.size();
-
+        
         // If there are no colors or scales, give black.
-        if (colors == 0 && scales == 0) {
-            return Color.BLACK;
-        }
-
+        if (colors == 0 && scales == 0) { return Color.BLACK; }
+        
         // If there are no scales, but there is a color, give that.
-        if (scales == 0 && colors == 1) {
-            return colorList.get(0);
-        }
-
+        if (scales == 0 && colors == 1) { return colorList.get(0); }
+        
         // Scale the value if logarithmic.
         double sValue;
-        if (linear) {
-            sValue = value;
-        } else {
-            sValue = Math.log10(scale * value);
-        }
-
+        if (linear) { sValue = value; }
+        else { sValue = Math.log10(scale * value); }
+        
         // Otherwise, determine which scale should get the value.
         for (GradientScale s : scaleList) {
             if (sValue < s.getMaximum()) {
                 return s.getColor(sValue);
             }
         }
-
+        
         // If it didn'tappear in the list, it is the hottest color.
         return colorList.get(colors - 1);
     }
-
+    
     protected void revalidate() {
         // Handle the default logarithmic revalidation.
         super.revalidate();
-
+        
         // Redistribute the lists.
         scaleList.clear();
-
+        
         // We need at least colors to make a scale - otherwise, the
         // special cases handle the color.
         int colors = colorList.size();
-        if (colors < 2) {
-            return;
-        }
-
+        if (colors < 2) { return; }
+        
         // Otherwise, define the list variables.
         double sStep;
         double sMin;
         if (linear) {
             sStep = (max - min) / (colors - 1);
             sMin = min;
-        } else {
+        }
+        else {
             sStep = (lMax - lMin) / (colors - 1);
             sMin = lMin;
         }
         double sMax = sMin + sStep;
-
+        
         // Generate a list of scales.
         for (int i = 0; i < (colors - 1); i++) {
             // Make and add a scale.
@@ -125,30 +108,23 @@
             s.setColdColor(colorList.get(i));
             s.setHotColor(colorList.get(i + 1));
             scaleList.add(s);
-
+            
             // Update the min/max.
             sMin = sMax;
             sMax += sStep;
         }
     }
-
+    
     /**
-     * <b>makeRainboowScale</b><br/>
-     * <br/>
-     * <code>public static <b>makeRainbowScale</b>(double minimum, double maximum)</code>
-     * <br/>
-     * <br>
+     * <b>makeRainboowScale</b><br/><br/>
+     * <code>public static <b>makeRainbowScale</b>(double minimum, double maximum)</code><br/><br>
      * Creates a <code>MultiGradientScale</code> that maps values from purple,
      * to blue, to cyan, to green, to yellow, and to red at the hottest.
-     * 
-     * @param minimum
-     *            - The lowet mapped value.
-     * @param maximum
-     *            - The highest mapped value.
+     * @param minimum - The lowet mapped value.
+     * @param maximum - The highest mapped value.
      * @return Returns the rainbow color mapping scale.
      **/
-    public static MultiGradientScale makeRainbowScale(double minimum,
-            double maximum) {
+    public static MultiGradientScale makeRainbowScale(double minimum, double maximum) {
         int str = 165;
         Color purple = new Color(55, 0, 55);
         Color blue = new Color(0, 0, str);
@@ -156,7 +132,7 @@
         Color green = new Color(0, str, 0);
         Color yellow = new Color(str, str, 0);
         Color red = new Color(str, 0, 0);
-
+        
         MultiGradientScale mgs = new MultiGradientScale();
         mgs.addColor(purple);
         mgs.addColor(blue);
@@ -166,7 +142,7 @@
         mgs.addColor(red);
         mgs.setMinimum(minimum);
         mgs.setMaximum(maximum);
-
+        
         return mgs;
     }
 }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal
Viewer.java 140 -> 141
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/Viewer.java	2014-01-30 23:23:09 UTC (rev 140)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/ecal/Viewer.java	2014-01-30 23:38:45 UTC (rev 141)
@@ -32,10 +32,8 @@
     private boolean processing = false;
     
     /**
-     * <b>Viewer</b><br/>
-     * <br/>
-     * <code>public <b>Viewer</b>()</code><br/>
-     * <br/>
+     * <b>Viewer</b><br/><br/>
+     * <code>public <b>Viewer</b>()</code><br/><br/>
      * Initializes the viewer window and calorimeter panel.
      **/
     public Viewer() {
@@ -81,16 +79,11 @@
     }
     
     /**
-     * <b>setDataSouce</b><br/>
-     * <br/>
-     * <code>public void <b>setDataSource</b>(String filepath)</code><br/>
-     * <br/>
+     * <b>setDataSouce</b><br/><br/>
+     * <code>public void <b>setDataSource</b>(String filepath)</code><br/><br/>
      * Sets the viewer to read from the indicated data source.
-     * 
-     * @param filepath
-     *            - The full path to the desired data file.
-     * @throws IOException
-     *             Occurs when there is an error opening the data file.
+     * @param filepath - The full path to the desired data file.
+     * @throws IOException Occurs when there is an error opening the data file.
      **/
     public void setDataSource(String filepath) throws IOException {
         em = new EventManager(filepath);
@@ -134,23 +127,17 @@
     }
     
     /**
-     * <b>displayNextEvent</b><br/>
-     * <br/>
-     * <code>public void <b>displayNextEvent</b>()</code><br/>
-     * <br/>
+     * <b>displayNextEvent</b><br/><br/>
+     * <code>public void <b>displayNextEvent</b>()</code><br/><br/>
      * Feeds the calorimeter panel the data from the next event.
-     * 
-     * @throws IOException
-     *             Occurs when there is an issue with reading the data file.
+     * @throws IOException Occurs when there is an issue with reading the data file.
      **/
     public void displayNextEvent() throws IOException {
         // Clear the ecal panel.
         ecalPanel.clearCrystals();
         
         // If there is no data source, we can not do anything.
-        if (em == null) {
-            return;
-        }
+        if (em == null) { return; }
         
         // Otherwise, get the next event.
         em.readEvent();
@@ -172,10 +159,8 @@
     }
     
     /**
-     * <b>resize</b><br/>
-     * <br/>
-     * <code>private void <b>resize</b>()</code><br/>
-     * <br/>
+     * <b>resize</b><br/><br/>
+     * <code>private void <b>resize</b>()</code><br/><br/>
      * Handles proper resizing of the window and its components.
      **/
     private void resize() {
@@ -185,17 +170,13 @@
     }
     
     /**
-     * <b>getPanelX</b><br/>
-     * <br/>
-     * <code>private int <b>getPanelX</b>(int ecalX)</code><br/>
-     * <br/>
+     * <b>getPanelX</b><br/><br/>
+     * <code>private int <b>getPanelX</b>(int ecalX)</code><br/><br/>
      * Converts the lcsim x-coordinate to the calorimeter panel's coordinate
      * system.
-     * 
-     * @param ecalX
-     *            - An lcsim calorimeter x-coordinate.
+     * @param ecalX - An lcsim calorimeter x-coordinate.
      * @return Returns the x-coordinate in the calorimeter panel's coordinate
-     *         system as an <code>int</code>.
+     * system as an <code>int</code>.
      **/
     private int getPanelX(int ecalX) {
         if (ecalX <= 0) {
@@ -206,17 +187,13 @@
     }
     
     /**
-     * <b>getPanelY</b><br/>
-     * <br/>
-     * <code>private int <b>getPanelY</b>(int ecalY)</code><br/>
-     * <br/>
+     * <b>getPanelY</b><br/><br/>
+     * <code>private int <b>getPanelY</b>(int ecalY)</code><br/><br/>
      * Converts the lcsim y-coordinate to the calorimeter panel's coordinate
      * system.
-     * 
-     * @param ecalY
-     *            - An lcsim calorimeter y-coordinate.
+     * @param ecalY - An lcsim calorimeter y-coordinate.
      * @return Returns the y-coordinate in the calorimeter panel's coordinate
-     *         system as an <code>int</code>.
+     * system as an <code>int</code>.
      **/
     private int getPanelY(int ecalY) {
         return 5 - ecalY;
@@ -251,17 +228,12 @@
      * at the correct size and location when the window is resized.
      **/
     private class ResizeListener implements ComponentListener {
-        public void componentResized(ComponentEvent e) {
-            resize();
-        }
+        public void componentResized(ComponentEvent e) { resize(); }
         
-        public void componentHidden(ComponentEvent e) {
-        }
+        public void componentHidden(ComponentEvent e) { }
         
-        public void componentMoved(ComponentEvent e) {
-        }
+        public void componentMoved(ComponentEvent e) { }
         
-        public void componentShown(ComponentEvent e) {
-        }
+        public void componentShown(ComponentEvent e) { }
     }
 }
SVNspam 0.1