Print

Print


Commit in lcsim/src/org/lcsim/util/lcio on MAIN
SIOMCParticle.java+22-91.9 -> 1.10
Another attempt to correctly solve mc end point issue

lcsim/src/org/lcsim/util/lcio
SIOMCParticle.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- SIOMCParticle.java	26 Jul 2007 23:00:03 -0000	1.9
+++ SIOMCParticle.java	27 Jul 2007 19:22:22 -0000	1.10
@@ -20,7 +20,7 @@
 /**
  *
  * @author Tony Johnson
- * @version $Id: SIOMCParticle.java,v 1.9 2007/07/26 23:00:03 tonyj Exp $
+ * @version $Id: SIOMCParticle.java,v 1.10 2007/07/27 19:22:22 tonyj Exp $
  */
 class SIOMCParticle implements MCParticle
 {
@@ -199,10 +199,16 @@
    {
       if (endPoint == null)
       {
-         if (getDaughters().isEmpty()) throw new RuntimeException("MCParticle end point not available");
-         endPoint = getDaughters().get(0).getOrigin();
+         for (MCParticle daughter : getDaughters())
+         {
+            if(!daughter.getSimulatorStatus().vertexIsNotEndpointOfParent())
+            {
+               return daughter.getOrigin();
+            }
+         }
+         throw new RuntimeException("MCParticle end point not available");
       }
-      return endPoint;
+      else return endPoint;
    }
    
    public SimulatorStatus getSimulatorStatus()
@@ -222,9 +228,16 @@
       
       out.writeInt(particle.getType().getPDGID());
       out.writeInt(particle.getGeneratorStatus());
-      boolean hasEndPoint = particle.getDaughters().isEmpty();
+      boolean shouldExplicityWriteOutEndPoint = true;
+      for (MCParticle daughter : particle.getDaughters())
+      {
+         if(!daughter.getSimulatorStatus().vertexIsNotEndpointOfParent())
+         {
+            shouldExplicityWriteOutEndPoint = false;
+         }
+      }
       Hep3Vector endPoint = null;
-      if (hasEndPoint)
+      if (shouldExplicityWriteOutEndPoint)
       {
          try
          {
@@ -232,11 +245,11 @@
          }
          catch (Exception x)
          {
-            hasEndPoint = false;
+            shouldExplicityWriteOutEndPoint = false;
          }
       }
       int simStatus = particle.getSimulatorStatus().getValue();
-      simStatus = LCIOUtil.bitSet(simStatus,Status.BITEndpoint,hasEndPoint);
+      simStatus = LCIOUtil.bitSet(simStatus,Status.BITEndpoint,shouldExplicityWriteOutEndPoint);
       out.writeInt(simStatus);
       
       out.writeDouble(particle.getOriginX());
@@ -257,7 +270,7 @@
       {
          out.writeFloat(0);
       }
-      if (hasEndPoint)
+      if (shouldExplicityWriteOutEndPoint)
       {
          out.writeDouble(endPoint.x());
          out.writeDouble(endPoint.y());
CVSspam 0.2.8