lcsim/src/org/lcsim/event/util
diff -u -r1.2 -r1.3
--- MCParticleClassifier.java 17 Aug 2005 23:47:36 -0000 1.2
+++ MCParticleClassifier.java 30 Sep 2005 21:38:26 -0000 1.3
@@ -43,30 +43,67 @@
public static MCPClass getClassification(MCParticle p)
{
+//
+// Check if particle existed in Generator
+//
if(p.getGeneratorStatus() > 0)
{
+//
+// Remove the documentation particles in case the generator left them floating
+//
+ if(p.getGeneratorStatus() == MCParticle.DOCUMENTATION)return MCPClass.GEN_INITIAL;
+//
+// Check if the generator particle has daughters in the generator
+//
boolean hasGeneratorDaughters = false;
List<MCParticle> daughters = p.getDaughters();
for(MCParticle d : daughters)
{
if(d.getGeneratorStatus() > 0)hasGeneratorDaughters = true;
}
-
+//
+// If no generator daughters return final state
+//
if (!hasGeneratorDaughters)
{
- return MCPClass.GEN_FINAL_STATE;
+//
+// Trap for strange generator problem: Hanging quark with INTERMEDIATE status
+// Therefore must check that Simulator saw this particle, otherwise return
+// GEN_INITIAL
+//
+ boolean inSim = p.getSimulatorStatus().isDecayedInTracker() ||
+ p.getSimulatorStatus().isDecayedInCalorimeter() ||
+ p.getSimulatorStatus().hasLeftDetector() ||
+ p.getSimulatorStatus().isStopped();
+ if(inSim)
+ {
+ return MCPClass.GEN_FINAL_STATE;
+ }
+ else
+ {
+ return MCPClass.GEN_INITIAL;
+ }
}
-
+//
+// A generator particle with gerenrator daughters:
+// if the simulator saw it must be a predecay
+//
if(p.getSimulatorStatus().isDecayedInTracker() |
p.getSimulatorStatus().isDecayedInCalorimeter())
{
return MCPClass.GEN_PREDECAY;
}
-
+//
+// simulator never saw it: initial
+//
return MCPClass.GEN_INITIAL;
}
else
{
+//
+// Particle didn't exist in generator: choices are backscatter, production without killing parent,
+// or the result of an interaction or decay( killing parent)
+//
if (p.getSimulatorStatus().isBackscatter())
{
return MCPClass.SIM_BACKSCATTER;