Commit in hps-java/src/main/java/org/lcsim/hps/recon/ecal on MAIN
HPSEcal1BitClusterer.java+43-361.1 -> 1.2
Fixed bad logic in 1-bit clusterer

hps-java/src/main/java/org/lcsim/hps/recon/ecal
HPSEcal1BitClusterer.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- HPSEcal1BitClusterer.java	18 Aug 2011 22:20:24 -0000	1.1
+++ HPSEcal1BitClusterer.java	18 Aug 2011 22:41:30 -0000	1.2
@@ -167,9 +167,13 @@
             int side1 = dec.getValue("side");
             Integer hitCount = hitCounts.get(possibleCluster);
 
+            boolean isCluster = true;
             for (Long neighborId : neighbors) {
                 // Set the ID.
                 dec.setID(neighborId);
+                Integer neighborHitCount = hitCounts.get(neighborId);
+                if (neighborHitCount == null)
+                    continue;
                 // Get ID field values.
                 int x2 = dec.getValue("ix");
                 int y2 = dec.getValue("iy");
@@ -179,49 +183,49 @@
                         if (x1 == 1) {
                             //special case: left edge of quadrant
                             if (x1 > x2 && y1 < y2) {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount > neighborHitCount)
                                     continue;
                             } else if (x1 > x2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else if (x1 < x2) {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             } else if (y1 < y2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             }
                         } else {
                             if (x1 > x2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else if (x1 < x2) {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             } else if (y1 < y2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             }
                         }
                     } else {
                         //quadrant 2
                         if (y1 > y2) {
-                            if (hitCounts.get(neighborId) > hitCount)
+                            if (hitCount>=neighborHitCount)
                                 continue;
                         } else if (y1 < y2) {
-                            if (hitCounts.get(neighborId) >= hitCount)
+                            if (hitCount>neighborHitCount)
                                 continue;
                         } else if (x1 > x2) {
-                            if (hitCounts.get(neighborId) > hitCount)
+                            if (hitCount>=neighborHitCount)
                                 continue;
                         } else {
-                            if (hitCounts.get(neighborId) >= hitCount)
+                            if (hitCount>neighborHitCount)
                                 continue;
                         }
                     }
@@ -231,68 +235,71 @@
                         if (x1 == 1) {
                             //special case: left edge of quadrant
                             if (x1 < x2 && y1 > y2) {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             } else if (x1 < x2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else if (x1 > x2) {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             } else if (y1 > y2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             }
                         } else {
                             if (x1 < x2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else if (x1 > x2) {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             } else if (y1 > y2) {
-                                if (hitCounts.get(neighborId) > hitCount)
+                                if (hitCount>=neighborHitCount)
                                     continue;
                             } else {
-                                if (hitCounts.get(neighborId) >= hitCount)
+                                if (hitCount>neighborHitCount)
                                     continue;
                             }
                         }
                     } else {
                         //quadrant 4
                         if (y1 < y2) {
-                            if (hitCounts.get(neighborId) > hitCount)
+                            if (hitCount>=neighborHitCount)
                                 continue;
                         } else if (y1 > y2) {
-                            if (hitCounts.get(neighborId) >= hitCount)
+                            if (hitCount>neighborHitCount)
                                 continue;
                         } else if (x1 < x2) {
-                            if (hitCounts.get(neighborId) > hitCount)
+                            if (hitCount>=neighborHitCount)
                                 continue;
                         } else {
-                            if (hitCounts.get(neighborId) >= hitCount)
+                            if (hitCount>neighborHitCount)
                                 continue;
                         }
                     }
                 }
+                isCluster = false;
+                break;
             }
 
-            BasicCluster cluster = new BasicCluster();
-            cluster.addHit(hitMap.get(possibleCluster));
-            for (Long neighborId : neighbors) {
-                // Find the neighbor hit in the event if it exists.
-                CalorimeterHit neighborHit = hitMap.get(neighborId);
+            if (isCluster) {
+                BasicCluster cluster = new BasicCluster();
+                cluster.addHit(hitMap.get(possibleCluster));
+                for (Long neighborId : neighbors) {
+                    // Find the neighbor hit in the event if it exists.
+                    CalorimeterHit neighborHit = hitMap.get(neighborId);
 
-                // Was this neighbor cell hit?
-                if (neighborHit != null) {
-                    cluster.addHit(neighborHit);
+                    // Was this neighbor cell hit?
+                    if (neighborHit != null) {
+                        cluster.addHit(neighborHit);
+                    }
                 }
+                clusters.add(cluster);
             }
-            clusters.add(cluster);
-
         }
 
         // Put Cluster collection into event.
CVSspam 0.2.8