Print

Print


Commit in lcsim/src/org/lcsim on MAIN
event/base/BaseVertex.java+15-241.1 -> 1.2
util/lcio/SIOVertex.java+16-451.1 -> 1.2
+31-69
2 modified files
SIOVertex now extends BaseVertex

lcsim/src/org/lcsim/event/base
BaseVertex.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- BaseVertex.java	25 Sep 2007 18:58:16 -0000	1.1
+++ BaseVertex.java	25 Sep 2007 21:49:44 -0000	1.2
@@ -1,23 +1,16 @@
-/*
- * BaseVertex.java
- *
- * Created on September 20, 2007, 6:32 AM
- *
- * $Id: BaseVertex.java,v 1.1 2007/09/25 18:58:16 ngraf Exp $
- */
-
 package org.lcsim.event.base;
 
 import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
+import java.util.Collections;
 import java.util.Map;
 import org.lcsim.event.ReconstructedParticle;
 import org.lcsim.event.Vertex;
 
 /**
- *
+ * Default implementation of Vertex
  * @author Norman Graf
+ * @version $Id: BaseVertex.java,v 1.2 2007/09/25 21:49:44 tonyj Exp $
  */
 public class BaseVertex implements Vertex
 {
@@ -27,15 +20,13 @@
     protected double _probability ;
     protected SymmetricMatrix _covarianceMatrix;
     protected Hep3Vector _position;
-    protected ReconstructedParticle _aParticle ;
-    
+    protected ReconstructedParticle _aParticle ;   
     
     /** Creates a new instance of BaseVertex */
     // TODO decide whether to allow default constructor and setters, or limit to a fully qualified constructor.
-//    public BaseVertex()
-//    {
-//    }
-//    
+    protected  BaseVertex()
+    {
+    }    
     public BaseVertex(boolean isPrimary, String type, double chi2, double prob, SymmetricMatrix cov, Hep3Vector pos, ReconstructedParticle rp)
     {
         _isPrimary = isPrimary;
@@ -59,7 +50,7 @@
     
     public Map<String, Double> getParameters()
     {
-        return null;
+        return Collections.<String, Double>emptyMap();
     }
     
     public Hep3Vector getPosition()
@@ -72,13 +63,13 @@
         return _type;
     }
     
-    public String toString()
-    {
-        String retValue;
-        
-        retValue = super.toString();
-        return retValue;
-    }
+//    public String toString()
+//    {
+//        String retValue;
+//        
+//        retValue = super.toString();
+//        return retValue;
+//    }
     
     public SymmetricMatrix getCovMatrix()
     {

lcsim/src/org/lcsim/util/lcio
SIOVertex.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- SIOVertex.java	18 Sep 2007 03:46:26 -0000	1.1
+++ SIOVertex.java	25 Sep 2007 21:49:44 -0000	1.2
@@ -13,34 +13,29 @@
 import java.util.Map;
 import org.lcsim.event.ReconstructedParticle;
 import org.lcsim.event.Vertex;
+import org.lcsim.event.base.BaseVertex;
 
 /**
  *
  * @author Tony Johnson
- * @version $Id: SIOVertex.java,v 1.1 2007/09/18 03:46:26 tonyj Exp $
+ * @version $Id: SIOVertex.java,v 1.2 2007/09/25 21:49:44 tonyj Exp $
  */
-class SIOVertex implements Vertex
+class SIOVertex extends BaseVertex
 {
-   private int primary;
-   private String type;
-   private double chi2;
-   private double probability;
    private SIORef recPRef;
-   private SymmetricMatrix errorMatrix;
-   private Hep3Vector position;
    private Map<String,Double> parameters;
    
    SIOVertex(SIOInputStream in, int flag, int version, String[] keys, String[] parameterNames) throws IOException
    {
-      this.primary = in.readInt();
-      this.type = keys[in.readInt()];
-      this.chi2 = in.readFloat();
-      this.probability = in.readFloat();
-      this.position = new BasicHep3Vector(in.readFloat(),in.readFloat(),in.readFloat());
+      _isPrimary = in.readInt() != 0;
+      _type = keys[in.readInt()];
+      _chi2 = in.readFloat();
+      _probability = in.readFloat();
+      _position = new BasicHep3Vector(in.readFloat(),in.readFloat(),in.readFloat());
       
       double[] covMatrix = new double[6];
       for (int i=0; i<covMatrix.length; i++) covMatrix[i] = in.readFloat();
-      errorMatrix = new SymmetricMatrix(3,covMatrix,true);
+      _covarianceMatrix = new SymmetricMatrix(3,covMatrix,true);
       int n = in.readInt();
       this.parameters = new HashMap<String,Double>(n);
       for (int i=0; i<n; i++) 
@@ -49,6 +44,7 @@
          if (!f.isNaN()) parameters.put(parameterNames[i],Double.valueOf(f));
       }
       recPRef = in.readPntr();
+      _aParticle = null;      
       in.readPTag(this);
    }
    static void write(Vertex v, SIOOutputStream out, int flag,  List<String> keys, List<String> parameterNames) throws IOException
@@ -75,36 +71,6 @@
       out.writePTag(v);
    }
    
-   public boolean isPrimary()
-   {
-      return primary != 0;
-   }
-   
-   public String getAlgorithmType()
-   {
-      return type;
-   }
-   
-   public double getChi2()
-   {
-      return chi2;
-   }
-   
-   public double getProbability()
-   {
-      return probability;
-   }
-   
-   public Hep3Vector getPosition()
-   {
-      return position;
-   }
-   
-   public SymmetricMatrix getCovMatrix()
-   {
-      return errorMatrix;
-   }
-   
    public Map<String, Double> getParameters()
    {
       return parameters;
@@ -112,6 +78,11 @@
    
    public ReconstructedParticle getAssociatedParticle()
    {
-      return (ReconstructedParticle) recPRef.getObject();
+      if (_aParticle == null && recPRef != null)
+      {
+         _aParticle = (ReconstructedParticle) recPRef.getObject();
+         recPRef = null;
+      }
+      return super.getAssociatedParticle();
    }
 }
CVSspam 0.2.8