Commit in lcsim/src/org/lcsim/event/util on MAIN
MCPClassifier.java+66-381.1 -> 1.2
Return value of MCP classification changed to enum from string (for better performance and stronger typing).

lcsim/src/org/lcsim/event/util
MCPClassifier.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- MCPClassifier.java	5 Aug 2005 21:55:25 -0000	1.1
+++ MCPClassifier.java	17 Aug 2005 23:42:07 -0000	1.2
@@ -6,50 +6,78 @@
 import java.util.Map;
 import org.lcsim.event.MCParticle;
 
-
 /**
- * MCPClassifier has a single method getClassification(MCParticle) which
- * returns a string classifying the MCParticle parameter. String values
- * are:
- * GeneratorInt -> Generator particle the simulator never saw
- * GeneratorPre -> Generator particle passed to the simulator along with a
+ * MCPClassifier has a single method, getClassification(MCParticle), that returns
+ * an enum classifying the particle.
+ *
+ * Possible return values are:
+ *
+ * GEN_INITIAL -> Generator particle the simulator never saw
+ *
+ * GEN_PREDECAY -> Generator particle passed to the simulator along with a
  *                 predecay, and the simulator generated the decay products.
- * GeneratorFS  -> Generator final state particle: either FinalState in the
- *                 input file, or intermediate passed to the Simulator with a
- *                 predecay that never happened.
- * Backscatter  -> Simulator particle produced as a result of backscatter from
- *                 a non-tracking region.
- * VNEOP        -> Simulator particle produced without destroying parent.
- * IntOrDecay   -> Simulator particle produced as a result of an interaction or
- *                 decay in a tracking region.
  *
+ * GEN_FINAL_STATE -> Generator final state particle: either FinalState in the
+ *                    input file, or intermediate passed to the Simulator with a
+ *                    predecay that never happened.
+ *
+ * SIM_BACKSCATTER -> Simulator particle produced as a result of backscatter from
+ *                    a non-tracking region.
+ *
+ * SIM_VERTEX_NOT_PARENT_ENDPOINT -> Simulator particle produced without destroying parent.
+ *
+ * SIM_INTERACTED_OR_DECAYED -> Simulator particle produced as a result of an interaction or
+ *                              decay in a tracking region.
  */
-
 public class MCPClassifier
 {
+    enum MCPClass
+    {
+        GEN_INITIAL,
+        GEN_PREDECAY,
+        GEN_FINAL_STATE,
+        SIM_BACKSCATTER,
+        SIM_VERTEX_NOT_PARENT_ENDPOINT,
+        SIM_INTERACTED_OR_DECAYED
+    };
     
-    public String getClassification(MCParticle p)
+    public MCPClass getClassification(MCParticle p)
     {
-		if(p.getGeneratorStatus() > 0)
-		{
-			boolean hasGeneratorDaughters = false;
-			List<MCParticle> daughters = p.getDaughters();
-			for(MCParticle d : daughters)
-			{
-				if(d.getGeneratorStatus() > 0)hasGeneratorDaughters = true;
-			}
-			if(!hasGeneratorDaughters)return "GeneratorFS";
-			if(p.getSimulatorStatus().isDecayedInTracker() |
-			   p.getSimulatorStatus().isDecayedInCalorimeter())return "GeneratorPre";
-			return "GeneratorInt";
-		}
-		else
-		{
-			if(p.getSimulatorStatus().isBackscatter())return "Backscatter";
-			if(p.getSimulatorStatus().vertexIsNotEndpointOfParent())return "VNEOP";
-			return "IntOrDecay";
-		}
-
+        if(p.getGeneratorStatus() > 0)
+        {
+            boolean hasGeneratorDaughters = false;
+            List<MCParticle> daughters = p.getDaughters();
+            for(MCParticle d : daughters)
+            {
+                if(d.getGeneratorStatus() > 0)hasGeneratorDaughters = true;
+            }
+            
+            if (!hasGeneratorDaughters)
+            {
+                return MCPClass.GEN_FINAL_STATE;
+            }
+            
+            if(p.getSimulatorStatus().isDecayedInTracker() |
+                    p.getSimulatorStatus().isDecayedInCalorimeter())
+            {
+                return MCPClass.GEN_PREDECAY;
+            }
+            
+            return MCPClass.GEN_INITIAL;
+        }
+        else
+        {
+            if (p.getSimulatorStatus().isBackscatter())
+            {
+                return MCPClass.SIM_BACKSCATTER;
+            }
+            
+            if(p.getSimulatorStatus().vertexIsNotEndpointOfParent())
+            {
+                return MCPClass.SIM_VERTEX_NOT_PARENT_ENDPOINT;
+            }
+            
+            return MCPClass.SIM_INTERACTED_OR_DECAYED;
+        }
     }
-    
-}
+}
\ No newline at end of file
CVSspam 0.2.8