Commit in hps-java/src/main/java/org/lcsim/hps/evio on MAIN
BasicEvioFileReader.java+40added 1.1
basic EVIO file reader for testing

hps-java/src/main/java/org/lcsim/hps/evio
BasicEvioFileReader.java added at 1.1
diff -N BasicEvioFileReader.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ BasicEvioFileReader.java	25 Apr 2012 21:13:47 -0000	1.1
@@ -0,0 +1,40 @@
+package org.lcsim.hps.evio;
+
+import java.io.File;
+
+import org.jlab.coda.jevio.EvioEvent;
+
+public class BasicEvioFileReader
+{
+    static public void main(String[] args) {
+        if (args.length < 1) {
+            throw new RuntimeException("Missing EVIO file name.");
+        }
+        String evioFileName = args[0];
+        File evioFile = new File(evioFileName);
+        if (!evioFile.exists()) {
+            throw new RuntimeException("File " + evioFileName + " does not exist.");
+        }
+        try {
+            org.jlab.coda.jevio.EvioReader reader = new org.jlab.coda.jevio.EvioReader(evioFile);
+            int totalEvents = reader.getEventCount();
+            System.out.println("EVIO file has " + totalEvents + " total events.");
+            int eventN = 1;
+            while (true) {
+                System.out.println("Reading event " + eventN + " of " + totalEvents);
+                System.out.println("There are " + reader.getNumEventsRemaining() + " events remaining.");
+                EvioEvent event = reader.parseNextEvent();
+                System.out.println("Successfully read event " + eventN + " which contains " + event.getTotalBytes() + " bytes.");
+                System.out.println("Event bank has " + event.getChildCount() + " sub-banks.");
+                if (reader.getNumEventsRemaining() == 0) { 
+                    break;
+                }
+                ++eventN;
+            }
+            reader.close();
+        } 
+        catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
\ No newline at end of file
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1