Print

Print


Author: [log in to unmask]
Date: Fri Feb 12 14:24:26 2016
New Revision: 4217

Log:
Changes to be able to setup and run readout and recon on the 2016 detector.

Added:
    java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/AbstractSvtDetectorSetup.java
    java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/EngRun2015SvtDetectorSetup.java
      - copied, changed from r4136, java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java
    java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/Prop2016SvtDetectorSetup.java
    java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/TestRunSvtDetectorSetup.java
    java/branches/layer0-branch/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-7-layers.xml
Removed:
    java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java
Modified:
    java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java
    java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java
    java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java
    java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java
    java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java
    java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java
    java/branches/layer0-branch/detector-model/src/test/java/org/hps/detector/svt/SvtDetectorSetupTest.java
    java/branches/layer0-branch/job/src/main/java/org/hps/job/JobManager.java
    java/branches/layer0-branch/logging/src/main/resources/org/hps/logging/config/logging.properties
    java/branches/layer0-branch/parent/pom.xml
    java/branches/layer0-branch/steering-files/src/main/resources/org/hps/steering/users/phansson/HPSTrackingDefaults.lcsim
    java/branches/layer0-branch/users/src/main/java/org/hps/users/phansson/TrackingReconstructionPlots.java

Modified: java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java
 =============================================================================
--- java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java	(original)
+++ java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/database/DatabaseConditionsManager.java	Fri Feb 12 14:24:26 2016
@@ -99,6 +99,13 @@
      */
     private static final int TEST_RUN_MAX_RUN = 1365;
 
+    
+    /**
+     * The max value for a run to be considered Eng Run 2015.
+     */
+    private static final int ENG_RUN_2015_MAX_RUN = 9999;
+
+    
     static {
         // Set default login timeout of 5 seconds.
         DriverManager.setLoginTimeout(30);
@@ -110,15 +117,22 @@
      * @return the static instance of the manager
      */
     public static synchronized DatabaseConditionsManager getInstance() {
+        
+        LOGGER.info("getInstance called");
 
         // Is there no manager installed yet?
         if (!ConditionsManager.isSetup() || !(ConditionsManager.defaultInstance() instanceof DatabaseConditionsManager)) {
 
+            LOGGER.info("setup cond manager");
+
             // Create a new instance if necessary, which will install it globally as the default.
             final DatabaseConditionsManager dbManager = new DatabaseConditionsManager();
 
             // Register default conditions manager.
             ConditionsManager.setDefaultConditionsManager(dbManager);
+
+            LOGGER.info("setup cond manager DONE");
+
         }
 
         // Get the instance back from the default conditions system and check that the type is correct now.
@@ -140,6 +154,16 @@
     public static boolean isTestRun(final int runNumber) {
         return runNumber > 0 && runNumber <= TEST_RUN_MAX_RUN;
     }
+    
+    /**
+     * Utility method to determine if a run number is from the Prop 2016.
+     *
+     * @param runNumber the run number
+     * @return <code>true</code> if run number is from the Prop 2016
+     */
+    public static boolean isProp2016Run(final int runNumber) {
+        return runNumber > ENG_RUN_2015_MAX_RUN;
+    }
 
     /**
      * Reset the global static instance of the conditions manager to a new object.
@@ -234,6 +258,11 @@
      * True if current run number is from Test Run.
      */
     private boolean isTestRun = false;
+
+    /**
+     * True if current run number is from Prop 2016.
+     */
+    private boolean isProp2016Run = false;
 
     /**
      * Flag used to print connection parameters one time.
@@ -687,6 +716,17 @@
         if (isTestRun(runNumber)) {
             this.isTestRun = true;
         }
+        
+        
+        System.out.println("initializing with detector " + detectorName + " and run " + runNumber);
+
+        if (isProp2016Run(runNumber)) {
+            System.out.println("prop2016 pelle YES");
+            this.isProp2016Run = true;
+        } else {
+            System.out.println("prop2016 pelle NO");
+        }
+        
 
         // Is not configured yet?
         if (!this.isConfigured) {
@@ -713,8 +753,12 @@
 
         // Call the super class's setDetector method to construct the detector object and activate conditions listeners.
         LOGGER.fine("activating default conditions manager");
+        System.out.println("call super setDetector with detector " + detectorName + " run " + runNumber);
+        
         super.setDetector(detectorName, runNumber);
 
+        System.out.println("DONE call super setDetector with detector " + detectorName + " run " + runNumber);
+        
         // Should all conditions sets be cached?
         if (this.cacheAllConditions) {
             // Cache the conditions sets of all registered converters.
@@ -737,6 +781,11 @@
 
         this.isInitialized = true;
 
+        
+        if (isProp2016Run(runNumber)) {
+            System.out.println("prop2016 pelle YES2");
+           
+        }
         LOGGER.info("conditions system initialized successfully");
     }
 
@@ -774,6 +823,15 @@
      */
     public boolean isTestRun() {
         return this.isTestRun;
+    }
+
+    /**
+     * Return <code>true</code> if Test Run configuration is active
+     *
+     * @return <code>true</code> if Test Run configuration is active
+     */
+    public boolean isProp2016Run() {
+        return this.isProp2016Run;
     }
 
     /**

Modified: java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java
 =============================================================================
--- java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java	(original)
+++ java/branches/layer0-branch/conditions/src/main/java/org/hps/conditions/svt/SvtConditions.java	Fri Feb 12 14:24:26 2016
@@ -2,9 +2,11 @@
 
 import static org.hps.conditions.svt.AbstractSvtChannel.MAX_NUMBER_OF_SAMPLES;
 
+import org.hps.conditions.svt.AbstractSvtDaqMapping.AbstractSvtDaqMappingCollection;
 import org.hps.conditions.svt.SvtChannel.SvtChannelCollection;
 import org.hps.conditions.svt.SvtDaqMapping.SvtDaqMappingCollection;
 import org.hps.conditions.svt.SvtT0Shift.SvtT0ShiftCollection;
+import org.hps.conditions.svt.TestRunSvtDaqMapping.TestRunSvtDaqMappingCollection;
 
 /**
  * This class contains all test run SVT conditions data by readout channel. {@link SvtChannel} objects from the SVT

Added: java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/AbstractSvtDetectorSetup.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/AbstractSvtDetectorSetup.java	(added)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/AbstractSvtDetectorSetup.java	Fri Feb 12 14:24:26 2016
@@ -0,0 +1,124 @@
+package org.hps.detector.svt;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.svt.AbstractSvtConditions;
+import org.hps.conditions.svt.AbstractSvtDaqMapping;
+import org.hps.conditions.svt.AbstractSvtDaqMapping.AbstractSvtDaqMappingCollection;
+import org.hps.conditions.svt.SvtConditions;
+import org.hps.util.Pair;
+import org.lcsim.conditions.ConditionsEvent;
+import org.lcsim.conditions.ConditionsListener;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
+import org.lcsim.geometry.compact.Subdetector;
+/**
+ * This class puts {@link SvtConditions} data onto <code>HpsSiSensor</code> objects.
+ *
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
+ * @author Per Hansson Adrian, SLAC
+ */
+public abstract class AbstractSvtDetectorSetup implements ConditionsListener {
+
+    /**
+     * Initialize logger.
+     */
+    protected static Logger LOGGER = Logger.getLogger(AbstractSvtDetectorSetup.class.getName());
+    /**
+     * The number of noise samples.
+     */
+    protected static final int NOISE_COUNT = 6;
+    /**
+     * The number of pedestals.
+     */
+    protected static final int PEDESTAL_COUNT = 6;
+    /**
+     * Flag to enable/disable this class from within conditions manager.
+     */
+    protected boolean enabled = true;
+    /**
+     * The name of the SVT subdetector in the detector model.
+     */
+    protected String svtName = "Tracker";
+
+    /**
+     * Get a DAQ pair (FEB ID, FEB Hybrid ID) for the given {@link HpsSiSensor}.
+     * 
+     * @param sensor
+     *            a sensor of type {@link HpsSiSensor}
+     * @return the DAQ pair associated with the sensor
+     */
+    abstract protected Pair<Integer, Integer> getDaqPair(AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping>  daqMap, final HpsSiSensor sensor);
+    
+
+    /**
+     * Hook that activates this class when conditions change (new detector or
+     * run number).
+     * 
+     * @param event
+     *            the conditions event
+     */
+    abstract public void conditionsChanged(final ConditionsEvent event);
+
+    /**
+     * Load conditions data onto a detector object.
+     * 
+     * @param subdetector
+     *            the SVT subdetector object
+     * @param conditions
+     *            the conditions object
+     */
+    abstract protected void loadDefault(final Subdetector subdetector, final AbstractSvtConditions conditions);
+   
+
+    /**
+     * Set whether this class is enabled to be activated on conditions changes.
+     * 
+     * @param enabled
+     *            <code>true</code> to enable
+     */
+    public void setEnabled(final boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    /**
+     * Set the log level.
+     * 
+     * @param level
+     *            the log level
+     */
+    public void setLogLevel(final Level level) {
+        LOGGER.setLevel(level);
+        LOGGER.getHandlers()[0].setLevel(level);
+    }
+
+    /**
+     * Set the name of the SVT in the detector model.
+     * 
+     * @param svtName
+     *            the name of the SVt in the detector model.
+     */
+    public void setSvtName(final String svtName) {
+        this.svtName = svtName;
+    }
+
+/*
+    static Pair<Integer, Integer> getTestRunDaqPair(TestRunSvtDaqMappingCollection daqMap, final HpsSiSensor sensor) {
+
+        final String svtHalf = sensor.isTopLayer() ? AbstractSvtDaqMapping.TOP_HALF : AbstractSvtDaqMapping.BOTTOM_HALF;
+        for (final TestRunSvtDaqMapping daqMapping : daqMap) {
+
+            if (svtHalf.equals(daqMapping.getSvtHalf()) && daqMapping.getLayerNumber() == sensor.getLayerNumber()) {
+
+                return new Pair<Integer, Integer>(daqMapping.getFpgaID(), daqMapping.getHybridID());
+            }
+        }
+        return null;
+    }
+*/
+    public AbstractSvtDetectorSetup() {
+        super();
+    }
+
+}

Copied: java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/EngRun2015SvtDetectorSetup.java (from r4136, java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java)
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java	(original)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/EngRun2015SvtDetectorSetup.java	Fri Feb 12 14:24:26 2016
@@ -2,31 +2,22 @@
 
 import java.util.Collection;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 
 import org.hps.conditions.database.DatabaseConditionsManager;
+import org.hps.conditions.svt.AbstractSvtConditions;
 import org.hps.conditions.svt.AbstractSvtDaqMapping;
+import org.hps.conditions.svt.AbstractSvtDaqMapping.AbstractSvtDaqMappingCollection;
 import org.hps.conditions.svt.ChannelConstants;
 import org.hps.conditions.svt.SvtChannel;
-import org.hps.conditions.svt.SvtDaqMapping;
-import org.hps.conditions.svt.TestRunSvtDaqMapping;
 import org.hps.conditions.svt.SvtChannel.SvtChannelCollection;
 import org.hps.conditions.svt.SvtConditions;
+import org.hps.conditions.svt.SvtDaqMapping;
 import org.hps.conditions.svt.SvtDaqMapping.SvtDaqMappingCollection;
 import org.hps.conditions.svt.SvtT0Shift;
 import org.hps.conditions.svt.SvtT0Shift.SvtT0ShiftCollection;
-import org.hps.conditions.svt.TestRunSvtChannel;
-import org.hps.conditions.svt.TestRunSvtChannel.TestRunSvtChannelCollection;
-import org.hps.conditions.svt.TestRunSvtConditions;
-import org.hps.conditions.svt.TestRunSvtDaqMapping.TestRunSvtDaqMappingCollection;
-import org.hps.conditions.svt.TestRunSvtT0Shift;
-import org.hps.conditions.svt.TestRunSvtT0Shift.TestRunSvtT0ShiftCollection;
 import org.hps.util.Pair;
 import org.lcsim.conditions.ConditionsEvent;
-import org.lcsim.conditions.ConditionsListener;
 import org.lcsim.detector.tracker.silicon.HpsSiSensor;
-import org.lcsim.detector.tracker.silicon.HpsTestRunSiSensor;
 import org.lcsim.geometry.compact.Subdetector;
 
 /**
@@ -34,71 +25,48 @@
  *
  * @author Jeremy McCormick, SLAC
  * @author Omar Moreno, UCSC
+ * @author Per Hansson Adrian, SLAC
  */
-public final class SvtDetectorSetup implements ConditionsListener {
-
-    /**
-     * Initialize logger.
-     */
-    private static Logger LOGGER = Logger.getLogger(SvtDetectorSetup.class.getPackage().getName());
-
-    /**
-     * The number of noise samples.
-     */
-    private static final int NOISE_COUNT = 6;
-
-    /**
-     * The number of pedestals.
-     */
-    private static final int PEDESTAL_COUNT = 6;
-
-    /**
-     * Flag to enable/disable this class from within conditions manager.
-     */
-    private boolean enabled = true;
-
-    /**
-     * The name of the SVT subdetector in the detector model.
-     */
-    private String svtName = "Tracker";
+public class EngRun2015SvtDetectorSetup extends AbstractSvtDetectorSetup {
 
     /**
      * Constructor that uses the default detector name.
      */
-    public SvtDetectorSetup() {
+    public EngRun2015SvtDetectorSetup() {
     }
 
     /**
      * Constructor that takes name of SVT.
-     *
-     * @param svtName the name of the SVT subdetector
+     * 
+     * @param svtName
+     *            the name of the SVT subdetector
      */
-    public SvtDetectorSetup(final String svtName) {
+    public EngRun2015SvtDetectorSetup(final String svtName) {
         this.svtName = svtName;
     }
 
-    /**
-     * Hook that activates this class when conditions change (new detector or run number).
-     *
-     * @param event the conditions event
+    /* (non-Javadoc)
+     * @see org.hps.detector.svt.AbstractSvtDetectorSetup#conditionsChanged(org.lcsim.conditions.ConditionsEvent)
      */
     @Override
     public void conditionsChanged(final ConditionsEvent event) {
         if (this.enabled) {
             final DatabaseConditionsManager manager = (DatabaseConditionsManager) event.getConditionsManager();
             final Subdetector subdetector = manager.getDetectorObject().getSubdetector(this.svtName);
+
+            if (manager.isTestRun())
+                throw new RuntimeException(
+                        "The conditions manager is Test run but we are settiung up the 2015 eng run SVT?!");
+
             if (subdetector != null) {
-                if (manager.isTestRun()) {
-                    LOGGER.info("activating Test Run setup");
-                    final TestRunSvtConditions svtConditions = manager.getCachedConditions(TestRunSvtConditions.class,
-                            "test_run_svt_conditions").getCachedData();
-                    this.loadTestRun(subdetector, svtConditions);
-                } else {
-                    LOGGER.info("activating default setup");
-                    final SvtConditions svtConditions = manager.getCachedConditions(SvtConditions.class,
-                            "svt_conditions").getCachedData();
-                    this.loadDefault(subdetector, svtConditions);
-                }
+                LOGGER.info("activating default setup");
+                final SvtConditions svtConditions = manager.getCachedConditions(SvtConditions.class, "svt_conditions")
+                        .getCachedData();
+                if( !(svtConditions instanceof SvtConditions))
+                    throw new RuntimeException("The conditions are of the wrong type.");
+                else
+                    LOGGER.info("svtConditions are correct instance.");
+                    loadDefault(subdetector, svtConditions);
             } else {
                 LOGGER.warning("no SVT detector was found so setup was NOT activated");
                 this.enabled = false;
@@ -108,23 +76,24 @@
         }
     }
 
-    /**
-     * Load conditions data onto a detector object.
-     *
-     * @param subdetector the SVT subdetector object
-     * @param conditions the conditions object
-     */
-    void loadDefault(final Subdetector subdetector, final SvtConditions conditions) {
-
+    @Override
+    protected void loadDefault(final Subdetector subdetector, final AbstractSvtConditions conditions) {
+        LOGGER.info("calling loaddefaut in EngRun2015SvtDetectorSetup");
+        
         LOGGER.info("loading default SVT conditions onto subdetector " + subdetector.getName());
-
+        
+        if( !(conditions instanceof SvtConditions))
+            throw new RuntimeException("The conditions are of the wrong type.");
+        
+        SvtConditions engRun2015Conditions = (SvtConditions) conditions;
         // Find sensor objects.
         final List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
         LOGGER.info("setting up " + sensors.size() + " SVT sensors");
-        final SvtChannelCollection channelMap = conditions.getChannelMap();
-        LOGGER.info("channel map has " + conditions.getChannelMap().size() + " entries");
-        final SvtDaqMappingCollection daqMap = conditions.getDaqMap();
-        final SvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();
+        final SvtChannelCollection channelMap = engRun2015Conditions.getChannelMap();
+        LOGGER.info("channel map has " + engRun2015Conditions.getChannelMap().size() + " entries");
+        //final AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> daqMap = engRun2015Conditions.getDaqMap();
+        final SvtDaqMappingCollection daqMap = engRun2015Conditions.getDaqMap();
+        final SvtT0ShiftCollection t0Shifts = engRun2015Conditions.getT0Shifts();
 
         // Loop over sensors.
         for (final HpsSiSensor sensor : sensors) {
@@ -159,7 +128,7 @@
             for (final SvtChannel channel : channels) {
 
                 // Get conditions data for this channel.
-                final ChannelConstants constants = conditions.getChannelConstants(channel);
+                final ChannelConstants constants = engRun2015Conditions.getChannelConstants(channel);
                 final int channelNumber = channel.getChannel();
 
                 //
@@ -199,158 +168,23 @@
         }
     }
 
-    /**
-     * Load conditions from Test Run detector.
-     *
-     * @param subdetector the SVT subdetector object
-     * @param conditions the Test Run conditions
-     */
-    void loadTestRun(final Subdetector subdetector, final TestRunSvtConditions conditions) {
+    @Override
+    protected Pair<Integer, Integer> getDaqPair(AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping> daqMap, final HpsSiSensor sensor) {
+        final String svtHalf = sensor.isTopLayer() ? AbstractSvtDaqMapping.TOP_HALF : AbstractSvtDaqMapping.BOTTOM_HALF;
+        for (final AbstractSvtDaqMapping abstractMapping : daqMap) {
+            
+            if(!(abstractMapping instanceof SvtDaqMapping))
+                throw new RuntimeException("This abstract mapping has the wrong type.");
+            
+            SvtDaqMapping svtMapping = (SvtDaqMapping) abstractMapping;
+            if (svtHalf.equals(svtMapping.getSvtHalf()) && svtMapping.getLayerNumber() == sensor.getLayerNumber()
+                    && svtMapping.getSide().equals(sensor.getSide())) {
 
-        LOGGER.info("loading Test Run SVT conditions onto subdetector " + subdetector.getName());
-
-        // Find sensor objects.
-        final List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
-        LOGGER.info("setting up " + sensors.size() + " SVT sensors");
-        final TestRunSvtChannelCollection channelMap = conditions.getChannelMap();
-        LOGGER.info("channel map has " + channelMap.size() + " entries");
-        final TestRunSvtDaqMappingCollection daqMap = conditions.getDaqMap();
-        final TestRunSvtT0ShiftCollection t0Shifts = conditions.getT0Shifts();
-
-        // Loop over sensors.
-        for (final HpsSiSensor sensor : sensors) {
-
-            // Reset possible existing conditions data on sensor.
-            sensor.reset();
-
-            // Get DAQ pair (FPGA ID, Hybrid ID) corresponding to this sensor
-            final Pair<Integer, Integer> daqPair = SvtDetectorSetup.getTestRunDaqPair(daqMap, sensor);
-            if (daqPair == null) {
-                throw new RuntimeException("Failed to find DAQ pair for sensor: " + sensor.getName());
-            }
-
-            // Set the FPGA ID of the sensor
-            ((HpsTestRunSiSensor) sensor).setFpgaID(daqPair.getFirstElement());
-
-            // Set the hybrid ID of the sensor
-            ((HpsTestRunSiSensor) sensor).setHybridID(daqPair.getSecondElement());
-
-            // Set the orientation of the sensor
-            final String orientation = daqMap.getOrientation(daqPair);
-            if (orientation != null && orientation.contentEquals(AbstractSvtDaqMapping.AXIAL)) {
-                sensor.setAxial(true);
-            } else if (orientation != null && orientation.contains(AbstractSvtDaqMapping.STEREO)) {
-                sensor.setStereo(true);
-            }
-
-            // Find all the channels for this sensor.
-            final Collection<TestRunSvtChannel> channels = channelMap.find(daqPair);
-
-            // Loop over the channels of the sensor.
-            for (final TestRunSvtChannel channel : channels) {
-
-                // Get conditions data for this channel.
-                final ChannelConstants constants = conditions.getChannelConstants(channel);
-                final int channelNumber = channel.getChannel();
-
-                //
-                // Set conditions data for this channel on the sensor object:
-                //
-                // Check if the channel was flagged as bad
-                if (constants.isBadChannel()) {
-                    sensor.setBadChannel(channelNumber);
-                }
-
-                // Set the pedestal and noise of each of the samples for the
-                // channel
-                final double[] pedestal = new double[6];
-                final double[] noise = new double[6];
-                for (int sampleN = 0; sampleN < HpsSiSensor.NUMBER_OF_SAMPLES; sampleN++) {
-                    pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
-                    noise[sampleN] = constants.getCalibration().getNoise(sampleN);
-                }
-                sensor.setPedestal(channelNumber, pedestal);
-                sensor.setNoise(channelNumber, noise);
-
-                // Set the gain and offset for the channel
-                sensor.setGain(channelNumber, constants.getGain().getGain());
-                sensor.setOffset(channelNumber, constants.getGain().getOffset());
-
-                // Set the shape fit parameters
-                sensor.setShapeFitParameters(channelNumber, constants.getShapeFitParameters().toArray());
-            }
-
-            // Set the t0 shift for the sensor.
-            final TestRunSvtT0Shift sensorT0Shift = t0Shifts.getT0Shift(daqPair);
-            sensor.setT0Shift(sensorT0Shift.getT0Shift());
-        }
-    }
-
-    /**
-     * Set whether this class is enabled to be activated on conditions changes.
-     *
-     * @param enabled <code>true</code> to enable
-     */
-    public void setEnabled(final boolean enabled) {
-        this.enabled = enabled;
-    }
-
-    /**
-     * Set the log level.
-     *
-     * @param level the log level
-     */
-    public void setLogLevel(final Level level) {
-        LOGGER.setLevel(level);
-        LOGGER.getHandlers()[0].setLevel(level);
-    }
-
-    /**
-     * Set the name of the SVT in the detector model.
-     *
-     * @param svtName the name of the SVt in the detector model.
-     */
-    public void setSvtName(final String svtName) {
-        this.svtName = svtName;
-    }
-    
-    /**
-     * Get a DAQ pair (FEB ID, FEB Hybrid ID) for the given {@link HpsSiSensor}.
-     *
-     * @param sensor a sensor of type {@link HpsSiSensor}
-     * @return the DAQ pair associated with the sensor
-     */
-    static Pair<Integer, Integer> getDaqPair(SvtDaqMappingCollection daqMap, final HpsSiSensor sensor) {
-
-        final String svtHalf = sensor.isTopLayer() ? AbstractSvtDaqMapping.TOP_HALF : AbstractSvtDaqMapping.BOTTOM_HALF;
-        for (final SvtDaqMapping object : daqMap) {
-
-            if (svtHalf.equals(object.getSvtHalf()) && object.getLayerNumber() == sensor.getLayerNumber()
-                    && object.getSide().equals(sensor.getSide())) {
-
-                return new Pair<Integer, Integer>(object.getFebID(), object.getFebHybridID());
+                return new Pair<Integer, Integer>(svtMapping.getFebID(), svtMapping.getFebHybridID());
             }
         }
         return null;
     }
-    
-    /**
-     * Get a test run DAQ pair (FPGA and Hybrid ID) for the given {@linkplain HpsTestRunSiSensor}.
-     *
-     * @param sensor a sensor of type {@link HpsTestRunSiSensor}
-     * @return the DAQ pair associated with the sensor
-     */
-    static Pair<Integer, Integer> getTestRunDaqPair(TestRunSvtDaqMappingCollection daqMap, final HpsSiSensor sensor) {
 
-        final String svtHalf = sensor.isTopLayer() ? AbstractSvtDaqMapping.TOP_HALF : AbstractSvtDaqMapping.BOTTOM_HALF;
-        for (final TestRunSvtDaqMapping daqMapping : daqMap) {
-
-            if (svtHalf.equals(daqMapping.getSvtHalf()) && daqMapping.getLayerNumber() == sensor.getLayerNumber()) {
-
-                return new Pair<Integer, Integer>(daqMapping.getFpgaID(), daqMapping.getHybridID());
-            }
-        }
-        return null;
-    }
     
 }

Added: java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/Prop2016SvtDetectorSetup.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/Prop2016SvtDetectorSetup.java	(added)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/Prop2016SvtDetectorSetup.java	Fri Feb 12 14:24:26 2016
@@ -0,0 +1,42 @@
+package org.hps.detector.svt;
+
+import org.hps.conditions.svt.AbstractSvtConditions;
+import org.hps.conditions.svt.SvtConditions;
+import org.lcsim.geometry.compact.Subdetector;
+
+/**
+ * This class puts {@link SvtConditions} data onto <code>HpsSiSensor</code>
+ * objects.
+ * 
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
+ * @author Per Hansson Adrian, SLAC
+ */
+public final class Prop2016SvtDetectorSetup extends EngRun2015SvtDetectorSetup {
+
+    /**
+     * Constructor that uses the default detector name.
+     */
+    public Prop2016SvtDetectorSetup() {
+        super();
+    }
+
+    /**
+     * Constructor that takes name of SVT.
+     * 
+     * @param svtName
+     *            the name of the SVT subdetector
+     */
+    public Prop2016SvtDetectorSetup(final String svtName) {
+        super(svtName);
+    }
+
+    @Override
+    protected void loadDefault(Subdetector subdetector, AbstractSvtConditions conditions) {
+        LOGGER.info("calling loaddefaut in Prop2016SvtDetectorSetup");
+        super.loadDefault(subdetector, conditions);
+    }
+
+    
+    
+}

Added: java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/TestRunSvtDetectorSetup.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/TestRunSvtDetectorSetup.java	(added)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/hps/detector/svt/TestRunSvtDetectorSetup.java	Fri Feb 12 14:24:26 2016
@@ -0,0 +1,195 @@
+package org.hps.detector.svt;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.hps.conditions.database.DatabaseConditionsManager;
+import org.hps.conditions.svt.AbstractSvtConditions;
+import org.hps.conditions.svt.AbstractSvtDaqMapping;
+import org.hps.conditions.svt.AbstractSvtDaqMapping.AbstractSvtDaqMappingCollection;
+import org.hps.conditions.svt.ChannelConstants;
+import org.hps.conditions.svt.TestRunSvtChannel;
+import org.hps.conditions.svt.TestRunSvtChannel.TestRunSvtChannelCollection;
+import org.hps.conditions.svt.TestRunSvtConditions;
+import org.hps.conditions.svt.TestRunSvtDaqMapping;
+import org.hps.conditions.svt.TestRunSvtDaqMapping.TestRunSvtDaqMappingCollection;
+import org.hps.conditions.svt.TestRunSvtT0Shift;
+import org.hps.conditions.svt.TestRunSvtT0Shift.TestRunSvtT0ShiftCollection;
+import org.hps.util.Pair;
+import org.lcsim.conditions.ConditionsEvent;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
+import org.lcsim.detector.tracker.silicon.HpsTestRunSiSensor;
+import org.lcsim.geometry.compact.Subdetector;
+
+/**
+ * This class puts {@link TestRunSvtConditions} data onto <code>HpsSiSensor</code> objects.
+ *
+ * @author Jeremy McCormick, SLAC
+ * @author Omar Moreno, UCSC
+ * @author Per Hansson Adrian, SLAC
+ */
+public final class TestRunSvtDetectorSetup extends AbstractSvtDetectorSetup {
+
+    /**
+     * Constructor that uses the default detector name.
+     */
+    public TestRunSvtDetectorSetup() {
+    }
+
+    /**
+     * Constructor that takes name of SVT.
+     *
+     * @param svtName the name of the SVT subdetector
+     */
+    public TestRunSvtDetectorSetup(final String svtName) {
+        this.svtName = svtName;
+    }
+    
+    
+    
+/* (non-Javadoc)
+ * @see org.hps.detector.svt.AbstractSvtDetectorSetup#conditionsChanged(org.lcsim.conditions.ConditionsEvent)
+ */
+@Override
+public void conditionsChanged(final ConditionsEvent event) {
+    if (this.enabled) {
+        final DatabaseConditionsManager manager = (DatabaseConditionsManager) event.getConditionsManager();
+        final Subdetector subdetector = manager.getDetectorObject().getSubdetector(this.svtName);
+        
+            if (!manager.isTestRun())
+                throw new RuntimeException(
+                        "The conditions manager is not Test run but we are settiung up test run SVT?!");
+        
+        if (subdetector != null) {
+            LOGGER.info("activating Test Run setup");
+            final TestRunSvtConditions svtConditions = manager.getCachedConditions(TestRunSvtConditions.class,
+                    "test_run_svt_conditions").getCachedData();
+            this.loadDefault(subdetector, svtConditions);
+        } else {
+            LOGGER.warning("no SVT detector was found so setup was NOT activated");
+            this.enabled = false;
+        }
+    } else {
+        LOGGER.config("disabled");
+    }
+}
+
+
+
+protected void loadDefault(final Subdetector subdetector, final AbstractSvtConditions conditions) {
+
+    LOGGER.info("loading Test Run SVT conditions onto subdetector " + subdetector.getName());
+    
+    if( !(conditions instanceof TestRunSvtConditions))
+        throw new RuntimeException("The conditions are of the wrong type.");
+
+    TestRunSvtConditions testRunConditions = (TestRunSvtConditions) conditions;
+    
+    // Find sensor objects.
+    final List<HpsSiSensor> sensors = subdetector.getDetectorElement().findDescendants(HpsSiSensor.class);
+    LOGGER.info("setting up " + sensors.size() + " SVT sensors");
+    final TestRunSvtChannelCollection channelMap = testRunConditions.getChannelMap();
+    LOGGER.info("channel map has " + channelMap.size() + " entries");
+    final TestRunSvtDaqMappingCollection daqMap = testRunConditions.getDaqMap();
+    final TestRunSvtT0ShiftCollection t0Shifts = testRunConditions.getT0Shifts();
+
+    // Loop over sensors.
+    for (final HpsSiSensor sensor : sensors) {
+
+        // Reset possible existing conditions data on sensor.
+        sensor.reset();
+
+        // Get DAQ pair (FPGA ID, Hybrid ID) corresponding to this sensor
+        final Pair<Integer, Integer> daqPair = getDaqPair(daqMap, sensor);
+        if (daqPair == null) {
+            throw new RuntimeException("Failed to find DAQ pair for sensor: " + sensor.getName());
+        }
+
+        // Set the FPGA ID of the sensor
+        ((HpsTestRunSiSensor) sensor).setFpgaID(daqPair.getFirstElement());
+
+        // Set the hybrid ID of the sensor
+        ((HpsTestRunSiSensor) sensor).setHybridID(daqPair.getSecondElement());
+
+        // Set the orientation of the sensor
+        final String orientation = daqMap.getOrientation(daqPair);
+        if (orientation != null && orientation.contentEquals(AbstractSvtDaqMapping.AXIAL)) {
+            sensor.setAxial(true);
+        } else if (orientation != null && orientation.contains(AbstractSvtDaqMapping.STEREO)) {
+            sensor.setStereo(true);
+        }
+
+        // Find all the channels for this sensor.
+        final Collection<TestRunSvtChannel> channels = channelMap.find(daqPair);
+
+        // Loop over the channels of the sensor.
+        for (final TestRunSvtChannel channel : channels) {
+
+            // Get conditions data for this channel.
+            final ChannelConstants constants = testRunConditions.getChannelConstants(channel);
+            final int channelNumber = channel.getChannel();
+
+            //
+            // Set conditions data for this channel on the sensor object:
+            //
+            // Check if the channel was flagged as bad
+            if (constants.isBadChannel()) {
+                sensor.setBadChannel(channelNumber);
+            }
+
+            // Set the pedestal and noise of each of the samples for the
+            // channel
+            final double[] pedestal = new double[6];
+            final double[] noise = new double[6];
+            for (int sampleN = 0; sampleN < HpsSiSensor.NUMBER_OF_SAMPLES; sampleN++) {
+                pedestal[sampleN] = constants.getCalibration().getPedestal(sampleN);
+                noise[sampleN] = constants.getCalibration().getNoise(sampleN);
+            }
+            sensor.setPedestal(channelNumber, pedestal);
+            sensor.setNoise(channelNumber, noise);
+
+            // Set the gain and offset for the channel
+            sensor.setGain(channelNumber, constants.getGain().getGain());
+            sensor.setOffset(channelNumber, constants.getGain().getOffset());
+
+            // Set the shape fit parameters
+            sensor.setShapeFitParameters(channelNumber, constants.getShapeFitParameters().toArray());
+        }
+
+        // Set the t0 shift for the sensor.
+        final TestRunSvtT0Shift sensorT0Shift = t0Shifts.getT0Shift(daqPair);
+        sensor.setT0Shift(sensorT0Shift.getT0Shift());
+    }
+}
+
+/**
+ * Get a test run DAQ pair (FPGA and Hybrid ID) for the given
+ * {@linkplain HpsTestRunSiSensor}.
+ * 
+ * @param sensor
+ *            a sensor of type {@link HpsTestRunSiSensor}
+ * @return the DAQ pair associated with the sensor
+ */
+@Override
+protected Pair<Integer, Integer> getDaqPair(AbstractSvtDaqMappingCollection<? extends AbstractSvtDaqMapping>  daqMap, HpsSiSensor sensor) {
+
+        final String svtHalf = sensor.isTopLayer() ? AbstractSvtDaqMapping.TOP_HALF : AbstractSvtDaqMapping.BOTTOM_HALF;
+        for (final AbstractSvtDaqMapping abstractMapping : daqMap) {
+            
+            if(!(abstractMapping instanceof TestRunSvtDaqMapping))
+                throw new RuntimeException("This abstract mapping has the wrong type.");
+            
+            TestRunSvtDaqMapping daqMapping = (TestRunSvtDaqMapping)  abstractMapping;
+            if (svtHalf.equals(daqMapping.getSvtHalf()) && daqMapping.getLayerNumber() == sensor.getLayerNumber()) {
+                return new Pair<Integer, Integer>(daqMapping.getFpgaID(), daqMapping.getHybridID());
+            }
+        }
+        return null;
+    
+}
+
+
+
+
+    
+}

Modified: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java	(original)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2014ConverterBase.java	Fri Feb 12 14:24:26 2016
@@ -36,7 +36,7 @@
  */
 public abstract class HPSTracker2014ConverterBase extends AbstractSubdetectorConverter {
 
-    protected boolean _debug = false;
+    protected boolean _debug = true;
     protected IMaterial trackingMaterial = null;
     protected static HPSTrackerJavaBuilder builder;
 
@@ -352,7 +352,7 @@
 
         if(_debug) {
             System.out.printf("%s: create HpsSiSensor with old layer id %d with sensorNumber %d name %s moduleDe %s sensorPath %s sensor Id %d \n", getClass().getSimpleName(), 
-                                layerDe.getIdentifier(),sensorNumber, sensorName, moduleDe.getName(), sensorPath, sensorNumber);
+                                layerDe.getIdentifier().getValue(),sensorNumber, sensorName, moduleDe.getName(), sensorPath, sensorNumber);
         }
         //System.out.printf("%s: HpsSiSensor old layer id %d and module nr %d and sensor nr %d <-> DE name %s \n", getClass().getSimpleName(), 
         //        builder.getDetectorIdentifierHelper().getValue(layerDe.getIdentifier(), "layer"), ((SiTrackerModule) moduleDe).getModuleId(), sensorNumber,sensorName);

Modified: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java	(original)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSTracker2016Converter.java	Fri Feb 12 14:24:26 2016
@@ -11,45 +11,52 @@
     public HPSTracker2016Converter() {
         super();
     }
-    
-    /* (non-Javadoc)
-     * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#initializeBuilder(org.jdom.Element)
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#
+     * initializeBuilder(org.jdom.Element)
      */
     protected HPSTrackerJavaBuilder initializeBuilder(Element node) {
-       return new HPSTracker2016JavaBuilder(_debug, node);
+        return new HPSTracker2016JavaBuilder(_debug, node);
     }
 
-    /* (non-Javadoc)
-     * @see org.lcsim.detector.converter.compact.AbstractSubdetectorConverter#getSubdetectorType()
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.lcsim.detector.converter.compact.AbstractSubdetectorConverter#
+     * getSubdetectorType()
      */
     public Class getSubdetectorType() {
         return HPSTracker2016.class;
     }
 
-    /* 
-     * Override this to handle different layer structure.
-     * (non-Javadoc)
-     * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#getModuleNumber(org.lcsim.geometry.compact.converter.JavaSurveyVolume)
+    /*
+     * Override this to handle different layer structure. (non-Javadoc)
+     * 
+     * @see org.lcsim.detector.converter.compact.HPSTracker2014ConverterBase#
+     * getModuleNumber(org.lcsim.geometry.compact.converter.JavaSurveyVolume)
      */
     protected int getModuleNumber(String surveyVolume) {
         boolean isTopLayer = HPSTrackerBuilder.getHalfFromName(surveyVolume).equals("top") ? true : false;
         int layer = HPSTrackerBuilder.getLayerFromVolumeName(surveyVolume);
         int moduleNumber = -1;
-        if(isTopLayer) {
-            if(layer < 5 ) {
+        if (isTopLayer) {
+            if (layer < 5) {
                 moduleNumber = 0;
             } else {
-                if(HPSTrackerBuilder.isHoleFromName(surveyVolume)) {
+                if (HPSTrackerBuilder.isHoleFromName(surveyVolume)) {
                     moduleNumber = 0;
                 } else {
                     moduleNumber = 2;
                 }
             }
         } else {
-            if(layer < 5 ) {
+            if (layer < 5) {
                 moduleNumber = 1;
             } else {
-                if(HPSTrackerBuilder.isHoleFromName(surveyVolume)) {
+                if (HPSTrackerBuilder.isHoleFromName(surveyVolume)) {
                     moduleNumber = 1;
                 } else {
                     moduleNumber = 3;
@@ -57,11 +64,10 @@
             }
         }
 
-        if(moduleNumber<0) throw new RuntimeException("Invalid module nr found for " + surveyVolume);
+        if (moduleNumber < 0)
+            throw new RuntimeException("Invalid module nr found for " + surveyVolume);
 
-                return moduleNumber;
+        return moduleNumber;
     }
 
-    
-    
 }

Modified: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java	(original)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/detector/tracker/silicon/HpsSiSensor.java	Fri Feb 12 14:24:26 2016
@@ -20,6 +20,7 @@
 import org.lcsim.detector.solids.Box;
 import org.lcsim.detector.solids.LineSegment3D;
 import org.lcsim.detector.solids.Polygon3D;
+import org.lcsim.geometry.compact.converter.HPSTrackerBuilder;
 
 /**
  * This class extends {@link SiSensor} with conditions specific to HPS SVT half-modules (sensors) used during the
@@ -559,4 +560,13 @@
         return this.millepedeId;
     }
 
+    /**
+     * Get the layer nr from the detector element name. 
+     * 
+     * @return the layer name.
+     */
+    public int getLayerNumberFromDetectorElement() {
+        return HPSTrackerBuilder.getLayerFromVolumeName(this.getName());
+    }
+
 }

Modified: java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java	(original)
+++ java/branches/layer0-branch/detector-model/src/main/java/org/lcsim/geometry/compact/converter/HPSTrackerBuilder.java	Fri Feb 12 14:24:26 2016
@@ -267,7 +267,7 @@
     
     public static String getHalfFromName(String name) {
         boolean matchBottom = Pattern.matches(".*bottom.*", name);
-        boolean matchTop = Pattern.matches(".*bottom.*", name);
+        boolean matchTop = Pattern.matches(".*top.*", name);
         
         if(matchBottom && matchTop)
             throw new RuntimeException("found both halfs from name  " + name);

Modified: java/branches/layer0-branch/detector-model/src/test/java/org/hps/detector/svt/SvtDetectorSetupTest.java
 =============================================================================
--- java/branches/layer0-branch/detector-model/src/test/java/org/hps/detector/svt/SvtDetectorSetupTest.java	(original)
+++ java/branches/layer0-branch/detector-model/src/test/java/org/hps/detector/svt/SvtDetectorSetupTest.java	Fri Feb 12 14:24:26 2016
@@ -62,7 +62,7 @@
     public void test() throws Exception {
 
         final DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
-        conditionsManager.addConditionsListener(new SvtDetectorSetup());
+        conditionsManager.addConditionsListener(new EngRun2015SvtDetectorSetup());
         //conditionsManager.setDetector("HPS-Proposal2014-v7-2pt2", 0);
         conditionsManager.setDetector("HPS-EngRun2015-Nominal-v3", 5772);
 
@@ -74,7 +74,7 @@
                 .getCachedData();
 
         // Load the SVT conditions onto detector.
-        final SvtDetectorSetup loader = new SvtDetectorSetup("Tracker");
+        final AbstractSvtDetectorSetup loader = new EngRun2015SvtDetectorSetup("Tracker");
         loader.loadDefault(detector.getSubdetector(SVT_SUBDETECTOR_NAME), conditions);
 
         // Check sensor data.

Modified: java/branches/layer0-branch/job/src/main/java/org/hps/job/JobManager.java
 =============================================================================
--- java/branches/layer0-branch/job/src/main/java/org/hps/job/JobManager.java	(original)
+++ java/branches/layer0-branch/job/src/main/java/org/hps/job/JobManager.java	Fri Feb 12 14:24:26 2016
@@ -4,7 +4,9 @@
 
 import org.hps.conditions.ConditionsDriver;
 import org.hps.conditions.database.DatabaseConditionsManager;
-import org.hps.detector.svt.SvtDetectorSetup;
+import org.hps.detector.svt.AbstractSvtDetectorSetup;
+import org.hps.detector.svt.Prop2016SvtDetectorSetup;
+import org.hps.detector.svt.TestRunSvtDetectorSetup;
 import org.lcsim.job.JobControlManager;
 import org.lcsim.util.Driver;
 
@@ -41,7 +43,26 @@
     public void setup(InputStream is) {
         
         // Add class that will setup SVT detector with conditions data (this is awkward but has to be done someplace).
-        DatabaseConditionsManager.getInstance().addConditionsListener(new SvtDetectorSetup());
+        
+        AbstractSvtDetectorSetup svtDetectorSetup;
+        
+        System.out.println("using run " + DatabaseConditionsManager.getInstance().getRun() + " pelle");
+        
+        if( DatabaseConditionsManager.getInstance().isTestRun() ) {
+            System.out.println("test run pelle");
+            svtDetectorSetup = new TestRunSvtDetectorSetup();
+        }
+        else if(DatabaseConditionsManager.getInstance().isProp2016Run()) {
+            System.out.println("2016 pelle");
+            svtDetectorSetup = new Prop2016SvtDetectorSetup();
+        }
+        else {
+            System.out.println("2015 pelle");
+            //svtDetectorSetup = new EngRun2015SvtDetectorSetup();
+            svtDetectorSetup = new Prop2016SvtDetectorSetup();
+        }
+        
+        DatabaseConditionsManager.getInstance().addConditionsListener(svtDetectorSetup);
         
         super.setup(is);
                 

Modified: java/branches/layer0-branch/logging/src/main/resources/org/hps/logging/config/logging.properties
 =============================================================================
--- java/branches/layer0-branch/logging/src/main/resources/org/hps/logging/config/logging.properties	(original)
+++ java/branches/layer0-branch/logging/src/main/resources/org/hps/logging/config/logging.properties	Fri Feb 12 14:24:26 2016
@@ -24,10 +24,10 @@
 
 # conditions
 org.hps.conditions.api.level = WARNING
-org.hps.conditions.database.level = CONFIG
+org.hps.conditions.database.level = FINEST
 org.hps.conditions.cli.level = CONFIG
 org.hps.conditions.ecal.level = WARNING
-org.hps.conditions.svt.level = WARNING
+org.hps.conditions.svt.level = FINEST
 
 # monitoring-drivers
 org.hps.monitoring.drivers.svt.level = INFO

Modified: java/branches/layer0-branch/parent/pom.xml
 =============================================================================
--- java/branches/layer0-branch/parent/pom.xml	(original)
+++ java/branches/layer0-branch/parent/pom.xml	Fri Feb 12 14:24:26 2016
@@ -12,7 +12,7 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <org.lcsim.cacheDir>${user.home}</org.lcsim.cacheDir>
-        <lcsimVersion>3.1.7-SNAPSHOT</lcsimVersion>
+        <lcsimVersion>3.2-SNAPSHOT</lcsimVersion>
         <skipSite>false</skipSite>
         <skipPlugin>false</skipPlugin>
     </properties>

Modified: java/branches/layer0-branch/steering-files/src/main/resources/org/hps/steering/users/phansson/HPSTrackingDefaults.lcsim
 =============================================================================
--- java/branches/layer0-branch/steering-files/src/main/resources/org/hps/steering/users/phansson/HPSTrackingDefaults.lcsim	(original)
+++ java/branches/layer0-branch/steering-files/src/main/resources/org/hps/steering/users/phansson/HPSTrackingDefaults.lcsim	Fri Feb 12 14:24:26 2016
@@ -20,7 +20,8 @@
 
     <driver name="ConditionsDriver" type="org.hps.conditions.ConditionsDriver">
          <detectorName>${detector}</detectorName>
-          <runNumber>${run}</runNumber>
+          <runNumber>10000</runNumber>
+          <!--<runNumber>${run}</runNumber>-->
         <freeze>true</freeze>
     </driver>
         <driver name="EventMarkerDriver" type="org.lcsim.job.EventMarkerDriver">
@@ -38,7 +39,7 @@
         <driver name="TrackerReconDriver" type="org.hps.recon.tracking.TrackerReconDriver">
             <debug>false</debug>
             <!--<strategyResource>HPS-Full-All.xml</strategyResource>-->
-            <strategyResource>HPS-Full.xml</strategyResource>
+            <strategyResource>HPS-Full-7-layers.xml</strategyResource>
         </driver>
         <driver name="GBLOutputDriver" type="org.hps.recon.tracking.gbl.GBLOutputDriver">
             <debug>0</debug>

Added: java/branches/layer0-branch/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-7-layers.xml
 =============================================================================
--- java/branches/layer0-branch/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-7-layers.xml	(added)
+++ java/branches/layer0-branch/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-7-layers.xml	Fri Feb 12 14:24:26 2016
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<StrategyList xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://lcsim.org/recon/tracking/seedtracker/strategybuilder/strategies.xsd">
+    <TargetDetector>HPS-Full-7-Layer</TargetDetector>
+    <Strategy name="HelicalTrackHit Strategy">
+        
+        <!--Cutoffs-->
+        
+        <MinPT>0.100</MinPT>
+        <MinHits>7</MinHits>
+        <MinConfirm>1</MinConfirm>
+        
+        <MaxDCA>4.0</MaxDCA>
+        <MaxZ0>4.0</MaxZ0>
+
+        <MaxChisq>100.0</MaxChisq>
+        <BadHitChisq>10.0</BadHitChisq>
+
+        <!--Layers-->
+
+        <Layers>                 
+            <Layer type="Seed" layer_number="5" detector_name="Tracker" be_flag="BARREL" />
+            <Layer type="Seed" layer_number="3" detector_name="Tracker" be_flag="BARREL" />
+            <Layer type="Seed" layer_number="1" detector_name="Tracker" be_flag="BARREL" />
+            <Layer type="Confirm" layer_number="7" detector_name="Tracker" be_flag="BARREL" />
+            <Layer type="Extend" layer_number="9" detector_name="Tracker" be_flag="BARREL" />
+             <Layer type="Extend" layer_number="11" detector_name="Tracker" be_flag="BARREL" />
+             <Layer type="Extend" layer_number="13" detector_name="Tracker" be_flag="BARREL" />
+        </Layers>
+    </Strategy>
+</StrategyList>
+

Modified: java/branches/layer0-branch/users/src/main/java/org/hps/users/phansson/TrackingReconstructionPlots.java
 =============================================================================
--- java/branches/layer0-branch/users/src/main/java/org/hps/users/phansson/TrackingReconstructionPlots.java	(original)
+++ java/branches/layer0-branch/users/src/main/java/org/hps/users/phansson/TrackingReconstructionPlots.java	Fri Feb 12 14:24:26 2016
@@ -114,6 +114,7 @@
     private double _bfield;
     private static Logger LOGGER = Logger.getLogger(TrackingReconstructionPlots.class.getName());
     private List<HpsSiSensor> sensors = new ArrayList<HpsSiSensor>();
+    private int nLayers = 7;
 
     @Override
     protected void detectorChanged(Detector detector) {
@@ -212,11 +213,9 @@
         }
         
         
-        
-        
         List<HelicalTrackHit> hthList = event.get(HelicalTrackHit.class, helicalTrackHitCollectionName);
-        int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-        int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+        Map<Integer, Integer> layersTop = new HashMap<Integer,Integer>();
+        Map<Integer, Integer> layersBot = new HashMap<Integer,Integer>();
         Map<HpsSiSensor, Integer> stripHitsFromStereoHits = new HashMap<HpsSiSensor, Integer>();
         for (HelicalTrackHit hth : hthList) {
             HelicalTrackCross htc = (HelicalTrackCross) hth;
@@ -229,20 +228,35 @@
                     stripHitsFromStereoHits.put(stripsensor, 0);
                 }
             }
-            if(sensor.isTopLayer()){
-                layersTop[htc.Layer() - 1]++;
-            } else {
-                layersBot[htc.Layer() - 1]++;
-            }
-        }
+            int l = sensor.getLayerNumberFromDetectorElement();
+            int n = 0;
+            if(sensor.isTopLayer()) {
+                if (layersTop.containsKey(l) )
+                    n = layersTop.get(l);
+                else
+                    layersTop.put(l,n+1);
+            }         
+             else {
+                 if (layersBot.containsKey(l) )
+                     n = layersTop.get(l);
+                 else
+                     layersTop.put(l,n+1);
+            }
+        }
+        
+        
         for(Map.Entry<HpsSiSensor,Integer> sensor : stripHitsFromStereoHits.entrySet()) {
             aida.histogram1D(sensor.getKey().getName() + " strip hits from stereo").fill(sensor.getValue());
         }
         
-        for (int i = 0; i < 12; i++) {
-            aida.profile1D("Number of Stereo Hits per layer in Top Half").fill(i + 1, layersTop[i]);
-            aida.profile1D("Number of Stereo Hits per layer in Bottom Half").fill(i + 1, layersBot[i]);
-        }
+        for (Map.Entry<Integer,Integer> e : layersTop.entrySet())
+            aida.profile1D("Number of Stereo Hits per layer in Top Half").fill(e.getKey(), e.getValue());
+        
+        for (Map.Entry<Integer,Integer> e : layersBot.entrySet())
+            aida.profile1D("Number of Stereo Hits per layer in Bottom Half").fill(e.getKey(), e.getValue());
+
+        
+        
         if (!event.hasCollection(Track.class, trackCollectionName)) {
 //            System.out.println(trackCollectionName + " does not exist; skipping event");
             aida.histogram1D("Number Tracks/Event").fill(0);
@@ -388,7 +402,8 @@
                 HelicalTrackCross htcross = (HelicalTrackCross) htc;
                 double sHit = helicalTrackFit.PathMap().get(htc);
                 Hep3Vector posonhelix = HelixUtils.PointOnHelix(helicalTrackFit, sHit);
-                boolean isTopLayer = false;
+                int layer = ((HpsSiSensor) ((RawTrackerHit) htcross.getStrips().get(0).rawhits().get(0)).getDetectorElement()).getLayerNumberFromDetectorElement();
+                boolean isTopLayer = !((HpsSiSensor) ((RawTrackerHit) htcross.getStrips().get(0).rawhits().get(0)).getDetectorElement()).isBottomLayer();
                 
                 
                 
@@ -424,68 +439,25 @@
                 }
                 
                 
-                   
+                
                 
                 
                 double yTr = posonhelix.y();
                 double zTr = posonhelix.z();
-                int layer = htc.Layer();
-                String modNum = "Layer X ";
-                if (layer == 1) {
-                    modNum = "Layer 1 ";
-                }
-                if (layer == 3) {
-                    modNum = "Layer 2 ";
-                }
-                if (layer == 5) {
-                    modNum = "Layer 3 ";
-                }
-                if (layer == 7) {
-                    modNum = "Layer 4 ";
-                }
-                if (layer == 9) {
-                    modNum = "Layer 5 ";
-                }
-                if (layer == 11) {
-                    modNum = "Layer 6 ";
-                }
-                //SymmetricMatrix cov = htc.getCorrectedCovMatrix();
-
-                aida.histogram1D(modNum + "Residual X(mm)").fill(htcross.getCorrectedPosition().y() - yTr);//these hits should be rotated track hits already
-                aida.histogram1D(modNum + "Residual Y(mm)").fill(htcross.getCorrectedPosition().z() - zTr);//these hits should be rotated track hits already
-                if (hit.getPosition()[2] > 0) {
-                    aida.histogram1D(modNum + "Residual X(mm) Top").fill(htcross.getCorrectedPosition().y() - yTr);//these hits should be rotated track hits already
-                    aida.histogram1D(modNum + "Residual Y(mm) Top").fill(htcross.getCorrectedPosition().z() - zTr);//these hits should be rotated track hits already
-
-                }
-                if (hit.getPosition()[2] < 0) {
-                    aida.histogram1D(modNum + "Residual X(mm) Bottom").fill(htcross.getCorrectedPosition().y() - yTr);//these hits should be rotated track hits already
-                    aida.histogram1D(modNum + "Residual Y(mm) Bottom").fill(htcross.getCorrectedPosition().z() - zTr);//these hits should be rotated track hits already
-
-                }
-                double x = htcross.getCorrectedPosition().y();
-                double y = htcross.getCorrectedPosition().z();
-                if(isTopLayer) {
-                    layersTop[htc.Layer() - 1]++;
-                    Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
-                    if (htc.Layer() == 1) {
-//                    System.out.println(sensorPos.toString());
-//                    System.out.println("Hit X = " + x + "; Hit Y = " + y);
-                        aida.histogram2D("Layer 1 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
-                    }
-                    if (htc.Layer() == 7) {
-                        aida.histogram2D("Layer 7 HTH Position:  Top").fill(x - sensorPos.x(), y - sensorPos.y());
-                    }
+                String modNum = "Layer " + String.valueOf(layer) + " ";
+                
+                aida.histogram1D(modNum + "Residual X(mm)").fill(htcross.getCorrectedPosition().y() - yTr);
+                aida.histogram1D(modNum + "Residual Y(mm)").fill(htcross.getCorrectedPosition().z() - zTr);
+
+                if (isTopLayer) {
+                    aida.histogram1D(modNum + "Residual X(mm) Top").fill(htcross.getCorrectedPosition().y() - yTr);
+                    aida.histogram1D(modNum + "Residual Y(mm) Top").fill(htcross.getCorrectedPosition().z() - zTr);
+
                 } else {
-                    layersBot[htc.Layer() - 1]++;
-                    Hep3Vector sensorPos = ((SiSensor) ((RawTrackerHit) htc.getRawHits().get(0)).getDetectorElement()).getGeometry().getPosition();
-                    if (htc.Layer() == 1) {
-                        aida.histogram2D("Layer 1 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
-                    }
-                    if (htc.Layer() == 7) {
-                        aida.histogram2D("Layer 7 HTH Position:  Bottom").fill(x - sensorPos.x(), y - sensorPos.y());
-                    }
-                }
+                    aida.histogram1D(modNum + "Residual X(mm) Bottom").fill(htcross.getCorrectedPosition().y() - yTr);
+                    aida.histogram1D(modNum + "Residual Y(mm) Bottom").fill(htcross.getCorrectedPosition().z() - zTr);
+                }
+                
                 
                 boolean doAmplitudePlots = true;
                 if(doAmplitudePlots) {
@@ -534,9 +506,9 @@
                 }
             }
             
-            for(Map.Entry<HpsSiSensor,Integer> sensor : stripHitsOnTrack.entrySet()) {
+            for(Map.Entry<HpsSiSensor,Integer> sensor : stripHitsOnTrack.entrySet())
                 aida.histogram1D(sensor.getKey().getName() + " strip hits iso on track").fill(stripHitsIsoOnTrack.get(sensor.getKey()));
-            }
+            
             
             
             Cluster clust = null;
@@ -1111,41 +1083,58 @@
         style3.dataStyle().errorBarStyle().setVisible(false);
         plotter3.createRegions(6, 2);
 
-       
-
-        IHistogram1D mod1ResX = aida.histogram1D("Layer 1 Residual X(mm)", 25, -1, 1);
-        IHistogram1D mod1ResY = aida.histogram1D("Layer 1 Residual Y(mm)", 25, -0.04, 0.04);
-
-        IHistogram1D mod2ResX = aida.histogram1D("Layer 2 Residual X(mm)", 25, -2, 2);
-        IHistogram1D mod2ResY = aida.histogram1D("Layer 2 Residual Y(mm)", 25, -1, 1);
-
-        IHistogram1D mod3ResX = aida.histogram1D("Layer 3 Residual X(mm)", 25, -2.5, 2.5);
-        IHistogram1D mod3ResY = aida.histogram1D("Layer 3 Residual Y(mm)", 25, -1.5, 1.5);
-
-        IHistogram1D mod4ResX = aida.histogram1D("Layer 4 Residual X(mm)", 25, -3.0, 3.0);
-        IHistogram1D mod4ResY = aida.histogram1D("Layer 4 Residual Y(mm)", 25, -2, 2);
-
-        IHistogram1D mod5ResX = aida.histogram1D("Layer 5 Residual X(mm)", 25, -4, 4);
-        IHistogram1D mod5ResY = aida.histogram1D("Layer 5 Residual Y(mm)", 25, -3, 3);
-
-        IHistogram1D mod6ResX = aida.histogram1D("Layer 6 Residual X(mm)", 25, -5, 5);
-        IHistogram1D mod6ResY = aida.histogram1D("Layer 6 Residual Y(mm)", 25, -3, 3);
-
-        plotter3.region(0).plot(mod1ResX);
-        plotter3.region(2).plot(mod2ResX);
-        plotter3.region(4).plot(mod3ResX);
-        plotter3.region(6).plot(mod4ResX);
-        plotter3.region(8).plot(mod5ResX);
-        plotter3.region(10).plot(mod6ResX);
-
-        plotter3.region(1).plot(mod1ResY);
-        plotter3.region(3).plot(mod2ResY);
-        plotter3.region(5).plot(mod3ResY);
-        plotter3.region(7).plot(mod4ResY);
-        plotter3.region(9).plot(mod5ResY);
-        plotter3.region(11).plot(mod6ResY);
-               
-        if(showPlots) plotter3.show();
+        plotter3_1 = fac.createPlotterFactory().create("HPS Residual Plots (Single hit per layer)");
+        plotter3_1.setTitle("Residuals (Top)");
+        //plotterFrame.addPlotter(plotter3_1);
+        IPlotterStyle style3_1 = plotter3_1.style();
+        style3_1.dataStyle().fillStyle().setColor("yellow");
+        style3_1.dataStyle().errorBarStyle().setVisible(false);
+        plotter3_1.createRegions(6, 2);
+        
+        plotter3_2 = fac.createPlotterFactory().create("HPS Residual Plots (Single strip cluster per layer)");
+        plotter3_2.setTitle("Residuals (Bottom)");
+        //plotterFrame.addPlotter(plotter3_2);
+        IPlotterStyle style3_2 = plotter3_2.style();
+        style3_2.dataStyle().fillStyle().setColor("yellow");
+        style3_2.dataStyle().errorBarStyle().setVisible(false);
+        plotter3_2.createRegions(6, 2);
+
+
+        
+        for(int l=0; l < nLayers; ++l) {
+            for(int h=0; h <3;++h) {
+                String half;
+                if (h==0) half = "";
+                else if (h==1) half = " Top";
+                else half = " Bottom";
+                String name = "Layer " + String.valueOf(l+1) + " Residual X(mm)" + half;
+                IHistogram1D mod1ResX = aida.histogram1D(name, 25, -1, 1);
+                name = "Layer " + String.valueOf(l+1) + " Residual Y(mm)" + half;
+                IHistogram1D mod1ResY = aida.histogram1D(name, 25, -1, 1);
+
+                if(l>5) {
+                    LOGGER.warning("cannot make plots for layer " + String.valueOf(l + 1));
+                    continue;
+                }
+                if (h==0) {
+                    plotter3.region(l*2).plot(mod1ResX);
+                    plotter3.region(l*2 + 1).plot(mod1ResY);
+                }
+                else if (h==0) {
+                    plotter3_1.region(l*2).plot(mod1ResX);
+                    plotter3_1.region(l*2 + 1).plot(mod1ResY);
+                }
+                else {
+                    plotter3_2.region(l*2).plot(mod1ResX);
+                    plotter3_2.region(l*2 + 1).plot(mod1ResY);
+                }
+            }
+        }
+        if(showPlots) {
+            plotter3.show();
+            plotter3_1.show();
+            plotter3_2.show();
+        }
         
         
         
@@ -1157,116 +1146,28 @@
         style3_11.dataStyle().errorBarStyle().setVisible(false);
         plotter3_11.createRegions(6, 6);
         int i=0;
+        double[] limits = {1.,1.5,3.,4.,5.,5.,5.0};
         for(HpsSiSensor sensor : sensors) {
             double min = 0.0;
             double max = 0.0;
-            if(sensor.getName().contains("L1")) {
-                min=-0.04; max=0.04;
-            } else if(sensor.getName().contains("L2")) {
-                min=-1; max=1;
-            } else if(sensor.getName().contains("L3")) {
-                min=-1.5; max=1.5;
-            } else if(sensor.getName().contains("L4")) {
-                min=-3; max=3;
-            } else if(sensor.getName().contains("L5")) {
-                min=-4; max=4;
-            } else if(sensor.getName().contains("L6")) {
-                min=-5; max=5;
-            } else {
-                throw new RuntimeException("Invalid sensor name: " + sensor.getName());
-            }
-           IHistogram1D resX = aida.histogram1D(sensor.getName() + " strip residual (mm)", 50, min, max);
+            int l = sensor.getLayerNumberFromDetectorElement();
+            max = limits[l-1];
+            min = -1.0*limits[l-1];
+            IHistogram1D resX = aida.histogram1D(sensor.getName() + " strip residual (mm)", 50, min, max);
+            if(l>6) {
+                LOGGER.warning("cannot make plots for this sensor " + sensor.getName());
+                continue;
+            }
             plotter3_11.region(i).plot(resX);
             i++;
         }
 
         if(showPlots) plotter3_11.show();
         
-
-        plotter3_1 = fac.createPlotterFactory().create("HPS Residual Plots (Single hit per layer)");
-        plotter3_1.setTitle("Residuals (Top)");
-        //plotterFrame.addPlotter(plotter3_1);
-        IPlotterStyle style3_1 = plotter3_1.style();
-        style3_1.dataStyle().fillStyle().setColor("yellow");
-        style3_1.dataStyle().errorBarStyle().setVisible(false);
-        plotter3_1.createRegions(6, 2);
-        
-        IHistogram1D mod1ResX_Top = aida.histogram1D("Layer 1 Residual X(mm) Top", 25, -1, 1);
-        IHistogram1D mod1ResY_Top = aida.histogram1D("Layer 1 Residual Y(mm) Top", 25, -0.04, 0.04);
-
-        IHistogram1D mod2ResX_Top = aida.histogram1D("Layer 2 Residual X(mm) Top", 25, -2, 2);
-        IHistogram1D mod2ResY_Top = aida.histogram1D("Layer 2 Residual Y(mm) Top", 25, -1, 1);
-
-        IHistogram1D mod3ResX_Top = aida.histogram1D("Layer 3 Residual X(mm) Top", 25, -2.5, 2.5);
-        IHistogram1D mod3ResY_Top = aida.histogram1D("Layer 3 Residual Y(mm) Top", 25, -1.5, 1.5);
-
-        IHistogram1D mod4ResX_Top = aida.histogram1D("Layer 4 Residual X(mm) Top", 25, -3.0, 3.0);
-        IHistogram1D mod4ResY_Top = aida.histogram1D("Layer 4 Residual Y(mm) Top", 25, -2, 2);
-
-        IHistogram1D mod5ResX_Top = aida.histogram1D("Layer 5 Residual X(mm) Top", 25, -4, 4);
-        IHistogram1D mod5ResY_Top = aida.histogram1D("Layer 5 Residual Y(mm) Top", 25, -3, 3);
-
-        IHistogram1D mod6ResX_Top = aida.histogram1D("Layer 6 Residual X(mm) Top", 25, -5, 5);
-        IHistogram1D mod6ResY_Top = aida.histogram1D("Layer 6 Residual Y(mm) Top", 25, -3, 3);
-
-        
-        plotter3_1.region(0).plot(mod1ResX_Top);
-        plotter3_1.region(2).plot(mod2ResX_Top);
-        plotter3_1.region(4).plot(mod3ResX_Top);
-        plotter3_1.region(6).plot(mod4ResX_Top);
-        plotter3_1.region(8).plot(mod5ResX_Top);
-        plotter3_1.region(10).plot(mod6ResX_Top);
-
-        plotter3_1.region(1).plot(mod1ResY_Top);
-        plotter3_1.region(3).plot(mod2ResY_Top);
-        plotter3_1.region(5).plot(mod3ResY_Top);
-        plotter3_1.region(7).plot(mod4ResY_Top);
-        plotter3_1.region(9).plot(mod5ResY_Top);
-        plotter3_1.region(11).plot(mod6ResY_Top);
-
-        if(showPlots) plotter3_1.show();
-        
-        plotter3_2 = fac.createPlotterFactory().create("HPS Residual Plots (Single strip cluster per layer)");
-        plotter3_2.setTitle("Residuals (Bottom)");
-        //plotterFrame.addPlotter(plotter3_2);
-        IPlotterStyle style3_2 = plotter3_2.style();
-        style3_2.dataStyle().fillStyle().setColor("yellow");
-        style3_2.dataStyle().errorBarStyle().setVisible(false);
-        plotter3_2.createRegions(6, 2);
-
-        IHistogram1D mod1ResX_Bottom = aida.histogram1D("Layer 1 Residual X(mm) Bottom", 25, -1, 1);
-        IHistogram1D mod1ResY_Bottom = aida.histogram1D("Layer 1 Residual Y(mm) Bottom", 25, -0.04, 0.04);
-
-        IHistogram1D mod2ResX_Bottom = aida.histogram1D("Layer 2 Residual X(mm) Bottom", 25, -2, 2);
-        IHistogram1D mod2ResY_Bottom = aida.histogram1D("Layer 2 Residual Y(mm) Bottom", 25, -1, 1);
-
-        IHistogram1D mod3ResX_Bottom = aida.histogram1D("Layer 3 Residual X(mm) Bottom", 25, -2.5, 2.5);
-        IHistogram1D mod3ResY_Bottom = aida.histogram1D("Layer 3 Residual Y(mm) Bottom", 25, -1.5, 1.5);
-
-        IHistogram1D mod4ResX_Bottom = aida.histogram1D("Layer 4 Residual X(mm) Bottom", 25, -3.0, 3.0);
-        IHistogram1D mod4ResY_Bottom = aida.histogram1D("Layer 4 Residual Y(mm) Bottom", 25, -2, 2);
-
-        IHistogram1D mod5ResX_Bottom = aida.histogram1D("Layer 5 Residual X(mm) Bottom", 25, -4, 4);
-        IHistogram1D mod5ResY_Bottom = aida.histogram1D("Layer 5 Residual Y(mm) Bottom", 25, -3, 3);
-
-        IHistogram1D mod6ResX_Bottom = aida.histogram1D("Layer 6 Residual X(mm) Bottom", 25, -5, 5);
-        IHistogram1D mod6ResY_Bottom = aida.histogram1D("Layer 6 Residual Y(mm) Bottom", 25, -3, 3);
-
-        plotter3_2.region(0).plot(mod1ResX_Bottom);
-        plotter3_2.region(2).plot(mod2ResX_Bottom);
-        plotter3_2.region(4).plot(mod3ResX_Bottom);
-        plotter3_2.region(6).plot(mod4ResX_Bottom);
-        plotter3_2.region(8).plot(mod5ResX_Bottom);
-        plotter3_2.region(10).plot(mod6ResX_Bottom);
-
-        plotter3_2.region(1).plot(mod1ResY_Bottom);
-        plotter3_2.region(3).plot(mod2ResY_Bottom);
-        plotter3_2.region(5).plot(mod3ResY_Bottom);
-        plotter3_2.region(7).plot(mod4ResY_Bottom);
-        plotter3_2.region(9).plot(mod5ResY_Bottom);
-        plotter3_2.region(11).plot(mod6ResY_Bottom);
-        
-        if(showPlots) plotter3_2.show();
+        
+        
+        
+
 
         plotter4 = fac.createPlotterFactory().create("HPS Track and ECal Plots");
         plotter4.setTitle("Track and ECal Correlations");
@@ -1495,8 +1396,8 @@
         style55.dataStyle().markerStyle().setSize(20);
         plotter55.createRegions(1, 2);
 
-        IProfile avgLayersTopPlot = aida.profile1D("Number of Stereo Hits per layer in Top Half", 13, 0, 13);
-        IProfile avgLayersBottomPlot = aida.profile1D("Number of Stereo Hits per layer in Bottom Half", 13, 0, 13);
+        IProfile avgLayersTopPlot = aida.profile1D("Number of Stereo Hits per layer in Top Half", 10, 0, 10);
+        IProfile avgLayersBottomPlot = aida.profile1D("Number of Stereo Hits per layer in Bottom Half", 10, 0, 10);
 
         plotter55.region(0).plot(avgLayersTopPlot);
         plotter55.region(1).plot(avgLayersBottomPlot);
@@ -1566,7 +1467,12 @@
         plotter8.createRegions(6, 6);
         i=0;
         for(SiSensor sensor : sensors) {
+            
             IHistogram1D resX = aida.histogram1D(sensor.getName() + " strip hits from stereo", 10, 0, 10);
+            if(sensor.getName().contains("L7")) {
+                LOGGER.warning("cannot setup this plot. Fix.");
+                continue;
+            }
             plotter8.region(i).plot(resX);
             i++;
         }
@@ -1580,7 +1486,12 @@
         plotter88.createRegions(6, 6);
         i=0;
         for(SiSensor sensor : sensors) {
+            
             IHistogram1D resX = aida.histogram1D(sensor.getName() + " strip hits", 10, 0, 10);
+            if(sensor.getName().contains("L7")) {
+                LOGGER.warning("cannot setup this plot. Fix.");
+                continue;
+            }
             plotter88.region(i).plot(resX);
             i++;
         }
@@ -1598,7 +1509,12 @@
         plotter888.createRegions(6, 6);
         i=0;
         for(SiSensor sensor : sensors) {
+            
             IHistogram1D resX = aida.histogram1D(sensor.getName() + " strip hits iso", 50, 0, 5);
+            if(sensor.getName().contains("L7")) {
+                LOGGER.warning("cannot setup this plot. Fix.");
+                continue;
+            }
             plotter888.region(i).plot(resX);
             i++;
         }
@@ -1612,7 +1528,12 @@
         plotter8888.createRegions(6, 6);
         i=0;
         for(SiSensor sensor : sensors) {
+            
             IHistogram1D resX = aida.histogram1D(sensor.getName() + " strip hits iso on track", 50, 0, 5);
+            if(sensor.getName().contains("L7")) {
+                LOGGER.warning("cannot setup this plot. Fix.");
+                continue;
+            }
             plotter8888.region(i).plot(resX);
             i++;
         }