LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  August 2015

HPS-SVN August 2015

Subject:

r3406 - /java/trunk/integration-tests/src/test/java/org/hps/EngRun2015ReconTest.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Wed, 26 Aug 2015 21:28:03 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (158 lines)

Author: [log in to unmask]
Date: Wed Aug 26 14:28:01 2015
New Revision: 3406

Log:
Integration test to check full reconstruction on a sample of clean events stripped from pass1. Work in progress.

Added:
    java/trunk/integration-tests/src/test/java/org/hps/EngRun2015ReconTest.java
      - copied, changed from r3096, java/trunk/integration-tests/src/test/java/org/hps/TestRunEvioToLcioTest.java

Copied: java/trunk/integration-tests/src/test/java/org/hps/EngRun2015ReconTest.java (from r3096, java/trunk/integration-tests/src/test/java/org/hps/TestRunEvioToLcioTest.java)
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/TestRunEvioToLcioTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/EngRun2015ReconTest.java	Wed Aug 26 14:28:01 2015
@@ -1,40 +1,123 @@
 package org.hps;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URL;
+import java.util.List;
 
 import junit.framework.TestCase;
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
 
 import org.hps.evio.EvioToLcio;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.util.Driver;
 import org.lcsim.util.cache.FileCache;
+import org.lcsim.util.loop.LCSimLoop;
 import org.lcsim.util.test.TestUtil.TestOutputFile;
 
 /**
- * Test to run the reconstruction on Test Run 2012 EVIO data.
- * @author Jeremy McCormick <[log in to unmask]>
+ * Test to run the standard reconstruction on Engineering Run 2015 EVIO data.
+ * Full energy electron candidate events were selected from pass1 output.
+ * The current test runs the default reconstruction over the evio file
+ * then analyzes the output lcio file.
+ * The current checks are minimal and need to be improved.
+ *
+ * @author Norman A Graf
  */
-public class TestRunEvioToLcioTest extends TestCase {
-    
-    final static String fileLocation = "http://www.lcsim.org/test/hps-java/TestRunEvioToLcioTest.evio"; 
-    
-    public void testTestRunEvioToLcio() throws Exception {
+public class EngRun2015ReconTest extends TestCase
+{
+
+    final static String fileLocation = "http://www.lcsim.org/test/hps-java/run5772_pass1_stripOneFee_1000Events.evio";
+
+    public void testEngRun2015Recon() throws Exception
+    {
         System.out.println("Caching file...");
         FileCache cache = new FileCache();
         File inputFile = cache.getCachedFile(new URL(fileLocation));
+        File outputFile = new TestOutputFile("EngRun2015ReconTest");
         String args[] = {
-                "-r",                       
-                "-x",
-                "/org/hps/steering/recon/TestRunOfflineRecon.lcsim",
-                "-d",
-                "HPS-TestRun-v5",
-                "-D",
-                "outputFile=" + new TestOutputFile("TestRunEvioToLcioTest").getPath(),
-                inputFile.getPath(),
-                "-n",
-                "1000"
+            "-r",
+            "-x",
+            "/org/hps/steering/recon/EngineeringRun2015FullReconGbl2.lcsim",
+            "-d",
+            "HPS-EngRun2015-Nominal-v2",
+            "-D",
+            "outputFile=" + outputFile.getPath(),
+            inputFile.getPath(),
+            "-n",
+            "1000"
         };
-        System.out.println("Running TestRunEvioToLcio.main ...");
+        System.out.println("Running EngRun2015ReconTest.main ...");
+        System.out.println("writing to: " + outputFile.getPath());
         EvioToLcio.main(args);
+
+        // Read in the LCIO event file and print out summary information.
+        System.out.println("Running ReconCheckDriver on output ...");
+        LCSimLoop loop = new LCSimLoop();
+        loop.add(new EngRun2015ReconTest.ReconCheckDriver());
+        try {
+            loop.setLCIORecordSource(new File(outputFile.getPath() + ".slcio"));
+            loop.loop(-1);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        System.out.println("Loop processed " + loop.getTotalSupplied() + " events.");
+        System.out.println("Done!");
     }
 
+    static class ReconCheckDriver extends Driver
+    {
+        int nFail;
+        int nProcessed;
+
+        public void process(EventHeader event)
+        {
+            boolean fail = false;
+            List<ReconstructedParticle> rps = event.get(ReconstructedParticle.class, "FinalStateParticles");
+            int nrp = rps.size();
+            if (nrp < 1) {
+                fail = true;
+            }
+            assertTrue("Didn't find at least one ReconstructedParticle", nrp > 0);
+            int nelectron = 0;
+            int npositron = 0;
+
+            ReconstructedParticle electron = null;
+            ReconstructedParticle positron = null;
+            for (ReconstructedParticle p : rps) {
+                if (p.getParticleIDUsed().getPDG() == 11) {
+                    electron = p;
+                    ++nelectron;
+                }
+                if (p.getParticleIDUsed().getPDG() == -11) {
+                    positron = p;
+                    ++npositron;
+                }
+            }
+            if (nelectron != 1) {
+                fail = true;
+            }
+            if (npositron != 0) {
+                fail = true;
+            }
+            if (fail) {
+                System.out.println("run " + event.getRunNumber() + " event " + event.getEventNumber());
+                System.out.println("found " + nelectron + " electrons and " + npositron + " positrons");
+                System.out.println("found " + nrp + " ReconstructedParticles ");
+            }
+            nProcessed++;
+            if (fail) {
+                nFail++;
+            }
+            //TODO add checks on quality of output (chi2, p, E, E/p matching, position matching, etc.)
+        }
+
+        public void endOfData()
+        {
+            System.out.println(nFail + " of " + nProcessed + " events failed");
+            assertEquals("Expected no events to fail",nFail, 0);
+        }
+    }
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use