Commit in hps-java/src/main/java/org/lcsim/hps/conditions on MAIN
HpsConditionsReader.java+44added 1.1
Conditions reader for 2014 HPS detector and beyond

hps-java/src/main/java/org/lcsim/hps/conditions
HpsConditionsReader.java added at 1.1
diff -N HpsConditionsReader.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HpsConditionsReader.java	29 Oct 2012 18:08:29 -0000	1.1
@@ -0,0 +1,44 @@
+package org.lcsim.hps.conditions;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.conditions.ConditionsReader;
+
+/**
+ * 
+ * @author Sho Uemura <[log in to unmask]>
+ * @version $Id: HpsConditionsReader.java,v 1.1 2012/10/29 18:08:29 omoreno Exp $
+ */
+public class HpsConditionsReader extends ConditionsReader {
+
+    private String detectorName = null;
+    private int run;
+    
+    public HpsConditionsReader(ConditionsReader reader){
+    }
+
+    @Override
+    public InputStream open(String name, String type) throws IOException {
+        InputStream in = getClass().getResourceAsStream("/org/lcsim/hps/calib/" + name + "." + type);
+        if (in == null) {
+            in = getClass().getResourceAsStream("/" + detectorName + "/" + name + "." + type);
+            if (in == null) {
+                throw new IOException("Conditions " + name + " for " + detectorName + " with type " + type + " were not found");
+            }
+        }
+        return in;
+    }
+    
+    @Override
+    public void close() throws IOException {
+    }
+    
+    @Override
+    protected boolean update(ConditionsManager manager, String detectorName, int run) throws IOException {
+        this.detectorName = detectorName;
+        this.run = run;
+
+        return true;
+    }
+}
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1