Print

Print


Commit in lcsim/src/org/lcsim/util/loop on MAIN
LCIODriver.java+26-91.9 -> 1.10
JM: add setter for listIgnore and create writer in startOfData so that LCIODriver is fully configurable via recon xml

lcsim/src/org/lcsim/util/loop
LCIODriver.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- LCIODriver.java	10 Sep 2008 21:25:01 -0000	1.9
+++ LCIODriver.java	11 Sep 2008 22:54:28 -0000	1.10
@@ -2,8 +2,10 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+
 import org.lcsim.event.EventHeader;
 import org.lcsim.util.Driver;
 import org.lcsim.util.lcio.LCIOWriter;
@@ -22,6 +24,8 @@
 public class LCIODriver extends Driver
 {
 	private LCIOWriter writer;
+	private Collection<String> listIgnore = Collections.EMPTY_SET;
+	private String filePath;
 	
 	public LCIODriver(String file)
 	{
@@ -58,16 +62,14 @@
 	public LCIODriver()
 	{}
 		
-	public void setOutputFilePath(String outputFilePath)
+	public void setOutputFilePath(String filePath)
 	{	
-		try
-		{
-			this.writer = new LCIOWriter(new File(outputFilePath),Collections.EMPTY_SET);
-		}
-		catch (IOException x)
-		{
-			throw new RuntimeException("Error opening LCIO file",x);
-		}  
+		this.filePath = filePath;
+	}
+	
+	public void setIgnoreCollections(String[] ignoreCollections)
+	{
+		listIgnore = Arrays.asList(ignoreCollections);
 	}
 	
 	public LCIOWriter getWriter()
@@ -77,6 +79,21 @@
 	
 	protected void startOfData()
 	{
+		// Setup writer if it hasn't been initialized yet.
+		if (this.writer == null)
+		{
+			if (filePath == null)
+				throw new RuntimeException("Cannot create LCIO writer.  The filePath was not set!");
+			try
+			{
+				this.writer = new LCIOWriter(new File(filePath),listIgnore);
+			}
+			catch (IOException x)
+			{
+				throw new RuntimeException("Error opening LCIO file",x);
+			}  
+		}
+		
 		try
 		{
 			writer.reOpen();
CVSspam 0.2.8