lcsim/src/org/lcsim/plugin/browser
diff -u -r1.1 -r1.2
--- ClusterTableModel.java 14 Mar 2005 16:11:33 -0000 1.1
+++ ClusterTableModel.java 25 Aug 2005 23:09:21 -0000 1.2
@@ -9,7 +9,7 @@
*/
class ClusterTableModel extends GenericTableModel
{
- private static final String[] columns = {"Type","Energy","Position","ITheta","IPhi"};
+ private static final String[] columns = {"Type","Energy","Position","ITheta","IPhi","Size"};
private static Class klass = Cluster.class;
ClusterTableModel()
lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.6 -r1.7
--- BasicCluster.java 5 Aug 2005 18:17:01 -0000 1.6
+++ BasicCluster.java 25 Aug 2005 23:09:21 -0000 1.7
@@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.Cluster;
import org.lcsim.geometry.compact.Subdetector;
@@ -282,4 +284,15 @@
needsPropertyCalculation = false;
}
+ /** Return the hits comprising the cluster, including hits in
+ * subclusters, as per interface. Hits belonging to more than one
+ * cluster/subcluster should be counted only once.
+ */
+ public int getSize() {
+ Set<CalorimeterHit> hitSet = new HashSet<CalorimeterHit>(this.hits);
+ for( Cluster clus : clusters ) {
+ hitSet.addAll( clus.getCalorimeterHits() );
+ }
+ return hitSet.size();
+ }
}