lcsim/src/org/lcsim/util/decision
diff -N ParticlePDGDecision.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ParticlePDGDecision.java 4 Jul 2006 23:57:23 -0000 1.1
@@ -0,0 +1,32 @@
+package org.lcsim.util.decision;
+
+import hep.physics.particle.Particle;
+import org.lcsim.util.decision.DecisionMakerSingle;
+
+/**
+ * Filter Particles according to their PDG code.
+ *
+ * @version $Id: ParticlePDGDecision.java,v 1.1 2006/07/04 23:57:23 mcharles Exp $
+ */
+
+public class ParticlePDGDecision implements DecisionMakerSingle<Particle>
+{
+ /**
+ * Constructor.
+ *
+ * @param pdg Require that abs(PDG) of particle matches this.
+ */
+ public ParticlePDGDecision(int pdg) {
+ m_requiredPDG = pdg;
+ }
+
+ /**
+ * Return true if the absolute value of the PDG code matches.
+ */
+ public boolean valid(Particle particleToTest) {
+ int thisPDG = particleToTest.getPDGID();
+ return( thisPDG == m_requiredPDG || thisPDG == -m_requiredPDG );
+ }
+
+ protected int m_requiredPDG;
+}