Commit in lcsim/src/org/lcsim/recon/cluster/cheat on MAIN
CheatClusterer.java+8-31.1 -> 1.2
GL: Fix bug in associating hits to MCParticle clusters

lcsim/src/org/lcsim/recon/cluster/cheat
CheatClusterer.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CheatClusterer.java	18 Jul 2005 03:11:09 -0000	1.1
+++ CheatClusterer.java	7 Dec 2005 17:12:25 -0000	1.2
@@ -22,7 +22,7 @@
 
 public class CheatClusterer
 {
-    
+
     public Map<MCParticle, CheatCluster> findClusters(List<SimCalorimeterHit> hits)
     {
         Map<MCParticle,CheatCluster> result = new HashMap<MCParticle,CheatCluster>();
@@ -32,7 +32,12 @@
             MCParticle pMax = hit.getMCParticle(0);
             for (int i=1; i<hit.getMCParticleCount(); i++)
             {
-                if (hit.getContributedEnergy(i) > eMax) pMax = hit.getMCParticle(i);
+		double eThis = hit.getContributedEnergy(i);
+                if (eThis > eMax) {
+		    // a bug fix... eMax was not being reset here. GL050927
+		    eMax = eThis;
+		    pMax = hit.getMCParticle(i);
+		}
             }
             CheatCluster cc = result.get(pMax);
             if (cc == null) result.put(pMax,cc = new CheatCluster(pMax));
@@ -55,5 +60,5 @@
         }
         return result;
     }
-    
+
 }
CVSspam 0.2.8