lcsim/src/org/lcsim/recon/cluster/cheat
diff -u -r1.5 -r1.6
--- CheatClusterDriver.java 21 Feb 2006 20:32:52 -0000 1.5
+++ CheatClusterDriver.java 5 Mar 2007 18:20:00 -0000 1.6
@@ -17,36 +17,63 @@
public class CheatClusterDriver extends Driver
{
private final CheatClusterer _clusterer;
-
+ private boolean dfault = true;
+ String outputName;
+ String[] inputName;
+
public CheatClusterDriver()
{
_clusterer = new CheatClusterer();
+ outputName = "RefinedCheatClusters";
}
-
+ public CheatClusterDriver(String[] in,String out)
+ {
+ _clusterer = new CheatClusterer();
+ dfault = false;
+ inputName = in;
+ outputName = out;
+ }
+
protected void process(EventHeader event)
{
// First look for clusters in individual collections
-
- List<List<SimCalorimeterHit>> collections = event.get(SimCalorimeterHit.class);
+ List<List<SimCalorimeterHit>> collections = null;
+ if(dfault)
+ {
+ collections = event.get(SimCalorimeterHit.class);
+ }
+ else
+ {
+ collections = new ArrayList<List<SimCalorimeterHit>>();
+ for(int i=0;i<inputName.length;i++)
+ {
+ collections.add(event.get(SimCalorimeterHit.class,inputName[i]));
+ }
+ }
+ List<List<CheatCluster>> clusters = new ArrayList<List<CheatCluster>>();
for (List<SimCalorimeterHit> collection : collections)
{
Map<MCParticle,CheatCluster> result = _clusterer.findClusters(collection);
String name = event.getMetaData(collection).getName();
- int flag = (1<<LCIOConstants.CLBIT_HITS);
- if (result.size() > 0) event.put(name+"CheatClusters", new ArrayList(result.values()), CheatCluster.class, flag);
+ int flag = (1<<LCIOConstants.CLBIT_HITS);
+ if (result.size() > 0)
+ {
+ List<CheatCluster> ccl = new ArrayList(result.values());
+ event.put(name+"CheatClusters", ccl, CheatCluster.class, flag);
+ clusters.add(ccl);
+ }
}
-
+
// Then look for refined clusters combining hits from all collections
-
- List<List<CheatCluster>> clusters = event.get(CheatCluster.class);
+
Map<MCParticle, CheatCluster> refined = _clusterer.findRefinedClusters(clusters);
- if (refined.size() > 0)
+ if (refined.size() > 0)
{
- int flag = 1<<LCIOConstants.CLBIT_HITS;
- event.put("RefinedCheatClusters", new ArrayList(refined.values()), CheatCluster.class, flag );
- }
+ int flag = 1<<LCIOConstants.CLBIT_HITS;
+ event.put(outputName, new ArrayList(refined.values()), CheatCluster.class, flag );
+ }
}
-
+
public String toString()
{
return "CheatClusterDriver";