Print

Print


Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN
HPSSVTCalibrationConstants.java+111added 1.1
Class for reading (from conditions system) and storing SVT constants

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSSVTCalibrationConstants.java added at 1.1
diff -N HPSSVTCalibrationConstants.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HPSSVTCalibrationConstants.java	24 Apr 2012 14:06:41 -0000	1.1
@@ -0,0 +1,111 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.lcsim.hps.recon.tracking;
+
+import java.io.IOException;
+import java.io.StreamTokenizer;
+import java.util.HashMap;
+import java.util.Map;
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.hps.util.Pair;
+
+/**
+ *
+ * @author mgraham
+ */
+public class HPSSVTCalibrationConstants{
+
+    // Map from Sensor to Hybrid/FPGA pair
+    public static Map<Pair<SiSensor /*
+             * Sensor
+             */, Integer> /*
+             * Channel Number
+             */, Double /*
+             * constant
+             */> noise;
+    public static Map<Pair<SiSensor /*
+             * Sensor
+             */, Integer> /*
+             * Channel Number
+             */, Double /*
+             * constant
+             */> pedestal;
+    public static Map<Pair<SiSensor /*
+             * Sensor
+             */, Integer> /*
+             * Channel Number
+             */, Double /*
+             * constant
+             */> tShaping;
+
+    /**
+     * Default Constructor.
+     */
+    public HPSSVTCalibrationConstants() {
+        pedestal = new HashMap<Pair<SiSensor, Integer>, Double>();
+        noise = new HashMap<Pair<SiSensor, Integer>, Double>();
+        tShaping = new HashMap<Pair<SiSensor, Integer>, Double>();
+
+    }
+
+    public void loadCalibrationConstants(String calibFile) {
+        //write something here to read in constants from calibration fiel
+/*
+        ConditionsManager conditions = ConditionsManager.defaultInstance();
+        StreamTokenizer tok = null;
+        try {
+            tok = new StreamTokenizer(conditions.getRawConditions(calibFile).getReader());
+        } catch (IOException e) {
+            throw new RuntimeException("couldn't get DAQ map from conditions manager", e);
+        }
+        tok.commentChar('#');
+        tok.eolIsSignificant(false);
+        tok.parseNumbers();
+        try {
+            while (tok.nextToken() != StreamTokenizer.TT_EOF) {
+                tok.pushBack();
+                int x = (int) getNumber(tok);
+                int y = (int) getNumber(tok);
+                int crate = (int) getNumber(tok);
+                short slot = (short) getNumber(tok);
+                short channel = (short) getNumber(tok);
+                addMapEntry(enc.getID(), getDaqID(crate, slot, channel));
+                pedestal.put(sensorChannel, physicalID);
+                noise.put(sensorChannel, daqID);
+                //	System.out.printf("x = %d, y = %d, crate = %d,slot =  % d, channel =  % d\n", x, y, crate, slot, channel); //
+                //System.out.printf("physicalID = %d, daqID = %d\n", enc.getID(), getDaqID(crate, slot, channel));
+            }
+        } catch (IOException e) {
+            throw new RuntimeException("couldn't parse DAQ map", e);
+        }
+        * 
+        */
+
+    }
+
+    public static double getNoise(SiSensor sensor, int channel) {
+        Pair<SiSensor, Integer> sensorChannel = new Pair(sensor, channel);
+        return noise.get(sensorChannel);
+    }
+
+    public static double getPedestal(SiSensor sensor, int channel) {
+        Pair<SiSensor, Integer> sensorChannel = new Pair(sensor, channel);
+        return pedestal.get(sensorChannel);
+    }
+
+    public static double getTShaping(SiSensor sensor, int channel) {
+        Pair<SiSensor, Integer> sensorChannel = new Pair(sensor, channel);
+        return tShaping.get(sensorChannel);
+    }
+
+    private  double getNumber(StreamTokenizer tok) throws IOException {
+        if (tok.nextToken() == StreamTokenizer.TT_NUMBER) {
+            return tok.nval;
+        } else {
+            throw new IOException("expected an int from DAQ map, instead got " + tok);
+        }
+    }
+}
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