4 modified files
lcsim/src/org/lcsim/recon/vertexing/zvtop4
diff -u -r1.10 -r1.11
--- VectorArithmetic.java 28 Jun 2006 01:54:49 -0000 1.10
+++ VectorArithmetic.java 28 Jun 2006 07:06:53 -0000 1.11
@@ -12,7 +12,7 @@
/**
* Class to perform basic vector arithmetic on Hep3Vectors
* @author jstrube
- * @version $Id: VectorArithmetic.java,v 1.10 2006/06/28 01:54:49 jstrube Exp $
+ * @version $Id: VectorArithmetic.java,v 1.11 2006/06/28 07:06:53 jstrube Exp $
*/
final public class VectorArithmetic {
@@ -86,8 +86,8 @@
* @param b SpacePoint 2
* @return a-b
*/
- public static Hep3Vector subtract(SpacePoint a, SpacePoint b) {
- return new BasicHep3Vector(a.x() - b.x(), a.y() - b.y(), a.z() - b.z());
+ public static SpacePoint subtract(SpacePoint a, SpacePoint b) {
+ return new CartesianPoint(a.x() - b.x(), a.y() - b.y(), a.z() - b.z());
}
public static double[] subtract(double[] a, double[] b) {
lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
diff -u -r1.1 -r1.2
--- VertexFactoryTest.java 28 Jun 2006 01:54:49 -0000 1.1
+++ VertexFactoryTest.java 28 Jun 2006 07:06:54 -0000 1.2
@@ -30,21 +30,21 @@
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(p.equals(part.getMomentum(), 5e-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(p.equals(part.getMomentum(), 5e-2), true);
+ assertEquals(x.equals(part.origin()), 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(x.equals(part.origin()), true);
assertEquals(part.getCharge(), -1);
assertEquals(part.getTracks().size(), 7);
lcsim/src/org/lcsim/contrib/JanStrube/vtxFitter
diff -u -r1.1 -r1.2
--- VertexFactory.java 28 Jun 2006 01:54:49 -0000 1.1
+++ VertexFactory.java 28 Jun 2006 07:06:54 -0000 1.2
@@ -1,5 +1,7 @@
package org.lcsim.contrib.JanStrube.vtxFitter;
+import hep.physics.vec.Hep3Vector;
+
import org.lcsim.event.ReconstructedParticle;
import org.lcsim.event.Track;
import org.lcsim.event.base.BaseReconstructedParticle;
@@ -32,22 +34,22 @@
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));
+ int c = (int) Math.pow(-1, Math.round(i+1/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);
+ momentum = 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))));
+ int c = (int)Math.pow(-1, Math.round(nTracks+1/2));
+ particle.addTrack(fac.getMCTrack(momentum, pos, c));
return particle;
}
}
lcsim/src/org/lcsim/event/base
diff -u -r1.5 -r1.6
--- BaseReconstructedParticle.java 28 Jun 2006 01:54:50 -0000 1.5
+++ BaseReconstructedParticle.java 28 Jun 2006 07:06:54 -0000 1.6
@@ -3,7 +3,7 @@
*
* Created on March 24, 2006, 9:30 AM
*
- * $Id: BaseReconstructedParticle.java,v 1.5 2006/06/28 01:54:50 jstrube Exp $
+ * $Id: BaseReconstructedParticle.java,v 1.6 2006/06/28 07:06:54 jstrube Exp $
*/
package org.lcsim.event.base;
@@ -221,6 +221,7 @@
Hep3Vector momentum = VectorArithmetic.add(_fourVec.v3(), track.getMomentum());
// FIXME HeplorentzVector.setV3 sets all four components ? That is not intuitive.
_fourVec.setV3(energy, momentum);
+ _charge += track.getCharge();
}
/**
CVSspam 0.2.8