Print

Print


Commit in lcsim/test/org/lcsim on MAIN
LCIOReconReadTest.java+60added 1.1
Trivial test which at least checks that momentum in tracks is coming back non-zero (LCSIM-187)

lcsim/test/org/lcsim
LCIOReconReadTest.java added at 1.1
diff -N LCIOReconReadTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ LCIOReconReadTest.java	14 Sep 2007 23:06:50 -0000	1.1
@@ -0,0 +1,60 @@
+package org.lcsim;
+
+import java.io.File;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.Track;
+import org.lcsim.util.Driver;
+import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
+
+/**
+ * @author tonyj
+ */
+public class LCIOReconReadTest extends TestCase
+{
+
+    public LCIOReconReadTest(String testName)
+    {
+        super(testName);
+    }
+
+    public static Test suite()
+    {
+        return new TestSuite(LCIOReconReadTest.class);
+    }
+
+    public void testLCIORead() throws Exception
+    {
+        URL url = new URL("http://www.lcsim.org/test/lcio/NonTrivialPFA.slcio");
+        FileCache cache = new FileCache();
+        File file = cache.getCachedFile(url);
+
+        LCSimLoop loop = new LCSimLoop();
+        loop.setLCIORecordSource(file);
+        loop.add(new ReadDriver());
+        loop.loop(1, null);
+        loop.dispose();
+    }
+    
+    private class ReadDriver extends Driver
+    {
+        private int n;
+
+        public void process(EventHeader event)
+        {
+            // Look for clusters
+            List<Track> tracks = event.get(Track.class,"Tracks_by_ron");
+            for (Track track : tracks)
+            {
+               double p = track.getPX();
+               assertTrue(p!=0);
+            }
+        }
+    }
+}
CVSspam 0.2.8