2 added + 6 modified, total 8 files
lcio/src/java/hep/lcio/example
diff -u -r1.14 -r1.14.6.1
--- RecJob.java 28 Feb 2005 14:49:51 -0000 1.14
+++ RecJob.java 28 Aug 2006 13:30:58 -0000 1.14.6.1
@@ -14,13 +14,14 @@
/**
*
* @author Tony Johnson
- * @version $Id: RecJob.java,v 1.14 2005/02/28 14:49:51 gaede Exp $
+ * @version $Id: RecJob.java,v 1.14.6.1 2006/08/28 13:30:58 engels Exp $
*/
public class RecJob implements LCRunListener, LCEventListener
{
private final static int NHITS = 50;
private final static int NCLUSTERS = 50;
private final static int NTRACKS = 50;
+ private final static int NVERTICES = 10;
private LCWriter lcWrt;
private Random random = new Random();
@@ -156,7 +157,22 @@
track.setTanLambda(j);
trackVec.add(track);
}
- evt.addCollection(trackVec, "Tracks");
+ evt.addCollection(trackVec, "Tracks");
+
+ ILCCollection vertexVec = new ILCCollection(LCIO.VERTEX);
+ for (int j = 0; j < NVERTICES; j++)
+ {
+ IVertex v = new IVertex();
+ v.setPrimary((j == 0 ? true : false));
+ v.setChi2(j+1.0f);
+ v.setProbability(j+2.0f);
+ float f[] = {j+j*1.0f,j+j*2.0f,j+j*3.0f};
+ v.setPosition(f);
+ float[] cov = { 10.0f , 20.0f, 30.0f, 40.0f, 50.0f, 60.0f };
+ v.setCovMatrix(cov);
+ vertexVec.add(v);
+ }
+ evt.addCollection(vertexVec, "Vertices");
try
{
lcio/src/java/hep/lcio/implementation/event
diff -N IVertex.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ IVertex.java 28 Aug 2006 13:31:06 -0000 1.1.2.1
@@ -0,0 +1,85 @@
+package hep.lcio.implementation.event;
+
+import hep.lcio.event.ReconstructedParticle;
+import hep.lcio.event.Vertex;
+
+/**Implementation of Vertex
+ * @author engels
+ *
+ */
+public class IVertex extends ILCObject implements Vertex {
+
+ private static float[] null0 = new float[0];
+ protected int primary;
+ protected float chi2;
+ protected float probability;
+ protected float[] position = new float[3];
+ protected float[] covMatrix = new float[6];
+ protected float[] parameters = null0;
+ protected ReconstructedParticle aRecP ;
+
+ public ReconstructedParticle getAssociatedParticle() {
+ return aRecP ;
+ }
+
+ public void setAssociatedParticle(ReconstructedParticle aRecP) {
+ checkAccess();
+ this.aRecP = aRecP;
+ }
+
+ public float getChi2() {
+ return chi2;
+ }
+
+ public void setChi2(float chi2) {
+ checkAccess();
+ this.chi2 = chi2;
+ }
+
+ public float[] getCovMatrix() {
+ return covMatrix;
+ }
+
+ public void setCovMatrix(float[] cov) {
+ if (cov.length != 6) throw new IllegalArgumentException();
+ checkAccess();
+ this.covMatrix = cov;
+ }
+
+ public float[] getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(float[] parameters) {
+ checkAccess();
+ this.parameters = parameters;
+ }
+
+ public float[] getPosition() {
+ return position;
+ }
+
+ public void setPosition(float[] position) {
+ if (position.length != 3) throw new IllegalArgumentException();
+ checkAccess();
+ this.position = position;
+ }
+
+ public float getProbability() {
+ return probability;
+ }
+
+ public void setProbability(float probability){
+ checkAccess();
+ this.probability = probability;
+ }
+
+ public boolean isPrimary() {
+ return primary!=0 ? true : false;
+ }
+
+ public void setPrimary(boolean primary){
+ checkAccess();
+ this.primary = (primary == true ? 1 : 0 );
+ }
+}
lcio/src/java/hep/lcio/implementation/event
diff -u -r1.12.6.1 -r1.12.6.2
--- IReconstructedParticle.java 18 Aug 2006 13:39:17 -0000 1.12.6.1
+++ IReconstructedParticle.java 28 Aug 2006 13:31:03 -0000 1.12.6.2
@@ -31,7 +31,9 @@
protected double mass;
protected float goodnessOfPID;
protected int type;
+ protected Vertex startVertex;
+
public float getGoodnessOfPID()
{
return goodnessOfPID;
@@ -171,15 +173,20 @@
return referencePoint;
}
-
-
- /** FIXME: empty implemetation */
- public Vertex getStartVertex() { return null ;}
-
- /** FIXME: empty implemetation */
- public Vertex getEndVertex() { return null ;}
-
-
+ public Vertex getStartVertex(){
+ return startVertex;
+ }
+
+ public void setStartVertex(Vertex vertex){
+ checkAccess();
+ this.startVertex = vertex;
+ }
+
+ public Vertex getEndVertex(){
+ if(particles.size() != 0)
+ return ((ReconstructedParticle)particles.get(0)).getStartVertex();
+ return null;
+ }
public void setTracks(List tracks)
{
lcio/src/java/hep/lcio/implementation/sio
diff -N SIOVertex.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SIOVertex.java 28 Aug 2006 13:31:09 -0000 1.1.2.1
@@ -0,0 +1,60 @@
+package hep.lcio.implementation.sio;
+
+import hep.lcd.io.sio.SIOInputStream;
+import hep.lcd.io.sio.SIOOutputStream;
+import hep.lcio.event.Vertex;
+import hep.lcio.event.ReconstructedParticle;
+import hep.lcio.implementation.event.IVertex;
+
+import java.io.IOException;
+
+/**
+* @author engels
+*/
+
+public class SIOVertex extends IVertex{
+ public SIOVertex(SIOInputStream in, SIOEvent owner, int major, int minor) throws IOException{
+ this.primary = in.readInt();
+ this.chi2 = in.readFloat();
+ this.probability = in.readFloat();
+ for (int i=0; i<3; i++) this.position[i] = in.readFloat();
+ for (int i=0; i<6; i++) this.covMatrix[i] = in.readFloat();
+ int n = in.readInt();
+ this.parameters = new float[n];
+ for (int i=0; i<n; i++) this.parameters[i] = in.readInt();
+ this.aRecP = (ReconstructedParticle) in.readPntr().getObject();
+ in.readPTag(this);
+ }
+ static void write(Vertex v, SIOOutputStream out) throws IOException{
+ if (v instanceof SIOVertex){
+ ((SIOVertex) v).write(out);
+ }
+ else{
+ out.writeInt(v.isPrimary()?1:0);
+ out.writeFloat(v.getChi2());
+ out.writeFloat(v.getProbability());
+ float[] pos = v.getPosition();
+ for (int i=0; i<3; i++) out.writeFloat(pos[i]);
+ float[] matrix = v.getCovMatrix();
+ for (int i=0; i<6; i++) out.writeFloat(matrix[i]);
+ float[] pars = v.getParameters();
+ int n = (pars == null ? 0 : pars.length);
+ out.writeInt(n);
+ for (int i=0; i<n; i++) out.writeFloat(pars[i]);
+ out.writePntr(v.getAssociatedParticle());
+ out.writePTag(v);
+ }
+ }
+ private void write(SIOOutputStream out) throws IOException{
+ out.writeInt(primary);
+ out.writeFloat(chi2);
+ out.writeFloat(probability);
+ for (int i=0; i<3; i++) out.writeFloat(position[i]);
+ for (int i=0; i<6; i++) out.writeFloat(covMatrix[i]);
+ int n = parameters == null ? 0 : parameters.length;
+ out.writeInt(n);
+ for (int i=0; i<n; i++) out.writeFloat(parameters[i]);
+ out.writePntr(aRecP);
+ out.writePTag(this);
+ }
+}
lcio/src/java/hep/lcio/implementation/sio
diff -u -r1.41 -r1.41.2.1
--- SIOEvent.java 28 Apr 2006 18:46:18 -0000 1.41
+++ SIOEvent.java 28 Aug 2006 13:31:07 -0000 1.41.2.1
@@ -15,7 +15,7 @@
/**
*
* @author Tony Johnson
- * @version $Id: SIOEvent.java,v 1.41 2006/04/28 18:46:18 jeremy Exp $
+ * @version $Id: SIOEvent.java,v 1.41.2.1 2006/08/28 13:31:07 engels Exp $
*/
class SIOEvent extends ILCEvent
{
@@ -298,6 +298,16 @@
ilc.setOwner(this);
addCollection(ilc,name);
}
+ else if (type.equals(LCIO.VERTEX))
+ {
+ int n = in.readInt();
+ SIOLCCollection ilc = new SIOLCCollection(type, flags, n);
+ ilc.setParameters( colParameters ) ;
+ for (int i = 0; i < n; i++)
+ ilc.add(new SIOVertex(in, this, major, minor));
+ ilc.setOwner(this);
+ addCollection(ilc,name);
+ }
else if (type.equals(LCIO.LCRELATION))
{
int n = in.readInt();
@@ -539,6 +549,11 @@
for (int i=0; i < n; i++)
SIOReconstructedParticle.write((ReconstructedParticle) col.getElementAt(i), out, flags);
}
+ else if (type.equals(LCIO.VERTEX))
+ {
+ for (int i=0; i < n; i++)
+ SIOVertex.write((Vertex) col.getElementAt(i), out);
+ }
else if (type.equals(LCIO.LCRELATION))
{
for (int i=0; i < n; i++)
lcio/src/java/hep/lcio/implementation/sio
diff -u -r1.5 -r1.5.6.1
--- SIOReconstructedParticle.java 27 May 2005 07:55:56 -0000 1.5
+++ SIOReconstructedParticle.java 28 Aug 2006 13:31:09 -0000 1.5.6.1
@@ -5,6 +5,7 @@
import hep.lcd.io.sio.SIOOutputStream;
import hep.lcd.io.sio.SIORef;
import hep.lcio.event.ReconstructedParticle;
+import hep.lcio.event.Vertex;
import hep.lcio.implementation.event.IReconstructedParticle;
import java.io.IOException;
import java.util.ArrayList;
@@ -14,7 +15,7 @@
/**
*
* @author tonyj
- * @version $Id: SIOReconstructedParticle.java,v 1.5 2005/05/27 07:55:56 gaede Exp $
+ * @version $Id: SIOReconstructedParticle.java,v 1.5.6.1 2006/08/28 13:31:09 engels Exp $
*/
class SIOReconstructedParticle extends IReconstructedParticle
{
@@ -65,6 +66,10 @@
{
tempClusters.add(in.readPntr());
}
+ if( SIOVersion.encode(major,minor) > SIOVersion.encode(1,7))
+ {
+ this.startVertex = (Vertex) in.readPntr().getObject();
+ }
in.readPTag(this);
}
static void write(ReconstructedParticle particle, SIOOutputStream out, int flag) throws IOException
@@ -102,6 +107,7 @@
List clusters = particle.getClusters();
out.writeInt(clusters.size());
for (Iterator i = clusters.iterator(); i.hasNext(); ) out.writePntr(i.next());
+ out.writePntr(particle.getStartVertex());
out.writePTag(particle);
}
}
@@ -129,6 +135,7 @@
for (Iterator i = tracks.iterator(); i.hasNext(); ) out.writePntr(i.next());
out.writeInt(clusters.size());
for (Iterator i = clusters.iterator(); i.hasNext(); ) out.writePntr(i.next());
+ out.writePntr(startVertex);
out.writePTag(this);
}
lcio/src/java/hep/lcio/test
diff -u -r1.9 -r1.9.2.1
--- RandomEvent.java 7 Jun 2006 22:32:33 -0000 1.9
+++ RandomEvent.java 28 Aug 2006 13:31:10 -0000 1.9.2.1
@@ -51,6 +51,7 @@
addCollection(LCIO.TRACK, ITrack.class, 1 << LCIO.TRBIT_HITS);
addCollection(LCIO.CLUSTER, ICluster.class, 1 << LCIO.CLBIT_HITS);
addCollection(LCIO.RECONSTRUCTEDPARTICLE, IReconstructedParticle.class);
+ addCollection(LCIO.VERTEX, IVertex.class);
addCollection(LCIO.CALORIMETERHIT, ICalorimeterHit.class, 1 << LCIO.RCHBIT_ID1 | 1 << LCIO.RCHBIT_LONG | 1 << LCIO.RCHBIT_TIME);
addCollection(LCIO.LCFLOATVEC, ILCFloatVec.class);
addCollection(LCIO.LCINTVEC, ILCIntVec.class);
lcio/src/java/hep/lcio/util
diff -u -r1.1 -r1.1.2.1
--- Printer.java 22 Jul 2006 23:17:58 -0000 1.1
+++ Printer.java 28 Aug 2006 13:31:11 -0000 1.1.2.1
@@ -15,6 +15,7 @@
import hep.lcio.event.ParticleID;
import hep.lcio.event.RawCalorimeterHit;
import hep.lcio.event.ReconstructedParticle;
+import hep.lcio.event.Vertex;
import hep.lcio.event.SimCalorimeterHit;
import hep.lcio.event.SimTrackerHit;
import hep.lcio.event.TPCHit;
@@ -62,6 +63,7 @@
plist.add(new LCIntVecPrinter());
plist.add(new LCStrVecPrinter());
plist.add(new ReconstructedParticlePrinter());
+ plist.add(new VertexPrinter());
plist.add(new RawCalorimeterHitPrinter());
plist.add(new TrackPrinter());
plist.add(new TPCHitPrinter());
@@ -769,12 +771,43 @@
return LCIO.LCSTRVEC;
}
}
-
+ class VertexPrinter extends LCTypePrinter{
+ void print(LCCollection coll, int nprint){
+ ps.println(" [ id ] | pri | chi2 | prob. | position ( x,y,z) | [assRecP]");
+
+ for (int i=0; i<nprint; i++){
+ Vertex v = (Vertex)coll.getElementAt(i);
+ ps.format(" [%08x] | %3s | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | %4.2e | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%08x] \n",
+ new Object[] {
+ Integer.valueOf(v.hashCode()),
+ v.isPrimary() ? "yes" : "no",
+ Double.valueOf(v.getChi2()),
+ Double.valueOf(v.getProbability()),
+ Double.valueOf(v.getPosition()[0]),
+ Double.valueOf(v.getPosition()[1]),
+ Double.valueOf(v.getPosition()[2]),
+ (v.getAssociatedParticle() != null ? Integer.valueOf(v.getAssociatedParticle().hashCode()):0)
+ }
+ );
+
+ // Print covariance matrix.
+ ps.print(" covariance( px,py,pz) : (");
+ for(int j=0; j<6; j++){
+ ps.format("%4.2e, ", new Object[] {Double.valueOf(v.getCovMatrix()[j])}) ;
+ }
+ ps.println(")");
+ }
+ }
+ String type()
+ {
+ return LCIO.VERTEX;
+ }
+ }
class ReconstructedParticlePrinter extends LCTypePrinter
{
void print(LCCollection coll, int nprint)
{
- ps.println(" [ id ] | com | type | momentum( px,py,pz) | energy | mass | charge | position ( x,y,z) | [pidUsed]");
+ ps.println(" [ id ] | com | type | momentum( px,py,pz) | energy | mass | charge | position ( x,y,z) | [pidUsed] | [sVtx] | [eVtx]");
for (int i=0; i<nprint; i++)
{
@@ -789,7 +822,7 @@
pidused = recp.getParticleIDUsed().hashCode();
}
- ps.format(" [%08x] | %3s | %2d | (%5.3e,%5.3e,%5.3e) | %4.2e | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%08x] \n",
+ ps.format(" [%08x] | %3s | %2d | (%5.3e,%5.3e,%5.3e) | %4.2e | %4.2e | %4.2e | (%5.3e,%5.3e,%5.3e) | [%08x] | [%08x] | [%08x]\n",
new Object[] {
Integer.valueOf(recp.hashCode()),
compound ? "yes" : "no",
@@ -803,7 +836,9 @@
Double.valueOf(recp.getReferencePoint()[0]),
Double.valueOf(recp.getReferencePoint()[1]),
Double.valueOf(recp.getReferencePoint()[2]),
- Integer.valueOf(pidused)
+ Integer.valueOf(pidused),
+ (recp.getStartVertex() != null ? Integer.valueOf(recp.getStartVertex().hashCode()):0),
+ (recp.getEndVertex() != null ? Integer.valueOf(recp.getEndVertex().hashCode()):0)
}
);
CVSspam 0.2.8