lcsim/src/org/lcsim/recon/cluster/util
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);
+ }
+}