Commit in lcsim/src/org/lcsim/contrib/timb/util/loop on MAIN
LCSimLoop.java+67added 1.1
fastmc modifications Oct 2005 - Feb 2006 

lcsim/src/org/lcsim/contrib/timb/util/loop
LCSimLoop.java added at 1.1
diff -N LCSimLoop.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LCSimLoop.java	26 May 2006 07:21:45 -0000	1.1
@@ -0,0 +1,67 @@
+package org.lcsim.util.loop;
+
+import java.util.List;
+import java.io.File;
+import java.io.IOException;
+import java.util.TooManyListenersException;
+
+import org.freehep.record.loop.SequentialRecordLoopImpl;
+import org.lcsim.util.Driver;
+import org.lcsim.util.DriverAdapter;
+import org.lcsim.util.event.LCSimEventGenerator;
+
+/**
+ *
+ * @author Tony Johnson
+ */
+public class LCSimLoop extends SequentialRecordLoopImpl
+{
+    private Driver top = new Driver();
+    
+    public LCSimLoop()
+    {
+	this(0);
+    }
+    
+    public LCSimLoop(long nskip)
+    {
+        try
+        {
+            super.addRecordListener(new DriverAdapter(top, nskip));
+        }
+        catch (TooManyListenersException x)
+        {
+            throw new RuntimeException("Can't happen!",x);
+        }
+    }
+    
+    public void add(Driver driver)
+    {
+        top.add(driver);
+    }
+    
+    public void remove(Driver driver)
+    {
+        top.remove(driver);
+    }
+    
+    public void setLCIORecordSource(File file) throws IOException
+    {
+        super.setRecordSource(new LCIOEventSource(file));
+    }
+    
+    public void setLCIORecordSource(LCIOEventSource src) throws IOException
+    {
+        super.setRecordSource(src);
+    }
+    
+    public void setStdhepRecordSource(File file, String detectorName) throws IOException
+    {
+        super.setRecordSource(new StdhepEventSource(file, detectorName));
+    }
+    
+    public void setRecordSource(LCSimEventGenerator gen)
+    {
+        super.setRecordSource(new EventGeneratorRecordSource(gen, "generator"));
+    }
+}
CVSspam 0.2.8