Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/recon/ecal on MAIN
HPSEcalClusterer.java+24-391.7 -> 1.8
cleanup

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcalClusterer.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- HPSEcalClusterer.java	18 Jul 2011 21:02:46 -0000	1.7
+++ HPSEcalClusterer.java	20 Jul 2011 17:51:52 -0000	1.8
@@ -6,8 +6,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.lcsim.detector.identifier.IIdentifierHelper;
-import org.lcsim.detector.identifier.Identifier;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;
@@ -28,7 +26,7 @@
  * @author Jeremy McCormick <[log in to unmask]>
  * @author Tim Nelson <[log in to unmask]>
  * 
- * @version $Id: HPSEcalClusterer.java,v 1.7 2011/07/18 21:02:46 jeremy Exp $
+ * @version $Id: HPSEcalClusterer.java,v 1.8 2011/07/20 17:51:52 jeremy Exp $
  */
 public class HPSEcalClusterer extends Driver 
 {
@@ -85,27 +83,23 @@
         
         if (ecalName == null)
             throw new RuntimeException("The parameter ecalName was not set!");
-        
-        //System.out.println(this.getClass().getCanonicalName());
-        //System.out.println(" seedEMin="+seedEMin);
-        //System.out.println(" addEMin="+addEMin);    
-        //System.out.println();
     }   
     
     public void detectorChanged(Detector detector)
-    {
-        //System.out.println(this.getClass().getCanonicalName() + " - detectorChanged");
-        
+    {        
+        // Get the Subdetector.
         ecal = (HPSEcal2)detector.getSubdetector(ecalName);
         
+        // Cache ref to neighbor map.
         neighborMap = ecal.makeNeighborMap();
-                        
-        //System.out.println(ecal.getName());
-        //System.out.println(" nx="+ecal.nx());
-        //System.out.println(" ny="+ecal.ny());
-        //System.out.println(" beamgap="+ecal.beamGap());
-        //System.out.println(" dface="+ecal.distanceToFace());
-        //System.out.println("done with neighbors map");
+        
+        System.out.println(ecal.getName());
+        System.out.println("  nx="+ecal.nx());
+        System.out.println("  ny="+ecal.ny());
+        System.out.println("  beamgap="+ecal.beamGap());
+        System.out.println("  dface="+ecal.distanceToFace());
+                
+        System.out.println(neighborMap.toString());
     }    
     
     public void process(EventHeader event)
@@ -116,10 +110,7 @@
         List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName);
         if (hits == null)
             throw new RuntimeException("Event is missing ECal hits collection!");
-        
-        HPSEcal2 ecal = (HPSEcal2)event.getMetaData(hits).getIDDecoder().getSubdetector();
-        IIdentifierHelper idhelp = ecal.getDetectorElement().getIdentifierHelper();
-            
+                    
         // Get the decoder for the ECal IDs.
         IDDecoder dec = ecal.getIDDecoder();
                
@@ -127,15 +118,10 @@
         Map<Long,CalorimeterHit> hitMap = new HashMap<Long,CalorimeterHit>();
         
         // Make a hit map for quick lookup by ID.
-
-        //System.out.println("HPSEcal hits ...");
-        //for (CalorimeterHit hit : hits)
-        //{
-            // TODO: add unpack(long) method to helper
-        //    System.out.println(idhelp.unpack(new Identifier(hit.getCellID())));
-        //    dec.setID(hit.getCellID());
-        //    hitMap.put(hit.getCellID(), hit);
-        //}
+        for (CalorimeterHit hit : hits)
+        {
+            hitMap.put(hit.getCellID(), hit);
+        }
         
         // New Cluster list to be added to event.
         List<Cluster> clusters = new ArrayList<Cluster>();
@@ -146,9 +132,7 @@
             // Cut on min seed E.
             if (hit.getRawEnergy() < seedEMin)
                 continue;
-            
-            //System.out.println("looking up neighbors for: " + idhelp.unpack(hit.getIdentifier()));
-            
+             
             // Get neighbor crystal IDs.
             Set<Long> neighbors = neighborMap.get(hit.getCellID());
             
@@ -162,15 +146,16 @@
             boolean isSeed = true;
             for (Long neighborId : neighbors)
             {                               
-                // Find neighbor hit if it exists.
+                // Find the neighbor hit in the event if it exists.
                 CalorimeterHit neighborHit = hitMap.get(neighborId);
                 
-                // Was this cell hit?
+                // Was this neighbor cell hit?
                 if (neighborHit != null)
                 {                                             
-                    // Neighbor cell has more energy so this hit is not a seed.
+                    // Check if neighbor cell has more energy.
                     if (neighborHit.getRawEnergy() > hit.getRawEnergy())
                     {
+                        // Neighbor has more energy, so cell is not a seed.
                         isSeed = false;
                         break;
                     } 
@@ -186,7 +171,7 @@
             // Did we find a seed?
             if (isSeed)
             {
-                // Make cluster from hit list.
+                // Make a cluster from the hit list.
                 BasicCluster cluster = new BasicCluster();
                 cluster.addHit(hit);
                 for (CalorimeterHit clusHit : neighborHits)
@@ -201,4 +186,4 @@
         int flag = 1 << LCIOConstants.CLBIT_HITS;
         event.put(clusterCollectionName, clusters, Cluster.class, flag);        
     }         
-}
+}
\ No newline at end of file
CVSspam 0.2.8