Print

Print


Author: [log in to unmask]
Date: Tue Aug  9 17:58:42 2016
New Revision: 4453

Log:
Driver used to load calibrations onto the HPS SVT sensors.

Added:
    java/branches/layer0-thin-branch/detector-model/src/main/java/org/hps/detector/svt/SvtTrackerSetup.java   (with props)

Added: java/branches/layer0-thin-branch/detector-model/src/main/java/org/hps/detector/svt/SvtTrackerSetup.java
 =============================================================================
--- java/branches/layer0-thin-branch/detector-model/src/main/java/org/hps/detector/svt/SvtTrackerSetup.java	(added)
+++ java/branches/layer0-thin-branch/detector-model/src/main/java/org/hps/detector/svt/SvtTrackerSetup.java	Tue Aug  9 17:58:42 2016
@@ -0,0 +1,88 @@
+package org.hps.detector.svt;
+
+import java.util.List; 
+import java.util.logging.Logger; 
+
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.detector.tracker.silicon.ChargeCarrier;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
+
+/**
+ * Class used to load calibrations onto the HPS SVT sensors. 
+ * 
+ * @author <a href="mailto:[log in to unmask]">Omar Moreno</a> 
+ */
+public class SvtTrackerSetup extends Driver {
+
+    /** Initialize Logger */
+    private static Logger LOGGER = Logger.getLogger(SvtTrackerSetup.class.getPackage().getName());
+    
+    /** Name of the LDMX Tagger and Recoil subdetectors in the detector model. */
+    private static final String _TRACKER_NAME = "Tracker";
+
+    /** Channel noise in ADC counts */
+    private static final double[] CHANNEL_NOISE = new double[]{ 60, 60, 60, 60, 60, 60 };
+    
+    /** Channel baseline */
+    private static final double[] CHANNEL_BASELINE = new double[]{ 3000, 3000, 3000, 3000, 3000, 3000 }; 
+   
+    /** Channel gain */
+    private static final double CHANNEL_GAIN = 1; 
+    
+    /** Channel offset */ 
+    private static final double CHANNEL_OFFSET = 0; 
+    
+    /** Channel t0 shift */
+    private static final double CHANNEL_T0_SHIFT = 0; 
+    
+    /** Shaper fit parameters */
+    private static final double[] SHAPER_FIT_PARAMETERS = new double[]{2500, -10, 35, 10};
+    
+    protected void detectorChanged(Detector detector) { 
+        
+        final List<HpsSiSensor> taggerSensors 
+            = detector.getSubdetector(_TRACKER_NAME).getDetectorElement().findDescendants(HpsSiSensor.class);
+        LOGGER.info("Setting up " + taggerSensors.size() + "  tracker sensors");
+       
+        this.setup(taggerSensors);
+    
+    }
+    
+    private void setup(List<HpsSiSensor> sensors) {
+       
+        // Loop over all of the sensors
+        for (final HpsSiSensor sensor : sensors) {
+
+            System.out.println("Sensor: " + sensor.toString());
+            
+            // Reset possible existing conditions data on sensor.
+            sensor.reset();
+           
+            // Get the total number of readout strips that this sensor contains
+            double totalChannels = sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getNCells(); 
+            
+            System.out.println("Total channels: " + totalChannels);
+            
+            // Loop through all of the sensor channels and set some default 
+            // conditions.
+            for (int channelNumber = 0; channelNumber < totalChannels; channelNumber++) {
+                
+                // Set the channel baseline and noise
+                sensor.setPedestal(channelNumber, CHANNEL_BASELINE);
+                sensor.setNoise(channelNumber, CHANNEL_NOISE);
+                
+                // Set the channel gain and offset
+                sensor.setGain(channelNumber, CHANNEL_GAIN);
+                sensor.setOffset(channelNumber, CHANNEL_OFFSET);
+            
+                // Set the t0 shift for the sensor
+                sensor.setT0Shift(CHANNEL_T0_SHIFT);
+
+                // Set the shape fit parameters
+                sensor.setShapeFitParameters(channelNumber, SHAPER_FIT_PARAMETERS);
+            }
+            LOGGER.info(sensor.toString());
+        }
+    }
+}