Print

Print


Commit in lcsim/src/org/lcsim/recon/cluster/util on MAIN
ClusterFirstLayerDecision.java+38added 1.1
ClusterLayerSeparationDecision.java+53added 1.1
+91
2 added files
Two support classes for cluster decision-making

lcsim/src/org/lcsim/recon/cluster/util
ClusterFirstLayerDecision.java added at 1.1
diff -N ClusterFirstLayerDecision.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ClusterFirstLayerDecision.java	11 Aug 2006 23:29:55 -0000	1.1
@@ -0,0 +1,38 @@
+package org.lcsim.recon.cluster.util;
+
+import org.lcsim.event.Cluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.util.decision.*;
+
+/**
+ * Accept clusters if their innermost hit is in the first n layers.
+ * 
+ * @version $Id: ClusterFirstLayerDecision.java,v 1.1 2006/08/11 23:29:55 mcharles Exp $
+ */
+
+public class ClusterFirstLayerDecision implements DecisionMakerSingle<Cluster> 
+{
+    int m_layerCut;
+
+    /**
+     * Simple constructor
+     */
+    public ClusterFirstLayerDecision(int layerCut) {
+	m_layerCut = layerCut;
+    }
+
+    public boolean valid(Cluster clus) {
+	int firstLayer = -1;
+	CalorimeterHit innermostHit = null;
+	for (CalorimeterHit hit : clus.getCalorimeterHits()) {
+	    org.lcsim.geometry.IDDecoder id = hit.getIDDecoder();
+	    id.setID(hit.getCellID());
+	    int layer = id.getLayer();
+	    if (innermostHit == null || layer < firstLayer ) {
+		firstLayer = layer;
+		innermostHit = hit;
+	    }
+	}
+	return (firstLayer <= m_layerCut);
+    }
+}

lcsim/src/org/lcsim/recon/cluster/util
ClusterLayerSeparationDecision.java added at 1.1
diff -N ClusterLayerSeparationDecision.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ClusterLayerSeparationDecision.java	11 Aug 2006 23:29:55 -0000	1.1
@@ -0,0 +1,53 @@
+package org.lcsim.recon.cluster.util;
+
+import java.util.*;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.util.decision.*;
+
+/**
+ * Accept clusters if some of their hits are within n layers
+ * of each other. This assumes that the clusters come from
+ * the same subdetector.
+ * 
+ * @version $Id: ClusterLayerSeparationDecision.java,v 1.1 2006/08/11 23:29:55 mcharles Exp $
+ */
+
+public class ClusterLayerSeparationDecision implements DecisionMakerPair<Cluster,Cluster> 
+{
+    /** Simple constructor. */
+    public ClusterLayerSeparationDecision() {}
+
+    /** Convenience constructor. */
+    public ClusterLayerSeparationDecision(int cut) { m_cut = cut; }
+
+    /** Set cut. */
+    public void setCut(int cut) { m_cut = cut; }
+
+    public boolean valid(Cluster clus1, Cluster clus2) {
+	List<CalorimeterHit> hits1 = clus1.getCalorimeterHits();
+	List<CalorimeterHit> hits2 = clus2.getCalorimeterHits();
+	Set<Integer> layers1 = new HashSet<Integer>();
+	Set<Integer> layers2 = new HashSet<Integer>();
+	for (CalorimeterHit hit : hits1) {
+	    org.lcsim.geometry.IDDecoder id = hit.getIDDecoder();
+	    id.setID(hit.getCellID());
+	    layers1.add(id.getLayer());
+	}
+	for (CalorimeterHit hit : hits2) {
+	    org.lcsim.geometry.IDDecoder id = hit.getIDDecoder();
+	    id.setID(hit.getCellID());
+	    layers2.add(id.getLayer());
+	}
+	for (Integer i : layers1) {
+	    for (Integer j : layers2) {
+		if (Math.abs(i.intValue()-j.intValue()) < m_cut) {
+		    return true;
+		}
+	    }
+	}
+	return false;
+    }
+   
+    protected int m_cut;
+}
CVSspam 0.2.8