Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/nn on MAIN
NearestNeighborCluster.java+21-41.3 -> 1.4
Added code for an energy threshold.

lcsim/src/org/lcsim/recon/cluster/nn
NearestNeighborCluster.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- NearestNeighborCluster.java	2 May 2005 22:11:31 -0000	1.3
+++ NearestNeighborCluster.java	23 Jun 2005 23:25:57 -0000	1.4
@@ -8,7 +8,7 @@
 
 /**
  * Represents a cluster composed of calorimeter hits contiguous within the specified domain.
- * @author Norman A. Graf
+ * @author Norman A. Graf with additions of threshold code by Eric J. Benavidez ([log in to unmask])
  * @version 1.0
  */
 public class NearestNeighborCluster extends HitsCluster
@@ -20,9 +20,11 @@
     * @param hitmap The list of hit calorimeter cells available for clustering.
     * @param hit The seed calorimeter hit for this cluster.
     * @param key The key for the seed calorimeter hit.
+    * @param threshold The energy threshold that must be met or exceeded in order
+    *   to be considered in the cluster.
     */
    
-   public NearestNeighborCluster(CalorimeterIDDecoder decoder, Map<Long, CalorimeterHit> hitmap, CalorimeterHit hit, Long key, int dU, int dV, int dLayer)
+   public NearestNeighborCluster(CalorimeterIDDecoder decoder, Map<Long, CalorimeterHit> hitmap, CalorimeterHit hit, Long key, int dU, int dV, int dLayer, double threshold)
    {
       // start by adding this hit to the cluster
       addHit(hit);
@@ -45,15 +47,30 @@
          {
             CalorimeterHit h = hitmap.get(neighbors[j]);
             // is the neighboring cell id hit?
+            // if so, does it meet or exceed threshold?
             if (h != null)
             {
-               addHit(h);
-               hitmap.remove(neighbors[j]);
+                if (h.getEnergy() >= threshold)
+                    addHit(h);
+                hitmap.remove(neighbors[j]);
             }
          }
       }
       //        calculateDerivedQuantities();
    }
+
+   /**
+    * Construct a NearestNeighborCluster. Note that the constructor actually performs the
+    * clustering, given a seed hit, without considering an energy threshold.
+    * @param decoder The CellID decoder appropriate for this collection of hits.
+    * @param hitmap The list of hit calorimeter cells available for clustering.
+    * @param hit The seed calorimeter hit for this cluster.
+    * @param key The key for the seed calorimeter hit.
+    */
+   public NearestNeighborCluster(CalorimeterIDDecoder decoder, Map<Long, CalorimeterHit> hitmap, CalorimeterHit hit, Long key, int dU, int dV, int dLayer)
+   {
+       this(decoder, hitmap, hit, key, dU, dV, dLayer, 0.0);
+   }
    
    /**
     * String representation of this object.
CVSspam 0.2.8