Author: [log in to unmask]
Date: Tue Dec 16 10:50:25 2014
New Revision: 1757
Log:
Updated the PassiveViewer to automatically detect whether an HPSEcalCluster is one of Holly's advanced clusters or not, and if so, include shared hits.
Modified:
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/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 Tue Dec 16 10:50:25 2014
@@ -3,6 +3,7 @@
import org.hps.monitoring.ecal.eventdisplay.event.Cluster;
import org.hps.monitoring.ecal.eventdisplay.event.EcalHit;
import org.hps.recon.ecal.HPSEcalCluster;
+import org.hps.recon.ecal.HPSEcalClusterIC;
import org.lcsim.event.CalorimeterHit;
/**
@@ -87,14 +88,44 @@
// 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);
+ // If this is an IC cluster, cast it so that shared hits can
+ // be properly displayed.
+ if(lcioCluster instanceof HPSEcalClusterIC) {
+ // Cast the cluster object.
+ HPSEcalClusterIC icCluster = (HPSEcalClusterIC) lcioCluster;
+
+ // Add any component hits to the cluster.
+ for(CalorimeterHit lcioHit : icCluster.getUniqueHits()) {
+ // 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);
+ }
+
+ // Add any shared hits to the cluster.
+ for(CalorimeterHit lcioHit : icCluster.getSharedHits()) {
+ // Get the position of the calorimeter hit.
+ int hix = lcioHit.getIdentifierFieldValue("ix");
+ int hiy = lcioHit.getIdentifierFieldValue("iy");
+
+ // Add the hit to the cluster.
+ panelCluster.addSharedHit(hix, hiy);
+ }
+ }
+
+ // Otherwise, it just has component hits.
+ else {
+ // 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.
|