Commit in lcsim/src/org/lcsim/recon/cluster/util on MAIN
HitInECALDecision.java+30added 1.1
Decision-maker requiring a hit to be in the ECAL

lcsim/src/org/lcsim/recon/cluster/util
HitInECALDecision.java added at 1.1
diff -N HitInECALDecision.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HitInECALDecision.java	3 Nov 2006 21:56:07 -0000	1.1
@@ -0,0 +1,30 @@
+package org.lcsim.recon.cluster.util;
+
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.util.decision.DecisionMakerSingle;
+
+/**
+ * Require hit to be in the ECAL.
+ * Implementation is not beautiful, but at least this way it
+ * only needs fixing in one place...
+ *
+ * @version $Id: HitInECALDecision.java,v 1.1 2006/11/03 21:56:07 mcharles Exp $
+ */
+
+public class HitInECALDecision implements DecisionMakerSingle<CalorimeterHit>
+{
+    /** Simple constructor. */
+    public HitInECALDecision() {}
+
+    /**
+     * Check whether this hit is in ECAL. 
+     * This implementation checks the string name of
+     * the subdetector, which is not very general or
+     * very efficient.
+     */
+    public boolean valid(CalorimeterHit hit) {
+	org.lcsim.geometry.Subdetector subdet = hit.getSubdetector();
+        String name = subdet.getName();
+        return (name.compareTo("EMBarrel") == 0 || name.compareTo("EMDEndcap") == 0);
+    }
+}
CVSspam 0.2.8