Print

Print


Commit in java/trunk/conditions/src on MAIN
main/java/org/hps/conditions/svt/SvtDetectorSetup.java+4-41028 -> 1029
test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java+32-171028 -> 1029
+36-21
2 modified files
Get the set of HpsSiSensors from the sub-detector instead of the detector.  Add additional test to SvtDetectorSetupTest. 

java/trunk/conditions/src/main/java/org/hps/conditions/svt
SvtDetectorSetup.java 1028 -> 1029
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java	2014-09-16 18:59:30 UTC (rev 1028)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java	2014-09-16 21:29:27 UTC (rev 1029)
@@ -19,16 +19,16 @@
 public final class SvtDetectorSetup {
 
     /**
-     * Load conditions data onto a detector object. This method is analogous to
-     * {@link org.lcsim.hps.recon.tracking.SvtUtils#setup(Detector)}.
+     * Load conditions data onto a detector object.
+     * 
      * @param detector The detector object.
      * @param conditions The conditions object.
      */
-    // FIXME: Change this to use a Subdetector instead of the Detector.
     public void load(Detector detector, SvtConditions conditions) {
 
         // Find sensor objects.
-        List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
+    	List<HpsSiSensor> sensors = detector.getSubdetector("Tracker").getDetectorElement().findDescendants(HpsSiSensor.class);
+        //List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
         SvtChannelCollection channelMap = conditions.getChannelMap();
         SvtDaqMappingCollection daqMap = conditions.getDaqMap();
         SvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();

java/trunk/conditions/src/test/java/org/hps/conditions/svt
SvtDetectorSetupTest.java 1028 -> 1029
--- java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java	2014-09-16 18:59:30 UTC (rev 1028)
+++ java/trunk/conditions/src/test/java/org/hps/conditions/svt/SvtDetectorSetupTest.java	2014-09-16 21:29:27 UTC (rev 1029)
@@ -15,7 +15,6 @@
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id$
  */
 // TODO: Update this test with more meaningful test.
 public class SvtDetectorSetupTest extends TestCase {
@@ -23,10 +22,19 @@
 	
 	//--- Constants ---//
 	//-----------------//
+	// TODO: Move all of these constants to their own class
 	
 	// Total number of SVT sensors
 	public static final int TOTAL_NUMBER_OF_SENSORS = 36;	
-	   
+	// Max FEB ID 
+	public static final int MAX_FEB_ID = 9; 
+	// Max FEB Hybrid ID
+	public static final int MAX_FEB_HYBRID_ID = 3;
+	// 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 DevReadOnlyConfiguration().setup().load("HPS-Proposal2014-v7-2pt2", 0);
 	}
@@ -49,42 +57,49 @@
         loader.load(detector, conditions);
 
         // Check sensor data.
-        List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
+        List<HpsSiSensor> sensors = detector.getSubdetector(SVT_SUBDETECTOR_NAME).getDetectorElement().findDescendants(HpsSiSensor.class);
+        //List<HpsSiSensor> sensors = detector.getDetectorElement().findDescendants(HpsSiSensor.class);
         
-        int nChannels = sensors.get(0).getNumberOfChannels();
-        this.printDebug("Total number of channels per sensor: " + nChannels);
+        // 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 (HpsSiSensor sensor : sensors) {
 
+        	int nChannels = sensor.getNumberOfChannels();
+        	assertTrue("The number of channels this sensor has is invalid", nChannels <= MAX_CHANNEL_NUMBER);
+        
         	this.printDebug(sensor.toString());
         	
-        	totalSensors++; 
-        	
-        	// Check that hardware information seems reasonable.
+        	// Check that the FEB ID as within the appropriate range
+            int febID = sensor.getFebID();
+            assertTrue("FEB ID is invalid.  The FEB ID should be less than " + MAX_FEB_ID,
+            		febID <= MAX_FEB_ID);
+            
             int febHybridID = sensor.getFebHybridID();
-            int febID = sensor.getFebID();
-
+            assertTrue("FEB Hybrid ID is invalid.  The FEB Hybrid ID should be less than " + MAX_FEB_HYBRID_ID,
+            		febHybridID <= MAX_FEB_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 is zero.", sensor.getPedestal(channel, sampleN) != 0);
-            		assertTrue("Noise is zero.", sensor.getNoise(channel, sampleN) != 0);
+            		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("PulseParameters points to null.", sensor.getShapeFitParameters(channel) != null);
+                assertTrue("Shape fit parameters points to null.",
+                		sensor.getShapeFitParameters(channel) != null);
                 
             }
         }
         
-        // Check for correct number of sensors processed.
-		this.printDebug("Total number of sensors found: " + totalSensors);
-		//assertTrue(totalSensors == TOTAL_NUMBER_OF_SENSORS);
-        
         System.out.println("Successfully loaded conditions data onto " + totalSensors + " SVT sensors!"); 
     }
 
SVNspam 0.1