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  January 2015

HPS-SVN January 2015

Subject:

r1819 - /java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java

From:

[log in to unmask]

Reply-To:

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

Date:

Fri, 2 Jan 2015 07:06:35 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (112 lines)

Author: [log in to unmask]
Date: Thu Jan  1 23:06:31 2015
New Revision: 1819

Log:
Add test of ECAL bad channel info.

Added:
    java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java

Added: java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java
 =============================================================================
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java	(added)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtBadChannelsTest.java	Thu Jan  1 23:06:31 2015
@@ -0,0 +1,96 @@
+package org.hps.conditions.svt;
+
+import java.util.logging.Level;
+
+import junit.framework.TestCase;
+
+import org.hps.conditions.api.ConditionsObjectCollection;
+import org.hps.conditions.api.ConditionsSeries;
+import org.hps.conditions.database.DatabaseConditionsManager;
+import org.hps.conditions.svt.SvtBadChannel.SvtBadChannelCollection;
+import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
+
+/**
+ * This test reads Test Run bad channel collections from the database
+ * using a conditions series and checks that the correct number
+ * of channels are flagged using several different runs.
+ * 
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class TestRunSvtBadChannelsTest extends TestCase {
+    
+    static String detectorName = "HPS-TestRun-v5";
+    
+    /*
+    mysql> select run_start, run_end, name from conditions where table_name like 'test_run_svt_bad_channels';
+    +-----------+---------+---------------------------+
+    | run_start | run_end | name                      |
+    +-----------+---------+---------------------------+
+    |         0 |    1365 | test_run_svt_bad_channels |
+    |      1351 |    1351 | test_run_svt_bad_channels |
+    |      1353 |    1353 | test_run_svt_bad_channels |
+    |      1354 |    1354 | test_run_svt_bad_channels |
+    |      1358 |    1358 | test_run_svt_bad_channels |
+    |      1359 |    1359 | test_run_svt_bad_channels |
+    |      1360 |    1360 | test_run_svt_bad_channels |
+    +-----------+---------+---------------------------+
+    */    
+    static int[] runNumbers = new int[] {0, 1351, 1353, 1354, 1358, 1359, 1360};
+
+    /*
+    mysql> select collection_id, count(*) from test_run_svt_bad_channels group by collection_id;
+    +---------------+----------+
+    | collection_id | count(*) |
+    +---------------+----------+
+    |             1 |       50 |
+    |             2 |      392 |
+    |             3 |      427 |
+    |             4 |      457 |
+    |             5 |      298 |
+    |             6 |      424 |
+    |             7 |      424 |
+    +---------------+----------+
+    */    
+    static int[] badChannelCount = {50, 392, 427, 457, 298, 424, 424};    
+    
+    public void testSvtBadChannels() throws ConditionsNotFoundException {
+                
+        DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+        conditionsManager.setXmlConfig("/org/hps/conditions/config/conditions_database_testrun_2012.xml");
+        conditionsManager.setLogLevel(Level.WARNING);
+        
+        for (int i = 0; i < runNumbers.length; i++) {  
+        
+            int runNumber = runNumbers[i];
+            
+            System.out.println("-------------");
+            System.out.println("Run #" + runNumber);
+            System.out.println("-------------");
+            System.out.println();
+            
+            conditionsManager.setDetector(detectorName, runNumber);
+        
+            ConditionsSeries<SvtBadChannel, SvtBadChannelCollection> series = 
+                    conditionsManager.getConditionsSeries(SvtBadChannelCollection.class, "test_run_svt_bad_channels");
+        
+            int totalBadChannels = 0;
+            for (ConditionsObjectCollection<SvtBadChannel> collection : series) {
+                //System.out.println(collection.getConditionsRecord());
+                totalBadChannels += collection.size();
+            }        
+            System.out.println("found " + totalBadChannels + " total bad chanenls");
+           
+            // The run 0 channels are for all runs.
+            int expectedBadChannels = badChannelCount[0];
+            if (runNumber != 0) {
+                // Add bad channels from individual runs.
+                expectedBadChannels += badChannelCount[i];
+            }
+            System.out.println("expected " + expectedBadChannels + " bad channels");
+            
+            assertEquals("Wrong number of bad channels for run #" + runNumber, expectedBadChannels, totalBadChannels);
+            
+            System.out.println();
+        }
+    }
+}

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