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  October 2014

HPS-SVN October 2014

Subject:

r1322 - /java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 28 Oct 2014 01:07:35 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (123 lines)

Author: omoreno
Date: Mon Oct 27 18:07:33 2014
New Revision: 1322

Log:
Test for TestRunSvtDetectorSetup.

Added:
    java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java   (with props)

Added: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java	(added)
+++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/test/java/org/hps/conditions/svt/TestRunSvtDetectorSetupTest.java	Mon Oct 27 18:07:33 2014
@@ -0,0 +1,107 @@
+package org.hps.conditions.svt;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.lcsim.detector.tracker.silicon.HpsTestRunSiSensor;
+import org.lcsim.geometry.Detector;
+
+import org.hps.conditions.DatabaseConditionsManager;
+import org.hps.conditions.config.TestRunReadOnlyConfiguration;
+
+/**
+ * This test loads {@link TestRunSvtConditions} data onto the detector and then checks that all
+ * channels of each sensor have non-zero data values for applicable parameters.
+ * 
+ * @author Omar Moreno <[log in to unmask]>
+ */
+public class TestRunSvtDetectorSetupTest extends TestCase {
+
+	//--- Constants ---//
+	//-----------------//
+	// TODO: Move all of these constants to their own class
+	
+	// Total number of SVT sensors
+	public static final int TOTAL_NUMBER_OF_SENSORS = 20;	
+	// Max FEB ID 
+	public static final int MAX_FPGA_ID = 6; 
+	// Max FEB Hybrid ID
+	public static final int MAX_HYBRID_ID = 2;
+	// Max channel number
+	public static final int MAX_CHANNEL_NUMBER = 639;
+	// SVT Subdetector name
+	public static final String SVT_SUBDETECTOR_NAME = "Tracker";
+	
+	public void setUp(){
+        new TestRunReadOnlyConfiguration().setup().load("HPS-TestRun-v5", 1351);
+	}
+	
+    /**
+     * Load SVT conditions data onto the detector and perform basic checks afterwards.
+     */
+	public void test() { 
+     
+		DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+	
+        // Get the detector.
+        Detector detector = conditionsManager.getCachedConditions(Detector.class, "compact.xml").getCachedData();
+	
+        // Get all test run SVT conditions.
+        TestRunSvtConditions conditions = conditionsManager.getCachedConditions(TestRunSvtConditions.class, "svt_conditions").getCachedData();
+	
+        // Load the test run SVT conditions onto detector.
+        TestRunSvtDetectorSetup loader = new TestRunSvtDetectorSetup();
+        loader.load(detector.getSubdetector(SVT_SUBDETECTOR_NAME), conditions);
+        
+        // Check sensor data.
+        List<HpsTestRunSiSensor> sensors = detector.getSubdetector(SVT_SUBDETECTOR_NAME).getDetectorElement().findDescendants(HpsTestRunSiSensor.class);
+        
+        // Check for correct number of sensors processed.
+		this.printDebug("Total number of sensors found: " + sensors.size());
+		assertTrue(sensors.size() == TOTAL_NUMBER_OF_SENSORS);
+        
+        
+        // Loop over sensors.
+        int totalSensors = 0; 
+        for (HpsTestRunSiSensor sensor : sensors) {
+        	
+        	int nChannels = sensor.getNumberOfChannels();
+        	assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
+        
+        	this.printDebug(sensor.toString());
+        	
+        	// Check that the FEB ID as within the appropriate range
+            int fpgaID = sensor.getFpgaID();
+            assertTrue("FPGA ID is invalid.  The FPGA ID should be less than " + MAX_FPGA_ID,
+            		fpgaID <= MAX_FPGA_ID);
+            
+            int hybridID = sensor.getHybridID();
+            assertTrue("Hybrid ID is invalid.  The Hybrid ID should be less than " + MAX_HYBRID_ID,
+            		hybridID <= MAX_HYBRID_ID);
+
+            for (int channel = 0; channel < nChannels; channel++) {
+
+            	//
+                // Check that channel conditions values are not zero
+            	//
+            	for(int sampleN = 0; sampleN < 6; sampleN++){
+            		assertTrue("Pedestal sample " + sampleN + " is zero.",
+            				sensor.getPedestal(channel, sampleN) != 0);
+            		assertTrue("Noise sample " + sampleN + " is zero.",
+            				sensor.getNoise(channel, sampleN) != 0);
+            	}
+                assertTrue("Gain is zero.", sensor.getGain(channel) != 0);
+                assertTrue("Shape fit parameters points to null.",
+                		sensor.getShapeFitParameters(channel) != null);
+            	
+            }
+        }
+        System.out.println("Successfully loaded test run conditions data onto " + totalSensors + " SVT sensors!"); 
+	}
+
+	private void printDebug(String debugMessage){
+		System.out.println(this.getClass().getSimpleName() + ":: " + debugMessage);
+	}
+	
+}

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