Print

Print


Author: [log in to unmask]
Date: Sun Mar  8 23:26:41 2015
New Revision: 2370

Log:
Add setters for the fields feb_id, feb_hybrid_id, side, svt_half and orientation.

Modified:
    java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java
    java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java
    java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/AbstractSvtDaqMapping.java	Sun Mar  8 23:26:41 2015
@@ -14,8 +14,6 @@
  */
 public abstract class AbstractSvtDaqMapping extends AbstractConditionsObject {
 
-    public static abstract class AbstractSvtDaqMappingCollection<T extends AbstractSvtDaqMapping> extends AbstractConditionsObjectCollection<T> {
-
         /**
          * Flag values for top or bottom half.
          */
@@ -27,6 +25,9 @@
          */
         public static final String AXIAL = "A";
         public static final String STEREO = "S";
+
+        public static abstract class AbstractSvtDaqMappingCollection<T extends AbstractSvtDaqMapping> extends AbstractConditionsObjectCollection<T> {
+
 
         /**
          * Get a DAQ pair for the given {@link HpsSiSensor}
@@ -48,18 +49,68 @@
 
     }
 
+    /**
+     *  Get the SVT half (TOP or BOTTOM) that the sensor belongs to.
+     *  
+     *  @return SVT half (TOP or BOTTOM)
+     */
     @Field(names = {"svt_half"})
     public String getSvtHalf() {
         return getFieldValue("svt_half");
     }
 
+    /**
+     *  Get the SVT sensor layer number (1-10 for test run and 1-12 for
+     *  engineering run).
+     *  
+     *  @return SVT sensor layer number
+     */
     @Field(names = {"layer"})
     public int getLayerNumber() {
         return getFieldValue("layer");
     }
 
+    
+    /**
+     *  Get the orientation of an SVT sensor (AXIAL or STEREO).
+     * 
+     *  @param orientation : Orientation of an SVT sensor (AXIAL or STEREO) 
+     */
     @Field(names = {"orientation"})
     public String getOrientation() {
         return getFieldValue("orientation");
     }
+    
+    /**
+     *  Set the SVT half (TOP or BOTTOM) that the sensor belongs to.
+     *  
+     *   @param svtHalf : SVT half (TOP or BOTTOM)
+     */
+    public void setSvtHalf(String svtHalf) { 
+        if (svtHalf != AbstractSvtDaqMapping.TOP_HALF || svtHalf != AbstractSvtDaqMapping.BOTTOM_HALF) 
+            throw new RuntimeException("[ " + this.getClass().getSimpleName() + " ]: Invalid value of SVT half.");
+        this.setFieldValue("svt_half", svtHalf);
+        
+    }
+    
+    /**
+     *  Set the SVT sensor layer number (1-10 for test run and 1-12 for
+     *  engineering run).
+     *  
+     *  @param layer : SVT sensor layer number
+     */
+    public void setLayerNumber(int layer) { 
+        this.setFieldValue("layer", layer);
+    }
+    
+    /**
+     *  Set the orientation of an SVT sensor (AXIAL or STEREO).
+     * 
+     *  @param orientation : Orientation of an SVT sensor (AXIAL or STEREO) 
+     */
+    public void setOrientation(String orientation) { 
+        if (orientation != AbstractSvtDaqMapping.AXIAL || orientation != AbstractSvtDaqMapping.STEREO)
+            throw new RuntimeException("[ " + this.getClass().getSimpleName() + " ]: Invalid orientation of sensor.");
+        this.setFieldValue("orientation", orientation);
+    }
 }

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDaqMapping.java	Sun Mar  8 23:26:41 2015
@@ -16,6 +16,12 @@
 @Table(names = {"svt_daq_map"})
 @Converter(multipleCollectionsAction = MultipleCollectionsAction.ERROR)
 public class SvtDaqMapping extends AbstractSvtDaqMapping {
+   
+    /**
+     *  Constants describing the side of a sensor
+     */
+    public static final String ELECTRON = "ELECTRON";
+    public static final String POSITRON = "POSITRON";
 
     public static class SvtDaqMappingCollection extends AbstractSvtDaqMappingCollection<SvtDaqMapping> {
 
@@ -100,18 +106,62 @@
         }
     }
 
+    /**
+     *  Get the Front End Board (FEB) ID.
+     *
+     *  @return The FEB ID
+     */
     @Field(names = {"feb_id"})
     public int getFebID() {
         return getFieldValue("feb_id");
     }
 
+    /**
+     *  Get the Front End Board (FEB) hybrid ID.
+     *  
+     *  @param The FEB hybrid ID
+     */
     @Field(names = {"feb_hybrid_id"})
     public int getFebHybridID() {
         return getFieldValue("feb_hybrid_id");
     }
 
+    /**
+     *  Get the side of the sensor (ELECTRON or POSITRON).
+     *  
+     *  @param sensor side (ELECTRON or POSITRON)
+     */
     @Field(names = {"side"})
     public String getSide() {
         return getFieldValue("side");
     }
+    
+    /**
+     *  Set the Front End Board (FEB) ID.
+     *  
+     *  @param febID : FEB ID
+     */
+    public void setFebID(int febID) { 
+        this.setFieldValue("feb_id", febID);
+    }
+    
+    /**
+     *  Set the Front End Board (FEB) hybrid ID.
+     *  
+     *  @param febHybridID : FEB hybrid ID
+     */
+    public void setFebHybridID(int febHybridID) { 
+        this.setFieldValue("feb_hybrid_id", febHybridID);
+    }
+    
+    /**
+     *  Set the side of the sensor (ELECTRON or POSITRON).
+     *  
+     *  @param side : sensor side (ELECTRON or POSITRON)
+     */
+    public void setSide(String side) {
+        if (side != SvtDaqMapping.ELECTRON || side != SvtDaqMapping.POSITRON) 
+            throw new RuntimeException("[ " + this.getClass().getSimpleName() + " ]: Invalid value for sensor side.");
+        this.setFieldValue("side", side);
+    }
 }

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtDetectorSetup.java	Sun Mar  8 23:26:41 2015
@@ -112,9 +112,9 @@
 
             // Set the orientation of the sensor
             String orientation = daqMap.getOrientation(daqPair);
-            if (orientation != null && orientation.contentEquals(SvtDaqMappingCollection.AXIAL)) {
+            if (orientation != null && orientation.contentEquals(SvtDaqMapping.AXIAL)) {
                 sensor.setAxial(true);
-            } else if (orientation != null && orientation.contains(SvtDaqMappingCollection.STEREO)) {
+            } else if (orientation != null && orientation.contains(SvtDaqMapping.STEREO)) {
                 sensor.setStereo(true);
             }
 
@@ -194,9 +194,9 @@
 
             // Set the orientation of the sensor
             String orientation = daqMap.getOrientation(daqPair);
-            if (orientation != null && orientation.contentEquals(TestRunSvtDaqMappingCollection.AXIAL)) {
+            if (orientation != null && orientation.contentEquals(TestRunSvtDaqMapping.AXIAL)) {
                 sensor.setAxial(true);
-            } else if (orientation != null && orientation.contains(TestRunSvtDaqMappingCollection.STEREO)) {
+            } else if (orientation != null && orientation.contains(TestRunSvtDaqMapping.STEREO)) {
                 sensor.setStereo(true);
             }