lcsim/src/org/lcsim/contrib/SteveMagill
diff -N MyHitInECALDecision.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MyHitInECALDecision.java 20 Aug 2008 22:02:31 -0000 1.1
@@ -0,0 +1,35 @@
+package org.lcsim.contrib.SteveMagill;
+
+/**
+ * package org.lcsim.recon.cluster.util;
+ * originally here, but there was a bug (typo) somewhere that is fixed in my own version
+ */
+
+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: MyHitInECALDecision.java,v 1.1 2008/08/20 22:02:31 magill Exp $
+ */
+
+public class MyHitInECALDecision implements DecisionMakerSingle<CalorimeterHit>
+{
+ /** Simple constructor. */
+ public MyHitInECALDecision() {}
+
+ /**
+ * 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("EMEndcap") == 0);
+ }
+}