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  February 2016

HPS-SVN February 2016

Subject:

r4228 - in /java/trunk/integration-tests: pom.xml src/test/java/org/hps/test/it/EvioToLcioTest.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 16 Feb 2016 21:17:38 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (267 lines)

Author: [log in to unmask]
Date: Tue Feb 16 13:17:35 2016
New Revision: 4228

Log:
Revise Evio2Lcio test to use test-data jar; remove EPICs data checks; run 1000 events from test file; remove SLAC only test profile (not needed any longer).

Modified:
    java/trunk/integration-tests/pom.xml
    java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java

Modified: java/trunk/integration-tests/pom.xml
 =============================================================================
--- java/trunk/integration-tests/pom.xml	(original)
+++ java/trunk/integration-tests/pom.xml	Tue Feb 16 13:17:35 2016
@@ -87,28 +87,5 @@
                 </plugins>
             </build>
         </profile> 
-        <!-- This profile activates automatically when not running tests on a SLAC Unix system with NFS access. -->
-        <profile>
-            <id>no-slac-nfs</id>
-            <activation>
-                <activeByDefault>false</activeByDefault>
-                <file>
-                    <missing>/nfs/slac/g/hps/</missing>
-                </file>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <configuration>
-                            <excludes>                           
-                                <exclude>org/hps/test/it/EvioToLcioTest.java</exclude> 
-                            </excludes>
-                        </configuration>
-                    </plugin>
-                </plugins>
-            </build>        
-        </profile>  
     </profiles>    
 </project>

Modified: java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java
 =============================================================================
--- java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java	(original)
+++ java/trunk/integration-tests/src/test/java/org/hps/test/it/EvioToLcioTest.java	Tue Feb 16 13:17:35 2016
@@ -1,5 +1,6 @@
 package org.hps.test.it;
 
+import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.logging.Level;
@@ -7,8 +8,8 @@
 
 import junit.framework.TestCase;
 
+import org.hps.data.test.TestDataUtility;
 import org.hps.evio.EvioToLcio;
-import org.hps.record.epics.EpicsData;
 import org.hps.record.scalers.ScalerData;
 import org.hps.test.util.TestOutputFile;
 import org.lcsim.event.EventHeader;
@@ -20,16 +21,6 @@
 /**
  * Basic test of converting EVIO to LCIO using the {@link org.hps.evio.EvioToLcio} command line utility on Engineering
  * Run 2015 data.
- * <p>
- * This test checks the LCIO output for the:</br>
- * <ul>
- * <li>correct number of EPICS data collections</li>
- * <li>correct number of scaler data collections</li>
- * <li>all expected event collections</li>
- * <li>scaler parameters in event header</li>
- * </ul>
- * <p>
- * The test input is the first file of run 5772 in which scaler data appears around every 100k events.
  *
  * @author Jeremy McCormick, SLAC
  */
@@ -45,12 +36,7 @@
          * Map to keep track of number of events with empty collections.
          */
         Map<String, Integer> emptyCollections = new HashMap<String, Integer>();
-
-        /**
-         * Number of EPICS data collections found.
-         */
-        int epicsDataCount = 0;
-
+       
         /**
          * Number of events processed.
          */
@@ -60,6 +46,12 @@
          * Number of scaler data collections found.
          */
         int scalerDataCount = 0;
+        
+        CheckDriver() {
+            for (String collectionName : COLLECTION_NAMES) {
+                emptyCollections.put(collectionName, new Integer(0));
+            }
+        }
 
         /**
          * Check a collection by making sure it is present in the event and incrementing a counter if it is empty.
@@ -72,13 +64,9 @@
             if (!event.hasCollection(type, name)) {
                 throw new RuntimeException("Missing " + name + " collection.");
             }
+            Integer nEmpty = emptyCollections.get(name);
             if (event.get(type, name).isEmpty()) {
-                Integer nEmpty = emptyCollections.get(name);
-                if (nEmpty == null) {
-                    nEmpty = 0;
-                }
                 ++nEmpty;
-                // System.out.println(name + " is empty in event " + event.getEventNumber());
                 emptyCollections.put(name, nEmpty);
             }
         }
@@ -88,17 +76,7 @@
                 this.checkCollection(event, COLLECTION_TYPES[i], COLLECTION_NAMES[i]);
             }
         }
-
-        private void checkEpicsData(final EventHeader event) {
-            final EpicsData epicsData = EpicsData.read(event);
-            if (epicsData != null) {
-                if (epicsData.getEpicsHeader() == null) {
-                    throw new RuntimeException("The EpicsData header is null.");
-                }
-                ++epicsDataCount;
-            }
-        }
-
+ 
         private void checkScalarData(final EventHeader event) {
             final ScalerData scalerData = ScalerData.read(event);
             if (scalerData != null) {
@@ -113,10 +91,7 @@
          */
         @Override
         public void process(final EventHeader event) {
-
-            // Find and check EPICS data.
-            this.checkEpicsData(event);
-
+          
             // Find scaler data.
             this.checkScalarData(event);
 
@@ -128,41 +103,34 @@
     }
 
     /**
-     * The number of empty collections that are allowed.
-     */
-    private static int[] ALLOWED_EMPTY = new int[] {45, 0, 0, 0};
-
-    /**
      * Names of collections to check.
      */
-    private static String[] COLLECTION_NAMES = new String[] {"EcalReadoutHits", "FADCGenericHits", "SVTRawTrackerHits",
-            "TriggerBank"};
+    private static String[] COLLECTION_NAMES = new String[] {
+        "EcalReadoutHits", 
+        "FADCGenericHits", 
+        "SVTRawTrackerHits",
+        "TriggerBank"
+    };
 
     /**
      * Classes of collections.
      */
-    private static Class<?>[] COLLECTION_TYPES = new Class<?>[] {RawTrackerHit.class, GenericObject.class,
-            RawTrackerHit.class, GenericObject.class};
-
-    /**
-     * The number of EPICS collections that should be found.
-     */
-    private static int EPICS_DATA_COUNT = 7;
-
-    /**
-     * The default input file (large file at SLAC so the pom.xml file excludes this test on non-SLAC hosts).
-     */
-    private static final String INPUT_FILE = "/nfs/slac/g/hps3/data/engrun2015/evio/hps_005772.evio.0";
+    private static Class<?>[] COLLECTION_TYPES = new Class<?>[] {
+        RawTrackerHit.class, 
+        GenericObject.class,
+        RawTrackerHit.class, 
+        GenericObject.class
+    };
 
     /**
      * The number of events that should be processed.
      */
-    private static int PROCESSED_COUNT = 251823;
+    private static int PROCESSED_COUNT = 1000;
 
     /**
      * The number of scaler data collections that should be found.
      */
-    private static int SCALER_DATA_COUNT = 3;
+    private static int SCALER_DATA_COUNT = 1;
    
     /**
      * Run the test.
@@ -171,13 +139,15 @@
      */
     public void testEvioToLcio() throws Exception {
 
+        final File inputFile = new TestDataUtility().getTestData("run5772_integrationTest.evio");
+        
         // LCIO output file.
         final TestOutputFile outputFile = new TestOutputFile(EvioToLcioTest.class, "hps_005772.slcio");
 
         // Run the command line utility.
         final String[] args = new String[] {"-l", outputFile.getPath(), "-d", "HPS-EngRun2015-Nominal-v1", "-r", "-x", 
-                "/org/hps/steering/EventMarker.lcsim", INPUT_FILE};
-        System.out.println("Running EvioToLcio on " + INPUT_FILE);
+                "/org/hps/steering/EventMarker.lcsim", inputFile.getAbsolutePath()};
+        System.out.println("Running EvioToLcio on " + inputFile.getPath());
         Logger.getLogger("org.hps.evio").setLevel(Level.WARNING);
         System.out.println("org.hps.evio logging level is " + Logger.getLogger("org.hps.evio").getLevel());
         EvioToLcio cnv = new EvioToLcio();
@@ -188,9 +158,6 @@
         System.out.println("Done running EvioToLcio!");
         System.out.println("conversion to LCIO took " + elapsed + " ms");
         
-        // Check that the conversion did not take too long.
-        //assertTrue("Conversion from EVIO to LCIO took too long.", elapsed < 2000000);
-
         // Read in the LCIO file and run the CheckDriver on it.
         System.out.println("Checking LCIO output ...");
         final LCSimLoop loop = new LCSimLoop();
@@ -209,22 +176,15 @@
         System.out.println("CheckDriver processed " + checkDriver.processedCount + " events.");
         assertEquals("Wrong number of events processed by the check Driver.", PROCESSED_COUNT, checkDriver.processedCount);
 
-        // Check that the correct number of EPICS data collections were written out.
-        System.out.println("Found " + checkDriver.epicsDataCount + " events with EPICS data.");
-        assertTrue("EPICS data count is wrong.", checkDriver.epicsDataCount == EPICS_DATA_COUNT);
-
         // Check that the correct number of scaler data collections were written out.
         System.out.println("Found " + checkDriver.scalerDataCount + " events with scaler data.");
         assertTrue("Scaler data count is wrong.", checkDriver.scalerDataCount == SCALER_DATA_COUNT);
-
-        // Check that there were not too many empty collections.  
+        
+        // Check that there were no empty output collections.
         for (int i = 0; i < COLLECTION_NAMES.length; i++) {
             final String collection = COLLECTION_NAMES[i];
             final Integer nEmpty = checkDriver.emptyCollections.get(collection);
-            if (nEmpty != null) {
-                System.out.println(collection + " had " + nEmpty + " empty collections.");
-                assertTrue(collection + " had too many empty collections.", nEmpty <= ALLOWED_EMPTY[i]);
-            }
+            assertTrue("Collection " + collection + " was empty.", nEmpty == 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