Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/structural on MAIN
DropFragments.java+44added 1.1
Initial commit of an alternate fragment-handler: discard all fragments

lcsim/src/org/lcsim/recon/cluster/structural
DropFragments.java added at 1.1
diff -N DropFragments.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DropFragments.java	2 Nov 2006 22:57:28 -0000	1.1
@@ -0,0 +1,44 @@
+package org.lcsim.recon.cluster.structural;
+
+import java.util.*;
+import hep.physics.vec.*;
+import org.lcsim.event.*;
+import org.lcsim.recon.cluster.util.BasicCluster;
+
+/**
+ * An implementation of <code>FragmentMerger</code>.
+ * We simply discard every fragment.
+ *
+ * @version $Id: DropFragments.java,v 1.1 2006/11/02 22:57:28 mcharles Exp $
+ */
+
+public class DropFragments implements FragmentMerger
+{
+    /**
+     * Constructor.
+     */
+    public DropFragments() {}
+
+    /**
+     * Drop the fragments and write out the nonFragments. The input lists
+     * are left unaltered.
+     *
+     * @return The list of merged Clusters
+     */
+    public List<Cluster> mergeFragments(List<Cluster> fragments, List<Cluster> nonFragments)
+    {
+	// Our output will be a new set of clusters that contain the old ones.
+	// So we'll need wrapped output:
+	Map<Cluster,BasicCluster> mapToWrappedClusters = new HashMap<Cluster,BasicCluster> ();
+	for (Cluster nonfrag : nonFragments) {
+	    BasicCluster newCluster = new BasicCluster();
+	    newCluster.addCluster(nonfrag);
+	    mapToWrappedClusters.put(nonfrag,newCluster);
+	}
+
+	// Return output, which is the wrapped non-fragments.
+	List<Cluster> output = new Vector<Cluster>();
+	output.addAll(mapToWrappedClusters.values());
+	return output;
+    }
+}
CVSspam 0.2.8