Commit in hps-java/src/main on MAIN | |||
java/org/lcsim/hps/recon/particle/TestRunReconParticleDriver.java | +3 | -2 | 1.2 -> 1.3 |
java/org/lcsim/hps/recon/vertexing/BaseSimpleVertexer.java | +36 | added 1.1 | |
/TwoTrackFringeVertexer.java | +69 | added 1.1 | |
/SimpleVertexer.java | +3 | -3 | 1.2 -> 1.3 |
/TwoLineVertexer.java | +101 | -10 | 1.3 -> 1.4 |
/TwoParticleVertexer.java | +29 | -23 | 1.2 -> 1.3 |
/TwoTrackVertexer.java | +5 | -127 | 1.9 -> 1.10 |
java/org/lcsim/hps/users/phansson/TwoTrackAnlysis.java | +43 | -29 | 1.26 -> 1.27 |
resources/org/lcsim/hps/steering/users/phansson/TwoTrackAnalysis.lcsim | +1 | -1 | 1.8 -> 1.9 |
+290 | -195 |
Updating to a more sane structure and adding yet another calculation of 3D POCA for lines.
diff -u -r1.2 -r1.3 --- TestRunReconParticleDriver.java 12 Jun 2013 22:56:07 -0000 1.2 +++ TestRunReconParticleDriver.java 18 Oct 2013 16:46:01 -0000 1.3 @@ -15,7 +15,7 @@
/** * * @author Omar Moreno <[log in to unmask]>
- * @version $Id: TestRunReconParticleDriver.java,v 1.2 2013/06/12 22:56:07 phansson Exp $
+ * @version $Id: TestRunReconParticleDriver.java,v 1.3 2013/10/18 16:46:01 phansson Exp $
*/ public class TestRunReconParticleDriver extends ReconParticleDriver {
@@ -39,7 +39,8 @@
Track electronTrack = electron.getTracks().get(0); Track positronTrack = positron.getTracks().get(0); vtxFitter.setTracks(electronTrack, positronTrack);
- Vertex vertex = vtxFitter.fitVertex();
+ vtxFitter.fitVertex(); + Vertex vertex = vtxFitter.getFittedVertex();
ReconstructedParticle candidate = new BaseReconstructedParticle(); ((BaseReconstructedParticle) candidate).setStartVertex(vertex);
diff -N BaseSimpleVertexer.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ BaseSimpleVertexer.java 18 Oct 2013 16:46:01 -0000 1.1 @@ -0,0 +1,36 @@
+package org.lcsim.hps.recon.vertexing; + +import org.lcsim.event.Vertex; + +/** + * + * Base class for simple vertexer objects. + * + * @author phansson + * + */ +public abstract class BaseSimpleVertexer implements SimpleVertexer { + + + protected boolean _debug = false; + protected Vertex _fitted_vertex = null; + + public BaseSimpleVertexer() { + } + + @Override + public abstract void fitVertex(); + + @Override + public Vertex getFittedVertex() { + return _fitted_vertex; + } + + public void clear() { + _fitted_vertex = null; + } + + public abstract boolean isValid(); + + +}
\ No newline at end of file
diff -N TwoTrackFringeVertexer.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ TwoTrackFringeVertexer.java 18 Oct 2013 16:46:01 -0000 1.1 @@ -0,0 +1,69 @@
+package org.lcsim.hps.recon.vertexing; + +import hep.physics.vec.BasicHep3Vector; +import hep.physics.vec.Hep3Vector; + +import org.lcsim.event.Track; +import org.lcsim.fit.helicaltrack.HelicalTrackFit; +import org.lcsim.fit.helicaltrack.HelixUtils; +import org.lcsim.hps.event.BeamlineConstants; +import org.lcsim.hps.recon.tracking.HPSTrack; +import org.lcsim.recon.tracking.seedtracker.SeedTrack; +import org.lcsim.util.swim.Helix; + +/** + * + * Class that vertexes two tracks taking into account fringe field + * + * @author phansson + * + */ +public class TwoTrackFringeVertexer extends TwoTrackVertexer { + protected HelixConverter converter = new HelixConverter(0.); + + public void setTracks(Track track1, Track track2) { + SeedTrack s1 = (SeedTrack) track1; + HelicalTrackFit htf1 = s1.getSeedCandidate().getHelix(); + HPSTrack hpstrk1 = new HPSTrack(htf1); + SeedTrack s2 = (SeedTrack) track2; + HelicalTrackFit htf2 = s2.getSeedCandidate().getHelix(); + HPSTrack hpstrk2 = new HPSTrack(htf2); + boolean debug = false; + + Hep3Vector posAtConv1 = hpstrk1.getPositionAtZMap(100.0, BeamlineConstants.HARP_POSITION_TESTRUN, 5.0)[0]; + Hep3Vector posAtConv2 = hpstrk2.getPositionAtZMap(100.0, BeamlineConstants.HARP_POSITION_TESTRUN, 5.0)[0]; + + StraightLineTrack slt1_conv = converter.Convert((Helix)hpstrk1.getTrajectory()); + StraightLineTrack slt2_conv = converter.Convert((Helix)hpstrk2.getTrajectory()); + + A1 = new BasicHep3Vector(slt1_conv.x0(),slt1_conv.y0(),slt1_conv.z0()); + B1 = new BasicHep3Vector(slt2_conv.x0(),slt2_conv.y0(),slt2_conv.z0()); + + double YZAtConv1[] = slt1_conv.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN); + double YZAtConv2[] = slt2_conv.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN); + + A2 = new BasicHep3Vector(BeamlineConstants.HARP_POSITION_TESTRUN,YZAtConv1[0],YZAtConv1[1]); + B2 = new BasicHep3Vector(BeamlineConstants.HARP_POSITION_TESTRUN,YZAtConv2[0],YZAtConv2[1]); + + if(debug) { + System.out.printf("%s: original track1 direction at x=0 %s \n",this.getClass().getSimpleName(),HelixUtils.Direction(hpstrk1,0.).toString()); + System.out.printf("%s: original track2 direction at x=0 %s \n",this.getClass().getSimpleName(),HelixUtils.Direction(hpstrk2,0.).toString()); + System.out.printf("%s: track1 direction at conv %s \n",this.getClass().getSimpleName(),hpstrk1.getTrajectory().getUnitTangentAtLength(0.).toString()); + System.out.printf("%s: track2 direction at conv %s \n",this.getClass().getSimpleName(),hpstrk2.getTrajectory().getUnitTangentAtLength(0.).toString()); + + + System.out.printf("%s: pos at converter track1 %s \n",this.getClass().getSimpleName(),posAtConv1.toString()); + System.out.printf("%s: pos at converter track2 %s \n",this.getClass().getSimpleName(),posAtConv2.toString()); + //System.out.printf("%s: dir at converter track1 %s (at 0: %s) \n",this.getClass().getSimpleName(),dirConv1.toString(),dirZero1.toString()); + //System.out.printf("%s: dir at converter track2 %s (at 0: %s) \n",this.getClass().getSimpleName(),dirConv2.toString(),dirZero2.toString()); + System.out.printf("%s: A1 %s \n",this.getClass().getSimpleName(),A1.toString()); + System.out.printf("%s: A2 %s \n",this.getClass().getSimpleName(),A2.toString()); + System.out.printf("%s: B1 %s \n",this.getClass().getSimpleName(),B1.toString()); + System.out.printf("%s: B2 %s \n",this.getClass().getSimpleName(),B2.toString()); + + } + } + + + +}
diff -u -r1.2 -r1.3 --- SimpleVertexer.java 15 Oct 2013 00:33:54 -0000 1.2 +++ SimpleVertexer.java 18 Oct 2013 16:46:01 -0000 1.3 @@ -4,7 +4,7 @@
*/ package org.lcsim.hps.recon.vertexing;
-import hep.physics.vec.Hep3Vector;
+import org.lcsim.event.Vertex;
/** *
@@ -12,7 +12,7 @@
*/ public interface SimpleVertexer {
- public Hep3Vector getVertex(); -
+ public void fitVertex(); + public Vertex getFittedVertex();
}
diff -u -r1.3 -r1.4 --- TwoLineVertexer.java 12 Jun 2013 22:56:07 -0000 1.3 +++ TwoLineVertexer.java 18 Oct 2013 16:46:01 -0000 1.4 @@ -4,22 +4,62 @@
*/ package org.lcsim.hps.recon.vertexing;
-import org.lcsim.hps.recon.vertexing.SimpleVertexer;
+import org.lcsim.event.base.BaseVertex; + +import hep.physics.matrix.BasicMatrix; +import hep.physics.matrix.MatrixOp;
import hep.physics.vec.Hep3Vector; import hep.physics.vec.VecOp;
-import org.lcsim.event.Track; -import org.lcsim.hps.event.HPSTransformations;
+import hep.physics.matrix.SymmetricMatrix; +
/**
+ * Class to calculate the POCA between two straight lines
* * @author phansson */
-public class TwoLineVertexer implements SimpleVertexer { - protected boolean _debug = false; - public TwoLineVertexer() {
+public class TwoLineVertexer extends BaseSimpleVertexer { + protected Hep3Vector A1,A2,B1,B2; + + public TwoLineVertexer() { + + } + + public void setLines(Hep3Vector PA1, Hep3Vector PA2, Hep3Vector PB1, Hep3Vector PB2) { + this.A1 = PA1; + this.A2 = PA2; + this.B1 = PB1; + this.B2 = PB2; + } + + public void clear() { + super.clear(); + setLines(null,null,null,null);
}
- public Hep3Vector getVertexPosition(Hep3Vector A1, Hep3Vector A2, Hep3Vector B1, Hep3Vector B2) {
+ public boolean isValid() { + if(A1==null || A2==null || B1==null || B2==null) return false; + else return true; + } + + @Override + public void fitVertex() { + assert isValid(); + Hep3Vector vtxPosition = getPOCALineToLine(); + _fitted_vertex = new BaseVertex(true, "Two Line Vertexer", 0, 0, new SymmetricMatrix(0), vtxPosition, null); + + } + + /** + * Function to calculate DCA in 3D of two lines + * @param A1 Starting 3D space point for one of the straight lines + * @param A2 End 3D space point for one of the straight lines + * @param B1 Starting 3D space point for one of the straight lines + * @param B2 End 3D space point for one of the straight lines + * @return position of closest approach of the two lines defined by the input parameters + */ + private Hep3Vector getPOCALineToLineAlt() { +
/* * Line1 defined by A1 and A2 * Line2 defined by B1 and B2
@@ -43,9 +83,60 @@
return vertexPos; }
- @Override - public Hep3Vector getVertex() { - throw new UnsupportedOperationException("Not supported yet.");
+ /** + * Function to calculate DCA in 3D of two lines + * @param A1 Starting 3D space point for one of the straight lines + * @param A2 End 3D space point for one of the straight lines + * @param B1 Starting 3D space point for one of the straight lines + * @param B2 End 3D space point for one of the straight lines + * @return position of closest approach of the two lines defined by the input parameters + */ + private Hep3Vector getPOCALineToLine() { + + if(_debug) 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 ya[][] = {VecOp.mult(-1,VecOp.sub(B1, A1)).v()}; + BasicMatrix y = (BasicMatrix)MatrixOp.transposed(new BasicMatrix(ya)); + Hep3Vector dB = VecOp.sub(B2, B1); + Hep3Vector dA = VecOp.sub(A2, A1); + BasicMatrix X = new BasicMatrix(3,2); + for(int col=0;col<2;++col) { + if(col==0) { + X.setElement(0, col, dB.x()); + X.setElement(1, col, dB.y()); + X.setElement(2, col, dB.z()); + } else { + X.setElement(0, col, -1*dA.x()); + X.setElement(1, col, -1*dA.y()); + X.setElement(2, col, -1*dA.z()); + } + } + + BasicMatrix X_T = (BasicMatrix)MatrixOp.transposed(X); + BasicMatrix XX_T = (BasicMatrix)MatrixOp.mult(X_T, X); + BasicMatrix IXX_T = (BasicMatrix)MatrixOp.inverse(XX_T); + BasicMatrix X_Ty = (BasicMatrix)MatrixOp.mult(X_T,y); + BasicMatrix b = (BasicMatrix)MatrixOp.mult(IXX_T, X_Ty); + double t = b.e(0, 0); + double s = b.e(1, 0); + Hep3Vector Bpca = VecOp.add(B1, VecOp.mult(t, dB)); + Hep3Vector Apca = VecOp.add(A1, VecOp.mult(s, dA)); + Hep3Vector vertex = VecOp.add(Apca, VecOp.mult(0.5, VecOp.sub(Bpca, Apca))); + if(_debug) { + System.out.printf("y:\n%s\n",y.toString()); + System.out.printf("X:\n%s\n",X.toString()); + System.out.printf("b:\n%s\n",b.toString()); + Hep3Vector ymin = VecOp.add(VecOp.mult(t, dB) , VecOp.mult(s, dA) ); + Hep3Vector yminprime = VecOp.add(VecOp.sub(B1, A1), ymin); + System.out.printf("ymin:\n%s\n",ymin.toString()); + System.out.printf("yminprime:\n%s\n",yminprime.toString()); + System.out.printf("Apca:\n%s\n",Apca.toString()); + System.out.printf("Bpca:\n%s\n",Bpca.toString()); + System.out.printf("vertex:\n%s\n",vertex.toString()); + } + return vertex; + +
}
diff -u -r1.2 -r1.3 --- TwoParticleVertexer.java 15 Oct 2013 00:33:54 -0000 1.2 +++ TwoParticleVertexer.java 18 Oct 2013 16:46:01 -0000 1.3 @@ -4,28 +4,48 @@
*/ package org.lcsim.hps.recon.vertexing;
-import org.lcsim.hps.event.HPSTransformations; -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;
+import org.lcsim.hps.event.HPSTransformations;
/** *
+ *Class that computes the vertex of two MC particles using the line vertexer class. + *
* @author phansson */ public class TwoParticleVertexer extends TwoLineVertexer {
- private MCParticle trk1; - private MCParticle trk2; - public TwoParticleVertexer() {
+ + public TwoParticleVertexer() {
} public void setParticle(MCParticle track1,MCParticle track2) {
- trk1 = track1; - trk2 = track2;
+ + //Calculate using detector coord. + Hep3Vector PA1 = track1.getOrigin(); + Hep3Vector PB1 = track2.getOrigin(); + Hep3Vector p1 = track1.getMomentum(); + Hep3Vector p2 = track2.getMomentum(); + + //propagate to different position + double dz = 20.0; + Hep3Vector PA2 = this.propAlongLine(PA1, p1, dz); + Hep3Vector PB2 = this.propAlongLine(PB1, p2, dz); + + if(_debug) { + System.out.printf("A1 %s p1 %s B1 %s p2 %s\n", PA1.toString(), p1.toString(), PB1.toString(), p2.toString()); + System.out.printf("A2 %s B2 %s\n", PA2.toString(), PB2.toString()); + } + + //set the member variables + A1 = HPSTransformations.transformVectorToTracking(PA1); + A2 = HPSTransformations.transformVectorToTracking(PA2); + B1 = HPSTransformations.transformVectorToTracking(PB1); + B2 = HPSTransformations.transformVectorToTracking(PB2); +
}
+
Hep3Vector propAlongLine(Hep3Vector org, Hep3Vector p, double dz) { double tanPxPz = p.x() / p.z(); double tanPyPz = p.y() / p.z();
@@ -33,20 +53,6 @@
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(HPSTransformations.getMatrix(), A1), VecOp.mult(HPSTransformations.getMatrix(), A2), VecOp.mult(HPSTransformations.getMatrix(), B1), VecOp.mult(HPSTransformations.getMatrix(), B2)); - } - -
}
diff -u -r1.9 -r1.10 --- TwoTrackVertexer.java 15 Oct 2013 00:57:24 -0000 1.9 +++ TwoTrackVertexer.java 18 Oct 2013 16:46:01 -0000 1.10 @@ -4,148 +4,26 @@
*/ package org.lcsim.hps.recon.vertexing;
-import hep.physics.matrix.SymmetricMatrix; -import hep.physics.vec.BasicHep3Vector; -import hep.physics.vec.Hep3Vector; -import hep.physics.vec.VecOp; -
import org.lcsim.event.Track;
-import org.lcsim.event.Vertex; -import org.lcsim.event.base.BaseVertex; -import org.lcsim.fit.helicaltrack.HelicalTrackFit; -import org.lcsim.fit.helicaltrack.HelixUtils;
import org.lcsim.hps.event.BeamlineConstants; import org.lcsim.hps.event.HPSTransformations;
-import org.lcsim.hps.recon.tracking.HPSTrack;
import org.lcsim.hps.recon.tracking.TrackUtils;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack; -import org.lcsim.util.swim.Helix;
/**
+ * Class that vertexes two tracks using straight line vertexing class.
* * @author phansson */ public class TwoTrackVertexer extends TwoLineVertexer {
- private HelixConverter converter = new HelixConverter(0.); - private Track trk1=null; - private Track trk2=null;
public TwoTrackVertexer() { } public void setTracks(Track track1,Track track2) {
- this.trk1 = track1; - this.trk2 = track2; - } - - public boolean isValid() { - if(this.trk1==null || this.trk2==null) return false; - else return true; - } - - public HelixConverter converter() { - return this.converter; - } - - private Hep3Vector getPosition(Track trk, double zposition) { - return TrackUtils.extrapolateTrack(trk, zposition); - } - - @Override - public Hep3Vector getVertex() { - assert isValid(); - Hep3Vector A1 = this.getPosition(trk1, 0); - Hep3Vector A2 = this.getPosition(trk1, BeamlineConstants.HARP_POSITION_TESTRUN); - Hep3Vector B1 = this.getPosition(trk2, 0); - Hep3Vector B2 = this.getPosition(trk2, BeamlineConstants.HARP_POSITION_TESTRUN); - return getVertexPosition(VecOp.mult(HPSTransformations.getMatrix(), A1), VecOp.mult(HPSTransformations.getMatrix(), A2), VecOp.mult(HPSTransformations.getMatrix(), B1), VecOp.mult(HPSTransformations.getMatrix(), B2)); - } - - public Hep3Vector getVertexWithFringe() { - assert isValid(); - SeedTrack s1 = (SeedTrack) trk1; - HelicalTrackFit htf1 = s1.getSeedCandidate().getHelix(); - HPSTrack hpstrk1 = new HPSTrack(htf1); - SeedTrack s2 = (SeedTrack) trk2; - HelicalTrackFit htf2 = s2.getSeedCandidate().getHelix(); - HPSTrack hpstrk2 = new HPSTrack(htf2); - boolean debug = false; - - Hep3Vector posAtConv1 = hpstrk1.getPositionAtZMap(100.0, BeamlineConstants.HARP_POSITION_TESTRUN, 5.0)[0]; - Hep3Vector posAtConv2 = hpstrk2.getPositionAtZMap(100.0, BeamlineConstants.HARP_POSITION_TESTRUN, 5.0)[0]; - - StraightLineTrack slt1_conv = converter.Convert((Helix)hpstrk1.getTrajectory()); - StraightLineTrack slt2_conv = converter.Convert((Helix)hpstrk2.getTrajectory()); - - Hep3Vector A1 = new BasicHep3Vector(slt1_conv.x0(),slt1_conv.y0(),slt1_conv.z0()); - Hep3Vector B1 = new BasicHep3Vector(slt2_conv.x0(),slt2_conv.y0(),slt2_conv.z0()); - - double YZAtConv1[] = slt1_conv.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN); - double YZAtConv2[] = slt2_conv.getYZAtX(BeamlineConstants.HARP_POSITION_TESTRUN); - - Hep3Vector A2 = new BasicHep3Vector(BeamlineConstants.HARP_POSITION_TESTRUN,YZAtConv1[0],YZAtConv1[1]); - Hep3Vector B2 = new BasicHep3Vector(BeamlineConstants.HARP_POSITION_TESTRUN,YZAtConv2[0],YZAtConv2[1]); - - - - if(debug) { - System.out.printf("%s: original track1 direction at x=0 %s \n",this.getClass().getSimpleName(),HelixUtils.Direction(hpstrk1,0.).toString()); - System.out.printf("%s: original track2 direction at x=0 %s \n",this.getClass().getSimpleName(),HelixUtils.Direction(hpstrk2,0.).toString()); - System.out.printf("%s: track1 direction at conv %s \n",this.getClass().getSimpleName(),hpstrk1.getTrajectory().getUnitTangentAtLength(0.).toString()); - System.out.printf("%s: track2 direction at conv %s \n",this.getClass().getSimpleName(),hpstrk2.getTrajectory().getUnitTangentAtLength(0.).toString()); - - - System.out.printf("%s: pos at converter track1 %s \n",this.getClass().getSimpleName(),posAtConv1.toString()); - System.out.printf("%s: pos at converter track2 %s \n",this.getClass().getSimpleName(),posAtConv2.toString()); - //System.out.printf("%s: dir at converter track1 %s (at 0: %s) \n",this.getClass().getSimpleName(),dirConv1.toString(),dirZero1.toString()); - //System.out.printf("%s: dir at converter track2 %s (at 0: %s) \n",this.getClass().getSimpleName(),dirConv2.toString(),dirZero2.toString()); - System.out.printf("%s: A1 %s \n",this.getClass().getSimpleName(),A1.toString()); - System.out.printf("%s: A2 %s \n",this.getClass().getSimpleName(),A2.toString()); - System.out.printf("%s: B1 %s \n",this.getClass().getSimpleName(),B1.toString()); - System.out.printf("%s: B2 %s \n",this.getClass().getSimpleName(),B2.toString()); - - } - - Hep3Vector vtxpos = getVertexPosition(A1, A2, B1, B2); - - if(debug) { - System.out.printf("%s: vtxpos = %s (w/o fringe = %s)\n",this.getClass().getSimpleName(),vtxpos.toString(),this.getVertex().toString()); - } - /* - StraightLineTrack sl1 = converter.Convert(hpstrk1.getTrajectory().); - StraightLineTrack sl2 = converter.Convert(htf2); - - Hep3Vector A1 = new BasicHep3Vector(sl1.x0(),sl1.y0(),sl1.z0()); - Hep3Vector B1 = new BasicHep3Vector(sl2.x0(),sl2.y0(),sl2.z0()); - - double yzAtX1[] = sl1.getYZAtX(SvtTrackExtrapolator.HARP_POSITION); - double yzAtX2[] = sl2.getYZAtX(SvtTrackExtrapolator.HARP_POSITION); - - Hep3Vector A2 = new BasicHep3Vector(SvtTrackExtrapolator.HARP_POSITION,yzAtX1[0],yzAtX1[1]); - Hep3Vector B2 = new BasicHep3Vector(SvtTrackExtrapolator.HARP_POSITION,yzAtX2[0],yzAtX2[1]); - - - Hep3Vector vtxpos = getVertexPosition(A1, A2, B1, B2); - if(debug) { - System.out.printf("%s: w/ fringe posAtConv1=%s posAtConv2=%s \n",this.getClass().getSimpleName(),posAtConv1.toString(),posAtConv2.toString()); - System.out.printf("%s: w/o fringe posAtConv1=%s posAtConv2=%s \n",this.getClass().getSimpleName(),this.getPosition(trk1, SvtTrackExtrapolator.HARP_POSITION).toString(),this.getPosition(trk2, SvtTrackExtrapolator.HARP_POSITION).toString()); - System.out.printf("%s: A1=%s A2=%s\n",this.getClass().getSimpleName(),A1.toString(),A2.toString()); - System.out.printf("%s: B1=%s B2=%s\n",this.getClass().getSimpleName(),A1.toString(),A2.toString()); - System.out.printf("%s: vyxpos = %s (w/o fringe = %s)\n",this.getClass().getSimpleName(),vtxpos.toString(),this.getVertex().toString()); - } - */ - return vtxpos;
+ A1 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track1, BeamlineConstants.HARP_POSITION_TESTRUN-100)); + A2 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track1, BeamlineConstants.HARP_POSITION_TESTRUN+100)); + B1 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track2, BeamlineConstants.HARP_POSITION_TESTRUN-100)); + B2 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track2, BeamlineConstants.HARP_POSITION_TESTRUN+100));
}
- /** - * - */ - public Vertex fitVertex(){ - assert isValid(); - - // Vertex the track and obtain the position - Hep3Vector vtxPosition = this.getVertexWithFringe(); - - return new BaseVertex(true, "Two Line Vertexer", 0, 0, new SymmetricMatrix(0), vtxPosition, null); - }
}
diff -u -r1.26 -r1.27 --- TwoTrackAnlysis.java 16 Oct 2013 19:50:51 -0000 1.26 +++ TwoTrackAnlysis.java 18 Oct 2013 16:46:02 -0000 1.27 @@ -6,36 +6,49 @@
import hep.aida.ref.plotter.PlotterRegion; import hep.physics.vec.BasicHep3Vector; import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.SpacePoint;
import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.logging.Level; import java.util.logging.Logger; import org.lcsim.detector.IDetectorElement; import org.lcsim.detector.tracker.silicon.DopedSilicon; import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.*;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.Track;
+import org.lcsim.event.TrackerHit;
import org.lcsim.event.util.ParticleTypeClassifier;
-import org.lcsim.fit.helicaltrack.*;
+import org.lcsim.fit.helicaltrack.HelicalTrackCross;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
+import org.lcsim.fit.helicaltrack.HitIdentifier;
import org.lcsim.geometry.Detector; import org.lcsim.hps.analysis.ecal.HPSMCParticlePlotsDriver; import org.lcsim.hps.event.BeamlineConstants; import org.lcsim.hps.evio.TriggerData; import org.lcsim.hps.recon.ecal.HPSEcalCluster;
-import org.lcsim.hps.recon.tracking.*;
+import org.lcsim.hps.recon.tracking.EventQuality;
+import org.lcsim.hps.recon.tracking.HPSTrack;
+import org.lcsim.hps.recon.tracking.SvtUtils;
+import org.lcsim.hps.recon.tracking.TrackUtils;
import org.lcsim.hps.recon.vertexing.StraightLineTrack; import org.lcsim.hps.recon.vertexing.TwoParticleVertexer;
+import org.lcsim.hps.recon.vertexing.TwoTrackFringeVertexer;
import org.lcsim.hps.recon.vertexing.TwoTrackVertexer; import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D; import org.lcsim.recon.tracking.seedtracker.SeedTrack; import org.lcsim.util.Driver; import org.lcsim.util.aida.AIDA;
-import org.lcsim.util.swim.Helix;
/** *
@@ -64,6 +77,7 @@
private boolean _debug; private HitIdentifier _ID = new HitIdentifier(); private TwoTrackVertexer vertexer = new TwoTrackVertexer();
+ private TwoTrackFringeVertexer fringeVertexer = new TwoTrackFringeVertexer();
private TwoParticleVertexer particleVertexer = new TwoParticleVertexer(); private IPlotter _plotterParticleVertex; private IPlotter _plotterTrackVertex;
@@ -170,7 +184,10 @@
totalEvents++;
-
+ + this.vertexer.clear(); + this.fringeVertexer.clear(); + this.particleVertexer.clear();
List<Track> tracklist = null;
@@ -221,10 +238,13 @@
if(tracks.size()>1) { Track trk1 = tracks.get(0)._track; Track trk2 = tracks.get(1)._track;
- - this.vertexer.setTracks(trk1, trk2); - vtxPos = this.vertexer.getVertex(); - vtxPosFringe = this.vertexer.getVertexWithFringe();
+ + vertexer.setTracks(trk1, trk2); + vertexer.fitVertex(); + vtxPos = vertexer.getFittedVertex().getPosition(); + fringeVertexer.setTracks(trk1, trk2); + fringeVertexer.fitVertex(); + vtxPosFringe = fringeVertexer.getFittedVertex().getPosition();
if(this._debug) { System.out.printf("%s: vtxPos=%s\n", this.getClass().getSimpleName(),vtxPos.toString());
@@ -239,6 +259,13 @@
System.out.printf("%s: vtxPosFringe is NaN -> Skip\n",this.getClass().getSimpleName()); vtxPos = null; }
+ + if(vtxPos!=null) { + this._vtxpos_x.fill(vtxPos.x()); + this._vtxpos_y.fill(vtxPos.y()); + this._vtxpos_z.fill(vtxPos.z()); + } +
boolean useFringe = false; StraightLineTrack[] slts = this.getSLTs(trk1, trk2, useFringe); double zAtCross = this.getCrossingS(trk1, trk2);
@@ -260,24 +287,10 @@
this._vtxposnonb_angle2.fill(Math.atan(slts[1].dzdx())); vtxPosNonBend = vtxNonBend[0];
- - //slts = this.getSLTs(trk1, trk2, true); - //zAtCross = this.getCrossingS(trk1, trk2, true); - //xyAtZ1 = slts[0].calculateXYAtZ(zAtCross); - //xyAtZ2 = slts[1].calculateXYAtZ(zAtCross); - //Hep3Vector[] vtxNonBendFringe = {new BasicHep3Vector(xyAtZ1[0],xyAtZ1[1],zAtCross), new BasicHep3Vector(xyAtZ2[0],xyAtZ2[1],zAtCross)}; - //System.out.printf("%s: vtxNonBendFridge=%s\n", this.getClass().getSimpleName(),vtxNonBendFringe.toString()); - - } - - if(vtxPos!=null) { - this._vtxpos_x.fill(vtxPos.x()); - this._vtxpos_y.fill(vtxPos.y()); - this._vtxpos_z.fill(vtxPos.z());
+
}
-
List<HPSEcalCluster> clusters = new ArrayList<HPSEcalCluster>(); if(!event.hasCollection(HPSEcalCluster.class, ecalClusterCollectionName)) {
@@ -322,9 +335,10 @@
} if(electron!=null && positron!=null) {
- this.particleVertexer.setParticle(electron, positron); - vtxPosMC = this.particleVertexer.getVertex(); - if(this._debug) System.out.printf("%s: vtxPosMC=%s\n", this.getClass().getSimpleName(),vtxPosMC.toString());
+ particleVertexer.setParticle(electron, positron); + particleVertexer.fitVertex(); + vtxPosMC = particleVertexer.getFittedVertex().getPosition(); + if(this._debug) System.out.printf("%s: vtxPosMC=%s org1 %s org2 %s\n", this.getClass().getSimpleName(),vtxPosMC.toString(),electron.getOrigin().toString(),positron.getOrigin().toString());
this._partvtxpos_x.fill(vtxPosMC.x()); this._partvtxpos_y.fill(vtxPosMC.y()); this._partvtxpos_z.fill(vtxPosMC.z());
diff -u -r1.8 -r1.9 --- TwoTrackAnalysis.lcsim 16 Oct 2013 19:50:51 -0000 1.8 +++ TwoTrackAnalysis.lcsim 18 Oct 2013 16:46:02 -0000 1.9 @@ -44,7 +44,7 @@
<driver name="TwoTrackAnalysis" type="org.lcsim.hps.users.phansson.TwoTrackAnlysis"> <debug>false</debug>
- <hideFrame>true</hideFrame>
+ <hideFrame>false</hideFrame>
<outputPlotFileName></outputPlotFileName> <outputNameTextTuple>${outputFile}</outputNameTextTuple> <trackCollectionName>MatchedTracks</trackCollectionName>
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