lcsim/src/org/lcsim/recon/cluster/cheat
diff -u -r1.5 -r1.6
--- CheatCluster.java 21 Jun 2006 17:10:38 -0000 1.5
+++ CheatCluster.java 1 Jul 2006 21:52:21 -0000 1.6
@@ -20,4 +20,4 @@
{
return particle;
}
-}
+}
\ No newline at end of file
lcsim/src/org/lcsim/recon/cluster/cheat
diff -u -r1.3 -r1.4
--- CheatClusterer.java 21 Feb 2006 20:32:52 -0000 1.3
+++ CheatClusterer.java 1 Jul 2006 21:52:22 -0000 1.4
@@ -2,9 +2,13 @@
import java.util.HashMap;
import java.util.List;
+import java.util.ArrayList;
import java.util.Map;
import org.lcsim.event.MCParticle;
import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.recon.cluster.util.Clusterer;
/**
* The Cluster cheater works by finding perfectly reconstructed clusters
@@ -16,28 +20,46 @@
* no attempt to merge clusters that would in fact be impossible to resolve.
*/
-public class CheatClusterer
+public class CheatClusterer implements Clusterer
{
+ public List<Cluster> createClusters(List<CalorimeterHit> hits)
+ {
+ List<SimCalorimeterHit> slist = new ArrayList<SimCalorimeterHit>();
+ for(CalorimeterHit h:hits)
+ {
+ if(h instanceof SimCalorimeterHit)
+ {
+ SimCalorimeterHit hit = (SimCalorimeterHit) h;
+ slist.add(hit);
+ }
+ }
+ return new ArrayList(this.findClusters(slist).values());
+ }
+ public List<Cluster> createClusters(Map<Long,CalorimeterHit> map)
+ {
+ return this.createClusters(new ArrayList(map.values()));
+ }
public Map<MCParticle, CheatCluster> findClusters(List<SimCalorimeterHit> hits)
{
Map<MCParticle,CheatCluster> result = new HashMap<MCParticle,CheatCluster>();
for (SimCalorimeterHit hit : hits)
{
- double eMax = hit.getContributedEnergy(0);
- MCParticle pMax = hit.getMCParticle(0);
- for (int i=1; i<hit.getMCParticleCount(); 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));
- cc.addHit(hit);
+ double eMax = hit.getContributedEnergy(0);
+ MCParticle pMax = hit.getMCParticle(0);
+ for (int i=1; i<hit.getMCParticleCount(); 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));
+ cc.addHit(hit);
}
return result;
}