LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  November 2014

HPS-SVN November 2014

Subject:

r1461 - in /java/trunk/ecal-event-display/src/main/java/org/hps/monitoring/ecal/eventdisplay/ui: PEventViewer.java POccupancyViewer.java PassiveViewer.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Sun, 9 Nov 2014 13:14:50 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (209 lines)

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>

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use