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  March 2015

HPS-SVN March 2015

Subject:

r2528 - /java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsScalarData.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 24 Mar 2015 22:25:09 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (141 lines)

Author: [log in to unmask]
Date: Tue Mar 24 15:25:04 2015
New Revision: 2528

Log:
Add additional methods to EPICS scalar API including access to item descriptions as listed on Confluence EVIO page.

Modified:
    java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsScalarData.java

Modified: java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsScalarData.java
 =============================================================================
--- java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsScalarData.java	(original)
+++ java/trunk/record-util/src/main/java/org/hps/record/epics/EpicsScalarData.java	Tue Mar 24 15:25:04 2015
@@ -6,6 +6,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.GenericObject;
@@ -13,7 +14,8 @@
 /**
  * This is an API for reading and writing EPICS scalar data to LCIO events,
  * as well as parsing the scalar data from a CDATA section of an EVIO string
- * data bank.
+ * data bank.  The {@link #read(EventHeader)} method should be used to create
+ * one of these objects from an LCIO event.
  * 
  * @author Jeremy McCormick <[log in to unmask]>
 */
@@ -31,6 +33,39 @@
     
     // The map of scalar keys to values.
     private Map<String, Double> dataMap = new LinkedHashMap<String, Double>();
+    
+    // EPICS key descriptions from
+    // https://confluence.slac.stanford.edu/display/hpsg/EVIO+Data+Format           
+    private final static Map<String, String> DESCRIPTIONS = new HashMap<String, String>();
+    static {
+        DESCRIPTIONS.put("MBSY2C_energy",       "Beam energy according to Hall B BSY dipole string");
+        DESCRIPTIONS.put("PSPECIRBCK",          "Pair Spectrometer Current Readback");
+        DESCRIPTIONS.put("HPS:LS450_2:FIELD",   "Frascati probe field");
+        DESCRIPTIONS.put("HPS:LS450_1:FIELD",   "Pair Spectrometer probe field");
+        DESCRIPTIONS.put("MTIRBCK",             "Frascati Current Readback");
+        DESCRIPTIONS.put("VCG2C21 2C21",        "Vacuum gauge pressure");
+        DESCRIPTIONS.put("VCG2C21A",            "2C21A Vacuum gauge pressure");
+        DESCRIPTIONS.put("VCG2C24A",            "2C24A Vacuum gauge pressure");
+        DESCRIPTIONS.put("VCG2H00A",            "2H00 Vacuum gauge pressure");
+        DESCRIPTIONS.put("VCG2H01A",            "2H01 Vacuum gauge pressure");
+        DESCRIPTIONS.put("VCG2H02A",            "2H02 Vacuum gauge pressure");
+        DESCRIPTIONS.put("scaler_calc1",        "Faraday cup current");
+        DESCRIPTIONS.put("scalerS12b",          "HPS-Left beam halo count");
+        DESCRIPTIONS.put("scalerS13b",          "HPS-Right beam halo count");
+        DESCRIPTIONS.put("scalerS14b",          "HPS-Top beam halo count");
+        DESCRIPTIONS.put("scalerS15b",          "HPS-SC beam halo count");
+        DESCRIPTIONS.put("hallb_IPM2C21A_XPOS", "Beam position X at 2C21");
+        DESCRIPTIONS.put("hallb_IPM2C21A_YPOS", "Beam position Y at 2C21");
+        DESCRIPTIONS.put("hallb_IPM2C21A_CUR",  "Current at 2C21");
+        DESCRIPTIONS.put("hallb_IPM2C24A_XPOS", "Beam position X at 2C24");
+        DESCRIPTIONS.put("hallb_IPM2C24A_YPOS", "Beam position Y at 2C24");
+        DESCRIPTIONS.put("hallb_IPM2C24A_CUR",  "Current at 2C24");
+        DESCRIPTIONS.put("hallb_IPM2H00_XPOS",  "Beam position X at 2H00");
+        DESCRIPTIONS.put("hallb_IPM2H00_YPOS",  "Beam position Y at 2H00");
+        DESCRIPTIONS.put("hallb_IPM2H00_CUR",   "Current at 2H00");
+        DESCRIPTIONS.put("hallb_IPM2H02_YPOS",  "Beam position X at 2H02");
+        DESCRIPTIONS.put("hallb_IPM2H02_XPOS",  "Beam position Y at 2H02");
+    };
        
     /**
      * Write this object's data into a GenericObject collection in the LCIO event using 
@@ -62,8 +97,42 @@
      * Get a double value from the key.
      * @return The value from the key.
      */
-    public Double getValue(String key) {
-        return dataMap.get(key);
+    public Double getValue(String name) {
+        return dataMap.get(name);
+    }
+    
+    /**
+     * Get the description of a named EPICS scalar.
+     * @param name The name of the scalar.
+     */
+    public static String getDescription(String name) {
+        return DESCRIPTIONS.get(name);
+    }
+    
+    /**
+     * Get the static list of default, available EPICs scalar names.
+     * <p>
+     * This could be different than the names which were actually 
+     * written into the collection header.  For this, use the method
+     * {@link #getUsedNames()}.
+     * 
+     * @return The list of default EPICS scalar names. 
+     */
+    public static Set<String> getDefaultNames() {
+        return DESCRIPTIONS.keySet();
+    }
+    
+    /**
+     * Get the list of used EPICS scalars in this object.
+     * <p>
+     * This could potentially be different than the list of
+     * default names from {@link #getDefaultNames()} but it
+     * will usually be the same.
+     * 
+     * @return The list of used EPICS scalar names.
+     */
+    public Set<String> getUsedNames() {
+        return dataMap.keySet();
     }
     
     /**
@@ -118,15 +187,15 @@
     }
 
     /**
-     * Given a list of keys, read the double values from the 
+     * Given a list of names, read the double values from the 
      * {@link org.lcsim.event.GenericObject} into the data map
      * of this object.
-     * @param object
-     * @param keys
-     */
-    void fromGenericObject(GenericObject object, String[] keys) {
-        for (int index = 0; index < keys.length; index++) {                      
-            dataMap.put(keys[index], object.getDoubleVal(index)); 
+     * @param object The GenericObject with the scalar values.
+     * @param names The list of names.
+     */
+    void fromGenericObject(GenericObject object, String[] names) {
+        for (int index = 0; index < names.length; index++) {                      
+            dataMap.put(names[index], object.getDoubleVal(index)); 
         }
     }
         

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