Print

Print


Author: [log in to unmask]
Date: Thu Oct 30 13:04:24 2014
New Revision: 1347

Log:
HPS Test run implementation of AbstractSvtT0Shifts.  This class is used to store and access t0 shifts using ID's specific to the HPS test run.

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

Added: java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java
 =============================================================================
--- java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java	(added)
+++ java/branches/hps_java_trunk_HPSJAVA-255/conditions/src/main/java/org/hps/conditions/svt/TestRunSvtT0Shift.java	Thu Oct 30 13:04:24 2014
@@ -0,0 +1,54 @@
+package org.hps.conditions.svt;
+
+import org.hps.util.Pair;
+
+/**
+ * This class is a container that allows associating a t0 shift with a specific 
+ * sensor by FPGA ID and hybrid ID.
+ * 
+ * @author Omar Moreno <[log in to unmask]>
+ */
+public final class TestRunSvtT0Shift extends AbstractSvtT0Shift {
+
+	public static class TestRunSvtT0ShiftCollection
+			extends AbstractSvtT0Shift.AbstractSvtT0ShiftCollection<TestRunSvtT0Shift> {
+
+        /**
+         * Get the {@link TestRunSvtT0Shift} associated with a given DAQ pair
+         * 
+         * @param DAQ pair for a given sensor
+         * @return The {@link TestRunSvtT0Shift} associated with the DAQ pair.  If a t0 shift
+         *         for a given DAQ pair can't be found, it returns null.
+         */
+		@Override
+		public TestRunSvtT0Shift getT0Shift(Pair<Integer, Integer> pair) {
+	
+            int fpgaID = pair.getFirstElement();
+            int hybridID = pair.getSecondElement();
+            for (TestRunSvtT0Shift t0Shift : this.getObjects()) {
+                if (t0Shift.getFpgaID() == fpgaID && t0Shift.getHybridID() == hybridID) {
+                    return t0Shift;
+                }
+            }
+            return null;
+		} 
+	}
+	
+	/**
+	 * Get the FPGA ID.
+	 * 
+	 * @return The FPGA ID.
+	 */
+	int getFpgaID() { 
+		return getFieldValue("fpga");
+	}
+	
+	/**
+	 * Get the hybrid ID.
+	 * 
+	 * @return The hybrid ID. 
+	 */
+	int getHybridID() { 
+		return getFieldValue("hybrid");
+	}
+}