lcsim/src/org/lcsim/util/loop
diff -u -r1.5 -r1.6
--- LCIODriver.java 25 Aug 2006 01:28:46 -0000 1.5
+++ LCIODriver.java 27 Mar 2007 17:14:29 -0000 1.6
@@ -14,20 +14,18 @@
public class LCIODriver extends Driver
{
private LCIOWriter writer;
+ private String file;
public LCIODriver(String file)
{
- try
- {
- writer = new LCIOWriter(file);
- }
- catch (IOException x)
- {
- throw new RuntimeException("Error opening LCIO file",x);
- }
+ this.file = file;
}
public LCIODriver(File file)
{
+ this.file = file.getAbsolutePath();
+ }
+ protected void startOfData()
+ {
try
{
writer = new LCIOWriter(file);
@@ -35,8 +33,8 @@
catch (IOException x)
{
throw new RuntimeException("Error opening LCIO file",x);
- }
- }
+ }
+ }
public LCIODriver(String file, Collection<String> listIgnore)
{
try
@@ -82,4 +80,4 @@
throw new RuntimeException("Error closing LCIO file",x);
}
}
-}
\ No newline at end of file
+}
lcsim/src/org/lcsim/util/loop
diff -u -r1.1 -r1.2
--- StdhepDriver.java 27 Mar 2007 16:43:28 -0000 1.1
+++ StdhepDriver.java 27 Mar 2007 17:14:29 -0000 1.2
@@ -8,15 +8,30 @@
import org.lcsim.util.Driver;
/**
- * A driver for writing out LCIO events.
+ * A driver for writing out Stdhep events.
+ * This driver only works if the event was orignially read in from a stdhep file.
+ * The driver writes out the original event, as read from the input file. Thus
+ * it is useful for filtering events from stdhep files, but not for modifying
+ * events in stdhep files.
* @author tonyj
*/
public class StdhepDriver extends Driver
{
private StdhepWriter writer;
+ private String file;
+ private String title;
+ private String comment;
+ private int expectedEvents;
public StdhepDriver(String file, String title, String comment, int expectedEvents)
{
+ this.file = file;
+ this.title = title;
+ this.comment = comment;
+ this.expectedEvents = expectedEvents;
+ }
+ protected void startOfData()
+ {
try
{
writer = new StdhepWriter(file, title, comment, expectedEvents);
@@ -55,7 +70,11 @@
{
try
{
- writer.close();
+ if (writer != null)
+ {
+ writer.close();
+ writer = null;
+ }
}
catch (IOException x)
{