lcsim/test
diff -N EventHeaderTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EventHeaderTest.java 25 Jul 2005 04:45:00 -0000 1.1
@@ -0,0 +1,79 @@
+/*
+ * EventHeaderTest.java
+ *
+ * Created on July 24, 2005, 8:58 PM
+ *
+ */
+
+import java.io.File;
+import java.net.URL;
+import java.sql.Driver;
+import java.util.List;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+import org.lcsim.event.EventHeader;
+
+/**
+ *
+ * @author jeremym
+ */
+public class EventHeaderTest extends TestCase
+{
+ int maxEvents = 10;
+
+ /** Creates a new instance of EventHeaderTest */
+ public EventHeaderTest()
+ {}
+
+ public static Test suite()
+ {
+ return new TestSuite(EventHeaderTest.class);
+ }
+
+ public void testEventHeader() throws Exception
+ {
+ runTestFile("http://www.lcsim.org/test/lcio/muons_SLIC_v1r9p1_sidmay05.slcio");
+ }
+
+ private void runTestFile(String s) throws Exception
+ {
+ System.out.println("Running HitPositionTest on file: " + s);
+
+ URL url = new URL(s);
+ FileCache cache = new FileCache();
+ File file = cache.getCachedFile(url);
+
+ LCSimLoop loop = new LCSimLoop();
+ loop.setLCIORecordSource(file);
+ loop.add(new EventHeaderTestDriver() );
+ loop.loop(maxEvents);
+ loop.dispose();
+ }
+
+ public void checkIDDecoder(EventHeader event)
+ {
+ //Fetch all of the collections containing SimTrackerHits...
+ List<List<SimTrackerHit>> simTrackerHitSets = event.get(SimTrackerHit.class);
+
+ // loop over the collections
+ for (List<SimTrackerHit> simTrackerHits : simTrackerHitSets)
+ {
+ LCMetaData meta = event.getMetaData(simTrackerHits);
+ IDDecoder decoder = meta.getIDDecoder();
+ System.out.println("decoder = "+decoder); // <==== always null.
+ //assert(decoder != null);
+ }
+ }
+
+ private class EventHeaderTestDriver extends Driver
+ {
+ public void process(EventHeader event)
+ {
+ checkIDDecoder(event);
+ }
+ }
+}
\ No newline at end of file