Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/recon/vertexing on MAIN
TwoParticleVertexer.java+49added 1.1
TwoTrackVertexer.java+48added 1.1
SimpleVertexer.java+21added 1.1
TwoLineVertexer.java+52added 1.1
+170
4 added files
New 2-track vertexing: can use MCParticle or Track objects.

hps-java/src/main/java/org/lcsim/hps/recon/vertexing
TwoParticleVertexer.java added at 1.1
diff -N TwoParticleVertexer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TwoParticleVertexer.java	22 Dec 2012 20:42:51 -0000	1.1
@@ -0,0 +1,49 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.recon.vertexing;
+
+import org.lcsim.hps.recon.vertexing.TwoLineVertexer;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+import org.lcsim.event.MCParticle;
+
+/**
+ *
+ * @author phansson
+ */
+public class TwoParticleVertexer extends TwoLineVertexer {
+    private MCParticle trk1;
+    private MCParticle trk2;
+    public TwoParticleVertexer() {
+    }
+    public void setParticle(MCParticle track1,MCParticle track2) {
+        trk1 = track1;
+        trk2 = track2;
+    }
+    Hep3Vector propAlongLine(Hep3Vector org, Hep3Vector p, double dz) {
+        double tanPxPz = p.x() / p.z();
+        double tanPyPz = p.y() / p.z();
+        double dx = dz * tanPxPz;
+        double dy = dz * tanPyPz;
+        return new BasicHep3Vector(org.x() + dx, org.y() + dy, org.z() + dz);
+    }
+    @Override
+    public Hep3Vector getVertex() {
+        Hep3Vector A1 = trk1.getOrigin();
+        Hep3Vector p1 = trk1.getMomentum();
+        Hep3Vector B1 = trk2.getOrigin();
+        Hep3Vector p2 = trk2.getMomentum();
+        //propagate to different position
+        double dz = 20.0;
+        Hep3Vector A2 = this.propAlongLine(A1, p1, dz);
+        Hep3Vector B2 = this.propAlongLine(B1, p2, dz);
+        return getVertexPosition(VecOp.mult(_detToTrk.getMatrix(), A1), VecOp.mult(_detToTrk.getMatrix(), A2), VecOp.mult(_detToTrk.getMatrix(), B1), VecOp.mult(_detToTrk.getMatrix(), B2));
+    }
+
+    
+    
+    
+}

hps-java/src/main/java/org/lcsim/hps/recon/vertexing
TwoTrackVertexer.java added at 1.1
diff -N TwoTrackVertexer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TwoTrackVertexer.java	22 Dec 2012 20:42:51 -0000	1.1
@@ -0,0 +1,48 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.recon.vertexing;
+
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+import org.lcsim.event.Track;
+import org.lcsim.hps.recon.tracking.SvtTrackExtrapolator;
+
+/**
+ *
+ * @author phansson
+ */
+public class TwoTrackVertexer extends TwoLineVertexer {
+    private SvtTrackExtrapolator trackExtraPolator = new SvtTrackExtrapolator();
+    private Track trk1;
+    private Track trk2;
+    
+    public TwoTrackVertexer() {
+    }
+
+    public void setTracks(Track track1,Track track2) {
+        this.trk1 = track1;
+        this.trk2 = track2;
+    }
+    
+    public SvtTrackExtrapolator extrapolator() {
+        return trackExtraPolator;
+    }
+    
+    private Hep3Vector getPosition(Track trk, double zposition) {
+        trackExtraPolator.setTrack(trk);
+        return trackExtraPolator.extrapolateTrack(zposition);
+    }
+
+    @Override
+    public Hep3Vector getVertex() {
+        Hep3Vector A1 = this.getPosition(trk1, 0);
+        Hep3Vector A2 = this.getPosition(trk1, SvtTrackExtrapolator.HARP_POSITION);
+        Hep3Vector B1 = this.getPosition(trk2, 0);
+        Hep3Vector B2 = this.getPosition(trk2, SvtTrackExtrapolator.HARP_POSITION);
+        return getVertexPosition(VecOp.mult(_detToTrk.getMatrix(), A1), VecOp.mult(_detToTrk.getMatrix(), A2), VecOp.mult(_detToTrk.getMatrix(), B1), VecOp.mult(_detToTrk.getMatrix(), B2));
+    }
+    
+    
+}

hps-java/src/main/java/org/lcsim/hps/recon/vertexing
SimpleVertexer.java added at 1.1
diff -N SimpleVertexer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SimpleVertexer.java	22 Dec 2012 20:42:51 -0000	1.1
@@ -0,0 +1,21 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.recon.vertexing;
+
+import hep.physics.vec.Hep3Vector;
+import org.lcsim.hps.event.HPSTransformations;
+
+/**
+ *
+ * @author phansson
+ */
+public interface SimpleVertexer {
+
+    static final HPSTransformations _detToTrk = new HPSTransformations();
+    
+    public Hep3Vector getVertex();
+    
+    
+}

hps-java/src/main/java/org/lcsim/hps/recon/vertexing
TwoLineVertexer.java added at 1.1
diff -N TwoLineVertexer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ TwoLineVertexer.java	22 Dec 2012 20:42:51 -0000	1.1
@@ -0,0 +1,52 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.recon.vertexing;
+
+import org.lcsim.hps.recon.vertexing.SimpleVertexer;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+import org.lcsim.event.Track;
+import org.lcsim.hps.event.HPSTransformations;
+
+/**
+ *
+ * @author phansson
+ */
+public class TwoLineVertexer implements SimpleVertexer {
+
+    public TwoLineVertexer() {
+    }
+    
+    public Hep3Vector getVertexPosition(Hep3Vector A1, Hep3Vector A2, Hep3Vector B1, Hep3Vector B2) {
+        /*
+         * Line1 defined by A1 and A2
+         * Line2 defined by B1 and B2
+         *
+         * nA = dot(cross(B2-B1,A1-B1),cross(A2-A1,B2-B1));
+         * nB = dot(cross(A2-A1,A1-B1),cross(A2-A1,B2-B1));
+         * d = dot(cross(A2-A1,B2-B1),cross(A2-A1,B2-B1));
+         * A0 = A1 + (nA/d)*(A2-A1);
+         * B0 = B1 + (nB/d)*(B2-B1);
+         */
+        System.out.printf("%s: A1=%s A2=%s B1=%s B2=%s\n", this.getClass().getSimpleName(), A1.toString(), A2.toString(), B1.toString(), B2.toString());
+        double nA = VecOp.dot(VecOp.cross(VecOp.sub(B2, B1), VecOp.sub(A1, B1)), VecOp.cross(VecOp.sub(A2, A1), VecOp.sub(B2, B1)));
+        double nB = VecOp.dot(VecOp.cross(VecOp.sub(A2, A1), VecOp.sub(A1, B1)), VecOp.cross(VecOp.sub(A2, A1), VecOp.sub(B2, B1)));
+        double d = VecOp.dot(VecOp.cross(VecOp.sub(A2, A1), VecOp.sub(B2, B1)), VecOp.cross(VecOp.sub(A2, A1), VecOp.sub(B2, B1)));
+        Hep3Vector A0 = VecOp.add(A1, VecOp.mult(nA / d, VecOp.sub(A2, A1)));
+        Hep3Vector B0 = VecOp.add(B1, VecOp.mult(nB / d, VecOp.sub(B2, B1)));
+        Hep3Vector diff = VecOp.sub(B0, A0);
+        Hep3Vector tmp = VecOp.mult(0.5, diff);
+        Hep3Vector vertexPos = VecOp.add(A0, tmp);
+        System.out.printf("%s: A0=%s B0=%s ==> vtxPos=%s (tmp=%s)\n", this.getClass().getSimpleName(), A0.toString(), B0.toString(), vertexPos.toString(), tmp.toString());
+        return vertexPos;
+    }
+
+    @Override
+    public Hep3Vector getVertex() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    
+}
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1