Author: mccaky Date: Wed Nov 5 04:08:38 2014 New Revision: 1435 Log: Fixed event display to keep filtered highlighting when events change. Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/LCIOManager.java java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/CalorimeterPanel.java java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/LCIOManager.java ============================================================================= --- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/LCIOManager.java (original) +++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/io/LCIOManager.java Wed Nov 5 04:08:38 2014 @@ -47,10 +47,18 @@ nextEvent(); } + /** + * Sets the name of the LCIO collection for cluster objects. + * @param clusterCollectionName - The cluster collection name. + */ public void setClusterCollectionName(String clusterCollectionName) { this.clusterCollectionName = clusterCollectionName; } + /** + * Sets the name of the LCIO collection for hit objects. + * @param hitCollectionName + */ public void setHitCollectionName(String hitCollectionName) { this.hitCollectionName = hitCollectionName; } @@ -69,6 +77,8 @@ else { return -1; } } + // TODO: LCIO files can't actually store an HPSEcalCluster; this + // needs to be converted to use regular LCIO clusters instead. @Override public List<Cluster> getClusters() { // If the current event is undefined, return an empty list. @@ -181,6 +191,8 @@ } } + // TODO: LCIO files can't actually store an HPSEcalCluster; this + // needs to be converted to use regular LCIO clusters instead. public static final Cluster toPanelCluster(HPSEcalCluster lcioCluster) { // If the argument is null, return null. if(lcioCluster == null) { return null; } @@ -199,6 +211,8 @@ if(lcioHit == null) { return null; } // Otherwise, get the cluster x/y indices and energy. + // TODO: This fails to acquire an IDDecoder; needs to be fixed + // before it can be pushed into production. int ix = lcioHit.getIdentifierFieldValue("ix"); int iy = lcioHit.getIdentifierFieldValue("iy"); double energy = lcioHit.getCorrectedEnergy(); Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/CalorimeterPanel.java ============================================================================= --- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/CalorimeterPanel.java (original) +++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/CalorimeterPanel.java Wed Nov 5 04:08:38 2014 @@ -31,7 +31,7 @@ */ public final class CalorimeterPanel extends JPanel { // Java-suggested variable. - private static final long serialVersionUID = 2L; + private static final long serialVersionUID = 3L; // The color used for rendering seed hits. private Color clusterColor = Color.GREEN; // The default color of the calorimeter crystals. @@ -209,10 +209,28 @@ * clears all highlighting. This <b>does not</b> enable disabled * crystals. */ + public void clearAll() { + for (int ix = 0; ix < xBoxes; ix++) { + for (int iy = 0; iy < yBoxes; iy++) { + crystal[ix][iy].setState(0.0, false, null); + crystal[ix][iy].clearAssociations(); + extremum[0] = Double.MAX_VALUE; + extremum[1] = 0.0; + } + } + } + + /** + * Sets all crystal energies to zero, removes all clusters, and + * clears all highlighting associated with an individual crystal. + * This <b>does not</b> enable disabled crystals or remove general + * highlighting. + */ public void clearCrystals() { for (int ix = 0; ix < xBoxes; ix++) { for (int iy = 0; iy < yBoxes; iy++) { - crystal[ix][iy].setState(0.0, false, null); + crystal[ix][iy].setEnergy(0.0); + crystal[ix][iy].setClusterCenter(false); crystal[ix][iy].clearAssociations(); extremum[0] = Double.MAX_VALUE; extremum[1] = 0.0; Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java ============================================================================= --- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java (original) +++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/DataFileViewer.java Wed Nov 5 04:08:38 2014 @@ -97,6 +97,9 @@ filterPanel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { + // Suppress panel redrawing until the highlights are set. + ecalPanel.setSuppressRedraw(true); + // Clear the panel highlighting. ecalPanel.clearHighlight(); @@ -111,6 +114,10 @@ ecalPanel.setCrystalHighlight(toPanelPoint(crystal), java.awt.Color.WHITE); } } + + // Redraw the highlights. + ecalPanel.setSuppressRedraw(false); + ecalPanel.repaint(); } }); Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java ============================================================================= --- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java (original) +++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/FileViewer.java Wed Nov 5 04:08:38 2014 @@ -32,7 +32,7 @@ * @author Kyle McCarty */ public class FileViewer extends Viewer { - private static final long serialVersionUID = 17058336873349781L; + private static final long serialVersionUID = 3L; // Gets events from some file. protected EventManager em = null;