lcio/bin
diff -u -r1.3 -r1.4
--- lcio 8 Dec 2006 10:04:46 -0000 1.3
+++ lcio 7 Nov 2007 20:45:45 -0000 1.4
@@ -34,7 +34,8 @@
LOCALCLASSPATH=$LCIO/lib/lcio.jar:$LCIO/tools/sio.jar:$LCIO/tools/jdom.jar:$LCIO/tools/saxpath.jar
LOCALCLASSPATH=$LOCALCLASSPATH:$LCIO/tools/jaxen-jdom.jar:$LCIO/tools/jaxen-core.jar:$LCIO/tools/jel.jar
LOCALCLASSPATH=$LOCALCLASSPATH:$LCIO/tools/commons-cli-1.0.jar:$LCIO/tools/commons-lang-2.1.jar
-LOCALCLASSPATH=$LOCALCLASSPATH:$LCIO/tools/freehep-hep.jar:$LCIO/tools/freehep-physics.jar:$LCIO/tools/freehep-base.jar
+#LOCALCLASSPATH=$LOCALCLASSPATH:$LCIO/tools/freehep-hep.jar:$LCIO/tools/freehep-physics.jar:$LCIO/tools/freehep-base.jar
+LOCALCLASSPATH=$LOCALCLASSPATH:$LCIO/tools/freehep-mcfio-2.0.1.jar:$LCIO/tools/freehep-stdhep-2.0.1.jar:$LCIO/tools/freehep-sio-2.0.jar:$LCIO/tools/freehep-xdr-2.0.3.jar:$LCIO/tools/freehep-physics-2.1.jar
# OS specific support for Cygwin
cygwin=false;
@@ -50,4 +51,4 @@
java -cp "$LOCALCLASSPATH" hep.lcio.util.CommandLineTool $*
else
java -cp $LOCALCLASSPATH hep.lcio.util.CommandLineTool $*
-fi
\ No newline at end of file
+fi
lcio/src/java/hep/lcio/util
diff -u -r1.1 -r1.2
--- StdhepConverter.java 28 Jun 2006 23:25:17 -0000 1.1
+++ StdhepConverter.java 7 Nov 2007 20:45:45 -0000 1.2
@@ -28,7 +28,7 @@
* Java 1.4 compatibility.
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: StdhepConverter.java,v 1.1 2006/06/28 23:25:17 jeremy Exp $
+ * @version $Id: StdhepConverter.java,v 1.2 2007/11/07 20:45:45 jeremy Exp $
*/
class StdhepConverter
{
@@ -37,7 +37,8 @@
// c_light copied from CLHEP 1.9.2.2
// CLHEP/Units/PhysicalConstants.h
private static final double c_light = 2.99792458e+8;
-
+ private boolean haveWarned = false;
+
StdhepConverter()
{}
@@ -52,11 +53,16 @@
LCFactory.getInstance().createLCWriter();
writer.open(lcio.getAbsolutePath());
+ int cntr=0;
+
try
{
+
// Loop over all records in the Stdhep file.
for (;;)
{
+ ++cntr;
+
// Get the next Stdhep event.
StdhepRecord record = reader.nextRecord();
@@ -66,25 +72,27 @@
// Convert to an LCCollection of MCParticle objects.
ILCCollection mcpcoll =
convert((StdhepEvent) record);
-
+
// Make a new LCEvent.
ILCEvent event = new ILCEvent();
-
+
// FIXME: What should this be set to?
// NullPointerException if not set to something.
event.setDetectorName("test");
-
+
// FIXME: What values for these?
event.setEventNumber(0);
event.setRunNumber(0);
event.setTimeStamp(0);
-
+
// Add the MCParticle collection to the event.
event.addCollection(mcpcoll, LCIO.MCPARTICLE);
-
+
// Write out the event to the LCIO file.
writer.writeEvent(event);
}
+
+ ++cntr;
}
}
catch (EOFException e)
@@ -92,8 +100,10 @@
// End of Stdhep file.
}
- reader.close();
+ System.out.println("processed events = " + cntr);
+ reader.close();
+
writer.close();
}
@@ -111,33 +121,37 @@
private int fillIndexVec(int[] vec, int idx1, int idx2)
{
int l = 0;
- if (idx1 != -1 && idx2 != -1)
- {
- if (idx1 < idx2)
+ //if (idx1 != -1 && idx2 != -1)
+ try {
+ if (idx1 >= 0 && idx2 >= 0)
{
- for (int i = idx1; i < (idx2 + 1); i++)
+ if (idx1 < idx2)
{
- vec[l++] = i;
+ for (int i = idx1; i < (idx2 + 1); i++)
+ {
+ vec[l++] = i;
+ }
+ }
+ else if (idx1 > idx2)
+ {
+ vec[l++] = idx1;
+ vec[l++] = idx2;
+ }
+ // indices are equal
+ else
+ {
+ vec[l++] = idx1;
}
}
- else if (idx1 > idx2)
- {
- vec[l++] = idx1;
- vec[l++] = idx2;
- }
- // indices are equal
- else
+ else if (idx1 >= 0)
{
vec[l++] = idx1;
}
}
- else if (idx1 != -1)
- {
- vec[l++] = idx1;
- }
- else if (idx2 != -1)
+ catch (ArrayIndexOutOfBoundsException x)
{
- vec[l++] = idx2;
+ if (!haveWarned) System.err.println("Warning: Array index out of bounds exception caused by corrupt stdhep file ignored");
+ haveWarned = true;
}
return l;
}
@@ -159,10 +173,10 @@
{
// Create new MCParticle for this Stdhep record.
IMCParticle particle = new IMCParticle();
-
+
// Add MCParticle to the temp array.
particles[i] = particle;
-
+
// Set vertex from VHEP.
double vertex[] =
{ hepevt.getVHEP(i, 0), hepevt.getVHEP(i, 1), hepevt.getVHEP(i, 2) };
@@ -178,7 +192,7 @@
try {
// Get the particle type.
type = ppp.get(hepevt.getIDHEP(i));
-
+
// Set the charge.
particle.setCharge((float) type.getCharge());
}
@@ -190,7 +204,7 @@
// Set mass from PHEP.
particle.setMass((float)hepevt.getPHEP(i, 4));
-
+
// Set PDG from IDHEP.
particle.setPDG(hepevt.getIDHEP(i));
@@ -228,7 +242,7 @@
checkAndAddDaughter(particles, ancestors, i, vec[j]);
}
}
-
+
// Add particles to the collection.
for (int i=0; i<n; i++)
{
lcio/config
diff -u -r1.60 -r1.61
--- lcio.properties 5 Nov 2007 15:02:18 -0000 1.60
+++ lcio.properties 7 Nov 2007 20:45:45 -0000 1.61
@@ -1,7 +1,7 @@
# ANT property file for LCIO
#
# Author: Mark Donszelmann
-# Version: $Id: lcio.properties,v 1.60 2007/11/05 15:02:18 gaede Exp $
+# Version: $Id: lcio.properties,v 1.61 2007/11/07 20:45:45 jeremy Exp $
#
debug=true
@@ -25,7 +25,10 @@
test.classpath=lib/lcio.jar;tools/sio.jar;tools/commons-cli-1.0.jar;tools/commons-lang-2.1.jar
test.format=frames
-classpath=src/java;tools/sio.jar;tools/saxpath.jar;tools/jel.jar;tools/jdom.jar;tools/jaxen-core.jar;tools/jaxen-jdom.jar;tools/commons-cli-1.0.jar;tools/commons-lang-2.1.jar;tools/freehep-physics.jar;tools/freehep-hep.jar
+classpath=src/java;tools/sio.jar;tools/saxpath.jar;tools/jel.jar;tools/jdom.jar;tools/jaxen-core.jar;tools/jaxen-jdom.jar;tools/commons-cli-1.0.jar;tools/commons-lang-2.1.jar;tools/freehep-physics-2.1.jar;tools/freehep-mcfio-2.0.1.jar;freehep-sio-2.0.jar;freehep-stdhep-2.0.1.jar;freehep-xdr-2.0.3.jar
+
+#tools/freehep-hep.jar
+
srcpath=src/java
exp.srcpath=