Print

Print


Commit in lcsim on MAIN
src/org/lcsim/contrib/JanStrube/standalone/FastMCTrackTester.py+63added 1.1
                                          /ZvTubePlotter.py+81added 1.1
                                          /ZvTopDriver.java+74added 1.1
                                          /.cvsignore+3added 1.1
                                          /MainLoop.java+38added 1.1
                                          /VertexFitterDriver.java+107added 1.1
                                          /ReconParticleTestDriver.py+34added 1.1
                                          /MainLoop.py+40added 1.1
                                          /FitterTestDriver.py+129added 1.1
src/org/lcsim/contrib/JanStrube/.cvsignore+2added 1.1
                               /ZvTubePlotter.py-811.2 removed
                               /MainLoop.py-391.4 removed
                               /FitterTestDriver.py-1291.2 removed
                               /VertexFitterDriver.java-1061.5 removed
                               /FastMCTrackTester.py-631.2 removed
                               /ZvTopDriver.java-731.5 removed
.project+231.3 -> 1.4
.classpath+281.5 -> 1.6
src/org/lcsim/contrib/JanStrube/vtxFitter/VertexFactory.java+53added 1.1
                                         /VertexFactoryTest.java+53added 1.1
                                         /Vertex.java+32added 1.1
src/org/lcsim/recon/vertexing/zvtop4/VectorArithmetic.java+25-41.9 -> 1.10
                                    /ZvTrack.java+15-11.22 -> 1.23
                                    /ZvUtil.java+8-51.16 -> 1.17
src/org/lcsim/math/distribution/MoyalDistribution.java+21.1 -> 1.2
src/org/lcsim/spacegeom/SpacePoint.java+33-91.6 -> 1.7
src/org/lcsim/event/base/BaseReconstructedParticle.java+22-101.4 -> 1.5
src/org/lcsim/util/swim/HelixSwimmer.java+6-11.13 -> 1.14
+871-521
13 added + 6 removed + 9 modified, total 28 files
Adding a vertex factory plus tests to my contrib area.
Adding some convenience methods to get around annoyances with double[] and hep.physics

lcsim/src/org/lcsim/contrib/JanStrube/standalone
FastMCTrackTester.py added at 1.1
diff -N FastMCTrackTester.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FastMCTrackTester.py	28 Jun 2006 01:54:45 -0000	1.1
@@ -0,0 +1,63 @@
+from hep.aida import IAnalysisFactory
+from org.lcsim.mc.fast.tracking import MCFastTrackFactory
+from org.lcsim.spacegeom import CartesianPoint
+from org.lcsim.util.swim import HelixSwimmer, Helix
+from java.lang import Boolean
+from java.lang.Math import sin, cos, atan
+
+af = IAnalysisFactory.create()
+tf = af.createTreeFactory()
+tree = tf.create('t.aida', 'xml', False, True)
+hf = af.createHistogramFactory(tree)
+
+x = hf.createCloud1D("trackX", "trackX")
+y = hf.createCloud1D('trackY', 'trackY')
+z = hf.createCloud1D('trackZ', 'trackZ')
+
+px = hf.createCloud1D('trackPX', 'trackPX')
+py = hf.createCloud1D('trackPY', 'trackPY')
+pz = hf.createCloud1D('trackPZ', 'trackPZ')
+
+d0 = hf.createCloud1D('d0', 'd0')
+phi0 = hf.createCloud1D('phi0', 'phi0')
+omega = hf.createCloud1D('omega', 'omega')
+z0 = hf.createCloud1D('z0', 'z0')
+s = hf.createCloud1D('s', 's')
+
+orgx = hf.createCloud1D('orgX', 'orgX')
+#orgy = hf.createCloud1D('orgY', 'orgY')
+
+fac = MCFastTrackFactory()
+momentum = CartesianPoint(2, 2, 2)
+for iev in range(1,100):
+  for iy in range(1,100):
+    point = CartesianPoint(-10 + 20./iev, -10 + 20./iy, 5)
+
+    track = fac.getMCTrack(momentum, point, 1)
+    
+#    x.fill(track.getReferencePointX())
+#    y.fill(track.getReferencePointY())
+#    z.fill(track.getReferencePointZ())
+#    px.fill(track.getPX())
+#    py.fill(track.getPY())
+#    pz.fill(track.getPZ())
+    parms = track.getTrackParameters()
+    helix = HelixSwimmer(5)
+    helix.setTrack(track)
+    
+    d0.fill(parms[0])
+    phi0.fill(parms[1])
+    omega.fill(parms[2])
+    z0.fill(parms[3])
+    s.fill(parms[4])
+    orgx.fill(helix.getDistanceToPoint(point))
+#    orgy.fill(xy.y())
+
+tree.commit()
+tree.close()
+
+
+
+
+
+

lcsim/src/org/lcsim/contrib/JanStrube/standalone
ZvTubePlotter.py added at 1.1
diff -N ZvTubePlotter.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ZvTubePlotter.py	28 Jun 2006 01:54:45 -0000	1.1
@@ -0,0 +1,81 @@
+from org.lcsim.util import Driver
+from org.lcsim.recon.vertexing.zvtop4 import ZvTrack
+from org.lcsim.spacegeom import CartesianPoint
+
+import sys
+sys.path.append('/home/jstrube/paida-3.2.1_2.8.1')
+from paida import IAnalysisFactory
+from paida.paida_core.IFunction import IFunction, IAnnotation
+
+
+class ZvTubePlotter(Driver):
+    def __init__(self):
+        self.anaFac = IAnalysisFactory.create()
+        self.tree = self.anaFac.createTreeFactory().create()
+        self.histFac = self.anaFac.createHistogramFactory(self.tree)
+        self.funcFac = self.anaFac.createFunctionFactory(self.tree)
+        self.plotter = self.anaFac.createPlotterFactory().create()
+        self.dataPointSetFac = self.anaFac.createDataPointSetFactory(self.tree)
+        return
+    
+    def process(self, event):
+        region = self.plotter.createRegion()
+        
+        tracks = event.getTracks()
+        iter = tracks.iterator()
+        while iter.hasNext():
+            iTrack = iter.next()
+            zvTrack = ZvTrack(iTrack)
+            f = ZvTube(zvTrack)
+            region.plot(f, "minX=-50.;maxX=50.;minY=-50.;maxY=50.;minZ=-1;maxZ=2")
+        
+        dataPointSet = self.dataPointSetFac.create('partEndPoints', 'MC Particle endpoints', 3)
+        particles = event.getMCParticles()
+        iter = particles.iterator()
+        while iter.hasNext():
+            iPart = iter.next()
+            try:
+                endPoint = iPart.getEndPoint()
+                dataPoint = dataPointSet.addPoint()
+                dataPoint.coordinate(0).setValue(endPoint.x())
+                dataPoint.coordinate(0).setErrorPlus(0.01)
+                dataPoint.coordinate(0).setErrorMinus(0.01)
+                dataPoint.coordinate(1).setValue(endPoint.y())
+                dataPoint.coordinate(1).setErrorPlus(0.01)
+                dataPoint.coordinate(1).setErrorMinus(0.01)
+                dataPoint.coordinate(2).setValue(0)
+                dataPoint.coordinate(2).setErrorPlus(0.05)
+                dataPoint.coordinate(2).setErrorMinus(0.05)
+            except:
+                pass
+        region.plot(dataPointSet)
+        self.plotter.show()
+        self.plotter.writeToFile('tracks.png')
+        print 'please press ENTER'
+        sys.stdin.readline()
+
+
+class ZvTube(IFunction):
+    def __init__(self, track):
+        self.track = track
+        self.title = 'ZvTube Function'
+        return
+
+    def providesGradient(self):
+        return false
+
+    def value(self, x):
+        point = CartesianPoint(x[0], x[1], 0)
+        value = self.track.getTubeProjection(point)
+#        print x, value, float(value)
+#        sys.stdin.readline()
+        return value
+
+    def dimension(self):
+        return 2
+
+    def annotation(self):
+        ann = IAnnotation()
+        ann.addItem('Title', self.title)
+        return ann
+

lcsim/src/org/lcsim/contrib/JanStrube/standalone
ZvTopDriver.java added at 1.1
diff -N ZvTopDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ZvTopDriver.java	28 Jun 2006 01:54:45 -0000	1.1
@@ -0,0 +1,74 @@
+package org.lcsim.contrib.JanStrube.standalone;
+import hep.physics.jet.AbstractJetFinder;
+import hep.physics.jet.FixNumberOfJetsFinder;
+import hep.physics.jet.JadeEJetFinder;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+
+import java.util.ArrayList;
+import java.util.Formatter;
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.Track;
+import org.lcsim.geometry.Detector;
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.recon.vertexing.zvtop4.ZvFitter;
+import org.lcsim.recon.vertexing.zvtop4.ZvTop;
+import org.lcsim.recon.vertexing.zvtop4.ZvTrack;
+import org.lcsim.recon.vertexing.zvtop4.ZvVertex;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.util.swim.HelixSwimmer;
+
+/*
+ * Puts Vertices and the associated Tracks into the event cache
+ * for WIRED4 to pick up
+ * @author jstrube
+ * @version $Id: ZvTopDriver.java,v 1.1 2006/06/28 01:54:45 jstrube Exp $
+ */
+public class ZvTopDriver extends Driver {
+    private HelixSwimmer swimmer;
+    private ZvFitter fitter;
+    private ZvTop topper;
+    AbstractJetFinder jetFind;
+    List<ZvVertex> vertices;
+    public ZvTopDriver() {
+        add(new MCFast());
+    }
+
+
+    public void process(EventHeader event) {
+        super.process(event);
+        // Get the list of MCParticles from the event
+        List<Track> tracks = event.getTracks();
+        // Histogram the number of particles per event
+        // Loop over the particles
+        Detector thisDetector = event.getDetector();
+        fitter = new ZvFitter(thisDetector);
+        FixNumberOfJetsFinder jetFind = new FixNumberOfJetsFinder(2);
+        List<Hep3Vector> eventVectorList = new ArrayList<Hep3Vector>();
+        for (Track iTrack : tracks) {
+            eventVectorList.add(new BasicHep3Vector(iTrack.getMomentum()));
+        }
+        jetFind.setEvent(eventVectorList);
+        topper = new ZvTop(jetFind.jet(0).v3(), fitter);
+        // should be proportional to jet momentum
+        topper.setAngularWeight(2);
+        topper.setIpWeight(1);
+        topper.setMaxDistFromIP(25);
+        topper.setResolvedCut(0.5);
+        vertices = topper.findVertices(tracks);
+        System.out.printf("found %d vertices\n", vertices.size());
+        for (ZvVertex iVtx : vertices) {
+            System.out.println("Vertex at pos: " + iVtx.getPosition());
+        }
+        List<ZvTrack> zvTracks = new ArrayList<ZvTrack>();
+        for (Track t : tracks) {
+            zvTracks.add(new ZvTrack(t));
+        }
+        event.put("ZvTracks", zvTracks, ZvTrack.class, 0);
+        event.put("VtxList", vertices, ZvVertex.class, 0);
+    }
+}

lcsim/src/org/lcsim/contrib/JanStrube/standalone
.cvsignore added at 1.1
diff -N .cvsignore
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .cvsignore	28 Jun 2006 01:54:46 -0000	1.1
@@ -0,0 +1,3 @@
+java.hprof.txt
+exampleAnalysisJava.aida
+t.aida

lcsim/src/org/lcsim/contrib/JanStrube/standalone
MainLoop.java added at 1.1
diff -N MainLoop.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MainLoop.java	28 Jun 2006 01:54:46 -0000	1.1
@@ -0,0 +1,38 @@
+package org.lcsim.contrib.JanStrube.standalone;
+// MainLoop.java
+// Java wrapper to enable running outside of JAS3
+// 16-JUL-2005 Jan Strube
+// from a response to the JAS mailing list by Tony Johnson
+
+import java.io.File;
+
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCSimLoop;
+import java.net.URL;
+import org.lcsim.util.cache.FileCache;
+
+public class MainLoop extends Driver
+{
+   public MainLoop()
+   {
+   }
+   public static void main(String[] args) throws Exception
+   {
+      LCSimLoop loop = new LCSimLoop();
+      URL location = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/ILC500/Zgamma/stdhep/pythia/pythiaZgamma.stdhep");
+      FileCache cache = new FileCache();
+      File trackFile = cache.getCachedFile(location);
+      loop.setStdhepRecordSource(trackFile, "sidaug05");
+//      loop.setLCIORecordSource(input);
+      loop.add(new MCFast(false, false));
+      loop.add(new VertexFitterDriver());
+//      File output = new File("exampleAnalysisJava.slcio");
+//      loop.add(new LCIODriver(output));
+      loop.loop(-1);
+      loop.dispose();
+      AIDA.defaultInstance().saveAs("exampleAnalysisJava.aida");
+   }
+}

lcsim/src/org/lcsim/contrib/JanStrube/standalone
VertexFitterDriver.java added at 1.1
diff -N VertexFitterDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ VertexFitterDriver.java	28 Jun 2006 01:54:46 -0000	1.1
@@ -0,0 +1,107 @@
+package org.lcsim.contrib.JanStrube.standalone;
+/*
+ * VertexFitterDriver.java
+ *
+ * Created on March 25, 2006, 3:15 PM
+ *
+ *@version $Id: VertexFitterDriver.java,v 1.1 2006/06/28 01:54:46 jstrube Exp $
+ */
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.ITuple;
+import hep.aida.ITupleFactory;
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.Track;
+import org.lcsim.mc.fast.tracking.ReconTrack;
+import org.lcsim.recon.vertexing.billoir.BilloirFitter;
+import org.lcsim.recon.vertexing.billoir.Vertex;
+import org.lcsim.recon.vertexing.billoir.VertexFitter;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+import static java.lang.Math.sqrt;
+
+/**
+ *
+ * @author jstrube
+ */
+public class VertexFitterDriver extends Driver {
+    private AIDA aida = AIDA.defaultInstance();
+    private IAnalysisFactory af = aida.analysisFactory();
+    private ITupleFactory tf = af.createTupleFactory(aida.tree());
+    private ITuple tuple;
+    private VertexFitter fitter;
+    private int primaryParticle = 23; //443;
+    private SpacePoint primaryVertex;
+    public VertexFitterDriver() {
+        String names = new String(
+            "float chi2; float fittedX; float fittedY; float fittedZ; float xError; float yError; float zError" +
+                "; float primaryX; float primaryY; float primaryZ" +
+                "; ITuple trackTuple={float chi2" +
+                      ", float unsmeared_theta" +
+                      ", float unsmeared_phi" +
+                      ", float unsmeared_omega" +
+                      ", float smeared_theta, float smeared_theta_error" +
+                      ", float smeared_phi, float smeared_phi_error" +
+                      ", float smeared_omega, float smeared_omega_error" +
+                      ", float fitted_theta, float fitted_theta_error" +
+                      ", float fitted_phi, float fitted_phi_error" +
+                      ", float fitted_omega, float fitted_omega_error}");
+        tuple = tf.create("vertexFitterResults", "properties of Vertex", names, "");
+        fitter = new BilloirFitter(5);
+    }
+    
+    public void process(EventHeader event) {
+    	System.out.println("Processing Event " + event.getEventNumber());
+        List<MCParticle> particles = event.getMCParticles();
+        List<Track> tracks = event.getTracks();
+        if (tracks.size() != 2)
+            return;
+        for (MCParticle iPart : particles) {
+            if (iPart.getGeneratorStatus() == MCParticle.INTERMEDIATE)
+                if (iPart.getPDGID() == primaryParticle)
+                    primaryVertex = new SpacePoint(iPart.getEndPoint());
+        }
+        Vertex vertex = fitter.fit(tracks, new CartesianPoint(0, 0, 0), false);
+        tuple.fill(0, (float) vertex._chi2);
+        tuple.fill(1, (float) vertex._xyzf[0]);
+        tuple.fill(2, (float) vertex._xyzf[1]);
+        tuple.fill(3, (float) vertex._xyzf[2]);
+        tuple.fill(4, (float) sqrt(vertex._vcov[0]));
+        tuple.fill(5, (float) sqrt(vertex._vcov[2]));
+        tuple.fill(6, (float) sqrt(vertex._vcov[5]));
+        tuple.fill(7, (float) primaryVertex.x());
+        tuple.fill(8, (float) primaryVertex.y());
+        tuple.fill(9, (float) primaryVertex.z());
+        
+        ITuple trackTuple = tuple.getTuple(10);
+        for (int i=0; i<2; ++i) {
+            ReconTrack rTrack = (ReconTrack) tracks.get(i);
+            Track iTrack = tracks.get(i);
+            trackTuple.fill(0, (float) vertex._chi2tr[i]);
+//            trackTuple.fill(1, (float) Math.atan(90-rTrack.getNotSmearedTrack().getTanL()));
+//            trackTuple.fill(2, (float) rTrack.getNotSmearedTrack().getPhi0());
+//            trackTuple.fill(3, (float) rTrack.getNotSmearedTrack().getOmega());
+            double tanLambda = iTrack.getTrackParameter(4);
+            double theta = Math.PI/2-Math.atan(tanLambda);
+            trackTuple.fill(4, (float) theta);
+            double thetaError = (1+tanLambda*tanLambda)*(1+tanLambda*tanLambda)*iTrack.getErrorMatrixElement(4,4);
+            trackTuple.fill(5, (float) thetaError);
+            trackTuple.fill(6, (float) iTrack.getTrackParameter(1));
+            trackTuple.fill(7, (float) iTrack.getErrorMatrixElement(1,1));
+            trackTuple.fill(8, (float) iTrack.getTrackParameter(2));
+            trackTuple.fill(9, (float) iTrack.getErrorMatrixElement(2, 2));
+            trackTuple.fill(10, (float) vertex._parf[0][i]);
+            trackTuple.fill(11, (float) sqrt(vertex._tcov[0][i]));
+            trackTuple.fill(12, (float) vertex._parf[1][i]);
+            trackTuple.fill(13, (float) sqrt(vertex._tcov[2][i]));
+            trackTuple.fill(14, (float) vertex._parf[2][i]);
+            trackTuple.fill(15, (float) sqrt(vertex._tcov[5][i]));
+            trackTuple.addRow();
+        }
+	tuple.addRow();
+    }
+}

lcsim/src/org/lcsim/contrib/JanStrube/standalone
ReconParticleTestDriver.py added at 1.1
diff -N ReconParticleTestDriver.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ReconParticleTestDriver.py	28 Jun 2006 01:54:46 -0000	1.1
@@ -0,0 +1,34 @@
+from org.lcsim.util import Driver
+from org.lcsim.util.aida import AIDA
+from org.lcsim.util.swim import HelixSwimmer
+from org.lcsim.spacegeom import CartesianPoint
+from org.lcsim.util.swim import Helix
+from java.lang.Math import atan
+
+class ReconParticleTestDriver(Driver):
+    def __init__(self):
+        self.aida = AIDA.defaultInstance()
+        
+    def process(self, event):
+        tracks = event.getTracks()
+        helix = HelixSwimmer(5)
+        
+        for track in tracks:
+            helix.setTrack(track)
+            part = track.getMCParticle()
+            ip = CartesianPoint(1, 1, 1)
+            
+            phi = track.getTrackParameter(1);
+            lamb = atan(track.getTrackParameter(4));
+            omega = track.getTrackParameter(2);
+            hlx = Helix(part.getOrigin(), 1/omega, phi, lamb)
+            
+            decayLength = part.getOrigin().magnitude()            
+            track_part_distance = helix.getDistanceToPoint(part.getOrigin())
+            self.aida.cloud1D('track_partOrigin_distance').fill(track_part_distance)
+            self.aida.cloud1D('d0').fill(track.getTrackParameter(0))
+            self.aida.cloud1D('part_decayLength').fill(decayLength)
+            self.aida.cloud2D('decayLength2distance').fill(decayLength, track_part_distance)
+            self.aida.cloud2D('momentum2distance').fill(part.getMomentum().magnitude(), decayLength)
+            self.aida.cloud1D('distance2IP').fill(hlx.getSignedClosestDifferenceToPoint(ip))
+            self.aida.cloud1D('dist2Orig').fill(hlx.getSignedClosestDifferenceToPoint(part.getOrigin()))

lcsim/src/org/lcsim/contrib/JanStrube/standalone
MainLoop.py added at 1.1
diff -N MainLoop.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MainLoop.py	28 Jun 2006 01:54:46 -0000	1.1
@@ -0,0 +1,40 @@
+#! /usr/bin/env jython
+from org.lcsim.util import Driver
+from org.lcsim.util.aida import AIDA
+from org.lcsim.util.loop import LCIODriver
+from org.lcsim.util.loop import LCSimLoop
+from org.lcsim.mc.fast import MCFast
+from java.net import URL
+from org.lcsim.util.cache import FileCache
+from java.io import File
+#from ZvTubePlotter import ZvTubePlotter
+from java.lang import System
+#import VertexFitterDriver
+from java.lang import Boolean
+from ReconParticleTestDriver import ReconParticleTestDriver
+
+true = Boolean("true")
+false = Boolean("false")
+
+def main():
+    loop = LCSimLoop()
+#    location = URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/ILC500/Zgamma/stdhep/pythia/pythiaZgamma.stdhep")
+    location = URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/singleParticle/stdhep/psi_mumu_Theta4-176_5-100GeV.stdhep")
+    cache = FileCache()
+    trackFile = cache.getCachedFile(location)
+    loop.setStdhepRecordSource(trackFile, "sidaug05")
+#    loop.setLCIORecordSource(input)
+    # no beamspotConstraint, no simple smearing
+    loop.add(MCFast(false, false))
+#    loop.add(ZvTubePlotter())
+#    loop.add(VertexFitterDriver())
+    loop.add(ReconParticleTestDriver())
+#    output = File(System.getProperty("user.home"),"fastmc.slcio")
+#    loop.add(LCIODriver(output))
+    loop.loop(-1)
+    loop.dispose()
+
+    AIDA.defaultInstance().saveAs("fastmc.aida")
+
+if __name__ == "__main__":
+    main()

lcsim/src/org/lcsim/contrib/JanStrube/standalone
FitterTestDriver.py added at 1.1
diff -N FitterTestDriver.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FitterTestDriver.py	28 Jun 2006 01:54:46 -0000	1.1
@@ -0,0 +1,129 @@
+from org.lcsim.util import Driver
+from org.lcsim.recon.vertexing.fitter import VertexFitter
+
+class FitterTestDriver(Driver):
+    def __init__(self):
+        #super.__init__(self):
+        aida = AIDA.defaultInstance()
+        fitter = VertexFitter(5)
+
+    def process(self, event):
+        tracks = event.getTracks()
+        if not len(tracks) == 2:
+            return
+
+def getJacobi(old):
+    new = []
+    new.append([old[0], 0, 0, 0, 0])
+    new.append([0, 0, 0, old[1], 0])
+    new.append([0, 0, 0, 0, old[2]])
+    new.append([0, old[3], 0, 0, 0])
+    new.append([0, 0, 1+Math.tan(old[4])*Math.tan(old[4]), 0, 0])
+    return new
+
+
+def jacobian():
+    return
+
+def flattenMatrix(matrix):
+    result = []
+    length = len(matrix)
+    for i in range(length):
+        for j in range(i, length):
+            result.append(matrix[i][j]);
+    return result;
+
+#public class VertexFitterTest extends TestCase {
+    #private Track track1;
+    #private Track track2;
+    #private LCSimLoop loop;
+    #private URL location;
+    #private FileCache cache;
+    #private File trackFile;
+    #private VertexFitter fitter;
+    #private AIDA aida = AIDA.defaultInstance();
+    #protected void setUp() throws Exception {
+        #super.setUp();
+        #loop = new LCSimLoop();
+        #// contains psi- mu mu events
+        #location = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/ILC500/Zgamma/stdhep/pythia/pythiaZgamma.stdhep");
+#//         location = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/singleParticle/stdhep/psi_mumu_Theta4-176_5-100GeV.stdhep");
+        #cache = new FileCache();
+        #trackFile = cache.getCachedFile(location);
+        #loop.setStdhepRecordSource(trackFile, "sidaug05");
+        #fitter = new VertexFitter(5);
+    #}
+    
+    #private class TrackFitDriver extends Driver {
+        #private List<double[]> weights = new ArrayList<double[]>();
+        #private List<double[]> trackParams = new ArrayList<double[]>();
+        #public void process(EventHeader event) {
+            #trackParams.clear();
+            #weights.clear();
+            #List<Track> tracks = event.getTracks();
+            #if (tracks.size() != 2)
+                #return;
+            #for (Track iTrack : tracks) {
+                #Matrix olderrors = new Matrix(iTrack.getErrorMatrix());
+                #olderrors.print(21, 20);
+                #double[] params = iTrack.getTrackParameters();
+                #System.err.println();
+                #Matrix jacobi = new Matrix(getJacobi(params));
+                #jacobi.print(21, 20);
+                #double theta = PI/2 - atan(params[4]);
+                #double[] newparams = new double[]{params[0], params[3], theta, params[1], params[2]};
+                #trackParams.add(newparams);
+                #double[][] weightArray = jacobi.times(olderrors).times(jacobi.transpose()).getArray();
+                #Matrix nw = new Matrix(weightArray);
+                #nw.print(31, 30);
+                #System.err.printf("Old Det: %g\nNew Det: %g\nJacobi Det: %g\n", olderrors.det(), nw.det(), jacobi.det());
+                #weights.add(flattenWeights(weightArray));
+            #}
+            
+            #System.err.printf("%d tracks\n", trackParams.size());
+            #System.err.println("fitting");
+            #boolean[] inVtx = new boolean[] {true, true};
+            #double[] initialPosition = new double[] {0, 0, 0};
+            
+            #for (double[] x : trackParams) {
+                #System.err.print("Track Parameters: ");
+                #for (double y : x) {
+                    #System.err.printf("%f\t", y);
+                #}
+                #System.err.println();
+            #}
+            #//System.err.printf("Check: Parameter 4 of track 2: %.3f\n", trackParams.toArray(new double[][]{})[1][3]);
+#//            for (double[] x : trackParams.toArray(new double[][]{})) {
+#//                System.err.print("Track Parameters: ");
+#//                for (double y : x) {
+#//                    System.err.printf("%f\t", y);
+#//                }
+#//                System.err.println();
+#//            }
+
+            #for (double[] x : weights) {
+                #System.err.print("Track weights: ");
+                #for (double y : x) {
+                    #System.err.printf("%f\t", y);
+                #}
+                #System.err.println();
+            #}
+            #Matrix newTrackParams = new Matrix(trackParams.toArray(new double[][]{}));
+            #newTrackParams.print(20, 21);
+            #Matrix newWeights = new Matrix(weights.toArray(new double[][]{}));
+            #newWeights.print(21, 20);
+            #Vertex v = fitter.fit(tracks.size(), false, inVtx, newTrackParams.transpose().getArray(), newWeights.transpose().getArray(), initialPosition);
+            #aida.cloud1D("vtx_chi2").fill(v._chi2);
+        #}
+        
+        
+        #}
+    #}
+
+    
+    #protected void tearDown() throws Exception {
+        #super.tearDown();
+        #aida.saveAs("x.aida");
+        #loop.dispose();
+    #}
+#}

lcsim/src/org/lcsim/contrib/JanStrube
.cvsignore added at 1.1
diff -N .cvsignore
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .cvsignore	28 Jun 2006 01:54:47 -0000	1.1
@@ -0,0 +1,2 @@
+zGammaReconTrackTest.aida
+fastmc.aida

lcsim/src/org/lcsim/contrib/JanStrube
ZvTubePlotter.py removed after 1.2
diff -N ZvTubePlotter.py
--- ZvTubePlotter.py	3 Aug 2005 18:52:25 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,81 +0,0 @@
-from org.lcsim.util import Driver
-from org.lcsim.recon.vertexing.zvtop4 import ZvTrack
-from org.lcsim.spacegeom import CartesianPoint
-
-import sys
-sys.path.append('/home/jstrube/paida-3.2.1_2.8.1')
-from paida import IAnalysisFactory
-from paida.paida_core.IFunction import IFunction, IAnnotation
-
-
-class ZvTubePlotter(Driver):
-    def __init__(self):
-        self.anaFac = IAnalysisFactory.create()
-        self.tree = self.anaFac.createTreeFactory().create()
-        self.histFac = self.anaFac.createHistogramFactory(self.tree)
-        self.funcFac = self.anaFac.createFunctionFactory(self.tree)
-        self.plotter = self.anaFac.createPlotterFactory().create()
-        self.dataPointSetFac = self.anaFac.createDataPointSetFactory(self.tree)
-        return
-    
-    def process(self, event):
-        region = self.plotter.createRegion()
-        
-        tracks = event.getTracks()
-        iter = tracks.iterator()
-        while iter.hasNext():
-            iTrack = iter.next()
-            zvTrack = ZvTrack(iTrack)
-            f = ZvTube(zvTrack)
-            region.plot(f, "minX=-50.;maxX=50.;minY=-50.;maxY=50.;minZ=-1;maxZ=2")
-        
-        dataPointSet = self.dataPointSetFac.create('partEndPoints', 'MC Particle endpoints', 3)
-        particles = event.getMCParticles()
-        iter = particles.iterator()
-        while iter.hasNext():
-            iPart = iter.next()
-            try:
-                endPoint = iPart.getEndPoint()
-                dataPoint = dataPointSet.addPoint()
-                dataPoint.coordinate(0).setValue(endPoint.x())
-                dataPoint.coordinate(0).setErrorPlus(0.01)
-                dataPoint.coordinate(0).setErrorMinus(0.01)
-                dataPoint.coordinate(1).setValue(endPoint.y())
-                dataPoint.coordinate(1).setErrorPlus(0.01)
-                dataPoint.coordinate(1).setErrorMinus(0.01)
-                dataPoint.coordinate(2).setValue(0)
-                dataPoint.coordinate(2).setErrorPlus(0.05)
-                dataPoint.coordinate(2).setErrorMinus(0.05)
-            except:
-                pass
-        region.plot(dataPointSet)
-        self.plotter.show()
-        self.plotter.writeToFile('tracks.png')
-        print 'please press ENTER'
-        sys.stdin.readline()
-
-
-class ZvTube(IFunction):
-    def __init__(self, track):
-        self.track = track
-        self.title = 'ZvTube Function'
-        return
-
-    def providesGradient(self):
-        return false
-
-    def value(self, x):
-        point = CartesianPoint(x[0], x[1], 0)
-        value = self.track.getTubeProjection(point)
-#        print x, value, float(value)
-#        sys.stdin.readline()
-        return value
-
-    def dimension(self):
-        return 2
-
-    def annotation(self):
-        ann = IAnnotation()
-        ann.addItem('Title', self.title)
-        return ann
-

lcsim/src/org/lcsim/contrib/JanStrube
MainLoop.py removed after 1.4
diff -N MainLoop.py
--- MainLoop.py	27 Jun 2006 09:00:13 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,39 +0,0 @@
-#! /usr/bin/env jython
-from org.lcsim.util import Driver
-from org.lcsim.util.aida import AIDA
-from org.lcsim.util.loop import LCIODriver
-from org.lcsim.util.loop import LCSimLoop
-from org.lcsim.mc.fast import MCFast
-from java.net import URL
-from org.lcsim.util.cache import FileCache
-from java.io import File
-#from ZvTubePlotter import ZvTubePlotter
-from java.lang import System
-#import VertexFitterDriver
-from java.lang import Boolean
-from ReconParticleTestDriver import ReconParticleTestDriver
-
-true = Boolean("true")
-false = Boolean("false")
-
-def main():
-    loop = LCSimLoop()
-    location = URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/ILC500/Zgamma/stdhep/pythia/pythiaZgamma.stdhep")
-#    location = URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/singleParticle/stdhep/psi_mumu_Theta4-176_5-100GeV.stdhep")
-    cache = FileCache()
-    trackFile = cache.getCachedFile(location)
-    loop.setStdhepRecordSource(trackFile, "sidaug05")
-#    loop.setLCIORecordSource(input)
-    loop.add(MCFast(false, false))
-#    loop.add(ZvTubePlotter())
-#    loop.add(VertexFitterDriver())
-    loop.add(ReconParticleTestDriver())
-#    output = File(System.getProperty("user.home"),"fastmc.slcio")
-#    loop.add(LCIODriver(output))
-    loop.loop(-1)
-    loop.dispose()
-
-    AIDA.defaultInstance().saveAs("fastmc.aida")
-
-if __name__ == "__main__":
-    main()

lcsim/src/org/lcsim/contrib/JanStrube
FitterTestDriver.py removed after 1.2
diff -N FitterTestDriver.py
--- FitterTestDriver.py	21 May 2006 07:42:32 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,129 +0,0 @@
-from org.lcsim.util import Driver
-from org.lcsim.recon.vertexing.fitter import VertexFitter
-
-class FitterTestDriver(Driver):
-    def __init__(self):
-        #super.__init__(self):
-        aida = AIDA.defaultInstance()
-        fitter = VertexFitter(5)
-
-    def process(self, event):
-        tracks = event.getTracks()
-        if not len(tracks) == 2:
-            return
-
-def getJacobi(old):
-    new = []
-    new.append([old[0], 0, 0, 0, 0])
-    new.append([0, 0, 0, old[1], 0])
-    new.append([0, 0, 0, 0, old[2]])
-    new.append([0, old[3], 0, 0, 0])
-    new.append([0, 0, 1+Math.tan(old[4])*Math.tan(old[4]), 0, 0])
-    return new
-
-
-def jacobian():
-    return
-
-def flattenMatrix(matrix):
-    result = []
-    length = len(matrix)
-    for i in range(length):
-        for j in range(i, length):
-            result.append(matrix[i][j]);
-    return result;
-
-#public class VertexFitterTest extends TestCase {
-    #private Track track1;
-    #private Track track2;
-    #private LCSimLoop loop;
-    #private URL location;
-    #private FileCache cache;
-    #private File trackFile;
-    #private VertexFitter fitter;
-    #private AIDA aida = AIDA.defaultInstance();
-    #protected void setUp() throws Exception {
-        #super.setUp();
-        #loop = new LCSimLoop();
-        #// contains psi- mu mu events
-        #location = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/ILC500/Zgamma/stdhep/pythia/pythiaZgamma.stdhep");
-#//         location = new URL("ftp://ftp-lcd.slac.stanford.edu/lcd/ILC/singleParticle/stdhep/psi_mumu_Theta4-176_5-100GeV.stdhep");
-        #cache = new FileCache();
-        #trackFile = cache.getCachedFile(location);
-        #loop.setStdhepRecordSource(trackFile, "sidaug05");
-        #fitter = new VertexFitter(5);
-    #}
-    
-    #private class TrackFitDriver extends Driver {
-        #private List<double[]> weights = new ArrayList<double[]>();
-        #private List<double[]> trackParams = new ArrayList<double[]>();
-        #public void process(EventHeader event) {
-            #trackParams.clear();
-            #weights.clear();
-            #List<Track> tracks = event.getTracks();
-            #if (tracks.size() != 2)
-                #return;
-            #for (Track iTrack : tracks) {
-                #Matrix olderrors = new Matrix(iTrack.getErrorMatrix());
-                #olderrors.print(21, 20);
-                #double[] params = iTrack.getTrackParameters();
-                #System.err.println();
-                #Matrix jacobi = new Matrix(getJacobi(params));
-                #jacobi.print(21, 20);
-                #double theta = PI/2 - atan(params[4]);
-                #double[] newparams = new double[]{params[0], params[3], theta, params[1], params[2]};
-                #trackParams.add(newparams);
-                #double[][] weightArray = jacobi.times(olderrors).times(jacobi.transpose()).getArray();
-                #Matrix nw = new Matrix(weightArray);
-                #nw.print(31, 30);
-                #System.err.printf("Old Det: %g\nNew Det: %g\nJacobi Det: %g\n", olderrors.det(), nw.det(), jacobi.det());
-                #weights.add(flattenWeights(weightArray));
-            #}
-            
-            #System.err.printf("%d tracks\n", trackParams.size());
-            #System.err.println("fitting");
-            #boolean[] inVtx = new boolean[] {true, true};
-            #double[] initialPosition = new double[] {0, 0, 0};
-            
-            #for (double[] x : trackParams) {
-                #System.err.print("Track Parameters: ");
-                #for (double y : x) {
-                    #System.err.printf("%f\t", y);
-                #}
-                #System.err.println();
-            #}
-            #//System.err.printf("Check: Parameter 4 of track 2: %.3f\n", trackParams.toArray(new double[][]{})[1][3]);
-#//            for (double[] x : trackParams.toArray(new double[][]{})) {
-#//                System.err.print("Track Parameters: ");
-#//                for (double y : x) {
-#//                    System.err.printf("%f\t", y);
-#//                }
-#//                System.err.println();
-#//            }
-
-            #for (double[] x : weights) {
-                #System.err.print("Track weights: ");
-                #for (double y : x) {
-                    #System.err.printf("%f\t", y);
-                #}
-                #System.err.println();
-            #}
-            #Matrix newTrackParams = new Matrix(trackParams.toArray(new double[][]{}));
-            #newTrackParams.print(20, 21);
-            #Matrix newWeights = new Matrix(weights.toArray(new double[][]{}));
-            #newWeights.print(21, 20);
-            #Vertex v = fitter.fit(tracks.size(), false, inVtx, newTrackParams.transpose().getArray(), newWeights.transpose().getArray(), initialPosition);
-            #aida.cloud1D("vtx_chi2").fill(v._chi2);
-        #}
-        
-        
-        #}
-    #}
-
-    
-    #protected void tearDown() throws Exception {
-        #super.tearDown();
-        #aida.saveAs("x.aida");
-        #loop.dispose();
-    #}
-#}

lcsim/src/org/lcsim/contrib/JanStrube
VertexFitterDriver.java removed after 1.5
diff -N VertexFitterDriver.java
--- VertexFitterDriver.java	20 Jun 2006 22:44:57 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,106 +0,0 @@
-/*
- * VertexFitterDriver.java
- *
- * Created on March 25, 2006, 3:15 PM
- *
- *@version $Id: VertexFitterDriver.java,v 1.5 2006/06/20 22:44:57 jstrube Exp $
- */
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.ITuple;
-import hep.aida.ITupleFactory;
-import java.util.List;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.Track;
-import org.lcsim.mc.fast.tracking.ReconTrack;
-import org.lcsim.recon.vertexing.billoir.BilloirFitter;
-import org.lcsim.recon.vertexing.billoir.Vertex;
-import org.lcsim.recon.vertexing.billoir.VertexFitter;
-import org.lcsim.spacegeom.CartesianPoint;
-import org.lcsim.spacegeom.SpacePoint;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-import static java.lang.Math.sqrt;
-
-/**
- *
- * @author jstrube
- */
-public class VertexFitterDriver extends Driver {
-    private AIDA aida = AIDA.defaultInstance();
-    private IAnalysisFactory af = aida.analysisFactory();
-    private ITupleFactory tf = af.createTupleFactory(aida.tree());
-    private ITuple tuple;
-    private VertexFitter fitter;
-    private int primaryParticle = 23; //443;
-    private SpacePoint primaryVertex;
-    public VertexFitterDriver() {
-        String names = new String(
-            "float chi2; float fittedX; float fittedY; float fittedZ; float xError; float yError; float zError" +
-                "; float primaryX; float primaryY; float primaryZ" +
-                "; ITuple trackTuple={float chi2" +
-                      ", float unsmeared_theta" +
-                      ", float unsmeared_phi" +
-                      ", float unsmeared_omega" +
-                      ", float smeared_theta, float smeared_theta_error" +
-                      ", float smeared_phi, float smeared_phi_error" +
-                      ", float smeared_omega, float smeared_omega_error" +
-                      ", float fitted_theta, float fitted_theta_error" +
-                      ", float fitted_phi, float fitted_phi_error" +
-                      ", float fitted_omega, float fitted_omega_error}");
-        tuple = tf.create("vertexFitterResults", "properties of Vertex", names, "");
-        fitter = new BilloirFitter(5);
-    }
-    
-    public void process(EventHeader event) {
-    	System.out.println("Processing Event " + event.getEventNumber());
-        List<MCParticle> particles = event.getMCParticles();
-        List<Track> tracks = event.getTracks();
-        if (tracks.size() != 2)
-            return;
-        for (MCParticle iPart : particles) {
-            if (iPart.getGeneratorStatus() == MCParticle.INTERMEDIATE)
-                if (iPart.getPDGID() == primaryParticle)
-                    primaryVertex = new SpacePoint(iPart.getEndPoint());
-        }
-        Vertex vertex = fitter.fit(tracks, new CartesianPoint(0, 0, 0), false);
-        tuple.fill(0, (float) vertex._chi2);
-        tuple.fill(1, (float) vertex._xyzf[0]);
-        tuple.fill(2, (float) vertex._xyzf[1]);
-        tuple.fill(3, (float) vertex._xyzf[2]);
-        tuple.fill(4, (float) sqrt(vertex._vcov[0]));
-        tuple.fill(5, (float) sqrt(vertex._vcov[2]));
-        tuple.fill(6, (float) sqrt(vertex._vcov[5]));
-        tuple.fill(7, (float) primaryVertex.x());
-        tuple.fill(8, (float) primaryVertex.y());
-        tuple.fill(9, (float) primaryVertex.z());
-        
-        ITuple trackTuple = tuple.getTuple(10);
-        for (int i=0; i<2; ++i) {
-            ReconTrack rTrack = (ReconTrack) tracks.get(i);
-            Track iTrack = tracks.get(i);
-            trackTuple.fill(0, (float) vertex._chi2tr[i]);
-//            trackTuple.fill(1, (float) Math.atan(90-rTrack.getNotSmearedTrack().getTanL()));
-//            trackTuple.fill(2, (float) rTrack.getNotSmearedTrack().getPhi0());
-//            trackTuple.fill(3, (float) rTrack.getNotSmearedTrack().getOmega());
-            double tanLambda = iTrack.getTrackParameter(4);
-            double theta = Math.PI/2-Math.atan(tanLambda);
-            trackTuple.fill(4, (float) theta);
-            double thetaError = (1+tanLambda*tanLambda)*(1+tanLambda*tanLambda)*iTrack.getErrorMatrixElement(4,4);
-            trackTuple.fill(5, (float) thetaError);
-            trackTuple.fill(6, (float) iTrack.getTrackParameter(1));
-            trackTuple.fill(7, (float) iTrack.getErrorMatrixElement(1,1));
-            trackTuple.fill(8, (float) iTrack.getTrackParameter(2));
-            trackTuple.fill(9, (float) iTrack.getErrorMatrixElement(2, 2));
-            trackTuple.fill(10, (float) vertex._parf[0][i]);
-            trackTuple.fill(11, (float) sqrt(vertex._tcov[0][i]));
-            trackTuple.fill(12, (float) vertex._parf[1][i]);
-            trackTuple.fill(13, (float) sqrt(vertex._tcov[2][i]));
-            trackTuple.fill(14, (float) vertex._parf[2][i]);
-            trackTuple.fill(15, (float) sqrt(vertex._tcov[5][i]));
-            trackTuple.addRow();
-        }
-	tuple.addRow();
-    }
-}

lcsim/src/org/lcsim/contrib/JanStrube
FastMCTrackTester.py removed after 1.2
diff -N FastMCTrackTester.py
--- FastMCTrackTester.py	27 Jun 2006 09:00:13 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@
-from hep.aida import IAnalysisFactory
-from org.lcsim.mc.fast.tracking import MCFastTrackFactory
-from org.lcsim.spacegeom import CartesianPoint
-from org.lcsim.util.swim import HelixSwimmer, Helix
-from java.lang import Boolean
-from java.lang.Math import sin, cos, atan
-
-af = IAnalysisFactory.create()
-tf = af.createTreeFactory()
-tree = tf.create('t.aida', 'xml', False, True)
-hf = af.createHistogramFactory(tree)
-
-x = hf.createCloud1D("trackX", "trackX")
-y = hf.createCloud1D('trackY', 'trackY')
-z = hf.createCloud1D('trackZ', 'trackZ')
-
-px = hf.createCloud1D('trackPX', 'trackPX')
-py = hf.createCloud1D('trackPY', 'trackPY')
-pz = hf.createCloud1D('trackPZ', 'trackPZ')
-
-d0 = hf.createCloud1D('d0', 'd0')
-phi0 = hf.createCloud1D('phi0', 'phi0')
-omega = hf.createCloud1D('omega', 'omega')
-z0 = hf.createCloud1D('z0', 'z0')
-s = hf.createCloud1D('s', 's')
-
-orgx = hf.createCloud1D('orgX', 'orgX')
-#orgy = hf.createCloud1D('orgY', 'orgY')
-
-fac = MCFastTrackFactory()
-momentum = CartesianPoint(2, 2, 2)
-for iev in range(1,100):
-  for iy in range(1,100):
-    point = CartesianPoint(-10 + 20./iev, -10 + 20./iy, 5)
-
-    track = fac.getMCTrack(momentum, point, 1)
-    
-#    x.fill(track.getReferencePointX())
-#    y.fill(track.getReferencePointY())
-#    z.fill(track.getReferencePointZ())
-#    px.fill(track.getPX())
-#    py.fill(track.getPY())
-#    pz.fill(track.getPZ())
-    parms = track.getTrackParameters()
-    helix = HelixSwimmer(5)
-    helix.setTrack(track)
-    
-    d0.fill(parms[0])
-    phi0.fill(parms[1])
-    omega.fill(parms[2])
-    z0.fill(parms[3])
-    s.fill(parms[4])
-    orgx.fill(helix.getDistanceToPoint(point))
-#    orgy.fill(xy.y())
-
-tree.commit()
-tree.close()
-
-
-
-
-
-

lcsim/src/org/lcsim/contrib/JanStrube
ZvTopDriver.java removed after 1.5
diff -N ZvTopDriver.java
--- ZvTopDriver.java	27 Mar 2006 06:38:08 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,73 +0,0 @@
-import hep.physics.jet.AbstractJetFinder;
-import hep.physics.jet.FixNumberOfJetsFinder;
-import hep.physics.jet.JadeEJetFinder;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import java.util.ArrayList;
-import java.util.Formatter;
-import java.util.List;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.Track;
-import org.lcsim.geometry.Detector;
-import org.lcsim.mc.fast.MCFast;
-import org.lcsim.recon.vertexing.zvtop4.ZvFitter;
-import org.lcsim.recon.vertexing.zvtop4.ZvTop;
-import org.lcsim.recon.vertexing.zvtop4.ZvTrack;
-import org.lcsim.recon.vertexing.zvtop4.ZvVertex;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-import org.lcsim.util.swim.HelixSwimmer;
-
-/*
- * Puts Vertices and the associated Tracks into the event cache
- * for WIRED4 to pick up
- * @author jstrube
- * @version $Id$
- */
-public class ZvTopDriver extends Driver {
-    private HelixSwimmer swimmer;
-    private ZvFitter fitter;
-    private ZvTop topper;
-    AbstractJetFinder jetFind;
-    List<ZvVertex> vertices;
-    public ZvTopDriver() {
-        add(new MCFast());
-    }
-
-
-    public void process(EventHeader event) {
-        super.process(event);
-        // Get the list of MCParticles from the event
-        List<Track> tracks = event.getTracks();
-        // Histogram the number of particles per event
-        // Loop over the particles
-        Detector thisDetector = event.getDetector();
-        fitter = new ZvFitter(thisDetector);
-        FixNumberOfJetsFinder jetFind = new FixNumberOfJetsFinder(2);
-        List<Hep3Vector> eventVectorList = new ArrayList<Hep3Vector>();
-        for (Track iTrack : tracks) {
-            eventVectorList.add(new BasicHep3Vector(iTrack.getMomentum()));
-        }
-        jetFind.setEvent(eventVectorList);
-        topper = new ZvTop(jetFind.jet(0).v3(), fitter);
-        // should be proportional to jet momentum
-        topper.setAngularWeight(2);
-        topper.setIpWeight(1);
-        topper.setMaxDistFromIP(25);
-        topper.setResolvedCut(0.5);
-        vertices = topper.findVertices(tracks);
-        System.out.printf("found %d vertices\n", vertices.size());
-        for (ZvVertex iVtx : vertices) {
-            System.out.println("Vertex at pos: " + iVtx.getPosition());
-        }
-        List<ZvTrack> zvTracks = new ArrayList<ZvTrack>();
-        for (Track t : tracks) {
-            zvTracks.add(new ZvTrack(t));
-        }
-        event.put("ZvTracks", zvTracks, ZvTrack.class, 0);
-        event.put("VtxList", vertices, ZvVertex.class, 0);
-    }
-}

lcsim
.project 1.3 -> 1.4
diff -N .project
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .project	28 Jun 2006 01:54:48 -0000	1.4
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>lcsim</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.python.pydev.PyDevBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.python.pydev.pythonNature</nature>
+	</natures>
+</projectDescription>

lcsim
.classpath 1.5 -> 1.6
diff -N .classpath
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .classpath	28 Jun 2006 01:54:48 -0000	1.6
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry excluding="org/lcsim/contrib/CalAnal/|org/lcsim/contrib/CarstenHensel/|org/lcsim/contrib/LeiXia/|org/lcsim/contrib/SODTracker/|org/lcsim/contrib/SODTracker/test/|org/lcsim/contrib/SteveKuhlmann/|org/lcsim/contrib/compile/SteveMagill/|org/lcsim/contrib/garfield/|org/lcsim/contrib/garfield/tester/|org/lcsim/contrib/proulx/ganging/|org/lcsim/contrib/timb/mc/fast/|org/lcsim/contrib/timb/util/|org/lcsim/contrib/tracking/|org/lcsim/contrib/uiowa/hitmap/|org/lcsim/contrib/uiowa/mipfinder/|org/lcsim/contrib/uiowa/mst/|org/lcsim/contrib/uiowa/standalone/|org/lcsim/contrib/uiowa/structural/|org/lcsim/contrib/uiowa/structural/likelihood/|org/lcsim/contrib/uiowa/template/|org/lcsim/contrib/uiowa/util/|org/lcsim/contrib/uiowa/util/decision/|org/lcsim/plugin/|org/lcsim/plugin/web/examples/|org/lcsim/recon/pfa/cheat/" kind="src" path="src"/>
+	<classpathentry kind="src" path="test"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/lib/freehep-base.jar"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/lib/jdom.jar"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/lib/openide-lookup.jar"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/extensions/bcel.jar"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/extensions/freehep-hep.jar"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/extensions/freehep-heprep.jar"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/extensions/freehep-physics.jar"/>
+	<classpathentry kind="lib" path="/afs/slac.stanford.edu/u/br/jstrube/.JAS3/extensions/sio.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/extensions/aida.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/extensions/aida-dev.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/extensions/freehep-hep.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/extensions/jc.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/extensions/jel.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/extensions/jxl.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/lib/freehep-base.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/lib/jdom.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/lib/jlfgr.jar"/>
+	<classpathentry kind="lib" path="/u1/local/JAS3/lib/openide-lookup.jar"/>
+	<classpathentry kind="lib" path="/u/br/jstrube/.JAS3/extensions/GeomConverter.jar"/>
+	<classpathentry kind="lib" path="/u/br/jstrube/.JAS3/extensions/commons-math.jar"/>
+	<classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
VertexFactory.java added at 1.1
diff -N VertexFactory.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ VertexFactory.java	28 Jun 2006 01:54:49 -0000	1.1
@@ -0,0 +1,53 @@
+package org.lcsim.contrib.JanStrube.vtxFitter;
+
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.Track;
+import org.lcsim.event.base.BaseReconstructedParticle;
+import org.lcsim.mc.fast.tracking.MCFastTrackFactory;
+import org.lcsim.recon.tracking.trfutil.RandomGenerator;
+import static org.lcsim.recon.vertexing.zvtop4.VectorArithmetic.subtract;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+
+/**
+ * Class to create ReconstructedParticle objects consisting
+ * of tracks with random (within limits) properties
+ * @author jstrube
+ *
+ */
+public class VertexFactory extends RandomGenerator {
+	SpacePoint momentum;
+	int charge;
+	/**
+	 * Creates a ReconstructedParticle at the given position and with the given momentum.
+	 * The momentum of the daughter tracks is random, but adds up to the given momentum.
+	 * The charge of the vertex is related to the number of tracks as follows:
+	 * charge = (-1)^(round(nTracks/2))
+	 * @param pos the position of the vertex in space 
+	 * @param mom the sum of the momenta of the tracks
+	 * @param charge the sum of the charges of the tracks
+	 * @param nTracks the number of tracks
+	 * @return a new Vertex with the desired properties
+	 */
+	public Vertex makeVertex(SpacePoint pos, SpacePoint mom, int nTracks) {
+		if (nTracks < 1)
+			throw new IllegalArgumentException("nTracks should be > 1");
+		SpacePoint zero = new CartesianPoint(0, 0, 0);
+		momentum = (SpacePoint) mom.clone();
+		Vertex particle = new Vertex(0.);
+		particle.setOrigin(pos);
+		MCFastTrackFactory fac = new MCFastTrackFactory();
+		for (int i=0; i<nTracks-1; i++) {
+			int c = (int) Math.pow(-1, Math.round(i/2));
+			double px = flat(-momentum.x(), momentum.x());
+			double py = flat(-momentum.y(), momentum.y());
+			double pz = flat(-momentum.z(), momentum.z());
+			SpacePoint p = new CartesianPoint(px, py, pz);
+			momentum = (SpacePoint) subtract(momentum, p);
+			Track t = fac.getMCTrack(p, pos, c);
+			particle.addTrack(t);
+		}
+		particle.addTrack(fac.getMCTrack(momentum, pos, (int)Math.pow(-1, Math.round(nTracks/2))));
+		return particle;
+	}
+}

lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
VertexFactoryTest.java added at 1.1
diff -N VertexFactoryTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ VertexFactoryTest.java	28 Jun 2006 01:54:49 -0000	1.1
@@ -0,0 +1,53 @@
+package org.lcsim.contrib.JanStrube.vtxFitter;
+
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+
+import junit.framework.TestCase;
+
+public class VertexFactoryTest extends TestCase {
+	SpacePoint x;
+	SpacePoint p;
+	VertexFactory fac;
+	protected void setUp() throws Exception {
+		super.setUp();
+		x = new CartesianPoint(3.6, -4.3, 2.1);
+		p = new CartesianPoint(4.2, 2.7, 2.2);
+		fac = new VertexFactory();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	/*
+	 * Test method for 'vtxFitter.VertexFactory.makeVertex(SpacePoint, SpacePoint, int)'
+	 */
+	public void testMakeVertex() {
+		// positively charged Vertex
+		Vertex part = fac.makeVertex(x, p, 1);
+		System.out.println(part.origin().toString());
+		assertEquals(x.equals(part.origin()), true);
+		System.out.println(part.getMomentum().toString());
+		assertEquals(p.equals(part.getMomentum(), 1e-2), true);
+		assertEquals(part.getCharge(), 1);
+		assertEquals(part.getTracks().size(), 1);
+		
+		// neutral Vertex
+		part = fac.makeVertex(x, p, 4);
+		assertEquals(p.equals(part.getMomentum()), true);
+		assertEquals(x.equals(part.getReferencePoint()), true);
+		assertEquals(part.getCharge(), 0);
+		assertEquals(part.getTracks().size(), 4);
+
+		// neutral Vertex
+		part = fac.makeVertex(x, p, 7);
+		assertEquals(p.equals(part.getMomentum()), true);
+		assertEquals(x.equals(part.getReferencePoint()), true);
+		assertEquals(part.getCharge(), -1);
+		assertEquals(part.getTracks().size(), 7);
+
+	}
+
+}

lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
Vertex.java added at 1.1
diff -N Vertex.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Vertex.java	28 Jun 2006 01:54:49 -0000	1.1
@@ -0,0 +1,32 @@
+package org.lcsim.contrib.JanStrube.vtxFitter;
+
+import org.lcsim.event.base.BaseReconstructedParticle;
+import org.lcsim.spacegeom.CartesianPoint;
+import org.lcsim.spacegeom.SpacePoint;
+
+public class Vertex extends BaseReconstructedParticle {
+	private SpacePoint origin;
+	private SpacePoint endpoint;
+	
+	public Vertex(double mass) {
+		super(mass);
+		origin = new CartesianPoint(0, 0, 0);
+		endpoint = new CartesianPoint(0, 0, 0);
+	}
+	
+	public void setOrigin(SpacePoint x) {
+		origin = x;
+	}
+	
+	public void setEndPoint(SpacePoint x) {
+		endpoint = x;
+	}
+	
+	public SpacePoint endpoint() {
+		return endpoint;
+	}
+	
+	public SpacePoint origin() {
+		return origin;
+	}
+}

lcsim/src/org/lcsim/recon/vertexing/zvtop4
VectorArithmetic.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- VectorArithmetic.java	31 Jan 2006 23:34:34 -0000	1.9
+++ VectorArithmetic.java	28 Jun 2006 01:54:49 -0000	1.10
@@ -12,7 +12,7 @@
 /**
  * Class to perform basic vector arithmetic on Hep3Vectors
  * @author jstrube
- * @version $Id: VectorArithmetic.java,v 1.9 2006/01/31 23:34:34 jstrube Exp $
+ * @version $Id: VectorArithmetic.java,v 1.10 2006/06/28 01:54:49 jstrube Exp $
  */
 final public class VectorArithmetic {
 
@@ -125,6 +125,20 @@
     }
 
     /**
+     * Calculates the sum of two 3-vectors
+     * @param a vector 1
+     * @param b vector 2
+     * @return the euclidian sum
+     */
+    public static Hep3Vector add(Hep3Vector a, double[] b) {
+    	if (b.length != 3)
+    		throw new IllegalArgumentException("b must have length 3");
+    	double[] x = new double[] {a.x() + b[0], a.y() + b[1], a.z() + b[2]};
+    	return new BasicHep3Vector(x);
+    }
+    
+    
+    /**
      * Returns the distance between two space points.
      * @param spt1 SpacePoint 1
      * @param spt2 SpacePoint 2
@@ -174,10 +188,17 @@
         return result;
     }
     
+    /**
+     * Calculates the Euclidian norm of the vector x
+     * @param x a vector
+     * @return norm of x
+     */
     @Deprecated public static double magnitude(double[] x) {
-        if (x.length != 3)
-            return -1;
-        return Math.sqrt(x[0]*x[0] + x[1]*x[1] + x[2]*x[2]);
+    	double norm = 0;
+    	for (int i=0; i<x.length; ++i) {
+    		norm += x[i]*x[i];
+    	}
+        return Math.sqrt(norm);
     }
     
     @Deprecated public static Hep3Vector unit(double[] x) {

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvTrack.java 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- ZvTrack.java	31 Jan 2006 23:34:34 -0000	1.22
+++ ZvTrack.java	28 Jun 2006 01:54:49 -0000	1.23
@@ -11,6 +11,7 @@
 import org.lcsim.geometry.compact.converter.lcdd.util.Rotation;
 import org.lcsim.spacegeom.CartesianPoint;
 import org.lcsim.spacegeom.SpacePoint;
+import org.lcsim.util.swim.Helix;
 
 import static java.lang.Math.sqrt;
 import static java.lang.Math.cos;
@@ -22,7 +23,7 @@
  * Representation of the Gaussian tubes
  * 
  * @author jstrube
- * @version $Id: ZvTrack.java,v 1.22 2006/01/31 23:34:34 jstrube Exp $
+ * @version $Id: ZvTrack.java,v 1.23 2006/06/28 01:54:49 jstrube Exp $
  */
 public class ZvTrack implements Track {
 
@@ -341,6 +342,19 @@
         return orgTrack.getType();
     }
 
+    
+    /**
+     * Calculates a Gaussian probability for a track to go through location
+     * @param location      
+     *            The spatial position at which to evaluate the "track
+     *            probability" in the lab frame
+     * @return the "track probability" at that location
+     */
+    public double getProbability(SpacePoint location) {
+    	Track x;
+    	//x.
+    	return 0;
+    }
     /**
      * Calculates a Gaussian uncertainty around the track. A parabolic
      * approximation is made instead of a helical parametrization The apex is at

lcsim/src/org/lcsim/recon/vertexing/zvtop4
ZvUtil.java 1.16 -> 1.17
diff -u -r1.16 -r1.17
--- ZvUtil.java	22 May 2006 07:56:42 -0000	1.16
+++ ZvUtil.java	28 Jun 2006 01:54:49 -0000	1.17
@@ -26,7 +26,7 @@
 /**
  * Repository of utility functions
  * @author jstrube
- * @version $Id: ZvUtil.java,v 1.16 2006/05/22 07:56:42 jstrube Exp $
+ * @version $Id: ZvUtil.java,v 1.17 2006/06/28 01:54:49 jstrube Exp $
  */
 final class ZvUtil {
 
@@ -51,7 +51,12 @@
         HelixSwimmer swimmer = new HelixSwimmer(5);
         swimmer.setTrack(iTrack);
         swimmer.getDistanceToPoint(new CartesianPoint(jTrack.getReferencePoint()));
-        
+        double x_i;
+        double x_j;
+        double y_i;
+        double y_j;
+        double z_i;
+        double z_j;
         return new SpacePoint();
     }
     
@@ -70,7 +75,7 @@
             double closestJTrackLength = jTrack.closestParabolaPointOptimized(thisITrackPoint);
             SpacePoint closestJTrackPoint = jTrack.getTubeCenter(closestJTrackLength);
             SpacePointVector t = new SpacePointVector(thisITrackPoint, closestJTrackPoint);
-            for(int iPoint=1; iPoint<=50; ++iPoint) {
+            for (int iPoint=1; iPoint<=50; ++iPoint) {
                 SpacePoint checkPoint = t.getPointAtLength(1/iPoint);
                 double overlap = iTrack.getTubeValue(checkPoint) * jTrack.getTubeValue(checkPoint); 
                 if (overlap > maxOverlap) {
@@ -151,8 +156,6 @@
         double z = hlxPar[tanLambda]/norm;
         return new BasicHep3Vector(x, y, z);
     }
-    // conversion constant 
-    public final static double fieldConversion = 1./333.567; // GeV/(cm*T)
     
     public static Track.Parameters convert2TrackParameters (ZvParameters params) {
         Track.Parameters result = new Track.Parameters();

lcsim/src/org/lcsim/math/distribution
MoyalDistribution.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- MoyalDistribution.java	18 Jul 2005 07:12:46 -0000	1.1
+++ MoyalDistribution.java	28 Jun 2006 01:54:50 -0000	1.2
@@ -1,3 +1,5 @@
+package org.lcsim.math.distribution;
+
 import java.util.Random;
 
 public class MoyalDistribution

lcsim/src/org/lcsim/spacegeom
SpacePoint.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- SpacePoint.java	18 Oct 2005 16:39:45 -0000	1.6
+++ SpacePoint.java	28 Jun 2006 01:54:50 -0000	1.7
@@ -2,6 +2,7 @@
 import static java.lang.Math.cos;
 import static java.lang.Math.sin;
 import static java.lang.Math.sqrt;
+import static java.lang.Math.abs;
 import static org.lcsim.spacegeom.Representation.Cartesian;
 import hep.physics.vec.Hep3Vector;
 
@@ -9,7 +10,7 @@
 
 /**
  *
- *@version $Id: SpacePoint.java,v 1.6 2005/10/18 16:39:45 ngraf Exp $
+ *@version $Id: SpacePoint.java,v 1.7 2006/06/28 01:54:50 jstrube Exp $
  */
 public class SpacePoint implements Serializable, Cloneable, Hep3Vector
 {
@@ -307,18 +308,41 @@
     
     
     /**
-     *Equality
-     *
-     * @param   spt SpacePoint to compare
-     * @return  true if objects are equal
+     * Tests for equality within errors
+     * @param spt a SpacePoint to compare against
+     * @param precision the precision of the comparison
+     * @return true if each of the components is within precision
+     * of the components of spt 
      */
-    public boolean equals(SpacePoint spt)
+    public boolean equals(SpacePoint spt, double precision)
     {
-        return ( x()==spt.x() ) &&
-                ( y()==spt.y() ) &&
-                ( z()==spt.z() );
+        return ( abs(x() - spt.x()) < precision ) &&
+                ( abs(y() - spt.y()) < precision ) &&
+                ( abs(z() - spt.z()) < precision );
     }
     
+    /**
+     * Tests for equality within errors
+     * @param spt a Hep3Vector to compare against
+     * @param precision the precision of the comparison
+     * @return true if each of the components is within precision
+     * of the components of spt 
+     */
+    public boolean equals(Hep3Vector spt, double precision)
+    {
+        return ( abs(x() - spt.x()) < precision ) &&
+                ( abs(y() - spt.y()) < precision ) &&
+                ( abs(z() - spt.z()) < precision );
+    }
+
+    /**
+     * Tests for equality
+     * @param   x SpacePoint to compare
+     * @return  true if objects are equal
+     */
+    public boolean equals(SpacePoint x) {
+    	return equals(x, 1e-10);
+    }
     
     /**
      *Inequality

lcsim/src/org/lcsim/event/base
BaseReconstructedParticle.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- BaseReconstructedParticle.java	22 Jun 2006 01:42:19 -0000	1.4
+++ BaseReconstructedParticle.java	28 Jun 2006 01:54:50 -0000	1.5
@@ -3,23 +3,24 @@
  *
  * Created on March 24, 2006, 9:30 AM
  *
- * $Id: BaseReconstructedParticle.java,v 1.4 2006/06/22 01:42:19 mcharles Exp $
+ * $Id: BaseReconstructedParticle.java,v 1.5 2006/06/28 01:54:50 jstrube Exp $
  */
 
 package org.lcsim.event.base;
 
-import hep.physics.particle.Particle;
-import hep.physics.particle.properties.ParticleType;
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.BasicHepLorentzVector;
 import hep.physics.vec.Hep3Vector;
 import hep.physics.vec.HepLorentzVector;
+
 import java.util.ArrayList;
 import java.util.List;
-import org.lcsim.event.*;
-import org.lcsim.mc.fast.reconstructedparticle.MCFastParticleID;
 
-import static java.lang.Math.sqrt;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.ParticleID;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.Track;
+import org.lcsim.recon.vertexing.zvtop4.VectorArithmetic;
 /**
  *
  * @author Norman Graf
@@ -31,7 +32,7 @@
     protected double[] _covMatrix = new double[10];
     protected double _mass;
     protected double _charge;
-    protected Hep3Vector _referencePoint;
+    protected BasicHep3Vector _referencePoint = new BasicHep3Vector();
     protected List<ParticleID> _particleIds = new ArrayList<ParticleID>();
     protected ParticleID _particleIdUsed;
     protected double _goodnessOfPid;
@@ -43,6 +44,11 @@
     // TODO currently adding tracks and clusters does not update four vector. Need to fix.
     public BaseReconstructedParticle()
     {
+    	this(0);
+    }
+    
+    public BaseReconstructedParticle(double mass) {
+    	_mass = mass;
     }
     
 // ReconstructedParticle interface
@@ -182,7 +188,7 @@
     }
     
     /**
-     * Add a particle that has been used to create this particle.
+     * Adds a particle that has been used to create this particle.
      * @param particle A ReconstructedParticle which contributes to this ReconstructedParticle.
      */
     // TODO make sure kinematics of this particle are also updated
@@ -192,7 +198,7 @@
     }
     
     /**
-     * Add a cluster that has been used to create this particle.
+     * Adds a cluster that has been used to create this particle.
      * @param cluster A Cluster which contributes to this ReconstructedParticle.
      */
     // TODO make sure kinematics of this particle are also updated
@@ -202,13 +208,19 @@
     }
     
     /**
-     * Add a track that has been used to create this particle.
+     * Adds a track that has been used to create this particle.
      * @param track A Track which contributes to this ReconstructedParticle.
      */
     // TODO make sure kinematics of this particle are also updated
     public void addTrack(Track track)
     {
         _tracks.add(track);
+        // FIXME there is something wrong if adding information from a track to a HeplorentzVector is _this_ complicated.
+        double p = VectorArithmetic.magnitude(track.getMomentum());
+        double energy = Math.sqrt(p*p + _mass*_mass) + _fourVec.t();
+        Hep3Vector momentum = VectorArithmetic.add(_fourVec.v3(), track.getMomentum());
+        // FIXME HeplorentzVector.setV3 sets all four components ? That is not intuitive.
+        _fourVec.setV3(energy, momentum);
     }
     
     /**

lcsim/src/org/lcsim/util/swim
HelixSwimmer.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- HelixSwimmer.java	30 May 2006 06:17:50 -0000	1.13
+++ HelixSwimmer.java	28 Jun 2006 01:54:50 -0000	1.14
@@ -14,7 +14,7 @@
  * For more info on swimming see <a href="doc-files/transport.pdf">this paper</a>
  * by Paul Avery.
  * @author tonyj
- * @version $Id: HelixSwimmer.java,v 1.13 2006/05/30 06:17:50 jstrube Exp $
+ * @version $Id: HelixSwimmer.java,v 1.14 2006/06/28 01:54:50 jstrube Exp $
  */
 public class HelixSwimmer
 {
@@ -104,6 +104,11 @@
       return Double.isNaN(x1) ? x2 : Math.min(x1,x2);
    }
    
+   /**
+    * Returns the distance along the trajectory to get to the point of closest approach 
+    * @param point The point to swim as close as possible to
+    * @return the length parameter by how much the trajectory has to be swum
+    */
    public double getDistanceToPoint(Hep3Vector point) {
        return trajectory.getDistanceToPoint(point);
    }
CVSspam 0.2.8