WhizDataFilter/src/main/java/org/lcsim/io/whizdata
diff -u -r1.1.1.1 -r1.2
--- Main.java 10 Dec 2007 18:32:23 -0000 1.1.1.1
+++ Main.java 10 Dec 2007 19:02:29 -0000 1.2
@@ -1,6 +1,7 @@
package org.lcsim.io.whizdata;
import hep.io.stdhep.StdhepRecord;
+import java.io.EOFException;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Random;
@@ -17,7 +18,11 @@
*/
public static void main(String[] args) throws FileNotFoundException, IOException
{
- WhizDataFileList list = new WhizDataFileList(args[0],new Random(12345));
+ if (args.length != 3) usage();
+ int seed = Integer.getInteger("seed", 0);
+ if (seed != 0) System.out.printf("Using seed %d\n", seed);
+ Random random = seed == 0 ? new Random() : new Random(seed);
+ WhizDataFileList list = new WhizDataFileList(args[0],random);
StdhepWriterWithEventLimit writer = new StdhepWriterWithEventLimit(args[1], args[2], args[2], 1000000);
long start = System.currentTimeMillis();
long n = 0;
@@ -35,6 +40,10 @@
if (n==3000000) break;
}
}
+ catch (EOFException x)
+ {
+ System.out.printf("EOF on input file\n");
+ }
finally
{
list.close();
@@ -43,4 +52,9 @@
System.out.printf("Read %,d events in %,d seconds\n", n, (stop - start) / 1000);
}
}
+
+ private static void usage() {
+ System.out.printf("Usage : java %s <spec-file> <output-pattern> <output-description>\n",Main.class.getName());
+ System.exit(1);
+ }
}
WhizDataFilter/src/main/java/org/lcsim/io/whizdata
diff -u -r1.1.1.1 -r1.2
--- WhizDataFileList.java 10 Dec 2007 18:32:23 -0000 1.1.1.1
+++ WhizDataFileList.java 10 Dec 2007 19:02:29 -0000 1.2
@@ -50,7 +50,7 @@
break;
}
String[] tokens = line.trim().split("\\s+");
- if (tokens.length != 4)
+ if (tokens.length < 4)
{
throw new IOException(String.format("Invalid line (notokens=%d): %s", tokens.length, line));
}