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  February 2015

HPS-SVN February 2015

Subject:

r2054 - in /java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster: GTPOnlineClusterDriver.java GTPOnlineClusterer.java

From:

[log in to unmask]

Reply-To:

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

Date:

Fri, 6 Feb 2015 02:40:44 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (177 lines)

Author: [log in to unmask]
Date: Thu Feb  5 18:40:39 2015
New Revision: 2054

Log:
Minor updates and fixes to the GTPOnline driver.

Modified:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterDriver.java	Thu Feb  5 18:40:39 2015
@@ -7,7 +7,7 @@
  * @author Kyle McCarty <[log in to unmask]>
  */
 public class GTPOnlineClusterDriver extends ClusterDriver {
-    // Store the cluistering algorithm.
+    // Store the clustering algorithm.
     private final GTPOnlineClusterer gtp;
     
     /**
@@ -26,7 +26,7 @@
      * GeV.
      */
     public void setSeedEnergyThreshold(double seedEnergyThreshold) {
-        gtp.getCuts().setValue("seedEnergyThreshold", seedEnergyThreshold);
+        getClusterer().getCuts().setValue("seedThreshold", seedEnergyThreshold);
         gtp.setSeedLowThreshold(seedEnergyThreshold);
     }
     

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/GTPOnlineClusterer.java	Thu Feb  5 18:40:39 2015
@@ -1,4 +1,7 @@
 package org.hps.recon.ecal.cluster;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -9,6 +12,7 @@
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.base.BaseCluster;
+import org.lcsim.util.aida.AIDA;
 
 /**
  * Class <code>GTPOnlineClusterer</code> is an implementation of the
@@ -51,10 +55,27 @@
     // Internal variables.
     private boolean verbose = false;
     
+    // Diagnostic plots.
+    private AIDA aida = AIDA.defaultInstance();
+    IHistogram1D hitEnergy = aida.histogram1D("GTP(O) Cluster Plots :: Hit Energy Distribution", 256, -1.0, 2.2);
+    IHistogram1D clusterSeedEnergy = aida.histogram1D("GTP(O) Cluster Plots :: Cluster Seed Energy Distribution", 176, 0.0, 2.2);
+    IHistogram1D clusterHitCount = aida.histogram1D("GTP(O) Cluster Plots :: Cluster Hit Count Distribution", 9, 1, 10);
+    IHistogram1D clusterTotalEnergy = aida.histogram1D("GTP(O) Cluster Plots :: Cluster Total Energy Distribution", 176, 0.0, 2.2);
+    IHistogram2D hitDistribution = aida.histogram2D("GTP(O) Cluster Plots :: Hit Distribution", 46, -23, 23, 11, -5.5, 5.5);
+    IHistogram2D clusterDistribution = aida.histogram2D("GTP(O) Cluster Plots :: Cluster Seed Distribution", 46, -23, 23, 11, -5.5, 5.5);
+    IHistogram1D energyDistribution = aida.histogram1D("GTP(O) Cluster Plots :: Percent Negative Energy Distribution", 100, 0.0, 1.0);
+    
+    /**
+     * Instantiates a new instance of a readout GTP clustering algorithm.
+     */
     GTPOnlineClusterer() {
         super(new String[] { "seedThreshold" }, new double[] { 0.050 });
     }
     
+    /**
+     * Gets any relevant cuts from the superclass and sets the local
+     * clusterer variables accordingly. 
+     */
     public void initialize() {
         seedThreshold = getCuts().getValue("seedThreshold");
     }
@@ -82,15 +103,28 @@
         }); 
         
         // VERBOSE :: Print the hit information.
-        if(verbose) { 
+        if(verbose) {
+        	Collections.sort(hitList, new Comparator<CalorimeterHit>() {
+				@Override
+				public int compare(CalorimeterHit firstHit, CalorimeterHit secondHit) {
+					int[] ix = { firstHit.getIdentifierFieldValue("ix"), secondHit.getIdentifierFieldValue("ix") };
+					if(ix[0] != ix[1]) { return Integer.compare(ix[0], ix[1]); }
+					else {
+						int iy[] = { firstHit.getIdentifierFieldValue("iy"), secondHit.getIdentifierFieldValue("iy") };
+						return Integer.compare(iy[0], iy[1]);
+					}
+				}
+        	});
+        	System.out.println("Event Hit Collection:");
             for(CalorimeterHit hit : hitList) {
                 int ix = hit.getIdentifierFieldValue("ix");
                 int iy = hit.getIdentifierFieldValue("iy");
                 double energy = hit.getCorrectedEnergy();
                 double time = hit.getTime();
                 
-                System.out.printf("\tHit --> %.3f GeV at (%3d, %3d) and at t = %.2f%n", energy, ix, iy, time);
+                System.out.printf("\tHit --> %6.3f GeV at (%3d, %3d) and at t = %.2f%n", energy, ix, iy, time);
             }
+            System.out.println();
         }
         
         // A seed hit is a hit that is the largest both within its
@@ -103,6 +137,10 @@
         // Iterate over each hit and see if it qualifies as a seed hit.
         seedLoop:
             for(CalorimeterHit seed : hitList) {
+            	// Put the hit energy into the hit energy distribution.
+            	hitEnergy.fill(seed.getCorrectedEnergy());
+            	hitDistribution.fill(seed.getIdentifierFieldValue("ix"), seed.getIdentifierFieldValue("iy"));
+            	
                 // Check whether the potential seed passes the seed
                 // energy cut.
                 if(seed.getCorrectedEnergy() < seedThreshold) {
@@ -145,15 +183,32 @@
                     }
                 }
                 
-                
                 // If this point is reached, then the seed was not
                 // invalidated by any of the other hits and is really
                 // a cluster center. Add the cluster to the list.
                 clusterList.add(protoCluster);
+                
+                // Populate the cluster distribution plots.
+                clusterSeedEnergy.fill(protoCluster.getCalorimeterHits().get(0).getCorrectedEnergy());
+                clusterTotalEnergy.fill(protoCluster.getEnergy());
+                clusterHitCount.fill(protoCluster.getCalorimeterHits().size());
+                clusterDistribution.fill(protoCluster.getCalorimeterHits().get(0).getIdentifierFieldValue("ix"),
+                		protoCluster.getCalorimeterHits().get(0).getIdentifierFieldValue("iy"));
+                
+                // Determine how much energy in the cluster is negative
+                // and how is positive.
+                double nenergy = 0.0;
+                double penergy = 0.0;
+                for(CalorimeterHit hit : protoCluster.getCalorimeterHits()) {
+                	if(hit.getCorrectedEnergy() > 0) { penergy += hit.getCorrectedEnergy(); }
+                	else { nenergy += hit.getCorrectedEnergy(); }
+                }
+                energyDistribution.fill(Math.abs(nenergy) / (penergy + Math.abs(nenergy)));
             }
         
         // VERBOSE :: Print out all the clusters in the event.
-        if(verbose) { 
+        if(verbose) {
+        	System.out.println("Event Cluster Collection:");
             for(Cluster cluster : clusterList) {
                 CalorimeterHit seedHit = cluster.getCalorimeterHits().get(0);
                 int ix = seedHit.getIdentifierFieldValue("ix");
@@ -161,7 +216,7 @@
                 double energy = cluster.getEnergy();
                 double time = seedHit.getTime();
                 
-                System.out.printf("\tCluster --> %.3f GeV at (%3d, %3d) and at t = %.2f%n", energy, ix, iy, time);
+                System.out.printf("\tCluster --> %6.3f GeV at (%3d, %3d) and at t = %.2f%n", energy, ix, iy, time);
                 
                 for(CalorimeterHit hit : cluster.getCalorimeterHits()) {
                     int hix = hit.getIdentifierFieldValue("ix");
@@ -171,6 +226,7 @@
                     System.out.printf("\t\tCompHit --> %.3f GeV at (%3d, %3d) and at t = %.2f%n", henergy, hix, hiy, htime);
                 }
             }
+        	System.out.println();
         }
         
         // VERBOSE :: Print a new line.

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