Author: mccaky
Date: Sun Nov 9 05:14:46 2014
New Revision: 1461
Log:
Updated passive event display Viewer objects to be able to take CalorimeterHit and HPSEcalCluster objects directly.
Modified:
java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java
java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/POccupancyViewer.java
java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PassiveViewer.java
Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java
=============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java (original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PEventViewer.java Sun Nov 9 05:14:46 2014
@@ -6,6 +6,8 @@
import org.hps.monitoring.ecal.eventdisplay.event.Association;
import org.hps.monitoring.ecal.eventdisplay.event.Cluster;
import org.hps.monitoring.ecal.eventdisplay.event.EcalHit;
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.event.CalorimeterHit;
/**
* Class <code>PEventViewer</code> represents a <code>PassiveViewer
@@ -21,10 +23,16 @@
protected ArrayList<EcalHit> hitList = new ArrayList<EcalHit>();
@Override
+ public void addHit(CalorimeterHit lcioHit) { hitList.add(toPanelHit(lcioHit)); }
+
+ @Override
public void addHit(EcalHit hit) { hitList.add(hit); }
@Override
public void addCluster(Cluster cluster) { clusterList.add(cluster); }
+
+ @Override
+ public void addCluster(HPSEcalCluster lcioCluster) { clusterList.add(toPanelCluster(lcioCluster)); }
/**
* Removes all of the hit data from the viewer.
Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/POccupancyViewer.java
=============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/POccupancyViewer.java (original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/POccupancyViewer.java Sun Nov 9 05:14:46 2014
@@ -6,6 +6,8 @@
import org.hps.monitoring.ecal.eventdisplay.event.Cluster;
import org.hps.monitoring.ecal.eventdisplay.event.EcalHit;
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.event.CalorimeterHit;
/**
* The class <code>POccupancyViewer</code> is an extension of the <code>
@@ -39,6 +41,16 @@
}
@Override
+ public void addHit(CalorimeterHit lcioHit) {
+ // Get the panel coordinates from the hit.
+ int ix = toPanelX(lcioHit.getIdentifierFieldValue("ix"));
+ int iy = toPanelX(lcioHit.getIdentifierFieldValue("iy"));
+
+ // Increment the hit count at the indicated location.
+ hits[ix][iy]++;
+ }
+
+ @Override
public void addHit(EcalHit hit) {
// Get the panel coordinates of the hit.
int ix = toPanelX(hit.getX());
@@ -52,7 +64,15 @@
* Adds a new cluster to the display.<br/><br/>
* <b>Note:</b> This operation is not supported for occupancies.
*/
+ @Override
public void addCluster(Cluster cluster) { }
+
+ /**
+ * Adds a new cluster to the display.<br/><br/>
+ * <b>Note:</b> This operation is not supported for occupancies.
+ */
+ @Override
+ public void addCluster(HPSEcalCluster cluster) { }
/**
* Removes a hit from the display.
@@ -117,4 +137,4 @@
// Update the status panel to account for the new event.
updateStatusPanel();
}
-}
+}
Modified: java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PassiveViewer.java
=============================================================================
--- java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PassiveViewer.java (original)
+++ java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui/PassiveViewer.java Sun Nov 9 05:14:46 2014
@@ -2,6 +2,8 @@
import org.hps.monitoring.ecal.eventdisplay.event.Cluster;
import org.hps.monitoring.ecal.eventdisplay.event.EcalHit;
+import org.hps.recon.ecal.HPSEcalCluster;
+import org.lcsim.event.CalorimeterHit;
/**
* Abstract class <code>PassiveViewer</code> represents a <code>Viewer
@@ -17,6 +19,12 @@
* Adds a new hit to the display.
* @param hit - The hit to be added.
*/
+ public abstract void addHit(CalorimeterHit lcioHit);
+
+ /**
+ * Adds a new hit to the display.
+ * @param hit - The hit to be added.
+ */
public abstract void addHit(EcalHit hit);
/**
@@ -24,6 +32,12 @@
* @param cluster - The cluster to be added.
*/
public abstract void addCluster(Cluster cluster);
+
+ /**
+ * Adds a new cluster to the display.
+ * @param cluster - The cluster to be added.
+ */
+ public abstract void addCluster(HPSEcalCluster cluster);
/**
* Clears any hits or clusters that have been added to the viewer.
@@ -38,7 +52,7 @@
* @param min - The lower bound.
* @param max - The upper bound.
*/
- public void setScale(double min, double max) { //A.C. I modified these to double since ecalPanel methods use double
+ public void setScale(double min, double max) {
ecalPanel.setScaleMinimum(min);
ecalPanel.setScaleMaximum(max);
}
@@ -48,14 +62,61 @@
* scale.
* @param max - The upper bound.
*/
- public void setScaleMaximum(double max) { ecalPanel.setScaleMaximum(max); } //A.C. I modified these to double since ecalPanel methods use double
+ public void setScaleMaximum(double max) { ecalPanel.setScaleMaximum(max); }
/**
* Sets the lower bound for the calorimeter display's color mapping
* scale.
* @param min - The lower bound.
*/
- public void setScaleMinimum(double min) { ecalPanel.setScaleMinimum(min); } //A.C. I modified these to double since ecalPanel methods use double
+ public void setScaleMinimum(double min) { ecalPanel.setScaleMinimum(min); }
+
+ /**
+ * Converts an <code>HPSEcalCluster</code> object to a panel <code>
+ * Cluster</code> object.
+ * @param lcioCluster - The <code>HPSEcalCluster</code> object.
+ * @return Returns the argument cluster as a <code>Cluster</code>
+ * object that can be used with the <code>Viewer</code>.
+ */
+ public static final Cluster toPanelCluster(HPSEcalCluster lcioCluster) {
+ // Get the cluster data from the LCIO cluster.
+ int ix = lcioCluster.getSeedHit().getIdentifierFieldValue("ix");
+ int iy = lcioCluster.getSeedHit().getIdentifierFieldValue("iy");
+ double energy = lcioCluster.getEnergy();
+
+ // Generate a new cluster.
+ Cluster panelCluster = new Cluster(ix, iy, energy);
+
+ // Add any component hits to the cluster.
+ for(CalorimeterHit lcioHit : lcioCluster.getCalorimeterHits()) {
+ // Get the position of the calorimeter hit.
+ int hix = lcioHit.getIdentifierFieldValue("ix");
+ int hiy = lcioHit.getIdentifierFieldValue("iy");
+
+ // Add the hit to the cluster.
+ panelCluster.addComponentHit(hix, hiy);
+ }
+
+ // Return the cluster.
+ return panelCluster;
+ }
+
+ /**
+ * Converts a <code>CalorimeterHit</code> object to a panel <code>
+ * EcalHit</code> object.
+ * @param lcioHit - The <code>CalorimeterHit</code> object.
+ * @return Returns the argument hit as an <code>EcalHit</code>
+ * object that can be used with the <code>Viewer</code>.
+ */
+ public static final EcalHit toPanelHit(CalorimeterHit lcioHit) {
+ // Get the hit information from the LCIO hit/
+ int ix = lcioHit.getIdentifierFieldValue("ix");
+ int iy = lcioHit.getIdentifierFieldValue("iy");
+ double energy = lcioHit.getCorrectedEnergy();
+
+ // Create the panel hit.
+ return new EcalHit(ix, iy, energy);
+ }
/**
* Displays the hits and clusters added by the <code>addHit</code>
|