lcsim/src/org/lcsim/contrib/Cassell
diff -N SteveReconLoop.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SteveReconLoop.java 2 Sep 2008 00:10:00 -0000 1.1
@@ -0,0 +1,105 @@
+/*
+ * SteveReconLoop.java
+ *
+ * Created on September 1, 2008, 4:35 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.Cassell;
+
+/**
+ *
+ * @author cassell
+ */
+import java.io.File;
+import org.lcsim.util.Driver;
+import org.lcsim.util.loop.LCIODriver;
+import org.lcsim.util.loop.LCSimLoop;
+import org.freehep.record.loop.LoopSourceExhaustedException;
+import org.lcsim.contrib.Cassell.recon.Steve.OutputSteveRecon;
+import java.util.*;
+public class SteveReconLoop {
+
+ public SteveReconLoop()
+ {
+ }
+ public static void main(String[] args) throws Exception
+ {
+ if (args.length<2)
+ {
+ //usage();
+ System.exit(1);
+ }
+ else
+ {
+ List<File> filelist = new ArrayList<File>();
+ String outpath = args[0];
+ String in = args[1];
+ String check = ".slcio";
+ if(in.endsWith(check))
+ {
+ for(int i=1;i<args.length;i++)
+ {
+ File infile = new File(args[i]);
+ if(infile.exists())
+ {
+ filelist.add(infile);
+ }
+ else
+ {
+ throw new RuntimeException("File "+args[i]+" does not exist");
+ }
+ }
+ }
+ else
+ {
+ File infile = new File(in);
+ File[] files = infile.listFiles();
+ if(files == null)
+ {
+ System.out.println("File list usage not yet implemented");
+ System.exit(1);
+ }
+ else
+ {
+ for(int i=0;i<files.length;i++)
+ {
+ if(files[i].getName().endsWith(check))
+ {
+ if(files[i].exists())
+ {
+ filelist.add(files[i]);
+ }
+ }
+ }
+ }
+ }
+
+ for(File inf:filelist)
+ {
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(inf);
+ String inname = inf.getName();
+ String outname = inname.substring(0, inname.lastIndexOf("."));
+ outname += "_UI"+check;
+ File output = new File(outpath,outname);
+ Driver myDriver = new OutputSteveRecon(output);
+ loop.add(myDriver);
+ long nevts = 0;
+ try
+ {
+ nevts = loop.loop(-1);
+ }
+ catch (LoopSourceExhaustedException x)
+ {
+ nevts = loop.getTotalCountableSupplied();
+ }
+ loop.dispose();
+ System.out.println("Processed "+nevts+"events from file "+inname);
+ }
+ }
+ }
+
+}