hps-java/src/main/java/org/lcsim/hps/conditions/svt
diff -N SvtDaqMap.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SvtDaqMap.java 10 Oct 2013 21:41:10 -0000 1.1
@@ -0,0 +1,58 @@
+package org.lcsim.hps.conditions.svt;
+
+import java.util.HashMap;
+
+import org.lcsim.hps.util.Pair;
+
+/**
+ * This class establishes the mapping between layer numbers and DAQ pair (FPGA, hybrid)
+ * for the top and bottom halves of the detector.
+ * @author Jeremy McCormick <[log in to unmask]>
+ *
+ */
+public class SvtDaqMap {
+
+ /**
+ * Flag for top or bottom half of detector.
+ */
+ enum Half {
+ TOP,
+ BOTTOM
+ }
+
+ /**
+ * This is the data structure used for the mapping of layer numbers to DAQ pair by top or bottom half.
+ */
+ static private class LayerMap extends HashMap<Half,HashMap<Integer,Pair<Integer,Integer>>> {
+ }
+
+ LayerMap layerMap = new LayerMap();
+
+ /**
+ * Class constructor.
+ */
+ SvtDaqMap() {
+ layerMap.put(Half.TOP, new HashMap<Integer,Pair<Integer,Integer>>());
+ layerMap.put(Half.BOTTOM, new HashMap<Integer,Pair<Integer,Integer>>());
+ }
+
+ /**
+ * Add a record to the DAQ map.
+ * @param half The value for top or bottom.
+ * @param layerNumber The layer number.
+ */
+ void add(Half half, int layerNumber, Pair<Integer,Integer> pair) {
+ layerMap.get(half).put(layerNumber, pair);
+ }
+
+ /**
+ * Get a DAQ pair (FPGA, hybrid) by layer number.
+ * @param half Value indicating top or bottom half.
+ * @param layerNumber The layer number.
+ * @return The DAQ pair or null if does not exist.
+ */
+ Pair<Integer,Integer> get(Half half, int layerNumber) {
+ return layerMap.get(half).get(layerNumber);
+ }
+
+}