lcsim/src/org/lcsim/recon/cluster/fixedcone
diff -u -r1.7 -r1.8
--- FixedConeClusterer.java 2 Aug 2005 17:18:03 -0000 1.7
+++ FixedConeClusterer.java 18 Oct 2005 18:52:44 -0000 1.8
@@ -273,6 +273,7 @@
List<CalorimeterHit> cells1 = c1.getCalorimeterHits();
List<CalorimeterHit> cells2 = c2.getCalorimeterHits();
int size2 = cells2.size();
+ List<CalorimeterHit> swap = new ArrayList<CalorimeterHit>();
// loop over cells in first cluster...
for(int i=0; i<cells1.size(); ++i)
@@ -296,12 +297,15 @@
if (R2<R1)
{
- // remove this cell from cluster1
- c1.removeHit(p2);
- // add it to cluster2
- c2.addHit(p2);
+ swap.add(p2);
}
}
+ for(CalorimeterHit h:swap)
+ {
+ c1.removeHit(h);
+ c2.addHit(h);
+ }
+ swap = new ArrayList<CalorimeterHit>();
// repeat for cluster 2
// only loop over cells in original cluster
for(int i=0; i<size2; ++i)
@@ -325,12 +329,14 @@
if (R1<R2)
{
- // remove this cell from cluster2
- c2.removeHit(p2);
- // add it to cluster1
- c1.addHit(p2);
+ swap.add(p2);
}
}
+ for(CalorimeterHit h:swap)
+ {
+ c2.removeHit(h);
+ c1.addHit(h);
+ }
c1.calculateProperties();
c2.calculateProperties();