Commit in java/trunk on MAIN
analysis/src/main/java/org/hps/analysis/examples/DetailedAnalysisDriver.java-1458 -> 459
                                                /FastTrackAnalysisDriver.java-1458 -> 459
                                                /JasAnalysisDriver.java-1458 -> 459
                                                /StarterAnalysisDriver.java-1458 -> 459
evio/src/main/java/org/hps/evio/SVTEvioReader.java+8-6458 -> 459
                               /SVTHitWriter.java+5-5458 -> 459
monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java+4-4458 -> 459
                                                               /SVTHitReconstructionPlots.java+7-7458 -> 459
                                                               /SVTMonitoringPlots.java+4-4458 -> 459
                                                               /SVTPulseFitPlots.java+3-3458 -> 459
                                                               /TrackingReconstructionPlots.java+4-4458 -> 459
recon/src/main/java/org/hps/recon/filtering/InTimeHitsFilter.java+4-4458 -> 459
recon/src/main/java/org/hps/recon/vertexing/TwoParticleVertexer.java+5-5458 -> 459
                                           /TwoTrackVertexer.java+5-5458 -> 459
steering-files/src/main/resources/org/hps/steering/monitoring/OnlineTracking.lcsim+1-1458 -> 459
                                                             /SVTEventDisplay.lcsim+1-1458 -> 459
                                                             /SVTMonitoring.lcsim+1-1458 -> 459
                                                             /TestRunEventDisplay.lcsim+1-1458 -> 459
                                                             /TestRunMonitoring.lcsim+1-1458 -> 459
                                                             /TestRunMonitoringExample.lcsim+1-1458 -> 459
steering-files/src/main/resources/org/hps/steering/readout/TestRunSim.lcsim+1-1458 -> 459
steering-files/src/main/resources/org/hps/steering/recon/GBLReco.lcsim+1-1458 -> 459
                                                        /HPS2014OfflineRecon.lcsim+1-1458 -> 459
                                                        /HPS2014OfflineTruthRecon.lcsim+1-1458 -> 459
                                                        /HPSTrackingDefaultsRecon.lcsim+1-1458 -> 459
                                                        /TestRunOfflineRecon.lcsim+1-1458 -> 459
                                                        /TestRunOfflineReconTwoTrkFilter.lcsim+1-1458 -> 459
steering-files/src/main/resources/org/hps/steering/users/OfflineTrackingAxial.lcsim+1-1458 -> 459
                                                        /TestRunOfflineReconSeeVertexingPlots.lcsim+1-1458 -> 459
steering-files/src/main/resources/org/hps/steering/users/meeg/EcalGainDriver.lcsim+1-1458 -> 459
steering-files/src/main/resources/org/hps/steering/users/phansson/MultScatAna.lcsim+1-1458 -> 459
                                                                 /TwoTrackAnalysis.lcsim+1-1458 -> 459
tracking/src/main/java/org/hps/recon/tracking/AlignmentParameters.java-560458 removed
                                             /AxialTrackReconDriver.java+60-69458 -> 459
                                             /DataTrackerFakeHitDriver.java-1030458 removed
                                             /DataTrackerHitDriver.java+32-27458 -> 459
                                             /DumbShaperFit.java+46-43458 -> 459
                                             /EcalTrackMatch.java-142458 removed
                                             /EventQuality.java+50-41458 -> 459
                                             /FindableTrack.java+108-97458 -> 459
                                             /FpgaData.java-197458 removed
                                             /HPSClusteringAlgorithm.java-25458 removed
                                             /HPSFittedRawTrackerHit.java-37458 removed
                                             /HPSNearestNeighborRMS.java-258458 removed
                                             /HPSRawTrackerHitFitterDriver.java-130458 removed
                                             /HPSSVTData.java-307458 removed
                                             /HPSShapeFitParameters.java-144458 removed
                                             /HPSShaperAnalyticFitAlgorithm.java-106458 removed
                                             /HPSShaperFitAlgorithm.java-18458 removed
                                             /HPSStripMaker.java-353458 removed
                                             /HPSTrack.java+65-80458 -> 459
                                             /HPSTransformations.java-66458 removed
                                             /HelicalTrackHitDriver.java+43-51458 -> 459
                                             /HelixConverter.java+41-38458 -> 459
                                             /HelixFitter.java+8-13458 -> 459
                                             /LCIOTrackAnalysis.java-169458 removed
                                             /MaterialManager.java+8-9458 -> 459
                                             /MaterialSupervisor.java+130-136458 -> 459
                                             /MultipleScattering.java+213-224458 -> 459
                                             /NoiselessReadoutChip.java+70-74458 -> 459
                                             /RunAlignment.java-96458 removed
                                             /SVTBadChannelFilterDriver.java+5-3458 -> 459
                                             /SVTRawTrackerHitThresholdDriver.java-80458 removed
                                             /SeedTracker.java-3458 -> 459
                                             /SimpleSvtReadout.java-425458 removed
                                             /SimpleTrackerDigiDriver.java+5-6458 -> 459
                                             /StraightLineTrack.java+42-41458 -> 459
                                             /TrackAnalysis.java-298458 removed
                                             /TrackUtils.java+544-544458 -> 459
                                             /TrackerDigiDriver.java+10-12458 -> 459
                                             /TrackerHitUtils.java+104-85458 -> 459
                                             /TrackerReconDriver.java+22-26458 -> 459
                                             /WTrack.java+147-160458 -> 459
tracking/src/main/java/org/hps/recon/tracking/apv25/HPSDataProcessingModule.java+7-7458 -> 459
                                                   /HPSSVTDataBuffer.java+7-5458 -> 459
tracking/src/main/java/org/hps/recon/tracking/gbl/GBLFileIO.java+1-5458 -> 459
                                                 /GBLOutput.java+4-4458 -> 459
                                                 /TruthResiduals.java+6-6458 -> 459
tracking/src/main/java/org/hps/svt/alignment/AlignmentParameters.java+2-2458 -> 459
                                            /BuildCompact.java+2-2458 -> 459
tracking/src/test/java/org/hps/recon/tracking/HelicalTrackHitDriverTest.java+2-1458 -> 459
                                             /TestRunTrackReconTest.java+1-1458 -> 459
                                             /TruthResidualTest.java+1-1458 -> 459
users/src/main/java/org/hps/users/jeremym/EcalConditionsTestDriver.java-3458 -> 459
users/src/main/java/org/hps/users/mgraham/DetailedAnalysisDriver.java+1-1458 -> 459
                                         /ElwinsTrackingRecon.java+2-2458 -> 459
                                         /FastTrackAnalysisDriver.java+1-1458 -> 459
                                         /JasAnalysisDriver.java+1-1458 -> 459
                                         /MainJASDriver.java+2-2458 -> 459
                                         /SingleSensorHelicalTrackHitDriver.java+4-4458 -> 459
                                         /SingleSensorTrackerReconDriver.java+2-2458 -> 459
                                         /TestAnalysisDriver.java+4-4458 -> 459
users/src/main/java/org/hps/users/mgraham/alignment/AlignmentParameters.java+2-2458 -> 459
users/src/main/java/org/hps/users/mgraham/jlabrotation/DetailedAnalysisDriver.java+1-1458 -> 459
users/src/main/java/org/hps/users/omoreno/SvtPerformance.java+4-4458 -> 459
                                         /SvtQA.java+8-8458 -> 459
                                         /SvtTrackRecoEfficiency.java+1-1458 -> 459
users/src/main/java/org/hps/users/phansson/ECalGainDriver.java-1458 -> 459
                                          /MultScatAnalysis.java-1458 -> 459
                                          /TrigRateDriver.java-5458 -> 459
+1886-6369
19 removed + 81 modified, total 100 files
Hit the tracking code with a wrecking ball and all its little friends, too.  Everything still works.  I promise.

java/trunk/analysis/src/main/java/org/hps/analysis/examples
DetailedAnalysisDriver.java 458 -> 459
--- java/trunk/analysis/src/main/java/org/hps/analysis/examples/DetailedAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/examples/DetailedAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -27,7 +27,6 @@
 
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.hps.recon.vertexing.BilliorTrack;
 import org.hps.recon.vertexing.BilliorVertex;
 import org.hps.recon.vertexing.BilliorVertexer;

java/trunk/analysis/src/main/java/org/hps/analysis/examples
FastTrackAnalysisDriver.java 458 -> 459
--- java/trunk/analysis/src/main/java/org/hps/analysis/examples/FastTrackAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/examples/FastTrackAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -19,7 +19,6 @@
 
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.hps.recon.vertexing.BilliorTrack;
 import org.hps.recon.vertexing.BilliorVertex;
 import org.hps.recon.vertexing.BilliorVertexer;

java/trunk/analysis/src/main/java/org/hps/analysis/examples
JasAnalysisDriver.java 458 -> 459
--- java/trunk/analysis/src/main/java/org/hps/analysis/examples/JasAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/examples/JasAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -22,7 +22,6 @@
 
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.hps.recon.vertexing.BFitter;
 import org.hps.recon.vertexing.BilliorTrack;
 import org.hps.recon.vertexing.BilliorVertex;

java/trunk/analysis/src/main/java/org/hps/analysis/examples
StarterAnalysisDriver.java 458 -> 459
--- java/trunk/analysis/src/main/java/org/hps/analysis/examples/StarterAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/examples/StarterAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -6,7 +6,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.hps.recon.tracking.LCIOTrackAnalysis;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.LCRelation;
 import org.lcsim.event.MCParticle;

java/trunk/evio/src/main/java/org/hps/evio
SVTEvioReader.java 458 -> 459
--- java/trunk/evio/src/main/java/org/hps/evio/SVTEvioReader.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/evio/src/main/java/org/hps/evio/SVTEvioReader.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -6,8 +6,8 @@
 
 import org.hps.conditions.deprecated.HPSSVTConstants;
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.FpgaData;
-import org.hps.recon.tracking.HPSSVTData;
+import org.hps.readout.svt.FpgaData;
+import org.hps.readout.svt.SVTData;
 //--- Coda ---//
 import org.jlab.coda.jevio.BaseStructure;
 import org.jlab.coda.jevio.EvioEvent;
@@ -20,6 +20,8 @@
 import org.lcsim.event.base.BaseRawTrackerHit;
 import org.hps.util.Pair;
 import org.lcsim.lcio.LCIOUtil;
+
+
 //--- Constants ---//
 import static org.hps.evio.EventConstants.SVT_BANK_TAG;
 
@@ -105,7 +107,7 @@
 
                     if (debug) {
                         System.out.println(this.getClass().getSimpleName() + ": The temperatures are: ");
-                        double[] temps = HPSSVTData.getTemperature(temperatureData);
+                        double[] temps = SVTData.getTemperature(temperatureData);
                         for (int index = 0; index < temps.length; index++) {
                             System.out.println("Temp " + index + ": " + temps[index]);
                         }
@@ -149,12 +151,12 @@
 
     private static RawTrackerHit makeHit(int[] data) {
         int hitTime = 0;
-        Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(HPSSVTData.getFPGAAddress(data), HPSSVTData.getHybridNumber(data));
+        Pair<Integer, Integer> daqPair = new Pair<Integer, Integer>(SVTData.getFPGAAddress(data), SVTData.getHybridNumber(data));
         SiSensor sensor = SvtUtils.getInstance().getSensor(daqPair);
 
-        int sensorChannel = HPSSVTData.getSensorChannel(data);
+        int sensorChannel = SVTData.getSensorChannel(data);
         long cell_id = SvtUtils.makeCellID(sensor, sensorChannel);
 
-        return new BaseRawTrackerHit(hitTime, cell_id, HPSSVTData.getAllSamples(data), null, sensor);
+        return new BaseRawTrackerHit(hitTime, cell_id, SVTData.getAllSamples(data), null, sensor);
     }
 }

java/trunk/evio/src/main/java/org/hps/evio
SVTHitWriter.java 458 -> 459
--- java/trunk/evio/src/main/java/org/hps/evio/SVTHitWriter.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/evio/src/main/java/org/hps/evio/SVTHitWriter.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -7,8 +7,8 @@
 
 import org.hps.conditions.deprecated.HPSSVTConstants;
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.FpgaData;
-import org.hps.recon.tracking.HPSSVTData;
+import org.hps.readout.svt.FpgaData;
+import org.hps.readout.svt.SVTData;
 import org.jlab.coda.jevio.DataType;
 import org.jlab.coda.jevio.EventBuilder;
 import org.jlab.coda.jevio.EvioBank;
@@ -80,11 +80,11 @@
             int fpgaAddress = SvtUtils.getInstance().getFPGA((SiSensor) hit.getDetectorElement());
             int hybridNumber = SvtUtils.getInstance().getHybrid((SiSensor) hit.getDetectorElement());
             int sensorChannel = hit.getIdentifierFieldValue("strip");
-            int apvNumber = HPSSVTData.getAPV(sensorChannel);
-            int channelNumber = HPSSVTData.getAPVChannel(sensorChannel);
+            int apvNumber = SVTData.getAPV(sensorChannel);
+            int channelNumber = SVTData.getAPVChannel(sensorChannel);
 
             int[] data = new int[4];
-            HPSSVTData.createSVTDataPacket(hybridNumber, apvNumber, channelNumber, fpgaAddress, hit.getADCValues(), data);
+            SVTData.createSVTDataPacket(hybridNumber, apvNumber, channelNumber, fpgaAddress, hit.getADCValues(), data);
             fpgaHits.get(fpgaAddress).add(data);
         }
 

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTCellIDPrintDriver.java 458 -> 459
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTCellIDPrintDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -4,7 +4,7 @@
 import java.io.PrintWriter;
 import java.util.List;
 
-import org.hps.recon.tracking.HPSSVTData;
+import org.hps.readout.svt.SVTData;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.util.Driver;
@@ -50,10 +50,10 @@
 
 	public void process(EventHeader event) {
 		// Get the list of ECal hits.
-		if (event.hasCollection(HPSSVTData.class, rawTrackerHitCollectionName)) {
-			List<HPSSVTData> hits = event.get(HPSSVTData.class, rawTrackerHitCollectionName);
+		if (event.hasCollection(SVTData.class, rawTrackerHitCollectionName)) {
+			List<SVTData> hits = event.get(SVTData.class, rawTrackerHitCollectionName);
 			//outputStream.println("Reading RawCalorimeterHit from event " + event.getEventNumber());
-			for (HPSSVTData hit : hits) {
+			for (SVTData hit : hits) {
 				outputStream.printf("FPGA=%d\thybrid=%d\tchannel=%d\n", hit.getFPGAAddress(), hit.getHybridNumber(), hit.getChannelNumber());
 			}
 		}

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTHitReconstructionPlots.java 458 -> 459
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTHitReconstructionPlots.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -16,7 +16,7 @@
 import java.util.logging.Logger;
 
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.HPSFittedRawTrackerHit;
+import org.hps.recon.tracking.FittedRawTrackerHit;
 import org.hps.util.Resettable;
 import org.lcsim.detector.identifier.IIdentifier;
 import org.lcsim.detector.identifier.IIdentifierHelper;
@@ -179,7 +179,7 @@
     }
 
     public void process(EventHeader event) {
-        if (!event.hasCollection(HPSFittedRawTrackerHit.class, fittedTrackerHitCollectionName)) {
+        if (!event.hasCollection(FittedRawTrackerHit.class, fittedTrackerHitCollectionName)) {
             System.out.println(fittedTrackerHitCollectionName + " does not exist; skipping event");
             int ns = sensors.size();
             for (int i = 0; i < ns; i++) {
@@ -191,11 +191,11 @@
         }
 
         ++eventCount;
-        List<HPSFittedRawTrackerHit> fittedrawHits = event.get(HPSFittedRawTrackerHit.class, fittedTrackerHitCollectionName);
+        List<FittedRawTrackerHit> fittedrawHits = event.get(FittedRawTrackerHit.class, fittedTrackerHitCollectionName);
         List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, trackerHitCollectionName);
         int[] layersTop = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
         int[] layersBot = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-        for (HPSFittedRawTrackerHit hrth : fittedrawHits) {
+        for (FittedRawTrackerHit hrth : fittedrawHits) {
             SiSensor sensor = (SiSensor) hrth.getRawTrackerHit().getDetectorElement();
             int layer = hrth.getRawTrackerHit().getLayerNumber();
             if (!SvtUtils.getInstance().isTopLayer(sensor)) {
@@ -234,7 +234,7 @@
         for (SiSensor sensor : sensors) {
             String sensorName = sensor.getName();
             int nraw = sensor.getReadout().getHits(RawTrackerHit.class).size();
-            int nreco = sensor.getReadout().getHits(HPSFittedRawTrackerHit.class).size();
+            int nreco = sensor.getReadout().getHits(FittedRawTrackerHit.class).size();
             aida.histogram1D(sensorName + "_raw_hits").fill(nraw);
             aida.histogram1D(sensorName + "_reco_hits").fill(nreco);
             if (clustMap.containsKey(sensor)) {
@@ -245,13 +245,13 @@
         }
     }
 
-    public double getCluAmp(SiTrackerHitStrip1D stripHits, List<HPSFittedRawTrackerHit> hrths) {
+    public double getCluAmp(SiTrackerHitStrip1D stripHits, List<FittedRawTrackerHit> hrths) {
         stripHits.getdEdx();
         List<RawTrackerHit> rawHits = stripHits.getRawHits();
         double sum = 0.0;
         for (RawTrackerHit hit : rawHits) {
             //find the fitted hit amplitude
-            for (HPSFittedRawTrackerHit fittedHit : hrths) {
+            for (FittedRawTrackerHit fittedHit : hrths) {
                 RawTrackerHit fh = fittedHit.getRawTrackerHit();
                 if (fh.equals(hit)) {
                     sum += fittedHit.getAmp();

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTMonitoringPlots.java 458 -> 459
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTMonitoringPlots.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTMonitoringPlots.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -9,7 +9,7 @@
 
 import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.HPSFittedRawTrackerHit;
+import org.hps.recon.tracking.FittedRawTrackerHit;
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
@@ -144,9 +144,9 @@
             }
         }
 
-        if (event.hasCollection(HPSFittedRawTrackerHit.class, fitCollection)) {
-            List<HPSFittedRawTrackerHit> fits = event.get(HPSFittedRawTrackerHit.class, fitCollection);
-            for (HPSFittedRawTrackerHit fit : fits) {
+        if (event.hasCollection(FittedRawTrackerHit.class, fitCollection)) {
+            List<FittedRawTrackerHit> fits = event.get(FittedRawTrackerHit.class, fitCollection);
+            for (FittedRawTrackerHit fit : fits) {
                 int layer = fit.getRawTrackerHit().getIdentifierFieldValue("layer"); // 1-10; axial layers are odd layers; stereo layers are even
                 int module = fit.getRawTrackerHit().getIdentifierFieldValue("module"); // 0-1; module number is top or bottom
                 int strip = fit.getRawTrackerHit().getIdentifierFieldValue("strip");

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
SVTPulseFitPlots.java 458 -> 459
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTPulseFitPlots.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/SVTPulseFitPlots.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -14,7 +14,7 @@
 import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
 import org.hps.conditions.deprecated.HPSSVTConstants;
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.HPSFittedRawTrackerHit;
+import org.hps.recon.tracking.FittedRawTrackerHit;
 import org.hps.util.Resettable;
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.event.EventHeader;
@@ -124,8 +124,8 @@
 
     public void process(EventHeader event) {
         ++eventCount;
-        List<HPSFittedRawTrackerHit> fittedrawHits = event.get(HPSFittedRawTrackerHit.class, fittedTrackerHitCollectionName);
-        for (HPSFittedRawTrackerHit fit : fittedrawHits) {
+        List<FittedRawTrackerHit> fittedrawHits = event.get(FittedRawTrackerHit.class, fittedTrackerHitCollectionName);
+        for (FittedRawTrackerHit fit : fittedrawHits) {
             SiSensor sensor = (SiSensor) fit.getRawTrackerHit().getDetectorElement();
             int strip = fit.getRawTrackerHit().getIdentifierFieldValue("strip");
             int layer = fit.getRawTrackerHit().getIdentifierFieldValue("layer"); // 1-10; axial layers are odd layers; stereo layers are even

java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt
TrackingReconstructionPlots.java 458 -> 459
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/TrackingReconstructionPlots.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/drivers/svt/TrackingReconstructionPlots.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -20,9 +20,9 @@
 import org.hps.conditions.deprecated.SvtUtils;
 import org.hps.recon.ecal.HPSEcalCluster;
 import org.hps.recon.tracking.DumbShaperFit;
-import org.hps.recon.tracking.HPSShapeFitParameters;
-import org.hps.recon.tracking.HPSShaperFitAlgorithm;
 import org.hps.recon.tracking.HelixConverter;
+import org.hps.recon.tracking.ShapeFitParameters;
+import org.hps.recon.tracking.ShaperFitAlgorithm;
 import org.hps.recon.tracking.StraightLineTrack;
 import org.hps.recon.tracking.TrackUtils;
 import org.hps.util.Resettable;
@@ -96,7 +96,7 @@
     double zAtColl = -1500;
     IHistogram1D trkPx;
     IHistogram1D nTracks;
-    HPSShaperFitAlgorithm _shaper = new DumbShaperFit();
+    ShaperFitAlgorithm _shaper = new DumbShaperFit();
 
     @Override
     protected void detectorChanged(Detector detector) {
@@ -866,7 +866,7 @@
                    double clusterSum=0;                 
                    for(RawTrackerHit rawHit: (List<RawTrackerHit>)hts.rawhits()){
                        ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants((SiSensor) rawHit.getDetectorElement(), rawHit.getIdentifierFieldValue("strip"));
-                        HPSShapeFitParameters fit = _shaper.fitShape(rawHit, constants);
+                        ShapeFitParameters fit = _shaper.fitShape(rawHit, constants);
                         double amp = fit.getAmp();
                         clusterSum+=amp;
                          aida.histogram1D("Amp (HitOnTrack)").fill(amp);

java/trunk/recon/src/main/java/org/hps/recon/filtering
InTimeHitsFilter.java 458 -> 459
--- java/trunk/recon/src/main/java/org/hps/recon/filtering/InTimeHitsFilter.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/recon/src/main/java/org/hps/recon/filtering/InTimeHitsFilter.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -3,7 +3,7 @@
 import java.util.List;
 
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.HPSFittedRawTrackerHit;
+import org.hps.recon.tracking.FittedRawTrackerHit;
 import org.lcsim.detector.identifier.IIdentifier;
 import org.lcsim.detector.tracker.silicon.ChargeCarrier;
 import org.lcsim.detector.tracker.silicon.SiSensor;
@@ -31,12 +31,12 @@
     @Override
     public void process(EventHeader event){
        incrementEventProcessed();
-        if(!event.hasCollection(HPSFittedRawTrackerHit.class, hitCollectionName))
+        if(!event.hasCollection(FittedRawTrackerHit.class, hitCollectionName))
             skipEvent(); 
         if(hitTimeCut<0)  //why are you even doing this???
             return;
 
-        List<HPSFittedRawTrackerHit> hits=event.get(HPSFittedRawTrackerHit.class, hitCollectionName);
+        List<FittedRawTrackerHit> hits=event.get(FittedRawTrackerHit.class, hitCollectionName);
 
         int totalTopHit=0;
         int totalBotHit=0;
@@ -46,7 +46,7 @@
         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};
 
-        for(HPSFittedRawTrackerHit hit : hits){
+        for(FittedRawTrackerHit hit : hits){
             boolean timeCut=inTime(hit.getT0());
 //            System.out.println("t0 =" + hit.getT0());
             if(timeCut){

java/trunk/recon/src/main/java/org/hps/recon/vertexing
TwoParticleVertexer.java 458 -> 459
--- java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoParticleVertexer.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoParticleVertexer.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -7,7 +7,7 @@
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
 
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.lcsim.event.MCParticle;
 
 /**
@@ -39,10 +39,10 @@
         }
         
         //set the member variables
-        A1 = HPSTransformations.transformVectorToTracking(PA1);
-        A2 = HPSTransformations.transformVectorToTracking(PA2);
-        B1 = HPSTransformations.transformVectorToTracking(PB1);
-        B2 = HPSTransformations.transformVectorToTracking(PB2);
+        A1 = CoordinateTransformations.transformVectorToTracking(PA1);
+        A2 = CoordinateTransformations.transformVectorToTracking(PA2);
+        B1 = CoordinateTransformations.transformVectorToTracking(PB1);
+        B2 = CoordinateTransformations.transformVectorToTracking(PB2);
 
     }
     

java/trunk/recon/src/main/java/org/hps/recon/vertexing
TwoTrackVertexer.java 458 -> 459
--- java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoTrackVertexer.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/recon/src/main/java/org/hps/recon/vertexing/TwoTrackVertexer.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,7 +1,7 @@
 package org.hps.recon.vertexing;
 
 import org.hps.conditions.deprecated.BeamlineConstants;
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.hps.recon.tracking.TrackUtils;
 import org.lcsim.event.Track;
 
@@ -16,10 +16,10 @@
     }
 
     public void setTracks(Track track1,Track track2) {
-        A1 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track1, BeamlineConstants.HARP_POSITION_TESTRUN-100));
-        A2 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track1, BeamlineConstants.HARP_POSITION_TESTRUN+100));
-        B1 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track2, BeamlineConstants.HARP_POSITION_TESTRUN-100));
-        B2 = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track2, BeamlineConstants.HARP_POSITION_TESTRUN+100));
+        A1 = CoordinateTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track1, BeamlineConstants.HARP_POSITION_TESTRUN-100));
+        A2 = CoordinateTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track1, BeamlineConstants.HARP_POSITION_TESTRUN+100));
+        B1 = CoordinateTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track2, BeamlineConstants.HARP_POSITION_TESTRUN-100));
+        B2 = CoordinateTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(track2, BeamlineConstants.HARP_POSITION_TESTRUN+100));
     }
     
 }

java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring
OnlineTracking.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/OnlineTracking.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/OnlineTracking.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -35,7 +35,7 @@
 	</driver>
 
           <driver name="RawTrackerHitFitterDriver"
-                type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+                type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
            <rawHitCollectionName>SVTRawTrackerHits</rawHitCollectionName>  
           <fittedHitCollectionName>SVTFittedRawTrackerHits</fittedHitCollectionName> 
            <fitAlgorithm>Analytic</fitAlgorithm>  

java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring
SVTEventDisplay.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SVTEventDisplay.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SVTEventDisplay.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -36,7 +36,7 @@
             <ecalCollectionName>EcalCalHits</ecalCollectionName>
         </driver>
         <driver name="RawTrackerHitFitterDriver"
-                type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+                type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
         </driver>
         <driver name="TrackerHitDriver" type="org.hps.recon.tracking.DataTrackerHitDriver"/>

java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring
SVTMonitoring.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SVTMonitoring.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/SVTMonitoring.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -41,7 +41,7 @@
             <ecalName>Ecal</ecalName>
             <ecalCollectionName>EcalCalHits</ecalCollectionName>
         </driver>
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>true</correctT0Shift>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring
TestRunEventDisplay.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/TestRunEventDisplay.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/TestRunEventDisplay.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -39,7 +39,7 @@
             <ecalCollectionName>EcalCalHits</ecalCollectionName>
         </driver>
         <driver name="RawTrackerHitFitterDriver"
-                type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+                type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
         </driver>
         <driver name="TrackerHitDriver" type="org.hps.recon.tracking.DataTrackerHitDriver"/>

java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring
TestRunMonitoring.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/TestRunMonitoring.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/TestRunMonitoring.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -39,7 +39,7 @@
             <ecalCollectionName>EcalCalHits</ecalCollectionName>
         </driver>
         <driver name="RawTrackerHitFitterDriver"
-                type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+                type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
         </driver>
         <driver name="TrackerHitDriver" type="org.hps.recon.tracking.DataTrackerHitDriver"/>

java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring
TestRunMonitoringExample.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/TestRunMonitoringExample.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/monitoring/TestRunMonitoringExample.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -30,7 +30,7 @@
             <ecalCollectionName>EcalCalHits</ecalCollectionName>
         </driver>
         <driver name="RawTrackerHitFitterDriver"
-                type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+                type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
         </driver>
         <driver name="TrackerHitDriver" type="org.hps.recon.tracking.DataTrackerHitDriver"/>

java/trunk/steering-files/src/main/resources/org/hps/steering/readout
TestRunSim.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunSim.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/readout/TestRunSim.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -91,7 +91,7 @@
         </driver>-->
 
 
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <debug>false</debug> 
             <rawHitCollectionName>SVTRawTrackerHits</rawHitCollectionName>  
             <fittedHitCollectionName>SVTFittedRawTrackerHits</fittedHitCollectionName> 

java/trunk/steering-files/src/main/resources/org/hps/steering/recon
GBLReco.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/GBLReco.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/GBLReco.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -44,7 +44,7 @@
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
         <driver name="BadChannelFilter" type="org.hps.recon.tracking.SVTBadChannelFilterDriver" /> 
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>false</correctT0Shift>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/recon
HPS2014OfflineRecon.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/HPS2014OfflineRecon.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/HPS2014OfflineRecon.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -26,7 +26,7 @@
             <eventInterval>1000</eventInterval>
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <useTimestamps>true</useTimestamps>
             <correctT0Shift>true</correctT0Shift>

java/trunk/steering-files/src/main/resources/org/hps/steering/recon
HPS2014OfflineTruthRecon.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/HPS2014OfflineTruthRecon.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/HPS2014OfflineTruthRecon.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -26,7 +26,7 @@
             <eventInterval>1000</eventInterval>
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <useTimestamps>false</useTimestamps>
             <correctT0Shift>false</correctT0Shift>

java/trunk/steering-files/src/main/resources/org/hps/steering/recon
HPSTrackingDefaultsRecon.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/HPSTrackingDefaultsRecon.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/HPSTrackingDefaultsRecon.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -33,7 +33,7 @@
             <eventInterval>1000</eventInterval>
         </driver>
         
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>true</correctT0Shift>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/recon
TestRunOfflineRecon.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/TestRunOfflineRecon.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/TestRunOfflineRecon.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -28,7 +28,7 @@
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
         <driver name="BadChannelFilter" type="org.hps.recon.tracking.SVTBadChannelFilterDriver" /> 
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>true</correctT0Shift>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/recon
TestRunOfflineReconTwoTrkFilter.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/TestRunOfflineReconTwoTrkFilter.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/TestRunOfflineReconTwoTrkFilter.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -22,7 +22,7 @@
             <eventInterval>1000</eventInterval>
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>true</correctT0Shift>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/users
OfflineTrackingAxial.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/OfflineTrackingAxial.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/OfflineTrackingAxial.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -28,7 +28,7 @@
 	</driver>
 
           <driver name="RawTrackerHitFitterDriver"
-                type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+                type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
            <rawHitCollectionName>SVTRawTrackerHits</rawHitCollectionName>  
           <fittedHitCollectionName>SVTFittedRawTrackerHits</fittedHitCollectionName> 
            <fitAlgorithm>Analytic</fitAlgorithm>  

java/trunk/steering-files/src/main/resources/org/hps/steering/users
TestRunOfflineReconSeeVertexingPlots.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/TestRunOfflineReconSeeVertexingPlots.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/TestRunOfflineReconSeeVertexingPlots.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -21,7 +21,7 @@
             <eventInterval>100</eventInterval>
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>true</correctT0Shift>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg
EcalGainDriver.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/EcalGainDriver.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/meeg/EcalGainDriver.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -47,7 +47,7 @@
             <ecalCollectionName>EcalCalHits</ecalCollectionName>
         </driver>
         <driver name="RawTrackerHitFitterDriver"
-                type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+                type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
 <!--                <fitAlgorithm>Dumb</fitAlgorithm>  -->
             <fitAlgorithm>Analytic</fitAlgorithm>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson
MultScatAna.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/MultScatAna.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/MultScatAna.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -87,7 +87,7 @@
             <eventInterval>100</eventInterval>
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>true</correctT0Shift>
         </driver>

java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson
TwoTrackAnalysis.lcsim 458 -> 459
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/TwoTrackAnalysis.lcsim	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/phansson/TwoTrackAnalysis.lcsim	2014-04-04 23:46:06 UTC (rev 459)
@@ -76,7 +76,7 @@
         </driver>        
         <driver name="RawTrackerHitSensorSetup" type="org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup"/>
         <driver name="BadChannelFilter" type="org.hps.recon.tracking.SVTBadChannelFilterDriver" /> 
-        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.HPSRawTrackerHitFitterDriver">
+        <driver name="RawTrackerHitFitterDriver" type="org.hps.recon.tracking.RawTrackerHitFitterDriver">
             <fitAlgorithm>Analytic</fitAlgorithm>
             <correctT0Shift>false</correctT0Shift>
         </driver>

java/trunk/tracking/src/main/java/org/hps/recon/tracking
AlignmentParameters.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/AlignmentParameters.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/AlignmentParameters.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,560 +0,0 @@
-package org.hps.recon.tracking;
-
-import hep.physics.matrix.BasicMatrix;
-import hep.physics.matrix.MatrixOp;
-import hep.physics.vec.BasicHep3Matrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Matrix;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.ITransform3D;
-import org.lcsim.detector.tracker.silicon.ChargeCarrier;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
-import org.lcsim.fit.helicaltrack.HelixUtils;
-import org.lcsim.fit.helicaltrack.MultipleScatter;
-import org.lcsim.fit.helicaltrack.TrackDirection;
-import org.lcsim.recon.tracking.seedtracker.SeedCandidate;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-
-/**
- * Class to calculate and print the residuals and derivatives
- * of the alignment parameters...used as input for MillePede
- * Notation follows the MillePede manual:
- * http://www.desy.de/~blobel/Mptwo.pdf
- *
- * the track is measured in the HelicalTrackFit frame
- * and residuals are in the sensor frame (u,v,w)
- *
- * ordering of track parameters is
- *    double d0 = _trk.dca();
- *    double z0 = _trk.z0();
- *    double slope = _trk.slope();
- *    double phi0 = _trk.phi0();
- *    double R = _trk.R();
- *
- * @author mgraham
- */
-public class AlignmentParameters {
-
-    private int _nlc = 5;  //the five track parameters
-    private int _ngl = 1; //delta(u) and delta(gamma) for each plane
-    private BasicMatrix _dfdq;
-    private BasicMatrix _dfdp;
-    private HelicalTrackFit _trk;
-    private double[] _resid = new double[3];
-    private double[] _error = new double[3];
-    private int[] _globalLabel = new int[1];
-    FileWriter fWriter;
-    PrintWriter pWriter;
-    Set<SiSensor> _process_sensors = new HashSet<SiSensor>();
-    boolean _DEBUG = false;
-    double smax = 1e3;
-
-    public AlignmentParameters(String outfile) {
-        try {
-//open things up
-            fWriter = new FileWriter(outfile);
-            pWriter = new PrintWriter(fWriter);
-        } catch (IOException ex) {
-            Logger.getLogger(RunAlignment.class.getName()).log(Level.SEVERE, null, ex);
-        }
-
-    }
-
-    public void PrintResidualsAndDerivatives(Track track) {
-        SeedTrack st = (SeedTrack) track;
-        SeedCandidate seed = st.getSeedCandidate();
-        Map<HelicalTrackHit, MultipleScatter> msmap = seed.getMSMap();
-        _trk = seed.getHelix();
-        List<TrackerHit> hitsOnTrack = track.getTrackerHits();
-        for (TrackerHit hit : hitsOnTrack) {
-            HelicalTrackHit htc = (HelicalTrackHit) hit;
-            double msdrphi = msmap.get(htc).drphi();
-            double msdz = msmap.get(htc).dz();
-            double sHit = _trk.PathMap().get(htc);
-            HelicalTrackCross cross = (HelicalTrackCross) htc;
-            List<HelicalTrackStrip> clusterlist = cross.getStrips();
-            TrackDirection trkdir = HelixUtils.CalculateTrackDirection(_trk, sHit);
-            cross.setTrackDirection(trkdir, _trk.covariance());
-            for (HelicalTrackStrip cl : clusterlist) {
-                CalculateLocalDerivatives(cl);
-                CalculateGlobalDerivatives(cl);
-                CalculateResidual(cl, msdrphi, msdz);
-//                CalculateResidual(cl, 0,0);
-                PrintStripResiduals(cl);
-            }
-        }
-        AddTarget(0.1, 0.02);
-    }
-
-    private void CalculateLocalDerivatives(HelicalTrackStrip strip) {
-        //get track parameters.
-        double d0 = _trk.dca();
-        double z0 = _trk.z0();
-        double slope = _trk.slope();
-        double phi0 = _trk.phi0();
-        double R = _trk.R();
-//strip origin is defined in the tracking coordinate system (x=beamline)
-        double xint = strip.origin().x();
-        double s = HelixUtils.PathToXPlane(_trk, xint, smax, _nlc).get(0);
-        double phi = s / R - phi0;
-        double[][] dfdq = new double[3][5];
-        //dx/dq
-        //these are wrong for X, but for now it doesn't matter
-        dfdq[0][0] = Math.sin(phi0);
-        dfdq[0][1] = 0;
-        dfdq[0][2] = 0;
-        dfdq[0][3] = d0 * Math.cos(phi0) + R * Math.sin(phi0) - s * Math.cos(phi0);
-        dfdq[0][4] = (phi - phi0) * Math.cos(phi0);
-        double[] mydydq = dydq(R, d0, phi0, xint, s);
-        double[] mydzdq = dzdq(R, d0, phi0, xint, slope, s);
-        for (int i = 0; i < 5; i++) {
-            dfdq[1][i] = mydydq[i];
-            dfdq[2][i] = mydzdq[i];
-        }
-
-        BasicMatrix dfdqGlobal = FillMatrix(dfdq, 3, 5);
-        Hep3Matrix trkToStrip = getTrackToStripRotation(strip);
-        _dfdq = (BasicMatrix) MatrixOp.mult(trkToStrip, dfdqGlobal);
-
-        if (_DEBUG) {
-            double[] trackpars = {d0, z0, slope, phi0, R, s, xint};
-            System.out.println("Strip Origin: ");
-            System.out.println(strip.origin());
-            System.out.println("trkToStrip Rotation:");
-            System.out.println(trkToStrip.toString());
-            printDerivatives(trackpars, dfdq);
-        }
-    }
-
-    private void CalculateGlobalDerivatives(HelicalTrackStrip strip) {
-        //1st index = alignment parameter (only u so far)
-        //2nd index = residual coordinate (on du so far)
-
-        double[][] dfdpLab = new double[3][1];
-        dfdpLab[0][0] = 0; //df/dx
-        dfdpLab[1][0] = 0; //df/dy
-        dfdpLab[2][0] = 1; //df/dz
-        BasicMatrix _dfdpLab = FillMatrix(dfdpLab, 3, 1);
-        Hep3Matrix trkToStrip = getTrackToStripRotation(strip);
-        _dfdp = (BasicMatrix) MatrixOp.mult(trkToStrip, _dfdpLab);
-        if (_DEBUG) {
-            System.out.printf("dfdz = %5.5f     %5.5f   %5.5f\n", _dfdp.e(0, 0), _dfdp.e(1, 0), _dfdp.e(2, 0));
-        }
-        _globalLabel[0] = GetIdentifier(strip);
-//         _globalLabel[0] = GetIdentifierModule(strip);
-
-    }
-
-    private void CalculateResidual(HelicalTrackStrip strip, double msdrdphi, double msdz) {
-
-        Hep3Vector u = strip.u();
-        Hep3Vector v = strip.v();
-        Hep3Vector w = strip.w();
-        Hep3Vector corigin = strip.origin();
-        double phi0 = _trk.phi0();
-        double R = _trk.R();
-        double xint = strip.origin().x();
-        double s = HelixUtils.PathToXPlane(_trk, xint, smax, _nlc).get(0);
-        double phi = s / R - phi0;
-        Hep3Vector trkpos = HelixUtils.PointOnHelix(_trk, s);
-
-        //System.out.println("trkpos = "+trkpos.toString());
-        //System.out.println("origin = "+corigin.toString());
-
-        Hep3Vector mserr = new BasicHep3Vector(msdrdphi * Math.sin(phi), msdrdphi * Math.sin(phi), msdz);
-        Hep3Vector vdiffTrk = VecOp.sub(trkpos, corigin);
-        Hep3Matrix trkToStrip = getTrackToStripRotation(strip);
-        Hep3Vector vdiff = VecOp.mult(trkToStrip, vdiffTrk);
-        double umc = vdiff.x();
-        double vmc = vdiff.y();
-        double wmc = vdiff.z();
-        double umeas = strip.umeas();
-        double uError = strip.du();
-        double msuError = VecOp.dot(mserr, u);
-        double vmeas = 0;
-        double vError = (strip.vmax() - strip.vmin()) / Math.sqrt(12);
-        double wmeas = 0;
-        double wError = 0.001;
-        //System.out.println("strip error="+uError+"; ms error ="+msuError);
-        _resid[0] = umeas - umc;
-        _error[0] = Math.sqrt(uError * uError + msuError * msuError);
-        _resid[1] = vmeas - vmc;
-        _error[1] = vError;
-        _resid[2] = wmeas - wmc;
-        _error[2] = wError;
-        if (_DEBUG) {
-            System.out.println("Strip Origin: ");
-            System.out.println(corigin.toString());
-            System.out.println("Position on Track:");
-            System.out.println(trkpos.toString());
-            System.out.println("vdiff :");
-            System.out.println(vdiff.toString());
-            System.out.println("u :");
-            System.out.println(u.toString());
-            System.out.println("umeas = " + umeas + "; umc = " + umc);
-            System.out.println("udiff = " + _resid[0] + " +/- " + _error[0]);
-
-        }
-
-    }
-
-    public double[] getResidual(Track track, int layer) {
-        double[] res = new double[7];
-        SeedTrack st = (SeedTrack) track;
-        SeedCandidate seed = st.getSeedCandidate();
-        Map<HelicalTrackHit, MultipleScatter> msmap = seed.getMSMap();
-        _trk = seed.getHelix();
-        List<TrackerHit> hitsOnTrack = track.getTrackerHits();
-        for (TrackerHit hit : hitsOnTrack) {
-            HelicalTrackHit htc = (HelicalTrackHit) hit;
-            double sHit = _trk.PathMap().get(htc);
-            HelicalTrackCross cross = (HelicalTrackCross) htc;
-            List<HelicalTrackStrip> clusterlist = cross.getStrips();
-            TrackDirection trkdir = HelixUtils.CalculateTrackDirection(_trk, sHit);
-            double msdrphi = msmap.get(htc).drphi();
-            double msdz = msmap.get(htc).dz();
-            cross.setTrackDirection(trkdir, _trk.covariance());
-            for (HelicalTrackStrip cl : clusterlist) {
-                if (cl.layer() == layer) {
-                    CalculateResidual(cl, msdrphi, msdz);
-                    res[0] = _resid[0];
-                    res[1] = _resid[1];
-                    res[2] = _resid[2];
-                    res[3] = _error[0];
-                    res[4] = _error[1];
-                    res[5] = _error[2];
-                    res[6] = layer;
-                    if(hit.getPosition()[2]<0)res[6]=layer+10;
-                }
-            }
-        }
-        return res;
-
-    }
-
-    public void AddTarget(double beamdy, double beamdz) {
-        double[][] dfdp = new double[3][1];
-        double d0 = _trk.dca();
-        double z0 = _trk.z0();
-        double slope = _trk.slope();
-        double phi0 = _trk.phi0();
-        double R = _trk.R();
-        double xint = 0; //target
-        double s = HelixUtils.PathToXPlane(_trk, xint, smax, _nlc).get(0);
-        Hep3Vector ptAtTarget = HelixUtils.PointOnHelix(_trk, s);
-        double[] mydydq = dydq(R, d0, phi0, xint, s);
-        double[] mydzdq = dzdq(R, d0, phi0, xint, slope, s);
-        _resid[0] = ptAtTarget.z();
-        _resid[1] = ptAtTarget.y();
-        _resid[2] = ptAtTarget.x();
-        _error[0] = beamdz;
-        _error[1] = beamdy;
-        _error[2] = 666;
-        dfdp[0][0] = 1;
-        dfdp[1][0] = 0;
-        dfdp[2][0] = 0;
-        _dfdp = FillMatrix(dfdp, 3, 1);
-        _globalLabel[0] = 666;
-        pWriter.printf("%4d\n", 666);
-        pWriter.printf("%5.5e %5.5e %5.5e\n", _resid[0], _resid[1], _resid[2]);
-        pWriter.printf("%5.5e %5.5e %5.5e\n", _error[0], _error[1], _error[2]);
-        for (int i = 0; i < _nlc; i++) {
-            pWriter.printf("%5.5e %5.5e -1.0\n", mydzdq[i], mydydq[i]);
-        }
-        for (int j = 0; j < _ngl; j++) {
-            pWriter.printf("%5.5e %5.5e %5.5e   %5d\n", _dfdp.e(0, j), _dfdp.e(1, j), _dfdp.e(2, j), _globalLabel[j]);
-        }
-
-    }
-
-    private void PrintStripResiduals(HelicalTrackStrip strip) {
-        if (_DEBUG) {
-            System.out.printf("Strip Layer =  %4d\n", strip.layer());
-            System.out.printf("Residuals (u,v,w) : %5.5e %5.5e %5.5e\n", _resid[0], _resid[1], _resid[2]);
-            System.out.printf("Errors (u,v,w)    : %5.5e %5.5e %5.5e\n", _error[0], _error[1], _error[2]);
-            String[] q = {"d0", "z0", "slope", "phi0", "R"};
-            System.out.println("track parameter derivatives");
-            for (int i = 0; i < _nlc; i++) {
-                System.out.printf("%s     %5.5e %5.5e %5.5e\n", q[i], _dfdq.e(0, i), _dfdq.e(1, i), _dfdq.e(2, i));
-            }
-            String[] p = {"u-displacement"};
-            System.out.println("global parameter derivatives");
-            for (int j = 0; j < _ngl; j++) {
-                System.out.printf("%s  %5.5e %5.5e %5.5e   %5d\n", p[j], _dfdp.e(0, j), _dfdp.e(1, j), _dfdp.e(2, j), _globalLabel[j]);
-            }
-
-        }
-        pWriter.printf("%4d\n", strip.layer());
-        pWriter.printf("%5.5e %5.5e %5.5e\n", _resid[0], _resid[1], _resid[2]);
-        pWriter.printf("%5.5e %5.5e %5.5e\n", _error[0], _error[1], _error[2]);
-        for (int i = 0; i < _nlc; i++) {
-            pWriter.printf("%5.5e %5.5e %5.5e\n", _dfdq.e(0, i), _dfdq.e(1, i), _dfdq.e(2, i));
-        }
-        for (int j = 0; j < _ngl; j++) {
-            pWriter.printf("%5.5e %5.5e %5.5e   %5d\n", _dfdp.e(0, j), _dfdp.e(1, j), _dfdp.e(2, j), _globalLabel[j]);
-        }
-    }
-
-    private Hep3Matrix getTrackToStripRotation(HelicalTrackStrip strip) {
-        ITransform3D detToStrip = GetGlobalToLocal(strip);
-        Hep3Matrix detToStripMatrix = (BasicHep3Matrix) detToStrip.getRotation().getRotationMatrix();
-        Hep3Matrix detToTrackMatrix = (BasicHep3Matrix) HPSTransformations.getMatrix();
-
-        if (_DEBUG) {
-            System.out.println("gblToLoc translation:");
-            System.out.println(detToStrip.getTranslation().toString());
-            System.out.println("gblToLoc Rotation:");
-            System.out.println(detToStrip.getRotation().toString());
-            System.out.println("detToTrack Rotation:");
-            System.out.println(detToTrackMatrix.toString());
-        }
-
-        return (Hep3Matrix) VecOp.mult(detToStripMatrix, VecOp.inverse(detToTrackMatrix));
-    }
-
-    private ITransform3D GetGlobalToLocal(HelicalTrackStrip strip) {
-        RawTrackerHit rth = (RawTrackerHit) strip.rawhits().get(0);
-        IDetectorElement ide = rth.getDetectorElement();
-        SiSensor sensor = ide.findDescendants(SiSensor.class).get(0);
-        SiSensorElectrodes electrodes = sensor.getReadoutElectrodes(ChargeCarrier.HOLE);
-        return electrodes.getGlobalToLocal();
-    }
-
-    private int GetIdentifier(HelicalTrackStrip strip) {
-        RawTrackerHit rth = (RawTrackerHit) strip.rawhits().get(0);
-        IDetectorElement ide = rth.getDetectorElement();
-        SiSensor sensor = ide.findDescendants(SiSensor.class).get(0);
-        //       return rth.getIdentifierFieldValue(sensor.getName());
-        return sensor.getSensorID();  //individual sensor positions
-//        int sid=sensor.getSensorID();
-//        int global=1;
-//        if(sid>10)global=2;
-//        return global;  //return top/bottom plates
-    }
-
-    private int GetIdentifierModule(HelicalTrackStrip strip) {
-        RawTrackerHit rth = (RawTrackerHit) strip.rawhits().get(0);
-        IDetectorElement ide = rth.getDetectorElement();
-        SiSensor sensor = ide.findDescendants(SiSensor.class).get(0);
-        //       return rth.getIdentifierFieldValue(sensor.getName());
-//        return sensor.getSensorID();  //individual sensor positions
-        int sid = sensor.getSensorID();
-        int gid = -1;
-        switch (sid) {
-            case 1:
-                gid = 1; break;
-            case 2:
-                gid = 1;break;
-            case 3:
-                gid = 2;break;
-            case 4:
-                gid = 2;break;
-            case 5:
-                gid = 3;break;
-            case 6:
-                gid = 3;break;
-            case 7:
-                gid = 4;break;
-            case 8:
-                gid = 4;break;
-            case 9:
-                gid = 5;break;
-            case 10:
-                gid = 5;break;
-            case 11:
-                gid = 11;break;
-            case 12:
-                gid = 11;break;
-            case 13:
-                gid = 12;break;
-            case 14:
-                gid = 12;break;
-            case 15:
-                gid = 13;break;
-            case 16:
-                gid = 13;break;
-            case 17:
-                gid = 14;break;
-            case 18:
-                gid = 14;break;
-            case 19:
-                gid = 15;break;
-            case 20:
-                gid = 15;break;
-        }
-
-        return gid;  //return top/bottom plates
-    }
-
-    private BasicMatrix FillMatrix(double[][] array, int nrow, int ncol) {
-        BasicMatrix retMat = new BasicMatrix(nrow, ncol);
-        for (int i = 0; i < nrow; i++) {
-            for (int j = 0; j < ncol; j++) {
-                retMat.setElement(i, j, array[i][j]);
-            }
-        }
-        return retMat;
-    }
-
-    public void closeFile() throws IOException {
-        pWriter.close();
-        fWriter.close();
-    }
-
-    private double dsdR(double R, double d0, double phi0, double xint) {
-        double sqrtTerm = Sqrt(R * R - Math.pow(((d0 - R) * Sin(phi0) + xint), 2));
-
-        double rsign = Math.signum(R);
-        double dsdr = (1 / sqrtTerm) * ((-rsign * xint) + (-rsign) * d0 * Sin(phi0)
-                + ArcTan(R * Cos(phi0), (-R) * Sin(phi0))
-                * sqrtTerm
-                - ArcTan(rsign * sqrtTerm, xint + (d0 - R) * Sin(phi0))
-                * sqrtTerm);
-
-
-        if (_DEBUG)
-            System.out.println("xint = " + xint + "; dsdr = " + dsdr);
-        return dsdr;
-
-    }
-
-    private double dsdphi(double R, double d0, double phi0, double xint) {
-        double sqrtTerm = Sqrt(R * R - Math.pow(((d0 - R) * Sin(phi0) + xint), 2));
-        double rsign = Math.signum(R);
-        double dsdphi = R * (sqrtTerm + rsign * d0 * Cos(phi0) - rsign * R * Cos(phi0)) / sqrtTerm;
-        if (_DEBUG)
-            System.out.println("xint = " + xint + "; dsdphi = " + dsdphi);
-        return dsdphi;
-    }
-
-    private double dsdd0(double R, double d0, double phi0, double xint) {
-        double sqrtTerm = Sqrt(R * R - Math.pow(((d0 - R) * Sin(phi0) + xint), 2));
-        double rsign = Math.signum(R);
-        double dsdd0 = rsign * (R * Sin(phi0)) / sqrtTerm;
-        if (_DEBUG)
-            System.out.println("xint = " + xint + "; dsdd0 = " + dsdd0);
-        return dsdd0;
-    }
-
-    private double[] dydq(double R, double d0, double phi0, double xint, double s) {
-        double[] dy = new double[5];
-//        dy[0] = Cos(phi0) + Cot(phi0 - s / R) * Csc(phi0 - s / R) * dsdd0(R, d0, phi0, xint);
-        dy[0] = Cos(phi0) - Sec(phi0 - s / R) * Tan(phi0 - s / R) * dsdd0(R, d0, phi0, xint);
-        dy[1] = 0;
-        dy[2] = 0;
-//        dy[3] = (-(d0 - R)) * Sin(phi0) - R * Cot(phi0 - s / R) * Csc(phi0 - s / R) * (1 - dsdphi(R, d0, phi0, xint) / R);
-        dy[3] = (-(d0 - R)) * Sin(phi0) + Sec(phi0 - s / R) * Tan(phi0 - s / R) * (R - dsdphi(R, d0, phi0, xint));
-        //        dy[4] = -Cos(phi0) + Csc(phi0 - s / R) - R * Cot(phi0 - s / R) * Csc(phi0 - s / R) * (s / (R * R) - dsdR(R, d0, phi0, xint) / R);
-        dy[4] = -Cos(phi0) + Sec(phi0 - s / R) + (1 / R) * Sec(phi0 - s / R) * Tan(phi0 - s / R) * (s - R * dsdR(R, d0, phi0, xint));
-        return dy;
-    }
-
-    private double[] dzdq(double R, double d0, double phi0, double xint, double slope, double s) {
-        double[] dz = new double[5];
-        dz[0] = slope * dsdd0(R, d0, phi0, xint);
-        dz[1] = 1;
-        dz[2] = s;
-        dz[3] = slope * dsdphi(R, d0, phi0, xint);
-        dz[4] = slope * dsdR(R, d0, phi0, xint);
-        return dz;
-    }
-
-    private double Csc(double val) {
-        return 1 / Math.sin(val);
-    }
-
-    private double Cot(double val) {
-        return 1 / Math.tan(val);
-    }
-
-    private double Sec(double val) {
-        return 1 / Math.cos(val);
-    }
-
-    private double Sin(double val) {
-        return Math.sin(val);
-    }
-
-    private double Cos(double val) {
-        return Math.cos(val);
-    }
-
-    private double Tan(double val) {
-        return Math.tan(val);
-    }
-
-    private double ArcTan(double val1, double val2) {
-        return Math.atan2(val1, val2);
-    }
-
-    private double Sign(double val) {
-        return Math.signum(val);
-    }
-
-    private double Sqrt(double val) {
-        return Math.sqrt(val);
-    }
-
-    private void printDerivatives(double[] trackpars, double[][] dfdq) {
-        System.out.println("======================================================");
-        System.out.println("s         xint");
-        System.out.printf("%5.5f %5.5f\n", trackpars[5], trackpars[6]);
-        System.out.println("             d0           z0           slope         phi0          R");
-        System.out.printf("Values       %5.5f    %5.5f     %5.5f      %5.5f      %5.5f\n", trackpars[0], trackpars[1], trackpars[2], trackpars[3], trackpars[4]);
-        System.out.printf("dzdq         ");
-        for (int i = 0; i < 5; i++) {
-            System.out.printf("%5.3e   ", dfdq[2][i]);
-        }
-        System.out.println();
-        System.out.printf("dudq         ");
-        for (int i = 0; i < _nlc; i++) {
-            System.out.printf("%5.3e   ", _dfdq.e(0, i));
-        }
-        System.out.println();
-        System.out.println();
-        System.out.printf("dydq         ");
-        for (int i = 0; i < 5; i++) {
-            System.out.printf("%5.3e   ", dfdq[1][i]);
-        }
-        System.out.println();
-        System.out.printf("dvdq         ");
-        for (int i = 0; i < _nlc; i++) {
-            System.out.printf("%5.3e   ", _dfdq.e(1, i));
-        }
-        System.out.println();
-        System.out.println();
-        System.out.printf("dxdq         ");
-        for (int i = 0; i < 5; i++) {
-            System.out.printf("%5.3e   ", dfdq[0][i]);
-        }
-        System.out.println();
-        System.out.printf("dwdq         ");
-        for (int i = 0; i < _nlc; i++) {
-            System.out.printf("%5.3e   ", _dfdq.e(2, i));
-        }
-        System.out.println();
-        //        System.out.println(        _trk.xc()+ "; "+_trk.yc());
-//          System.out.println(        _trk.x0()+ "; "+_trk.y0());
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
AxialTrackReconDriver.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/AxialTrackReconDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/AxialTrackReconDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -28,18 +28,16 @@
 import org.lcsim.util.Driver;
 
 /**
- * This class runs the Track Reconstruction for the HPS Test Proposal detector.
- * The tracker digitization must be run in front of it. It is intended to work
- * with the {@link TrackerDigiDriver} digitization Driver.
- *
- * @author jeremym
- * @version $Id: TrackerReconDriver.java,v 1.18 2012/05/03 20:50:29 mgraham Exp
- * $
+ * Axial track reconstruction.
+ * 
+ * @author Matt Graham
+ * @version $Id: TrackerReconDriver.java,v 1.18 2012/05/03 20:50:29 mgraham Exp $
  */
+// TODO: Add more documentation about what this Driver does. --JM
 public final class AxialTrackReconDriver extends Driver {
 
     // Debug flag.
-    //private final static boolean DEBUG = false;
+    // private final static boolean DEBUG = false;
     private boolean debug = false;
     // Tracks found across all events.
     int ntracks = 0;
@@ -86,9 +84,8 @@
 
     /**
      * Set the tracking strategy resource.
-     *
-     * @param strategyResource The absolute path to the strategy resource in the
-     * hps-java jar.
+     * 
+     * @param strategyResource The absolute path to the strategy resource in the hps-java jar.
      */
     public void setStrategyResource(String strategyResource) {
         this.strategyResource = strategyResource;
@@ -128,9 +125,8 @@
 
     /**
      * Set the SimTrackerHit collection to be used for tracking.
-     *
-     * @param simTrackerHitCollectionName The name of the SimTrackerHit
-     * collection in the event.
+     * 
+     * @param simTrackerHitCollectionName The name of the SimTrackerHit collection in the event.
      */
     public void setSimTrackerHitCollectionName(String simTrackerHitCollectionName) {
         this.simTrackerHitCollectionName = simTrackerHitCollectionName;
@@ -171,16 +167,15 @@
             throw new RuntimeException("No SiTrackerModules found in detector.");
         }
 
-
         // Create the Driver.
         HelicalTrackHitDriver hthdriver = new HelicalTrackHitDriver();
         hthdriver.addCollection(stripHitsCollectionName);
         hthdriver.setOutputCollectionName(hthOutputCollectionName);
-//        hthdriver.setHitRelationName(helicalTrackHitRelationsCollectionName);
-//        hthdriver.setMCRelationName(helicalTrackMCRelationsCollectionName);
+        // hthdriver.setHitRelationName(helicalTrackHitRelationsCollectionName);
+        // hthdriver.setMCRelationName(helicalTrackMCRelationsCollectionName);
 
-  //      hthdriver.setStripMaxSeparation(stripMaxSeparation);
-  //      hthdriver.setStripTolerance(stripTolerance); // user parameter?
+        // hthdriver.setStripMaxSeparation(stripMaxSeparation);
+        // hthdriver.setStripTolerance(stripTolerance); // user parameter?
         hthdriver.setTransformToTracking(true);
         hthdriver.setDebug(true);
         add(hthdriver);
@@ -205,8 +200,7 @@
     }
 
     /**
-     * This method is used to run the reconstruction and print debug
-     * information.
+     * This method is used to run the reconstruction and print debug information.
      */
     public void process(EventHeader event) {
         // This call runs the track reconstruction using the sub-Drivers.
@@ -214,7 +208,6 @@
         double maxChi2 = 250;
         List<HelicalTrackHit> hth = event.get(HelicalTrackHit.class, stInputCollectionName);
 
-
         System.out.println("The HelicalTrackHit collection " + hthOutputCollectionName + " has " + hth.size() + " hits.");
         List<HelicalTrackHit> hitsLayer1 = getLayerHits(hth, 1);
         List<HelicalTrackHit> hitsLayer3 = getLayerHits(hth, 3);
@@ -227,25 +220,25 @@
             for (HelicalTrackHit h3 : hitsLayer3) {
                 for (HelicalTrackHit h5 : hitsLayer5) {
                     for (HelicalTrackHit h7 : hitsLayer7) {
-//                        for (HelicalTrackHit h9 : hitsLayer9) {
+                        // for (HelicalTrackHit h9 : hitsLayer9) {
 
-                            SeedCandidate seed = new SeedCandidate(sFinallist.get(0), bfield);
-                            seed.addHit(h1);
-                            seed.addHit(h3);
-                            seed.addHit(h5);
-                            seed.addHit(h7);
-//                            seed.addHit(h9);
+                        SeedCandidate seed = new SeedCandidate(sFinallist.get(0), bfield);
+                        seed.addHit(h1);
+                        seed.addHit(h3);
+                        seed.addHit(h5);
+                        seed.addHit(h7);
+                        // seed.addHit(h9);
 
-                            HelicalTrackFit fitRes = fit(seed);
-                            if (fitRes != null) {
-                                seed.setHelix(fitRes);
-                                if (fitRes.chisq()[1] > maxChi2)
-                                    continue;
+                        HelicalTrackFit fitRes = fit(seed);
+                        if (fitRes != null) {
+                            seed.setHelix(fitRes);
+                            if (fitRes.chisq()[1] > maxChi2)
+                                continue;
 
-                                seedtracks.add(seed);
-//                       System.out.println(fitRes.toString());
-                            }
-//                        }
+                            seedtracks.add(seed);
+                            // System.out.println(fitRes.toString());
+                        }
+                        // }
                     }
                 }
             }
@@ -280,11 +273,11 @@
         SlopeInterceptLineFitter _lfitter = new SlopeInterceptLineFitter();
         SlopeInterceptLineFit _lfit;
         boolean success = false;
-        //  Check if we have enough pixel hits to do a straight-line fit of s vs z
+        // Check if we have enough pixel hits to do a straight-line fit of s vs z
         int npix = hitcol.size();
-        //  Calculate the arc lengths from the DCA to each hit and check for backwards hits
+        // Calculate the arc lengths from the DCA to each hit and check for backwards hits
         Map<HelicalTrackHit, Double> smap = getPathLengths(hitcol);
-        //  Create the objects that will hold the fit output
+        // Create the objects that will hold the fit output
         double[] chisq = new double[2];
         int[] ndof = new int[2];
         ndof[0] = 0;
@@ -292,13 +285,12 @@
         double[] par = new double[5];
         SymmetricMatrix cov = new SymmetricMatrix(5);
 
-
-        //  Setup for the line fit
+        // Setup for the line fit
         double[] s = new double[npix];
         double[] z = new double[npix];
         double[] dz = new double[npix];
 
-        //  Store the coordinates and errors for the line fit
+        // Store the coordinates and errors for the line fit
         for (int i = 0; i < npix; i++) {
             HelicalTrackHit hit = hitcol.get(i);
             z[i] = hit.z();
@@ -308,48 +300,48 @@
             System.out.println(z[i] + " " + dz[i] + " " + s[i]);
         }
 
-        //  Call the line fitter and check for success
+        // Call the line fitter and check for success
         success = _lfitter.fit(s, z, dz, npix);
         if (!success) {
             return null;
         }
 
-        //  Save the line fit, chi^2, and DOF
+        // Save the line fit, chi^2, and DOF
         _lfit = _lfitter.getFit();
         chisq[1] = _lfit.chisquared();
         ndof[1] = npix - 2;
 
-        //  Save the line fit parameters
+        // Save the line fit parameters
         par[HelicalTrackFit.z0Index] = _lfit.intercept();
         par[HelicalTrackFit.slopeIndex] = _lfit.slope();
         par[HelicalTrackFit.curvatureIndex] = 0.0001;
         par[HelicalTrackFit.dcaIndex] = 0.0001;
         par[HelicalTrackFit.phi0Index] = 0.000;
 
-
-        //  Save the line fit covariance matrix elements
+        // Save the line fit covariance matrix elements
         cov.setElement(HelicalTrackFit.z0Index, HelicalTrackFit.z0Index, Math.pow(_lfit.interceptUncertainty(), 2));
         cov.setElement(HelicalTrackFit.z0Index, HelicalTrackFit.slopeIndex, _lfit.covariance());
         cov.setElement(HelicalTrackFit.slopeIndex, HelicalTrackFit.slopeIndex, Math.pow(_lfit.slopeUncertainty(), 2));
         cov.setElement(HelicalTrackFit.curvatureIndex, HelicalTrackFit.curvatureIndex, 0);
         cov.setElement(HelicalTrackFit.curvatureIndex, HelicalTrackFit.phi0Index, 0);
         cov.setElement(HelicalTrackFit.phi0Index, HelicalTrackFit.phi0Index, 0);
-        cov.setElement(HelicalTrackFit.curvatureIndex, HelicalTrackFit.dcaIndex, 0);  // fix d0 sign convention
-        cov.setElement(HelicalTrackFit.phi0Index, HelicalTrackFit.dcaIndex, 0);  // fix d0 sign convention
+        cov.setElement(HelicalTrackFit.curvatureIndex, HelicalTrackFit.dcaIndex, 0); // fix d0 sign
+                                                                                     // convention
+        cov.setElement(HelicalTrackFit.phi0Index, HelicalTrackFit.dcaIndex, 0); // fix d0 sign
+                                                                                // convention
         cov.setElement(HelicalTrackFit.dcaIndex, HelicalTrackFit.dcaIndex, 0);
 
-
-        //  Create the HelicalTrackFit for this helix
+        // Create the HelicalTrackFit for this helix
         return new HelicalTrackFit(par, cov, chisq, ndof, smap, msmap);
 
     }
 
     private Map<HelicalTrackHit, Double> getPathLengths(List<HelicalTrackHit> hits) {
 
-        //  Create a map to store the arc lengths
+        // Create a map to store the arc lengths
         Map<HelicalTrackHit, Double> smap = new HashMap<HelicalTrackHit, Double>();
 
-        //  Initialize looper tracking and iterate over ordered list of hits
+        // Initialize looper tracking and iterate over ordered list of hits
         double slast = 0.;
         int ilast = -1;
         double s;
@@ -359,10 +351,10 @@
             HelicalTrackHit hit = hits.get(i);
             if (hit instanceof HelicalTrack2DHit) {
 
-                //  Axial hit - measure from the DCA (can't handle loopers)
-//                s = HelixUtils.PathLength(_cfit, hit);
+                // Axial hit - measure from the DCA (can't handle loopers)
+                // s = HelixUtils.PathLength(_cfit, hit);
                 s = hit.getPosition()[0];
-                //  Save the arc length for this hit
+                // Save the arc length for this hit
                 smap.put(hit, s);
             }
         }
@@ -387,45 +379,44 @@
     }
 
     private void addTracksToEvent(EventHeader event, List<SeedCandidate> seedlist, double bfield) {
-        //  Create a the track list
+        // Create a the track list
         List<Track> tracks = new ArrayList<Track>();
 
-        //  Initialize the reference point to the origin
+        // Initialize the reference point to the origin
         double[] ref = new double[3];
         ref[0] = 0.;
         ref[1] = 0.;
         ref[2] = 0.;
-        //  Loop over the SeedCandidates that have survived
+        // Loop over the SeedCandidates that have survived
         for (SeedCandidate trackseed : seedlist) {
 
-            //  Create a new SeedTrack (SeedTrack extends BaseTrack)
+            // Create a new SeedTrack (SeedTrack extends BaseTrack)
             SeedTrack trk = new SeedTrack();
 
-            //  Add the hits to the track
+            // Add the hits to the track
             for (HelicalTrackHit hit : trackseed.getHits()) {
                 trk.addHit((TrackerHit) hit);
             }
 
-            //  Retrieve the helix and save the relevant bits of helix info
+            // Retrieve the helix and save the relevant bits of helix info
             HelicalTrackFit helix = trackseed.getHelix();
             trk.setTrackParameters(helix.parameters(), bfield);
             trk.setCovarianceMatrix(helix.covariance());
             trk.setChisq(helix.chisqtot());
             trk.setNDF(helix.ndf()[0] + helix.ndf()[1]);
 
-            //  Flag that the fit was successful and set the reference point
+            // Flag that the fit was successful and set the reference point
             trk.setFitSuccess(true);
             trk.setReferencePoint(ref);
             trk.setRefPointIsDCA(true);
 
-            //  Set the strategy used to find this track
+            // Set the strategy used to find this track
             trk.setStratetgy(trackseed.getSeedStrategy());
 
-            //  Set the SeedCandidate this track is based on
+            // Set the SeedCandidate this track is based on
             trk.setSeedCandidate(trackseed);
 
-
-            //  Add the track to the list of tracks
+            // Add the track to the list of tracks
             tracks.add((Track) trk);
         }
 

java/trunk/tracking/src/main/java/org/hps/recon/tracking
DataTrackerFakeHitDriver.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/DataTrackerFakeHitDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/DataTrackerFakeHitDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,1030 +0,0 @@
-package org.hps.recon.tracking;
-
-import hep.aida.IAnalysisFactory;
-import hep.aida.IHistogram1D;
-import hep.aida.IPlotter;
-import hep.aida.IProfile1D;
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Matrix;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.hps.conditions.deprecated.SvtUtils;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.ITransform3D;
-import org.lcsim.detector.ITranslation3D;
-import org.lcsim.detector.Transform3D;
-import org.lcsim.detector.Translation3D;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.solids.Box;
-import org.lcsim.detector.solids.Inside;
-import org.lcsim.detector.solids.Polygon3D;
-import org.lcsim.detector.tracker.silicon.ChargeCarrier;
-import org.lcsim.detector.tracker.silicon.DopedSilicon;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
-import org.lcsim.detector.tracker.silicon.SiStrips;
-import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.base.BaseRawTrackerHit;
-import org.lcsim.event.base.BaseSimTrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelixUtils;
-import org.lcsim.fit.helicaltrack.HitIdentifier;
-import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType;
-import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType.CoordinateSystem;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- *
- * @author phansson
- */
-public class DataTrackerFakeHitDriver extends Driver {
-
-    private boolean debug = false;
-    TrackerHitUtils trackerhitutils = new TrackerHitUtils();
-    Hep3Matrix detToTrk;
-    Hep3Vector _bfield;
-    TrackerHitType trackerType = new TrackerHitType(TrackerHitType.CoordinateSystem.GLOBAL, TrackerHitType.MeasurementType.STRIP_1D);
-    CoordinateSystem coordinate_system = trackerType.getCoordinateSystem();
-    private HitIdentifier _ID = new HitIdentifier();
-    private EventHeader.LCMetaData metaData = null;
-    private boolean _doHth = false;
-    boolean createSimTrackerHits = false;
-    // Collections
-    List<SimTrackerHit> simHits = null;
-    List<SiTrackerHit> stripHits1D = null;
-    List<HelicalTrackHit> hths = null;
-    String trackCollectionName = "MCParticle_HelicalTrackFit";
-    String stripHitOutputCollectionName = "StripClusterer_SiTrackerHitStrip1D";
-    String hthOutputCollectionName = "RotatedHelicalTrackHits";
-    String simTrackerHitCollectionName = "FakeTrackerHits";
-    // Subdetector name.
-    private String subdetectorName = "Tracker";
-    // Various data lists required by digitization.
-    private List<String> processPaths = new ArrayList<String>();
-    private List<IDetectorElement> processDEs = new ArrayList<IDetectorElement>();
-    private Set<SiSensor> processSensors = new HashSet<SiSensor>();
-    //Visualization
-    private boolean hideFrame = false;
-    private AIDA aida = AIDA.defaultInstance();
-    private HashMap<SiSensor, IProfile1D> _delta_histos;
-    private HashMap<SiSensor, IHistogram1D> _delta_itercount = new HashMap<SiSensor, IHistogram1D>();
-    IProfile1D _prf_final_deltas;
-    IProfile1D _prf_all_deltas;
-    IHistogram1D _h_nstriphits_top;
-    IHistogram1D _h_nstriphits_bottom;
-    IAnalysisFactory af = aida.analysisFactory();
-    IPlotter plotter_iter;
-    IPlotter plotter_itercount;
-    IPlotter plotter_iter_final;
-    IPlotter plotter_iter_all;
-    IPlotter plotter_nstripclusters;
-    IPlotter plotter_trackposodd;
-    int[][] counts = new int[2][10];
-
-    public void setDebug(boolean debug) {
-        this.debug = debug;
-    }
-
-    public void setHideFrame(boolean hide) {
-        this.hideFrame = hide;
-    }
-
-    public void setDoHth(boolean debug) {
-        this._doHth = debug;
-    }
-
-    /**
-     * Enable/disable the creation of SimTrackerHits
-     */
-    public void setCreateSimTrackerHits(boolean createSimTrackerHits) {
-        this.createSimTrackerHits = createSimTrackerHits;
-    }
-
-//    public void setReadoutCollectionName(String readoutCollectionName) {
-//        this.readoutCollectionName = readoutCollectionName;
-//    }
-    public void setSubdetectorName(String subdetectorName) {
-        this.subdetectorName = subdetectorName;
-    }
-
-    public void setStripHitOutputCollectionName(String stripHitOutputCollectionName) {
-        this.stripHitOutputCollectionName = stripHitOutputCollectionName;
-    }
-
-    public void setHthOutputCollectionName(String hthOutputCollectionName) {
-        this.hthOutputCollectionName = hthOutputCollectionName;
-    }
-
-    public void setTrackCollectionName(String trackCollectionName) {
-        this.trackCollectionName = trackCollectionName;
-    }
-
-    /**
-     * Creates a new instance of TrackerHitDriver.
-     */
-    public DataTrackerFakeHitDriver() {
-        this._delta_histos = new HashMap<SiSensor, IProfile1D>();
-    }
-
-    /**
-     * Do initialization once we get a Detector.
-     */
-    @Override
-    public void detectorChanged(Detector detector) {
-
-        // Call sub-Driver's detectorChanged methods.
-        super.detectorChanged(detector);
-
-
-        Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
-        _bfield = new BasicHep3Vector(0, 0, detector.getFieldMap().getField(IP).y());
-        detToTrk = trackerhitutils.detToTrackRotationMatrix();
-
-
-        // Process detectors specified by path, otherwise process entire
-        // detector
-        IDetectorElement deDetector = detector.getDetectorElement();
-
-        for (String path : processPaths) {
-            processDEs.add(deDetector.findDetectorElement(path));
-        }
-
-        if (processDEs.isEmpty()) {
-            processDEs.add(deDetector);
-        }
-
-        for (IDetectorElement detectorElement : processDEs) {
-            processSensors.addAll(detectorElement.findDescendants(SiSensor.class));
-        }
-
-        // Set the detector to process.
-        processPaths.add(subdetectorName);
-
-        this.makePlots();
-
-    }
-
-    /**
-     * Perform the digitization.
-     */
-    @Override
-    public void process(EventHeader event) {
-
-
-        // Obtain the tracks from the event
-        if (!event.hasCollection(HPSTrack.class, trackCollectionName)) {
-            this.printDebug("No HPSTracks were found, skipping event");
-            simHits = null;
-            return;
-        }
-        List<HPSTrack> tracks = event.get(HPSTrack.class, trackCollectionName);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": found " + tracks.size() + " tracks (" + this.trackCollectionName + ")");
-        }
-
-        // Instantiate the list of interest 
-        if (this._doHth) {
-            this.printDebug("Creating HelicalTrackHits...");
-            hths = new ArrayList<HelicalTrackHit>();
-        } else if (createSimTrackerHits) {
-            this.printDebug("Creating SimTrackerHits...");
-            simHits = new ArrayList<SimTrackerHit>();
-            metaData = event.getMetaData(event.get(SimTrackerHit.class, "TrackerHits"));
-        } else {
-            // Create StripHit1Ds by default
-            this.printDebug("Creating StripHit1D...");
-            stripHits1D = new ArrayList<SiTrackerHit>();
-        }
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": Add hits for " + tracks.size() + " tracks (" + this.trackCollectionName + ")");
-        }
-
-        for (HPSTrack helix : tracks) {
-            if (debug) {
-                System.out.println(this.getClass().getSimpleName() + ": trying to add hits for this track");
-            }
-
-            // Get the MC Particle associated with this track
-            MCParticle mcParticle = helix.getMCParticle();
-
-            if (debug) {
-                System.out.println(this.getClass().getSimpleName() + helix.toString());
-                System.out.println(this.getClass().getSimpleName() + ": htf x0 " + helix.x0() + " y0 " + helix.y0());
-
-                System.out.println(this.getClass().getSimpleName() + ": create a WTrack object");
-            }
-
-            WTrack wtrack = new WTrack(helix, Math.abs(_bfield.z()), true); //remove sign from B-field (assumed to go along z-direction)
-
-            if (debug) {
-                System.out.println(this.getClass().getSimpleName() + ": " + wtrack.toString());
-
-            }
-
-
-
-            int n_hits_top = 0;
-            int n_hits_bot = 0;
-            boolean isTopTrack = false;
-            boolean isBotTrack = false;
-
-            // Make hits if the helix passed through the sensor 
-            for (SiSensor sensor : processSensors) {
-
-                if (debug) {
-                    System.out.println(this.getClass().getSimpleName() + ": add hits to sensor " + sensor.getName() + " at position " + sensor.getGeometry().getPosition().toString());
-                }
-
-                // When creating stereo hits, skip the even sensors
-                if (this._doHth && _ID.getLayer(sensor) % 2 == 0) {
-                    if (debug) {
-                        System.out.println(this.getClass().getSimpleName() + ": this was an even sensor -> skip for HTH production");
-                    }
-                    continue;
-                }
-
-                // Get the position where the sensor and track intercept (Maybe this should go 
-                // inside the method makeSimTrackerHit since it's the only method that uses it
-                Hep3Vector trackPosAtSensor = this.getHelixPlaneIntercept(sensor, wtrack);
-                this.printDebug("The track/plane intercept at " + trackPosAtSensor.toString());
-
-                // Check if the track lies within the sensor
-                boolean isHit = TrackUtils.sensorContainsTrack(trackPosAtSensor, sensor);
-
-                if (isHit) {
-                    if (debug) {
-                        System.out.println(this.getClass().getSimpleName() + ": make a tracker hit and add to this sensor");
-                    }
-                    if (SvtUtils.getInstance().isTopLayer(sensor)) {
-                        n_hits_top++;
-                        isTopTrack = true;
-                    } else {
-                        n_hits_bot++;
-                        isBotTrack = true;
-                    }
-                    if (this._doHth) {
-                        hths.add(this.makeHelicalTrackHit(sensor, wtrack));
-                    } else if (createSimTrackerHits) {
-                        // Create a SimTrackerHit at the intersect between a track and a sensor
-                        simHits.add(this.makeSimTrackerHit(metaData, sensor, trackPosAtSensor, mcParticle, wtrack));
-                    } else {
-                        stripHits1D.add(this.makeTrackerHit(sensor, wtrack));
-                    }
-                } else {
-                    if (debug) {
-                        System.out.println(this.getClass().getSimpleName() + ": this helix didn't pass within the sensor so no hit was added");
-                    }
-                }
-
-            }
-
-            if (isTopTrack) {
-                this._h_nstriphits_top.fill(n_hits_top);
-            }
-            if (isBotTrack) {
-                this._h_nstriphits_bottom.fill(n_hits_bot);
-            }
-            if (isTopTrack && isBotTrack) {
-                System.out.println(this.getClass().getSimpleName() + ": tris track is both top and bottom??? \n" + wtrack.toString() + "\nHTF:" + helix.toString());
-                System.exit(1);
-            }
-
-            /*
-             stripHits1D.addAll(stripHits1D_for_track);
-             hths.addAll(hths_for_track);
-             */
-        }
-
-
-
-        if (debug) {
-            if (stripHits1D != null) {
-                System.out.println(this.getClass().getSimpleName() + ": Produced " + stripHits1D.size() + " hits for collection " + this.stripHitOutputCollectionName);
-            }
-            if (hths != null) {
-                System.out.println(this.getClass().getSimpleName() + ": Produced " + hths.size() + " hits for collection " + this.hthOutputCollectionName);
-            }
-        }
-
-
-        //int flag = LCIOUtil.bitSet(0, 31, true); // Turn on 64-bit cell ID.
-        //event.put(this.rawTrackerHitOutputCollectionName, rawHits, RawTrackerHit.class, flag, toString());
-        // Put the collection of interest into the event
-
-        if (_doHth) {
-            event.put(hthOutputCollectionName, hths, HelicalTrackHit.class, 0);
-        } else if (createSimTrackerHits) {
-            event.put(simTrackerHitCollectionName, simHits, SimTrackerHit.class, 0);
-            this.printDebug("SimTrackerHits created: " + simHits.size());
-        } else {
-            event.put(stripHitOutputCollectionName, stripHits1D, SiTrackerHitStrip1D.class, 0, toString());
-        }
-        //event.put("RotatedHelicalTrackHits", rotatedhits, HelicalTrackHit.class, 0);
-
-        /*
-         if (debug) {
-         if(event.hasCollection(HelicalTrackHit.class, "RotatedHelicalTrackHits")) {
-         System.out.println(this.getClass().getSimpleName() + ": has hths:");
-         for(HelicalTrackHit hth : hths) {
-         System.out.println(this.getClass().getSimpleName() + ": " + hth.getPosition().toString());
-         }
-         } else {
-         System.out.println(this.getClass().getSimpleName() + ": has not hths!");
-         }
-         }
-         if (debug) {
-         for (int mod = 0; mod < 2; mod++) {
-         for (int layer = 0; layer < 10; layer++) {
-         counts[mod][layer] += SvtUtils.getInstance().getSensor(mod, layer).getReadout().getHits(SiTrackerHit.class).size();
-         }
-         }
-         }*/
-    }
-
-    private SiTrackerHitStrip1D makeTrackerHit(SiSensor sensor, WTrack wtrack) {
-        //private SiTrackerHitStrip1D makeTrackerHit(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        //create fake raw tracker hit
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": makeTrackerHit");
-        }
-
-        List<RawTrackerHit> rth_cluster = this.makeRawTrackerFakeHit(sensor);
-        if (rth_cluster.size() != 1) {
-            System.out.println(this.getClass().getSimpleName() + ": the fake raw tracker hit cluster is different than one!? " + rth_cluster.size());
-            System.exit(1);
-        }
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": created a fake raw tracker hit ");
-        }
-        RawTrackerHit raw_hit = rth_cluster.get(0);
-        IIdentifier id = raw_hit.getIdentifier();
-
-        //Get the electrode objects
-        SiTrackerIdentifierHelper _sid_helper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
-        ChargeCarrier carrier = ChargeCarrier.getCarrier(_sid_helper.getSideValue(id));
-        SiSensorElectrodes electrodes = ((SiSensor) raw_hit.getDetectorElement()).getReadoutElectrodes(carrier);
-
-
-
-
-        ITransform3D local_to_global;
-        if (coordinate_system == TrackerHitType.CoordinateSystem.GLOBAL) {
-            local_to_global = new Transform3D();
-        } else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
-            local_to_global = sensor.getGeometry().getLocalToGlobal();
-        } else {
-            throw new RuntimeException(this.getClass().getSimpleName() + " problem with coord system " + coordinate_system.toString());
-        }
-
-
-        ITransform3D electrodes_to_global = electrodes.getLocalToGlobal();
-        ITransform3D global_to_hit = local_to_global.inverse();
-        ITransform3D electrodes_to_hit = Transform3D.multiply(global_to_hit, electrodes_to_global);
-
-        Hep3Vector u = electrodes_to_hit.rotated(electrodes.getMeasuredCoordinate(0));
-        Hep3Vector v = electrodes_to_hit.rotated(electrodes.getUnmeasuredCoordinate(0));
-        Hep3Vector w = VecOp.cross(u, v);
-        Hep3Vector _orgloc = new BasicHep3Vector(0., 0., 0.);
-        electrodes_to_global.transformed(_orgloc);
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": electrodes  u " + u.toString());
-            System.out.println(this.getClass().getSimpleName() + ": electrodes  v " + v.toString());
-            System.out.println(this.getClass().getSimpleName() + ": electrodes  w " + w.toString() + "( " + w.magnitude() + ")");
-        }
-
-        electrodes_to_global.getTranslation().translate(_orgloc);
-        if (debug) {
-            System.out.print(this.getClass().getSimpleName() + ": orgloc " + _orgloc.toString() + "  -> ");
-        }
-        _orgloc = VecOp.mult(detToTrk, _orgloc);
-        if (debug) {
-            System.out.println(_orgloc.toString());
-        }
-
-
-
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": Try to find the interception point");
-        }
-
-        //B-field must go along Z direction
-        Hep3Vector h = new BasicHep3Vector(_bfield.x(), _bfield.y(), Math.abs(_bfield.z()));
-        h = VecOp.unit(h);
-        //Rotate into tracking frame
-        Hep3Vector eta = VecOp.mult(detToTrk, w);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": eta  " + eta.toString());
-        }
-
-        Hep3Vector position = wtrack.getHelixAndPlaneIntercept(_orgloc, eta, h);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": found interception point at position " + position.toString());
-        }
-
-
-        HelicalTrackFit htf = wtrack._htf;
-        List<Double> s = HelixUtils.PathToXPlane(htf, position.x(), 0, 0);
-        Hep3Vector posOnHelix = HelixUtils.PointOnHelix(htf, s.get(0));
-        Hep3Vector posdiff = VecOp.sub(position, posOnHelix);
-        System.out.println(this.getClass().getSimpleName() + ": diffpos " + posdiff.toString() + " L " + position.toString() + " posOnHelix " + posOnHelix.toString() + " R=" + htf.R());
-
-        position = VecOp.mult(VecOp.inverse(detToTrk), position);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": rotate the hit position to the global frame -> " + position.toString());
-        }
-
-
-
-        // Need to make sure that the position is at the edge of the strip in the global frame
-        // 1. Rotate to the local sensor frame
-        position = ((SiSensor) electrodes.getDetectorElement()).getGeometry().getGlobalToLocal().transformed(position);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": local (sensor) hit position " + position.toString());
-        }
-
-        // 2. Remove the coordinate of the unmeasured direction
-
-        position = new BasicHep3Vector(position.x(), 0, position.z());
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": fixed local (sensor) hit position " + position.toString());
-        }
-
-        // 3. Transform back to global coordinates
-
-        position = ((SiSensor) electrodes.getDetectorElement()).getGeometry().getLocalToGlobal().transformed(position);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": fixed global hit position " + position.toString());
-        }
-
-
-
-
-        //Fill dummy versions
-        SymmetricMatrix covariance = this.getCovariance(rth_cluster, electrodes);
-        double time = this.getTime(rth_cluster);
-        double energy = this.getEnergy(rth_cluster);
-
-
-        SiTrackerHitStrip1D hit = new SiTrackerHitStrip1D(position, covariance, energy, time, rth_cluster, trackerType);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": created SiStrip1D at " + position.toString());
-        }
-
-
-        return hit;
-
-
-    }
-
-    /**
-     *
-     * Find the unit vector of a sensor
-     *
-     * @param sensor
-     * @return unit vector of the plane
-     */
-    private Hep3Vector getPlaneUnitVector(SiSensor sensor) {
-        /*
-         * Weird way of getting the unit vector by creating a fake raw tracker hit...must be simpler way?
-         */
-        RawTrackerHit raw_hit = this.makeRawTrackerFakeHit(sensor).get(0);
-        IIdentifier id = raw_hit.getIdentifier();
-        //Get the electrode objects
-        SiTrackerIdentifierHelper _sid_helper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
-        ChargeCarrier carrier = ChargeCarrier.getCarrier(_sid_helper.getSideValue(id));
-        SiSensorElectrodes electrodes = ((SiSensor) raw_hit.getDetectorElement()).getReadoutElectrodes(carrier);
-        ITransform3D local_to_global;
-        if (coordinate_system == TrackerHitType.CoordinateSystem.GLOBAL) {
-            local_to_global = new Transform3D();
-        } else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
-            local_to_global = sensor.getGeometry().getLocalToGlobal();
-        } else {
-            throw new RuntimeException(this.getClass().getSimpleName() + " problem with coord system " + coordinate_system.toString());
-        }
-        ITransform3D electrodes_to_global = electrodes.getLocalToGlobal();
-        ITransform3D global_to_hit = local_to_global.inverse();
-        ITransform3D electrodes_to_hit = Transform3D.multiply(global_to_hit, electrodes_to_global);
-
-        Hep3Vector u = electrodes_to_hit.rotated(electrodes.getMeasuredCoordinate(0));
-        Hep3Vector v = electrodes_to_hit.rotated(electrodes.getUnmeasuredCoordinate(0));
-        Hep3Vector w = VecOp.cross(u, v);
-        Hep3Vector eta = VecOp.mult(detToTrk, w);
-        return eta;
-
-    }
-
-    /**
-     *
-     * Find the origin of the sensor plane
-     *
-     * @param sensor
-     * @return origin position of the plane
-     */
-    private Hep3Vector getOrgLoc(SiSensor sensor) {
-        /*
-         * Weird way of getting the org location by creating a fake raw tracker hit...must be simpler way?
-         */
-        List<RawTrackerHit> rth_cluster = this.makeRawTrackerFakeHit(sensor);
-        if (rth_cluster.size() != 1) {
-            System.out.println(this.getClass().getSimpleName() + ": the fake raw tracker hit cluster is different than one!? " + rth_cluster.size());
-            System.exit(1);
-        }
-        //Get the electrode objects
-        IIdentifier id = rth_cluster.get(0).getIdentifier();
-        SiTrackerIdentifierHelper _sid_helper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
-        ChargeCarrier carrier = ChargeCarrier.getCarrier(_sid_helper.getSideValue(id));
-        SiSensorElectrodes electrodes = ((SiSensor) rth_cluster.get(0).getDetectorElement()).getReadoutElectrodes(carrier);
-        ITransform3D local_to_global;
-        if (coordinate_system == TrackerHitType.CoordinateSystem.GLOBAL) {
-            local_to_global = new Transform3D();
-        } else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
-            local_to_global = sensor.getGeometry().getLocalToGlobal();
-        } else {
-            throw new RuntimeException(this.getClass().getSimpleName() + " problem with coord system " + coordinate_system.toString());
-        }
-        ITransform3D electrodes_to_global = electrodes.getLocalToGlobal();
-        Hep3Vector _orgloc = new BasicHep3Vector(0., 0., 0.);
-        electrodes_to_global.transformed(_orgloc);
-        electrodes_to_global.getTranslation().translate(_orgloc);
-        if (debug) {
-            System.out.print(this.getClass().getSimpleName() + ": orgloc " + _orgloc.toString() + "  -> ");
-        }
-        _orgloc = VecOp.mult(detToTrk, _orgloc);
-        if (debug) {
-            System.out.println(_orgloc.toString());
-        }
-
-        return _orgloc;
-
-    }
-
-    private Hep3Vector getHelixPlaneIntercept(SiSensor sensor, WTrack wtrack) {
-        Hep3Vector eta = this.getPlaneUnitVector(sensor);
-        Hep3Vector _orgloc = this.getOrgLoc(sensor);
-        Hep3Vector h = new BasicHep3Vector(_bfield.x(), _bfield.y(), Math.abs(_bfield.z()));
-        h = VecOp.unit(h);
-        Hep3Vector position = wtrack.getHelixAndPlaneIntercept(_orgloc, eta, h);
-        if (debug) {
-            HelicalTrackFit htf = wtrack._htf;
-            List<Double> s = HelixUtils.PathToXPlane(htf, position.x(), 0, 0);
-            Hep3Vector posOnHelix = HelixUtils.PointOnHelix(htf, s.get(0));
-            Hep3Vector posdiff = VecOp.sub(position, posOnHelix);
-            System.out.println(this.getClass().getSimpleName() + ": Path length to position " + position.toString() + ": s = " + s.get(0));
-            System.out.println(this.getClass().getSimpleName() + ": Difference between W and helixutils: diffpos " + posdiff.toString() + " ( " + position.toString() + " posOnHelix " + posOnHelix.toString() + " R=" + htf.R());
-        }
-
-
-        return position;
-    }
-
-    private HelicalTrackHit makeHelicalTrackHit(SiSensor sensor, WTrack wtrack) {
-        //private SiTrackerHitStrip1D makeTrackerHit(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        //create fake raw tracker hit
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": makeTrackerHit");
-        }
-
-        List<RawTrackerHit> rth_cluster = this.makeRawTrackerFakeHit(sensor);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": Try to find the interception point");
-        }
-
-        Hep3Vector position = this.getHelixPlaneIntercept(sensor, wtrack);
-
-
-        //Fill dummy covariance matrix with minimal uncertainties
-        //SymmetricMatrix covariance = this.getCovariance(rth_cluster, electrodes);
-        SymmetricMatrix covariance = new SymmetricMatrix(3);
-        double cov_xx = Math.pow(0.00001, 2); //1um error
-        double cov_yy = cov_xx;
-        double cov_zz = cov_xx;
-        covariance.setElement(0, 0, cov_xx);
-        covariance.setElement(1, 1, cov_yy);
-        covariance.setElement(2, 2, cov_zz);
-
-        double time = this.getTime(rth_cluster);
-        double energy = this.getEnergy(rth_cluster);
-
-
-        //IDetectorElement de = sensor;
-        String det = _ID.getName(sensor);
-        int layer = _ID.getLayer(sensor);
-        BarrelEndcapFlag beflag = _ID.getBarrelEndcapFlag(sensor);
-
-        if (layer % 2 == 0) {
-            if (debug) {
-                System.out.println(this.getClass().getSimpleName() + ": problem, trying to create a HTH for even layer? " + layer);
-            }
-            System.exit(1);
-        }
-
-        HelicalTrackHit hit = new HelicalTrackHit(position, covariance, 0.0, time, 3, rth_cluster, det, layer, beflag);
-        //SiTrackerHitStrip1D hit = new SiTrackerHitStrip1D(position, covariance, energy, time, rth_cluster, trackerType);
-
-        if (debug) {
-            System.out.println(this.getClass().getSimpleName() + ": created HelicalTrackHit at " + position.toString() + " and layer " + hit.Layer() + "(" + layer + ")");
-        }
-
-
-        return hit;
-
-
-    }
-
-    /**
-     * Create a SimTrackerHit and add it to the corresponding readout
-     *
-     * @param metaData : meta data associated with the SimTrackerHit collection
-     * @param sensor : sensor on which the hit will be created on
-     * @param trkPositionAtSensor : the position of a track at a sensor plane
-     * @param particle : MC particle associated with the track containing the
-     * hit
-     * @return SimTrackerHit
-     */
-    private SimTrackerHit makeSimTrackerHit(EventHeader.LCMetaData metaData, SiSensor sensor, Hep3Vector trkPositionAtSensor, MCParticle particle, WTrack wtrack) {
-
-        // Transform the position of the SimTrackerHit to the detector coordinates
-        // TODO: Fix the extrapolator so that it returns the position in the detector frame
-        //Hep3Vector trkPositionAtSensorDet = VecOp.mult(VecOp.inverse(detToTrk),trkPositionAtSensor);
-        //this.printDebug("The helix and sensor intercept at: " + trkPositionAtSensorDet.toString());
-
-        // Sensor to tracking frame transformation
-        ITransform3D localToGlobal = sensor.getGeometry().getLocalToGlobal();
-        // Tracking frame to sensor transformation
-        ITransform3D globalToSensor = sensor.getGeometry().getGlobalToLocal();
-
-        // Get the sensor position
-        Hep3Vector sensorPosition = sensor.getGeometry().getPosition();
-        this.printDebug("Sensor position: " + sensorPosition.toString());
-        // Transform the sensor position to the tracking frame
-        Hep3Vector transformedSensorPosition = globalToSensor.transformed(sensorPosition);
-        this.printDebug("Transformed sensor position: " + transformedSensorPosition.toString());
-
-        // Get the solid representing a sensor
-        Box sensorSolid = (Box) sensor.getGeometry().getLogicalVolume().getSolid();
-        // Get the solid faces
-        Polygon3D pSide = sensorSolid.getFacesNormalTo(new BasicHep3Vector(0, 0, 1)).get(0);
-        this.printDebug("p Side: " + pSide.toString());
-        Polygon3D nSide = sensorSolid.getFacesNormalTo(new BasicHep3Vector(0, 0, -1)).get(0);
-        this.printDebug("n Side: " + pSide.toString());
-
-        // Translate to the sensor face (p side) 
-        ITranslation3D translateToPSide = new Translation3D(VecOp.mult(-pSide.getDistance(), pSide.getNormal()));
-        this.printDebug("pSide Translation vector: " + translateToPSide.getTranslationVector().toString());
-
-        // Translate to the p side of the sensor
-        Hep3Vector pSidePosition = translateToPSide.translated(transformedSensorPosition);
-        this.printDebug("Translated sensor position at p side: " + pSidePosition.toString());
-        // Transform the sensor position to the tracking coordinates
-        localToGlobal.transform(pSidePosition);
-        this.printDebug("Translated sensor position at p side in tracking coordinates: " + pSidePosition.toString());
-        // Check if the point lies inside of the sensor
-        if (sensor.getGeometry().inside(pSidePosition) == Inside.OUTSIDE) {
-            throw new RuntimeException("Position of p side face does not lie within the sensor volume!");
-        } else {
-            this.printDebug("p side position lies within the sensor volume");
-        }
-
-        // Find the interception between the p side face and the track
-        Hep3Vector h = new BasicHep3Vector(_bfield.x(), _bfield.y(), Math.abs(_bfield.z()));
-        h = VecOp.unit(h);
-        // Transform the sensor position to the lcsim coordinates
-        pSidePosition = VecOp.mult(detToTrk, pSidePosition);
-        this.printDebug("p side position in lcsim coordinates: " + pSidePosition.toString());
-        //Hep3Vector pSideInter = wutils.getHelixAndPlaneIntercept(wtrack, pSidePosition, VecOp.unit(pSidePosition), h);
-        Hep3Vector eta = this.getPlaneUnitVector(sensor);
-        Hep3Vector pSideInter = wtrack.getHelixAndPlaneIntercept(pSidePosition, eta, h);
-        this.printDebug("Intersection between track and p side: " + pSideInter.toString());
-        // Transform back to the JLab coordinates 
-        pSideInter = VecOp.mult(VecOp.inverse(detToTrk), pSideInter);
-        this.printDebug("Intersection trasnformed to the JLab coordinates: " + pSideInter.toString());
-        if (sensor.getGeometry().inside(pSideInter) == Inside.OUTSIDE) {
-            throw new RuntimeException("Position of p side/track intercept does not lie within the sensor volume!");
-        } else {
-            this.printDebug("p side/track intercept lies within the sensor volume");
-        }
-
-        // Translate to the sensor n side
-        ITranslation3D translateToNSide = new Translation3D(VecOp.mult(-nSide.getDistance(), nSide.getNormal()));
-        this.printDebug("n side Translation vector: " + translateToNSide.getTranslationVector().toString());
-
-        // Translate to the n side of the sensor
-        Hep3Vector nSidePosition = translateToNSide.translated(transformedSensorPosition);
-        this.printDebug("Translated sensor position at n side: " + nSidePosition.toString());
-        // Transform the sensor position to the tracking coordinates
-        localToGlobal.transform(nSidePosition);
-        this.printDebug("Translated sensor position at n side in tracking coordinates: " + nSidePosition.toString());
-        // Check if the point lies inside of the sensor
-        if (sensor.getGeometry().inside(nSidePosition) == Inside.OUTSIDE) {
-            throw new RuntimeException("Position of n side face does not lie within the sensor volume!");
-        } else {
-            this.printDebug("n side position lies within the sensor volume");
-        }
-
-        // Find the interception between the p side face and the track
-        // Transform the sensor position to the lcsim coordinates
-        nSidePosition = VecOp.mult(detToTrk, nSidePosition);
-        this.printDebug("n side position in lcsim coordinates: " + nSidePosition.toString());
-        //Hep3Vector pSideInter = wutils.getHelixAndPlaneIntercept(wtrack, pSidePosition, VecOp.unit(pSidePosition), h);
-        Hep3Vector nSideInter = wtrack.getHelixAndPlaneIntercept(nSidePosition, eta, h);
-        this.printDebug("Intersection between track and n side: " + nSideInter.toString());
-        // Transform back to the JLab coordinates 
-        nSideInter = VecOp.mult(VecOp.inverse(detToTrk), nSideInter);
-        this.printDebug("Intersection trasnfored to the JLab coordinates: " + nSideInter.toString());
-        if (sensor.getGeometry().inside(nSideInter) == Inside.OUTSIDE) {
-            throw new RuntimeException("Position of n side/track intercept does not lie within the sensor volume!");
-        } else {
-            this.printDebug("n side/track intercept lies within the sensor volume");
-        }
-
-        // Find the midpoint between a straight line connecting the p side and n side intercepts 
-        Hep3Vector trkPositionAtSensorDet = VecOp.add(nSideInter, pSideInter);
-        trkPositionAtSensorDet = VecOp.mult(.5, trkPositionAtSensorDet);
-        this.printDebug("Hit will be placed at position: " + trkPositionAtSensorDet.toString());
-        if (sensor.getGeometry().inside(trkPositionAtSensorDet) == Inside.OUTSIDE) {
-            throw new RuntimeException("Midpoint does not lie within the sensor volume!");
-        } else {
-            this.printDebug("midpoint lies within the sensor volume");
-        }
-
-        // Find the length of the line. For now, this is the path length
-        // Note: The small delta parameter is to avoid ending up outside of the sensor
-        double pathLength = VecOp.sub(nSideInter, pSideInter).magnitude() - .01;
-        this.printDebug("The path length is: " + pathLength);
-
-        /* DEBUG
-         Hep3Vector midpoint = new BasicHep3Vector(trkPositionAtSensorDet.v());
-         Hep3Vector direction = VecOp.unit(new BasicHep3Vector(particle.getMomentum().v()));
-         Hep3Vector half_length = VecOp.mult(pathLength/2.0,direction);
-        
-         Hep3Vector endPoint = VecOp.add(midpoint,half_length);
-         this.printDebug("The end point is at position: " + endPoint.toString());
-        
-         Hep3Vector startPoint = VecOp.add(midpoint,VecOp.mult(-1.0,half_length));
-         this.printDebug("The start point is at position: " + startPoint.toString());
-        
-         if(sensor.getGeometry().inside(endPoint) == Inside.OUTSIDE){
-         throw new RuntimeException("Position of end point does not lie within the sensor volume!");
-         } else { 
-         this.printDebug("end point lies within the sensor volume");
-         }
-        
-         if(sensor.getGeometry().inside(startPoint) == Inside.OUTSIDE){
-         throw new RuntimeException("Position start point does not lie within the sensor volume!");
-         } else { 
-         this.printDebug("Start point lies within the sensor volume");
-         } */
-
-        double dEdx = 24000/* MIP */ * DopedSilicon.ENERGY_EHPAIR;
-        double[] momentum = particle.getMomentum().v();
-        this.printDebug("Particle Momentum: " + particle.getMomentum().toString());
-        double time = 0;
-        int cellID = (int) TrackerHitUtils.makeSimTrackerHitId(sensor).getValue();
-
-        SimTrackerHit simHit = new BaseSimTrackerHit(trkPositionAtSensorDet.v(), dEdx, momentum, pathLength, time, cellID, particle, metaData, sensor);
-        // Add it to the sensor readout
-        // sensor.getReadout().addHit(simHit);
-        return simHit;
-    }
-
-    //private SymmetricMatrix getCovariance() {     
-    private SymmetricMatrix getCovariance(List<RawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        SymmetricMatrix covariance = new SymmetricMatrix(3);
-        covariance.setElement(0, 0, Math.pow(getMeasuredResolution(cluster, electrodes), 2));
-        covariance.setElement(1, 1, Math.pow(getUnmeasuredResolution(cluster, electrodes), 2));
-        covariance.setElement(2, 2, 0.0);
-
-        SymmetricMatrix covariance_global = electrodes.getLocalToGlobal().transformed(covariance);
-
-//        System.out.println("Global covariance matrix: \n"+covariance_global);
-
-        return covariance_global;
-
-    }
-
-    private double getMeasuredResolution(List<RawTrackerHit> cluster, SiSensorElectrodes electrodes) // should replace this by a ResolutionModel class that gives expected resolution.  This could be a big job.
-    {
-        double measured_resolution;
-
-        double sense_pitch = ((SiSensor) electrodes.getDetectorElement()).getSenseElectrodes(electrodes.getChargeCarrier()).getPitch(0);
-
-//        double readout_pitch = electrodes.getPitch(0);
-//        double noise = _readout_chip.getChannel(strip_number).computeNoise(electrodes.getCapacitance(strip_number));
-//        double signal_expected = (0.000280/DopedSilicon.ENERGY_EHPAIR) *
-//                ((SiSensor)electrodes.getDetectorElement()).getThickness(); // ~280 KeV/mm for thick Si sensors
-        double _oneClusterErr = 1 / Math.sqrt(12);
-        double _twoClusterErr = 1 / 5;
-        double _threeClusterErr = 1 / 3;
-        double _fourClusterErr = 1 / 2;
-        double _fiveClusterErr = 1;
-
-        if (cluster.size() == 1) {
-            measured_resolution = sense_pitch * _oneClusterErr;
-        } else if (cluster.size() == 2) {
-            measured_resolution = sense_pitch * _twoClusterErr;
-        } else if (cluster.size() == 3) {
-            measured_resolution = sense_pitch * _threeClusterErr;
-        } else if (cluster.size() == 4) {
-            measured_resolution = sense_pitch * _fourClusterErr;
-        } else {
-            measured_resolution = sense_pitch * _fiveClusterErr;
-        }
-
-        return measured_resolution;
-    }
-
-    private double getUnmeasuredResolution(List<RawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        // Get length of longest strip in hit
-        double hit_length = 0;
-        for (RawTrackerHit hit : cluster) {
-            hit_length = Math.max(hit_length, ((SiStrips) electrodes).getStripLength(1));
-        }
-        return hit_length / Math.sqrt(12);
-    }
-
-    private double getTime(List<RawTrackerHit> cluster) {
-        return 0;
-    }
-
-    private double getEnergy(List<RawTrackerHit> cluster) {
-        double total_charge = 20000;
-//        
-//         double total_charge = 0.0;
-//        for (RawTrackerHit hit : cluster) {
-//            double signal = hit.getAmp();
-//            total_charge += signal;
-//        }
-        return total_charge * DopedSilicon.ENERGY_EHPAIR;
-    }
-
-    /**
-     * Creates a raw tracker hit at a dummy channel
-     *
-     * @param sensor that will get the hit
-     * @return list of a single raw tracker hit
-     */
-    public List<RawTrackerHit> makeRawTrackerFakeHit(SiSensor sensor) {
-    
-        //if(debug) System.out.println(this.getClass().getSimpleName() + ": makeRawTrackerFakeHit for sensor " + sensor.getName());
-        List<RawTrackerHit> raw_hits = new ArrayList<RawTrackerHit>();
-
-        // Get SimTrackerHits
-        //IReadout ro = sensor.getReadout();
-
-
-        // Loop over electrodes and digitize with readout chip
-        for (ChargeCarrier carrier : ChargeCarrier.values()) {
-            if (sensor.hasElectrodesOnSide(carrier)) {
-
-                //if(debug) System.out.println(this.getClass().getSimpleName() + ": creating a dummy hit for sensor " + sensor.getName());
-                //SortedMap<Integer,List<Integer>> digitized_hits = _readout_chip.readout(electrode_data.get(carrier),sensor.getReadoutElectrodes(carrier));
-                //if(debug) System.out.println(this.getClass().getSimpleName() + ": creating a dummy hit for sensor " + sensor.getName());
-
-                int channel = 1;
-                int time = 0;
-                long cell_id = sensor.makeStripId(channel, carrier.charge()).getValue();
-                //List<Integer> readout_data = new ArrayList<Integer>();
-                short[] adc_values = new short[6];
-                for (Integer i = 0; i < 6; ++i) {
-                    Integer adc = 50;
-                    adc_values[i] = adc.shortValue(); //ADC counts
-                }
-                IDetectorElement detector_element = sensor;
-                RawTrackerHit raw_hit = new BaseRawTrackerHit(time, cell_id, adc_values, new ArrayList<SimTrackerHit>(), detector_element);
-                //ro.addHit(raw_hit);
-                raw_hits.add(raw_hit);
-
-
-            }
-
-        }
-
-        return raw_hits;
-    }
-
-    private void makePlots() {
-
-        for (SiSensor sensor : processSensors) {
-            if (debug) {
-                System.out.println(this.getClass().getSimpleName() + ": Making plots for " + sensor.getName());
-            }
-            IProfile1D h = aida.profile1D("deltas " + sensor.getName(), 7, 0, 7);
-            this._delta_histos.put(sensor, h);
-            IHistogram1D h1 = aida.histogram1D("Number of iterations " + sensor.getName(), 7, 0, 7);
-            this._delta_itercount.put(sensor, h1);
-        }
-
-        _prf_all_deltas = aida.profile1D("alldeltas", 10, 0, 10);//,50,-20,20);
-        _prf_final_deltas = aida.profile1D("finaldeltas", 10, 0, 10);//,50,-20,20);
-
-        _h_nstriphits_top = aida.histogram1D("NstripClusters top", 11, -0.5, 10.5);
-        _h_nstriphits_bottom = aida.histogram1D("NstripClusters bottom", 11, -0.5, 10.5);
-
-        //_h_trkposodd_top = aida.histogram1D("_h_trkposodd_top", 50, -0.5, 10.5);
-
-        plotter_iter_final = af.createPlotterFactory().create();
-        plotter_iter_final.createRegions(1, 1);
-        plotter_iter_final.region(0).plot(_prf_final_deltas);
-        plotter_iter_final.region(0).style().xAxisStyle().setLabel("Final iteration");
-        plotter_iter_final.region(0).style().yAxisStyle().setLabel("<Distance to xp>");
-
-        plotter_iter_all = af.createPlotterFactory().create();
-        plotter_iter_all.createRegions(1, 1);
-        plotter_iter_all.region(0).plot(_prf_all_deltas);
-        plotter_iter_all.region(0).style().xAxisStyle().setLabel("Iteration");
-        plotter_iter_all.region(0).style().yAxisStyle().setLabel("<Distance to xp>");
-
-
-        plotter_iter = af.createPlotterFactory().create();
-        plotter_iter.createRegions(6, 4);
-        plotter_iter.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
-        plotter_iter.style().statisticsBoxStyle().setVisible(false);
-        plotter_itercount = af.createPlotterFactory().create();
-        plotter_itercount.createRegions(6, 4);
-
-        plotter_nstripclusters = af.createPlotterFactory().create();
-        plotter_nstripclusters.createRegions(2, 2);
-        plotter_nstripclusters.region(0).plot(_h_nstriphits_top);
-        plotter_nstripclusters.region(1).plot(_h_nstriphits_bottom);
-
-        plotter_trackposodd = af.createPlotterFactory().create();
-        plotter_trackposodd.createRegions(2, 2);
-        //plotter_trackposodd.region(0).plot(_h_trkposodd_top);
-
-        int i = 0;
-        for (SiSensor sensor : this.processSensors) {
-            if (debug) {
-                System.out.println(this.getClass().getSimpleName() + ": " + i + ": adding plot to plotter for " + sensor.getName());
-            }
-            plotter_iter.region(i).plot(this._delta_histos.get(sensor));
-            plotter_iter.style().setParameter("hist2DStyle", "colorMap");
-            plotter_iter.region(i).style().xAxisStyle().setLabel("Iteration");
-            plotter_iter.region(i).style().yAxisStyle().setLabel("<Distance to xp>");
-
-            plotter_itercount.region(i).plot(this._delta_itercount.get(sensor));
-            plotter_itercount.region(i).style().xAxisStyle().setLabel("# iterations");
-            ++i;
[truncated at 1000 lines; 33 more skipped]

java/trunk/tracking/src/main/java/org/hps/recon/tracking
DataTrackerHitDriver.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/DataTrackerHitDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/DataTrackerHitDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -17,19 +17,21 @@
 import org.lcsim.util.Driver;
 
 /**
- *
- * @author mgraham
+ * 
+ * @author Matt Graham
  */
+// TODO: Add documentation about what this Driver does. --JM
 public class DataTrackerHitDriver extends Driver {
+
     // Debug switch for development.
 
     private boolean debug = false;
     // Collection name.
-//    private String readoutCollectionName = "TrackerHits";
+    // private String readoutCollectionName = "TrackerHits";
     // Subdetector name.
     private String subdetectorName = "Tracker";
     // Name of RawTrackerHit output collection.
-//    private String rawTrackerHitOutputCollectionName = "RawTrackerHitMaker_RawTrackerHits";
+    // private String rawTrackerHitOutputCollectionName = "RawTrackerHitMaker_RawTrackerHits";
     // Name of StripHit1D output collection.
     private String stripHitOutputCollectionName = "StripClusterer_SiTrackerHitStrip1D";
     // Clustering parameters.
@@ -50,19 +52,19 @@
     private List<IDetectorElement> processDEs = new ArrayList<IDetectorElement>();
     private Set<SiSensor> processSensors = new HashSet<SiSensor>();
     // Digi class objects.
-//    private SiDigitizer stripDigitizer;
-//    private HPSFittedRawTrackerHitMaker hitMaker;
-    private HPSStripMaker stripClusterer;
-    //  private    DumbShaperFit shaperFit;
+    // private SiDigitizer stripDigitizer;
+    // private HPSFittedRawTrackerHitMaker hitMaker;
+    private StripMaker stripClusterer;
+    // private DumbShaperFit shaperFit;
     int[][] counts = new int[2][10];
 
     public void setDebug(boolean debug) {
         this.debug = debug;
     }
 
-//    public void setReadoutCollectionName(String readoutCollectionName) {
-//        this.readoutCollectionName = readoutCollectionName;
-//    }
+    // public void setReadoutCollectionName(String readoutCollectionName) {
+    // this.readoutCollectionName = readoutCollectionName;
+    // }
     public void setSubdetectorName(String subdetectorName) {
         this.subdetectorName = subdetectorName;
     }
@@ -140,23 +142,22 @@
 
         for (IDetectorElement detectorElement : processDEs) {
             processSensors.addAll(detectorElement.findDescendants(SiSensor.class));
-            //if (debug)
-            //    System.out.println("added " + processSensors.size() + " sensors");
+            // if (debug)
+            // System.out.println("added " + processSensors.size() + " sensors");
         }
 
         // Create the sensor simulation.
         CDFSiSensorSim stripSim = new CDFSiSensorSim();
 
-
         // Create Strip clustering algorithm.
-        HPSNearestNeighborRMS stripClusteringAlgo = new HPSNearestNeighborRMS();
+        NearestNeighborRMSClusterer stripClusteringAlgo = new NearestNeighborRMSClusterer();
         stripClusteringAlgo.setSeedThreshold(clusterSeedThreshold);
         stripClusteringAlgo.setNeighborThreshold(clusterNeighborThreshold);
         stripClusteringAlgo.setClusterThreshold(clusterThreshold);
 
-//         hitMaker=new HPSFittedRawTrackerHitMaker(shaperFit);    
+        // hitMaker=new HPSFittedRawTrackerHitMaker(shaperFit);
         // Create the clusterers and set hit-making parameters.
-        stripClusterer = new HPSStripMaker(stripSim, stripClusteringAlgo);
+        stripClusterer = new StripMaker(stripSim, stripClusteringAlgo);
 
         stripClusterer.setMaxClusterSize(clusterMaxSize);
         stripClusterer.setCentralStripAveragingThreshold(clusterCentralStripAveragingThreshold);
@@ -178,16 +179,16 @@
     @Override
     public void process(EventHeader event) {
         // Call sub-Driver processing.
-//        super.process(event);
+        // super.process(event);
 
         // Make new lists for output.
-//        List<HPSFittedRawTrackerHit> rawHits = new ArrayList<HPSFittedRawTrackerHit>();
+        // List<HPSFittedRawTrackerHit> rawHits = new ArrayList<HPSFittedRawTrackerHit>();
         List<SiTrackerHit> stripHits1D = new ArrayList<SiTrackerHit>();
 
-//        // Make HPS hits.
-//        for (SiSensor sensor : processSensors) {            
-//            rawHits.addAll(hitMaker.makeHits(sensor));
-//        }
+        // // Make HPS hits.
+        // for (SiSensor sensor : processSensors) {
+        // rawHits.addAll(hitMaker.makeHits(sensor));
+        // }
 
         // Make strip hits.
         for (SiSensor sensor : processSensors) {
@@ -196,15 +197,19 @@
 
         // Debug prints.
         if (debug) {
-//            List<SimTrackerHit> simHits = event.get(SimTrackerHit.class, this.readoutCollectionName);
-//            System.out.println("SimTrackerHit collection " + this.readoutCollectionName + " has " + simHits.size() + " hits.");
-//            System.out.println("RawTrackerHit collection " + this.rawTrackerHitOutputCollectionName + " has " + rawHits.size() + " hits.");
+            // List<SimTrackerHit> simHits = event.get(SimTrackerHit.class,
+            // this.readoutCollectionName);
+            // System.out.println("SimTrackerHit collection " + this.readoutCollectionName +
+            // " has " + simHits.size() + " hits.");
+            // System.out.println("RawTrackerHit collection " +
+            // this.rawTrackerHitOutputCollectionName + " has " + rawHits.size() + " hits.");
             System.out.println("TrackerHit collection " + this.stripHitOutputCollectionName + " has " + stripHits1D.size() + " hits.");
         }
 
         // Put output hits into collection.
         int flag = LCIOUtil.bitSet(0, 31, true); // Turn on 64-bit cell ID.
-//        event.put(this.rawTrackerHitOutputCollectionName, rawHits, RawTrackerHit.class, flag, toString());
+        // event.put(this.rawTrackerHitOutputCollectionName, rawHits, RawTrackerHit.class, flag,
+        // toString());
         event.put(this.stripHitOutputCollectionName, stripHits1D, SiTrackerHitStrip1D.class, 0, toString());
         if (debug) {
             for (int mod = 0; mod < 2; mod++) {

java/trunk/tracking/src/main/java/org/hps/recon/tracking
DumbShaperFit.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/DumbShaperFit.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/DumbShaperFit.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -4,59 +4,62 @@
 import org.lcsim.event.RawTrackerHit;
 
 /**
- *
- * @author mgraham
+ * 
+ * @author Matt Graham
  */
-public class DumbShaperFit implements HPSShaperFitAlgorithm {
+// FIXME: Is there some other description besides "dumb" that could be used in this class name?
+// --JM
+// TODO: Add class documentation.
+public class DumbShaperFit implements ShaperFitAlgorithm {
 
     public DumbShaperFit() {
-    }    
-    
+    }
+
     @Override
-    public HPSShapeFitParameters fitShape(RawTrackerHit rth, ChannelConstants constants) {
-    	short[] adcVals = rth.getADCValues();
-    	return this.fitShape(adcVals, constants);    	    	
+    public ShapeFitParameters fitShape(RawTrackerHit rth, ChannelConstants constants) {
+        short[] adcVals = rth.getADCValues();
+        return this.fitShape(adcVals, constants);
     }
-    
-    public HPSShapeFitParameters fitShape(short[] adcVals, ChannelConstants constants){
-    	HPSShapeFitParameters fitresults = new HPSShapeFitParameters();
-        double[] pedSub={-99.0,-99.0,-99.0,-99.0,-99.0,-99.0};
-        double maxADC=-99999;
-        int iMax=-1;
-        double t0=-999;
-        for(int i=0;i<6;i++){
-            pedSub[i]=adcVals[i]-constants.getPedestal();
-            if(pedSub[i]>maxADC){
-               maxADC=pedSub[i];
-               iMax=i;
-            }   
+
+    public ShapeFitParameters fitShape(short[] adcVals, ChannelConstants constants) {
+        ShapeFitParameters fitresults = new ShapeFitParameters();
+        double[] pedSub = { -99.0, -99.0, -99.0, -99.0, -99.0, -99.0 };
+        double maxADC = -99999;
+        int iMax = -1;
+        double t0 = -999;
+        for (int i = 0; i < 6; i++) {
+            pedSub[i] = adcVals[i] - constants.getPedestal();
+            if (pedSub[i] > maxADC) {
+                maxADC = pedSub[i];
+                iMax = i;
+            }
         }
-        if(iMax>0&&iMax<5){           
-            t0 = (pedSub[iMax-1]*24.0*(iMax-1)+pedSub[iMax]*24.0*(iMax)+pedSub[iMax+1]*24.0*(iMax+1))/(pedSub[iMax-1]+pedSub[iMax]+pedSub[iMax+1]);
-        }else if(iMax==0){
-               t0 =(pedSub[iMax]*24.0*(iMax)+pedSub[iMax+1]*24.0*(iMax+1))/(pedSub[iMax]+pedSub[iMax+1]) ;
-        }else if(iMax==5){
-               t0 =(pedSub[iMax]*24.0*(iMax)+pedSub[iMax-1]*24.0*(iMax-1))/(pedSub[iMax-1]+pedSub[iMax]) ;
+        if (iMax > 0 && iMax < 5) {
+            t0 = (pedSub[iMax - 1] * 24.0 * (iMax - 1) + pedSub[iMax] * 24.0 * (iMax) + pedSub[iMax + 1] * 24.0 * (iMax + 1)) / (pedSub[iMax - 1] + pedSub[iMax] + pedSub[iMax + 1]);
+        } else if (iMax == 0) {
+            t0 = (pedSub[iMax] * 24.0 * (iMax) + pedSub[iMax + 1] * 24.0 * (iMax + 1)) / (pedSub[iMax] + pedSub[iMax + 1]);
+        } else if (iMax == 5) {
+            t0 = (pedSub[iMax] * 24.0 * (iMax) + pedSub[iMax - 1] * 24.0 * (iMax - 1)) / (pedSub[iMax - 1] + pedSub[iMax]);
         }
-        
-           //mg...put in a cut here to make sure pulse shape is reasonable
-        //if not, set t0 to -99 (which will fail the later t0>0 cut
-        if(iMax==0||iMax==5)
-            t0=-99;
-        //make sure it goes up below iMax
-        for(int i=0;i<iMax;i++){
-            if(pedSub[i+1]<pedSub[i])
-                t0=-99;
+
+        // mg...put in a cut here to make sure pulse shape is reasonable
+        // if not, set t0 to -99 (which will fail the later t0>0 cut
+        if (iMax == 0 || iMax == 5)
+            t0 = -99;
+        // make sure it goes up below iMax
+        for (int i = 0; i < iMax; i++) {
+            if (pedSub[i + 1] < pedSub[i])
+                t0 = -99;
         }
-        //...and down below iMax
-        for(int i=iMax;i<5;i++){
-            if(pedSub[i+1]>pedSub[i])
-                t0=-99;
-        }                       
-        
+        // ...and down below iMax
+        for (int i = iMax; i < 5; i++) {
+            if (pedSub[i + 1] > pedSub[i])
+                t0 = -99;
+        }
+
         fitresults.setAmp(maxADC);
         fitresults.setT0(t0);
-        
+
         return fitresults;
     }
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
EcalTrackMatch.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/EcalTrackMatch.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/EcalTrackMatch.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,142 +0,0 @@
-package org.hps.recon.tracking;
-
-import hep.physics.vec.Hep3Vector;
-
-import java.util.List;
-
-import org.lcsim.event.Cluster;
-import org.lcsim.event.Track;
-
-/**
- *
- * @author phansson
- */
-public class EcalTrackMatch {
-
-//    public static final double crystalSizeX = (13.3 + 16.0) / 2;
-//    public static final double crystalSizeY = (13.3 + 16.0) / 2;
-//    private double RADIUS = crystalSizeX; 
-//    private String trackCollectionName = "MatchedTracks";
-    Cluster cluster;
-    Track matchedTrack;
-    private boolean debug = false;
-
-    public EcalTrackMatch() {
-        cluster = null;
-        matchedTrack = null;
-    }
-
-    public EcalTrackMatch(boolean deb) {
-        cluster = null;
-        matchedTrack = null;
-        debug = deb;
-
-    }
-
-    public void setDebug(boolean debug) {
-        this.debug = debug;
-    }
-
-    public Track getMatchedTrack() {
-        return matchedTrack;
-    }
-
-    public void setCluster(Cluster cl) {
-        this.cluster = cl;
-    }
-
-    public double dX(Track track) {
-        return dist(track, 0);
-    }
-
-    public double dY(Track track) {
-        return dist(track, 1);
-    }
-
-    public double dist(Track track, int dir) {
-        Hep3Vector trk_pos = TrackUtils.getTrackPositionAtEcal(track);
-        double dx;
-        if (dir == 0) {
-            dx = cluster.getPosition()[0] - trk_pos.x();
-        } else {
-            dx = cluster.getPosition()[1] - trk_pos.y();
-        }
-        if (debug) {
-            System.out.println("dist = " + dx + " from cluster to track in " + (dir == 0 ? "X" : "Y") + " to track at " + trk_pos.x() + "," + trk_pos.y() + "," + trk_pos.z());
-        }
-        return dx;
-    }
-
-    public double dR(Track track) {
-        Hep3Vector trk_pos = TrackUtils.getTrackPositionAtEcal(track);
-        double dx = dX(track);
-        double dy = dY(track);
-        double dr = Math.sqrt(dx * dx + dy * dy);
-        if (debug) {
-            System.out.println("dR = " + dr + " to track at " + trk_pos.toString());
-        }
-        return dr;
-    }
-
-    public void match(List<Track> tracks) {
-        matchedTrack = null;
-        if (debug) {
-            System.out.println("Matching cluster at " + cluster.getPosition()[0] + "," + cluster.getPosition()[1] + "," + cluster.getPosition()[2] + " with " + tracks.size() + " tracks.");
-        }
-        //get the position of the cluster anc compare to tracks at the ecal face
-        double dr;
-//        SeedTrack trk;
-//        Hep3Vector trk_pos;
-        double drmin = 999999.9;
-        for (Track track : tracks) {
-            dr = dR(track);
-            if (dr < drmin) {
-                drmin = dr;
-                matchedTrack = track;
-            }
-        }
-        if (debug) {
-            if (matchedTrack == null) {
-                System.out.println("No matched track was found");
-            } else {
-                System.out.println("Matched a track with dr " + dR(matchedTrack));
-            }
-        }
-    }
-
-    public boolean match(List<Track> tracks, double drmax) {
-        match(tracks);
-        return isMatched(drmax);
-    }
-
-    public boolean isMatched(double rad_max) {
-        if (matchedTrack == null) {
-            return false;
-        }
-        double dr = dR(matchedTrack);
-        return (dr < rad_max ? true : false);
-    }
-
-    public boolean isMatchedY(double max) {
-        if (matchedTrack == null) {
-            return false;
-        }
-        double dy = dY(matchedTrack);
-        return (Math.abs(dy) < max);
-    }
-
-    public double getDistanceToTrack() {
-        return matchedTrack == null ? -1 : dR(matchedTrack);
-
-    }
-
-    public double getDistanceToTrackInX() {
-        return matchedTrack == null ? -1 : dX(matchedTrack);
-
-    }
-
-    public double getDistanceToTrackInY() {
-        return matchedTrack == null ? -1 : dY(matchedTrack);
-
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
EventQuality.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/EventQuality.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/EventQuality.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 package org.hps.recon.tracking;
 
 import java.util.ArrayList;
@@ -13,102 +9,115 @@
  * Singleton class to hold default cut values
  * 
  * @author Per Hansson Adrian <[log in to unmask]>
- * @version $id: $ 
  */
+// FIXME: Does this belong in Matt's new analysis.dataquality package instead?
+// It is used by TrackUtils so it is left here for now.
 public class EventQuality {
-    
-    
-    
+
     private static EventQuality _instance = null;
-    public static enum Quality{LOOSE,MEDIUM,TIGHT}
-    public static enum Cut{
-        UNDEFINED(0),PZ(1),CHI2(2),SHAREDHIT(3),NHITS(4),TOPBOTHIT(5);
+
+    public static enum Quality {
+        LOOSE, MEDIUM, TIGHT
+    }
+
+    public static enum Cut {
+        UNDEFINED(0), PZ(1), CHI2(2), SHAREDHIT(3), NHITS(4), TOPBOTHIT(5);
+
         private int value;
+
         private Cut(int value) {
             this.value = value;
         }
+
         public int getValue() {
             return this.value;
         }
     }
+
     private List<CutObject> _cut_list = new ArrayList<CutObject>();
-    
+
     public EventQuality() {
-        addCut(new CutObject(Cut.CHI2,"CHI2",100000.,10.,10.));
-        addCut(new CutObject(Cut.PZ,"PZ",0.000005,0.4,0.4));
-        addCut(new CutObject(Cut.SHAREDHIT,"SHAREDHIT",0,0,0));
-        addCut(new CutObject(Cut.NHITS,"NHITS",4,4,5));
-        addCut(new CutObject(Cut.TOPBOTHIT,"TOPBOTHIT",0,0,0));
+        addCut(new CutObject(Cut.CHI2, "CHI2", 100000., 10., 10.));
+        addCut(new CutObject(Cut.PZ, "PZ", 0.000005, 0.4, 0.4));
+        addCut(new CutObject(Cut.SHAREDHIT, "SHAREDHIT", 0, 0, 0));
+        addCut(new CutObject(Cut.NHITS, "NHITS", 4, 4, 5));
+        addCut(new CutObject(Cut.TOPBOTHIT, "TOPBOTHIT", 0, 0, 0));
     }
-    
+
     public static EventQuality instance() {
-        if(_instance==null) {
+        if (_instance == null) {
             _instance = new EventQuality();
         }
         return _instance;
     }
-        
+
     private void addCut(CutObject c) {
         _cut_list.add(c);
     }
-    
+
     private CutObject find(Cut cut) {
-        for(CutObject co : _cut_list) {
-            if (co._cut==cut) {
+        for (CutObject co : _cut_list) {
+            if (co._cut == cut) {
                 return co;
             }
         }
         return null;
     }
-    
-    public double getCutValue(Cut cut,Quality quality) {
+
+    public double getCutValue(Cut cut, Quality quality) {
         CutObject co = find(cut);
-        if(co==null) {
-            System.out.printf("Cut \"%d\" didn't exist!?\n",cut);
+        if (co == null) {
+            System.out.printf("Cut \"%d\" didn't exist!?\n", cut);
             System.exit(0);
         }
         return co.get(quality);
     }
-    
+
     @Override
     public String toString() {
-        String s = String.format("EventQuality has %d cuts defined:\n",this._cut_list.size());
-        for (CutObject c: _cut_list) {
-            s += String.format("%s\n",c.toString());
+        String s = String.format("EventQuality has %d cuts defined:\n", this._cut_list.size());
+        for (CutObject c : _cut_list) {
+            s += String.format("%s\n", c.toString());
         }
         return s;
     }
-    
+
     public String print(int cuts) {
-        String s = String.format("cuts=%d:\n",cuts);
+        String s = String.format("cuts=%d:\n", cuts);
         for (CutObject cut : _cut_list) {
-            int tmp = cuts & (1<<cut._cut.getValue());
-            s += String.format("Cut %s %s\n",cut._name,tmp==0?"PASSED":"FAILED");
+            int tmp = cuts & (1 << cut._cut.getValue());
+            s += String.format("Cut %s %s\n", cut._name, tmp == 0 ? "PASSED" : "FAILED");
         }
         return s;
     }
-    
+
     private class CutObject {
+
         String _name = "UNDEFINED";
         Cut _cut = Cut.UNDEFINED;
-        Map<Quality,Double> _map = new HashMap<Quality,Double>();
-        public CutObject(Cut c, String name, double val1,double val2,double val3) {
+        Map<Quality, Double> _map = new HashMap<Quality, Double>();
+
+        public CutObject(Cut c, String name, double val1, double val2, double val3) {
             _cut = c;
             _name = name;
             _map.put(Quality.LOOSE, val1);
             _map.put(Quality.MEDIUM, val2);
             _map.put(Quality.TIGHT, val3);
         }
+
+        // FIXME: Method is not called anywhere.
         public void set(Quality q, double val) {
-            _map.put(q,val);
+            _map.put(q, val);
         }
+
         public double get(Quality q) {
             return _map.get(q);
         }
+
         @Override
         public String toString() {
-            return String.format("Name:%s cut:%d val=[%f,%f,%f]",_name,_cut.getValue(),_map.get(Quality.LOOSE),_map.get(Quality.MEDIUM),_map.get(Quality.TIGHT));
+            return String.format("Name:%s cut:%d val=[%f,%f,%f]", _name, _cut.getValue(), _map.get(Quality.LOOSE), _map.get(Quality.MEDIUM), _map.get(Quality.TIGHT));
         }
     }
-    
+
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
FindableTrack.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/FindableTrack.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/FindableTrack.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -30,61 +30,65 @@
 import org.lcsim.recon.tracking.seedtracker.SeedStrategy;
 
 /**
- *
+ * 
  * @author Richard Partridge
  * @version $Id: FindableTrack.java,v 1.4 2012/11/08 01:22:41 omoreno Exp $
  */
+// FIXME: This class is used in some analyses but is not actually created by the recon.
+// Should it be put someplace else like in the analysis module? --JM
 public class FindableTrack {
 
     public enum Ignore {
         NoPTCut, NoDCACut, NoZ0Cut, NoSeedCheck, NoConfirmCheck, NoMinHitCut
     };
-    
+
     private double _bfield;
     private RelationalTable<SimTrackerHit, MCParticle> _hittomc;
     private HitIdentifier _ID;
-    private int _nlayersTot=10;
-    
-    public FindableTrack(EventHeader event, List<SimTrackerHit> simTrackerHits){
-        
+    private int _nlayersTot = 10;
+
+    public FindableTrack(EventHeader event, List<SimTrackerHit> simTrackerHits) {
+
         // Get the magnetic field
         Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
         _bfield = event.getDetector().getFieldMap().getField(IP).y();
-        
-        //  Instantiate the hit identifier class
+
+        // Instantiate the hit identifier class
         _ID = new HitIdentifier();
-        
-        //  Create a relational table that maps SimTrackerHits to MCParticles
+
+        // Create a relational table that maps SimTrackerHits to MCParticles
         _hittomc = new BaseRelationalTable<SimTrackerHit, MCParticle>(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        
+
         List<List<SimTrackerHit>> simTrackerHitCollections = new ArrayList<List<SimTrackerHit>>();
-        
+
         // If the collection of SimTrackerHits is not specified get the collection from the event.
         // Otherwise, add the collection to the list of collections to be processed.
-        if(simTrackerHits == null) simTrackerHitCollections.addAll(event.get(SimTrackerHit.class));
-        else simTrackerHitCollections.add(simTrackerHits);
-        
-        //  Loop over the SimTrackerHits and fill in the relational table
-        for (List<SimTrackerHit> simlist : simTrackerHitCollections){
+        if (simTrackerHits == null)
+            simTrackerHitCollections.addAll(event.get(SimTrackerHit.class));
+        else
+            simTrackerHitCollections.add(simTrackerHits);
+
+        // Loop over the SimTrackerHits and fill in the relational table
+        for (List<SimTrackerHit> simlist : simTrackerHitCollections) {
             for (SimTrackerHit simhit : simlist)
                 if (simhit.getMCParticle() != null)
                     _hittomc.add(simhit, simhit.getMCParticle());
         }
     }
-    
-    public FindableTrack(EventHeader event, List<SimTrackerHit> simTrackerHits, int nLayersTot){
+
+    public FindableTrack(EventHeader event, List<SimTrackerHit> simTrackerHits, int nLayersTot) {
         this(event, simTrackerHits);
         this._nlayersTot = nLayersTot;
     }
-    
-    public FindableTrack(EventHeader event){
+
+    public FindableTrack(EventHeader event) {
         this(event, null);
     }
 
-    public FindableTrack(EventHeader event, int nLayersTot){
+    public FindableTrack(EventHeader event, int nLayersTot) {
         this(event, null, nLayersTot);
     }
-    
+
     public boolean isFindable(MCParticle mcp, List<SeedStrategy> slist, Ignore ignore) {
         List<Ignore> ignores = new ArrayList<Ignore>();
         ignores.add(ignore);
@@ -97,44 +101,44 @@
 
     public boolean isFindable(MCParticle mcp, List<SeedStrategy> slist, List<Ignore> ignores) {
 
-        //  We can't find neutral particles'
+        // We can't find neutral particles'
         if (mcp.getCharge() == 0)
             return false;
 
-        //  Find the helix parameters in the L3 convention used by org.lcsim
+        // Find the helix parameters in the L3 convention used by org.lcsim
         HelixParamCalculator helix = new HelixParamCalculator(mcp, _bfield);
 
-        //  We haven't yet determined the track is findable
+        // We haven't yet determined the track is findable
         boolean findable = false;
 
-        //  Loop over strategies and check if the track is findable
+        // Loop over strategies and check if the track is findable
         for (SeedStrategy strat : slist) {
 
-            //  Check the MC Particle's pT
+            // Check the MC Particle's pT
             if (!CheckPT(helix, ignores, strat))
                 continue;
 
-            //  Check the MC Particle's DCA
+            // Check the MC Particle's DCA
             if (!CheckDCA(helix, ignores, strat))
                 continue;
 
-            //  Check the MC Particle's Z0
+            // Check the MC Particle's Z0
             if (!CheckZ0(helix, ignores, strat))
                 continue;
 
-            //  Check that we have hits on the seed layers
+            // Check that we have hits on the seed layers
             if (!CheckSeed(mcp, ignores, strat))
                 continue;
 
-            //  Check that we have the required confirmation hits
+            // Check that we have the required confirmation hits
             if (!CheckConfirm(mcp, ignores, strat))
                 continue;
 
-            //  Check for the minimum number of hits
+            // Check for the minimum number of hits
             if (!CheckMinHits(mcp, ignores, strat))
                 continue;
 
-            //  Passed all the checks - track is findable
+            // Passed all the checks - track is findable
             findable = true;
             break;
         }
@@ -144,13 +148,13 @@
 
     public int LayersHit(MCParticle mcp) {
 
-        //  Get the list of hits associated with the MCParticle
+        // Get the list of hits associated with the MCParticle
         Set<SimTrackerHit> hitlist = _hittomc.allTo(mcp);
 
-        //  Create a set of the identifiers for the hit layers
+        // Create a set of the identifiers for the hit layers
         Set<String> idset = new HashSet<String>();
 
-        //  Create the set of identifiers
+        // Create the set of identifiers
         for (SimTrackerHit simhit : hitlist) {
 
             String identifier_old = _ID.Identifier(getDetectorElement(simhit));
@@ -161,76 +165,82 @@
 
         return idset.size();
     }
-    
-    public boolean isTrackFindable(MCParticle mcParticle, int nLayers){
-        
-        if(nLayers%2 == 1) throw new RuntimeException(this.getClass().getSimpleName() + ": The required number of layers hit must be even");
-        
+
+    public boolean isTrackFindable(MCParticle mcParticle, int nLayers) {
+
+        if (nLayers % 2 == 1)
+            throw new RuntimeException(this.getClass().getSimpleName() + ": The required number of layers hit must be even");
+
         // A neutral particle can't be found
-        if(mcParticle.getCharge() == 0) return false;
-        
+        if (mcParticle.getCharge() == 0)
+            return false;
+
         // Get the list of SimTrackerHits associated with the MC particle
         Set<SimTrackerHit> simHits = _hittomc.allTo(mcParticle);
-        
+
         // Find the layers hit
         boolean[] layerHit = new boolean[_nlayersTot];
-        for(SimTrackerHit simHit : simHits){
-            layerHit[simHit.getLayer()-1] = true;
+        for (SimTrackerHit simHit : simHits) {
+            layerHit[simHit.getLayer() - 1] = true;
         }
-        
+
         int nLayersHit = 0;
         // Check how many pairs of layers were hit
-        for(int index = 0; index < _nlayersTot; index += 2){
-            if(layerHit[index] && layerHit[index+1]) nLayersHit += 2; 
+        for (int index = 0; index < _nlayersTot; index += 2) {
+            if (layerHit[index] && layerHit[index + 1])
+                nLayersHit += 2;
         }
-        
+
         return nLayersHit >= nLayers;
     }
-    
-    public Set<SimTrackerHit> getSimTrackerHits(MCParticle mcParticle){
+
+    public Set<SimTrackerHit> getSimTrackerHits(MCParticle mcParticle) {
         return _hittomc.allTo(mcParticle);
     }
-    
+
     public boolean InnerTrackerIsFindable(MCParticle mcp, int nlayers, boolean printout) {
         Set<SimTrackerHit> hitlist = _hittomc.allTo(mcp);
-        boolean[] layerHit={false,false,false,false,false,false,false,false,false,false,false,false};
+        boolean[] layerHit = { false, false, false, false, false, false, false, false, false, false, false, false };
         for (SimTrackerHit simhit : hitlist) {
-            layerHit[simhit.getLayer()-1]=true;
+            layerHit[simhit.getLayer() - 1] = true;
         }
-        for(int i=0;i<nlayers;i++){
+        for (int i = 0; i < nlayers; i++) {
             System.out.println(layerHit[i]);
-            if(layerHit[i]==false)return false;
+            if (layerHit[i] == false)
+                return false;
         }
         return true;
     }
 
-       public boolean InnerTrackerIsFindable(MCParticle mcp, int nlayers) {
+    public boolean InnerTrackerIsFindable(MCParticle mcp, int nlayers) {
         Set<SimTrackerHit> hitlist = _hittomc.allTo(mcp);
-        boolean[] layerHit={false,false,false,false,false,false,false,false,false,false,false,false};
+        boolean[] layerHit = { false, false, false, false, false, false, false, false, false, false, false, false };
         for (SimTrackerHit simhit : hitlist) {
-            layerHit[simhit.getLayer()-1]=true;
+            layerHit[simhit.getLayer() - 1] = true;
         }
-        for(int i=0;i<nlayers;i++){
-            if(layerHit[i]==false)return false;
+        for (int i = 0; i < nlayers; i++) {
+            if (layerHit[i] == false)
+                return false;
         }
         return true;
     }
 
-      public boolean OuterTrackerIsFindable(MCParticle mcp, int start) {
+    public boolean OuterTrackerIsFindable(MCParticle mcp, int start) {
         Set<SimTrackerHit> hitlist = _hittomc.allTo(mcp);
-        boolean[] layerHit={false,false,false,false,false,false,false,false,false,false,false,false};
+        boolean[] layerHit = { false, false, false, false, false, false, false, false, false, false, false, false };
         for (SimTrackerHit simhit : hitlist) {
-            layerHit[simhit.getLayer()-1]=true;
+            layerHit[simhit.getLayer() - 1] = true;
         }
-        for(int i=start;i<_nlayersTot;i++){
-            if(layerHit[i]==false)return false;
+        for (int i = start; i < _nlayersTot; i++) {
+            if (layerHit[i] == false)
+                return false;
         }
         return true;
     }
 
     private boolean CheckPT(HelixParamCalculator helix, List<Ignore> ignores, SeedStrategy strat) {
 
-        //  First see if we are skipping this check
+        // First see if we are skipping this check
         if (ignores.contains(Ignore.NoPTCut))
             return true;
 
@@ -239,7 +249,7 @@
 
     private boolean CheckDCA(HelixParamCalculator helix, List<Ignore> ignores, SeedStrategy strat) {
 
-        //  First see if we are skipping this check
+        // First see if we are skipping this check
         if (ignores.contains(Ignore.NoDCACut))
             return true;
 
@@ -248,7 +258,7 @@
 
     private boolean CheckZ0(HelixParamCalculator helix, List<Ignore> ignores, SeedStrategy strat) {
 
-        //  First see if we are skipping this check
+        // First see if we are skipping this check
         if (ignores.contains(Ignore.NoZ0Cut))
             return true;
 
@@ -257,7 +267,7 @@
 
     private boolean CheckSeed(MCParticle mcp, List<Ignore> ignores, SeedStrategy strat) {
 
-        //  First see if we are skipping this check
+        // First see if we are skipping this check
         if (ignores.contains(Ignore.NoSeedCheck))
             return true;
 
@@ -266,7 +276,7 @@
 
     private boolean CheckConfirm(MCParticle mcp, List<Ignore> ignores, SeedStrategy strat) {
 
-        //  First see if we are skipping this check
+        // First see if we are skipping this check
         if (ignores.contains(Ignore.NoConfirmCheck))
             return true;
 
@@ -275,7 +285,7 @@
 
     private boolean CheckMinHits(MCParticle mcp, List<Ignore> ignores, SeedStrategy strat) {
 
-        //  First see if we are skipping this check
+        // First see if we are skipping this check
         if (ignores.contains(Ignore.NoMinHitCut))
             return true;
 
@@ -284,40 +294,41 @@
 
     private int HitCount(MCParticle mcp, List<SeedLayer> lyrlist) {
 
-        //  Get the list of hits associated with the MCParticle
+        // Get the list of hits associated with the MCParticle
         Set<SimTrackerHit> hitlist = _hittomc.allTo(mcp);
 
-        //  Count the number of layers with hits in them
+        // Count the number of layers with hits in them
         int hitcount = 0;
         for (SeedLayer lyr : lyrlist)
-            //  Loop over the hits for this MCParticle
+            // Loop over the hits for this MCParticle
             for (SimTrackerHit simhit : hitlist) {
 
-                //  Get the detector element for this hit
-//                IDetectorElement de = getDetectorElement(simhit);
+                // Get the detector element for this hit
+                // IDetectorElement de = getDetectorElement(simhit);
 
-                //  Check names
-//                String detname_old = _ID.getName(de);
+                // Check names
+                // String detname_old = _ID.getName(de);
                 String detname_new = simhit.getSubdetector().getName();
-                //               if (!detname_old.equals(detname_new)) {
-                //                   System.out.println("Detector name mismatch - old: "+detname_old+ " new: "+detname_new);
-                //               }
-                //               int layer_old = _ID.getLayer(de);
+                // if (!detname_old.equals(detname_new)) {
+                // System.out.println("Detector name mismatch - old: "+detname_old+
+                // " new: "+detname_new);
+                // }
+                // int layer_old = _ID.getLayer(de);
                 int layer_new = simhit.getLayer();
-                //               if (layer_old != layer_new) {
-                //                   System.out.println("Layer number mismatch - old: "+layer_old+" new: "+layer_new);
-                //               }
-//                BarrelEndcapFlag be_old = _ID.getBarrelEndcapFlag(de);
+                // if (layer_old != layer_new) {
+                // System.out.println("Layer number mismatch - old: "+layer_old+" new: "+layer_new);
+                // }
+                // BarrelEndcapFlag be_old = _ID.getBarrelEndcapFlag(de);
                 BarrelEndcapFlag be_new = simhit.getBarrelEndcapFlag();
-                //               if (!be_old.equals(be_new)) {
-                //                   System.out.println("BarrelEndcapFlag mismatch - old: "+be_old+" new: "+be_new);
-                //               }
+                // if (!be_old.equals(be_new)) {
+                // System.out.println("BarrelEndcapFlag mismatch - old: "+be_old+" new: "+be_new);
+                // }
 
-                //  See if this hit is on the layer we are checking
-//               if (!lyr.getDetName().equals(_ID.getName(de))) continue;
-//                if (lyr.getLayer() != _ID.getLayer(de)) continue;
-//                if (!lyr.getBarrelEndcapFlag().equals(_ID.getBarrelEndcapFlag(de)))
-//                    continue;
+                // See if this hit is on the layer we are checking
+                // if (!lyr.getDetName().equals(_ID.getName(de))) continue;
+                // if (lyr.getLayer() != _ID.getLayer(de)) continue;
+                // if (!lyr.getBarrelEndcapFlag().equals(_ID.getBarrelEndcapFlag(de)))
+                // continue;
                 if (!lyr.getDetName().equals(detname_new))
                     continue;
                 if (lyr.getLayer() != layer_new)

java/trunk/tracking/src/main/java/org/hps/recon/tracking
FpgaData.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/FpgaData.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/FpgaData.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,197 +0,0 @@
-package org.hps.recon.tracking;
-
-//--- java ---//
-import static org.hps.conditions.deprecated.HPSSVTConstants.ADC_TEMP_COUNT;
-import static org.hps.conditions.deprecated.HPSSVTConstants.BETA;
-import static org.hps.conditions.deprecated.HPSSVTConstants.CONST_A;
-import static org.hps.conditions.deprecated.HPSSVTConstants.MAX_TEMP;
-import static org.hps.conditions.deprecated.HPSSVTConstants.MIN_TEMP;
-import static org.hps.conditions.deprecated.HPSSVTConstants.R_DIV;
-import static org.hps.conditions.deprecated.HPSSVTConstants.TEMP_INC;
-import static org.hps.conditions.deprecated.HPSSVTConstants.TEMP_K0;
-import static org.hps.conditions.deprecated.HPSSVTConstants.TEMP_MASK;
-import static org.hps.conditions.deprecated.HPSSVTConstants.V_MAX;
-import static org.hps.conditions.deprecated.HPSSVTConstants.V_REF;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-//--- org.lcsim ---//
-import org.lcsim.event.GenericObject;
-//-- Constants ---//
-
-/**
- * Generic object to contain hybrid temperatures and data tail value. Converts
- * and ADC value to a temperature in celsius
- *
- * @author Omar Moreno <[log in to unmask]>
- * @version $Id: FpgaData.java,v 1.3 2012/08/16 01:06:30 meeg Exp $
- */
-public class FpgaData implements GenericObject {
-
-    int fpgaID;
-    List<Double> temperatures = new ArrayList<Double>();
-    int tail;
-    private static double[] temperatureTable = null;
-
-    /**
-     *
-     * @param temperature : array containing hybrid temperatures
-     * @param tail : word present at the end of a FPGA data set
-     */
-    public FpgaData(int fpgaID, int[] data, int tail) {
-        this.fpgaID = fpgaID;
-
-        int[] temperature = extractTemperature(data);
-
-        // Fill the temperature lookup table
-        fillTemperatureTable();
-
-        this.tail = tail;
-
-        // Fill the temperature list
-        for (int index = 0; index < temperature.length; index++) {
-            temperatures.add(intToTemperature(temperature[index]));
-        }
-    }
-
-    public FpgaData(int fpgaID, double[] temperatures, int tail) {
-        this.fpgaID = fpgaID;
-
-        this.tail = tail;
-
-        this.temperatures.clear();
-        // Fill the temperature list
-        for (int index = 0; index < temperatures.length; index++) {
-            this.temperatures.add(temperatures[index]);
-        }
-    }
-
-    /**
-     * Extract temperatures from the SVT data stream
-     *
-     * @param data : array containing temperature data
-     * @return temperatures
-     *
-     */
-    public static int[] extractTemperature(int[] data) {
-        int[] temperatures = new int[(data.length) * 2];
-
-        int tempIndex = 0;
-        for (int index = 0; index < data.length; index++) {
-            temperatures[tempIndex] = data[index] & TEMP_MASK;
-            temperatures[tempIndex + 1] = (data[index] >>> 16) & TEMP_MASK;
-            tempIndex += 2;
-        }
-        return temperatures;
-    }
-
-    /**
-     * Temperature lookup table. Takes an ADC value and returns a temperature in
-     * Celsius
-     */
-    private static void fillTemperatureTable() {
-
-        if (temperatureTable == null) {
-            temperatureTable = new double[ADC_TEMP_COUNT];
-
-            double tempK, res, volt;
-            int idx;
-            double temp = MIN_TEMP;
-
-            while (temp < MAX_TEMP) {
-
-                tempK = TEMP_K0 + temp;
-                res = CONST_A * Math.exp(BETA / tempK);
-                volt = (res * V_MAX) / (R_DIV + res);
-                idx = (int) ((volt / V_REF) * (double) (ADC_TEMP_COUNT - 1));
-                if (idx < ADC_TEMP_COUNT) {
-                    temperatureTable[idx] = temp;
-                }
-                temp += TEMP_INC;
-            }
-        }
-    }
-
-    public static double intToTemperature(int tempIndex) {
-        fillTemperatureTable();
-        return temperatureTable[tempIndex];
-    }
-
-    public static int temperatureToInt(double temperature) {
-        fillTemperatureTable();
-        return Math.abs(Arrays.binarySearch(temperatureTable, temperature));
-    }
-
-    public int[] extractData() {
-        fillTemperatureTable();
-
-        int[] header = new int[(temperatures.size() + 1) / 2];
-        for (int i = 0; i < temperatures.size(); i++) {
-            if (i % 2 == 0) {
-                header[i / 2] = (header[i / 2] &= ~TEMP_MASK) | (temperatureToInt(temperatures.get(i)) & TEMP_MASK);
-            } else {
-                header[i / 2] = (header[i / 2] &= ~(TEMP_MASK << 16)) | ((temperatureToInt(temperatures.get(i)) & TEMP_MASK) << 16);
-            }
-        }
-        return header;
-    }
-
-    public int getFpga() {
-        return fpgaID;
-    }
-
-    public int getTail() {
-        return tail;
-    }
-
-    /**
-     * Get the temperature at a given index
-     */
-    @Override
-    public double getDoubleVal(int index) {
-        return temperatures.get(index);
-    }
-
-    @Override
-    public float getFloatVal(int index) {
-        return 0;
-    }
-
-    /**
-     * Get the tail value
-     */
-    @Override
-    public int getIntVal(int index) {
-        switch (index) {
-            case 0:
-                return getFpga();
-            case 1:
-                return getTail();
-            default:
-                throw new ArrayIndexOutOfBoundsException(index);
-        }
-    }
-
-    @Override
-    public int getNDouble() {
-        return temperatures.size();
-    }
-
-    @Override
-    public int getNFloat() {
-        return 0;
-    }
-
-    @Override
-    public int getNInt() {
-        return 2;
-    }
-
-    @Override
-    public boolean isFixedSize() {
-        return false;
-    }
-;
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSClusteringAlgorithm.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSClusteringAlgorithm.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSClusteringAlgorithm.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,25 +0,0 @@
-package org.hps.recon.tracking;
-
-import java.util.List;
-
-/**
- *
- * @author mgraham
- */
-
-
-public interface HPSClusteringAlgorithm {
-
-    /**
-     * Finds the clusters given a list of RawTrackerHits on a particular
-     * silicon sensor with electrodes given by SiSensorElectrodes.  A list
-     * of clusters is returned, with each cluster being a list of RawTrackerHits
-     * the form the cluster.
-     *
-     * @param hits base hits
-     * @return list of clusters, with each cluster being a list of RawTrackerHits
-     */
-    public List<List<HPSFittedRawTrackerHit>> findClusters(
-             List<HPSFittedRawTrackerHit> hits);
-
-}
\ No newline at end of file

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSFittedRawTrackerHit.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSFittedRawTrackerHit.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSFittedRawTrackerHit.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,37 +0,0 @@
-package org.hps.recon.tracking;
-
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.base.BaseLCRelation;
-
-/**
- *
- * @author meeg
- * @version $Id: HPSFittedRawTrackerHit.java,v 1.3 2013/04/16 22:05:43 phansson Exp $
- */
-public class HPSFittedRawTrackerHit extends BaseLCRelation {
-
-	public HPSFittedRawTrackerHit(RawTrackerHit hit, HPSShapeFitParameters fit) {
-		super(hit, fit);
-	}
-
-	public RawTrackerHit getRawTrackerHit() {
-		return (RawTrackerHit) getFrom();
-	}
-
-	public HPSShapeFitParameters getShapeFitParameters() {
-		return (HPSShapeFitParameters) getTo();
-	}
-
-	public double getT0() {
-		return getShapeFitParameters().getT0();
-	}
-
-	public double getAmp() {
-		return getShapeFitParameters().getAmp();
-	}
-        
-        @Override
-        public String toString() {
-            return String.format("HPSFittedRawTrackerHit: hit cell id %d on sensor %s with fit %s\n",this.getRawTrackerHit().getCellID(),getRawTrackerHit().getDetectorElement().getName(),this.getShapeFitParameters().toString());
-        }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSNearestNeighborRMS.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSNearestNeighborRMS.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSNearestNeighborRMS.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,258 +0,0 @@
-package org.hps.recon.tracking;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
-import org.hps.conditions.deprecated.HPSSVTConstants;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
-import org.lcsim.event.RawTrackerHit;
-
-/**
- *
- * @author mgraham
- */
-public class HPSNearestNeighborRMS implements HPSClusteringAlgorithm {
-
-    private static String _NAME = "NearestNeighborRMS";
-    private double _seed_threshold;
-    private double _neighbor_threshold;
-    private double _cluster_threshold;
-    private double _meanTime = 24;
-    private double _timeWindow = 48;
-    private double _maxChisq = 20.0;
-
-    /**
-     * Instantiate NearestNeighborRMS with specified thresholds.
-     * Seed threshold is the minimum charge to initiate a cluster.  Neighbor
-     * threshold is the minimum charge to add a neighboring cell to a cluster.
-     * Cluster threshold is minimum charge of the entire cluster.
-     * All thresholds are in units of RMS noise of the channel(s).
-     *
-     * @param seed_threshold seed threshold
-     * @param neighbor_threshold neighbor threshold
-     * @param cluster_threshold cluster threshold
-     */
-    public HPSNearestNeighborRMS(double seed_threshold, double neighbor_threshold, double cluster_threshold) {
-        _seed_threshold = seed_threshold;
-        _neighbor_threshold = neighbor_threshold;
-        _cluster_threshold = cluster_threshold;
-    }
-
-    /**
-     * Instantiate NearestNeighborRMS with default thresholds:
-     *
-     * seed_threshold = 4*RMS noise
-     * neighbor_threshold = 3*RMS noise
-     * cluster_threshold = 4*RMS noise
-     */
-    public HPSNearestNeighborRMS() {
-        this(4.0, 3.0, 4.0);
-    }
-
-    /**
-     * Set the seed threshold.  Units are RMS noise.
-     *
-     * @param seed_threshold seed threshold
-     */
-    public void setSeedThreshold(double seed_threshold) {
-        _seed_threshold = seed_threshold;
-    }
-
-    /**
-     * Set the neighbor threshold.  Units are RMS noise.
-     *
-     * @param neighbor_threshold neighbor threshold
-     */
-    public void setNeighborThreshold(double neighbor_threshold) {
-        _neighbor_threshold = neighbor_threshold;
-    }
-
-    /**
-     * Set the cluster threshold.  Units are RMS noise.
-     *
-     * @param cluster_threshold cluster threshold
-     */
-    public void setClusterThreshold(double cluster_threshold) {
-        _cluster_threshold = cluster_threshold;
-    }
-
-    /**
-     * Find clusters using the nearest neighbor algorithm.
-     *    
-     * @param base_hits List of RawTrackerHits to be clustered
-     * @return list of clusters, with a cluster being a list of RawTrackerHits
-     */
-    @Override
-    public List<List<HPSFittedRawTrackerHit>> findClusters(List<HPSFittedRawTrackerHit> base_hits) {
-
-        //  Check that the seed threshold is at least as large as  the neighbor threshold
-        if (_seed_threshold < _neighbor_threshold) {
-            throw new RuntimeException("Tracker hit clustering error: seed threshold below neighbor threshold");
-        }
-
-        //  Create maps that show the channel status and relate the channel number to the raw hit and vice versa
-        int mapsize = 2 * base_hits.size();
-        Map<Integer, Boolean> clusterable = new HashMap<Integer, Boolean>(mapsize);
-        Map<HPSFittedRawTrackerHit, Integer> hit_to_channel = new HashMap<HPSFittedRawTrackerHit, Integer>(mapsize);
-        Map<Integer, HPSFittedRawTrackerHit> channel_to_hit = new HashMap<Integer, HPSFittedRawTrackerHit>(mapsize);
-
-        //  Create list of channel numbers to be used as cluster seeds
-        List<Integer> cluster_seeds = new ArrayList<Integer>();
-
-        //  Loop over the raw hits and construct the maps used to relate cells and hits, initialize the
-        //  clustering status map, and create a list of possible cluster seeds
-        for (HPSFittedRawTrackerHit base_hit : base_hits) {
-
-            RawTrackerHit rth = base_hit.getRawTrackerHit();
-            // get the channel number for this hit
-            SiTrackerIdentifierHelper sid_helper = (SiTrackerIdentifierHelper) rth.getIdentifierHelper();
-            IIdentifier id = rth.getIdentifier();
-            int channel_number = sid_helper.getElectrodeValue(id);
-
-            //  Check for duplicate RawTrackerHit
-            if (hit_to_channel.containsKey(base_hit)) {
-                throw new RuntimeException("Duplicate hit: " + id.toString());
-            }
-
-            //  Check for duplicate RawTrackerHits or channel numbers
-            if (channel_to_hit.containsKey(channel_number)) {
-//                throw new RuntimeException("Duplicate channel number: "+channel_number);
-                System.out.println("Duplicate channel number: " + channel_number);
-            }
-
-            //  Add this hit to the maps that relate channels and hits
-            hit_to_channel.put(base_hit, channel_number);
-            channel_to_hit.put(channel_number, base_hit);
-
-            //  Get the signal from the readout chip
-            double signal = base_hit.getAmp();
-            double noiseRMS = HPSSVTCalibrationConstants.getNoise((SiSensor) rth.getDetectorElement(), channel_number);
-            double time = base_hit.getT0();
-            //  Mark this hit as available for clustering if it is above the neighbor threshold
-            clusterable.put(channel_number, signal / noiseRMS >= _neighbor_threshold);
-
-            //  Add this hit to the list of seeds if it is above the seed threshold
-            if (signal / noiseRMS >= _seed_threshold && passTimingCut(base_hit) && passChisqCut(base_hit)) {
-                cluster_seeds.add(channel_number);
-            }
-        }
-
-        //  Create a list of clusters
-        List<List<HPSFittedRawTrackerHit>> cluster_list = new ArrayList<List<HPSFittedRawTrackerHit>>();
-
-        //  Now loop over the cluster seeds to form clusters
-        for (int seed_channel : cluster_seeds) {
-
-            //  First check if this hit is still available for clustering
-            if (!clusterable.get(seed_channel)) {
-                continue;
-            }
-
-            //  Create a new cluster
-            List<HPSFittedRawTrackerHit> cluster = new ArrayList<HPSFittedRawTrackerHit>();
-            double cluster_signal = 0.;
-            double cluster_noise_squared = 0.;
-
-            //  Create a queue to hold channels whose neighbors need to be checked for inclusion
-            LinkedList<Integer> unchecked = new LinkedList<Integer>();
-
-            //  Add the seed channel to the unchecked list and mark it as unavailable for clustering
-            unchecked.addLast(seed_channel);
-            clusterable.put(seed_channel, false);
-
-            //  Check the neighbors of channels added to the cluster
-            while (unchecked.size() > 0) {
-
-                //  Pull the next channel off the queue and add it's hit to the cluster
-                int clustered_cell = unchecked.removeFirst();
-                cluster.add(channel_to_hit.get(clustered_cell));
-                cluster_signal += channel_to_hit.get(clustered_cell).getAmp();
-                cluster_noise_squared += Math.pow(HPSSVTCalibrationConstants.getNoise((SiSensor) (channel_to_hit.get(clustered_cell)).getRawTrackerHit().getDetectorElement(), clustered_cell), 2);
-//                cluster_noise_squared +=0;  //need to get the noise from the calib. const. class
-                //  Get the neigbor channels
-//                Set<Integer> neighbor_channels = electrodes.getNearestNeighborCells(clustered_cell);
-                Set<Integer> neighbor_channels = getNearestNeighborCells(clustered_cell);
-
-                //   Now loop over the neighbors and see if we can add them to the cluster
-                for (int channel : neighbor_channels) {
-
-                    //  Get the status of this channel
-                    Boolean addhit = clusterable.get(channel);
-
-                    //  If the map entry is null, there is no raw hit for this channel
-                    if (addhit == null) {
-                        continue;
-                    }
-
-                    //  Check if this neighbor channel is still available for clustering
-                    if (!addhit) {
-                        continue;
-                    }
-
-                    //  Add channel to the list of unchecked clustered channels
-                    //  and mark it unavailable for clustering
-                    unchecked.addLast(channel);
-                    clusterable.put(channel, false);
-
-                }  // end of loop over neighbor cells
-            }  // end of loop over unchecked cells
-
-            //  Finished with this cluster, check cluster threshold and add it to the list of clusters
-            if (cluster.size() > 0
-                    && cluster_signal / Math.sqrt(cluster_noise_squared) > _cluster_threshold) {
-                cluster_list.add(cluster);
-            }
-
-        }  //  End of loop over seeds
-
-        //  Finished finding clusters
-        return cluster_list;
-    }
-
-    private boolean passTimingCut(HPSFittedRawTrackerHit hit) {
-
-        boolean pass = false;
-        double time = hit.getT0();
-        if (Math.abs(time - _meanTime) < _timeWindow) {
-            pass = true;
-        }
-
-        return pass;
-    }
-
-    private boolean passChisqCut(HPSFittedRawTrackerHit hit) {
-        return hit.getShapeFitParameters().getChiSq() < _maxChisq;
-    }
-
-    public int getNeighborCell(int cell, int ncells_0, int ncells_1) {
-        int neighbor_cell = cell + ncells_0;
-        if (isValidCell(neighbor_cell)) {
-            return neighbor_cell;
-        } else {
-            return -1;
-        }
-    }
-
-    public Set<Integer> getNearestNeighborCells(int cell) {
-        Set<Integer> neighbors = new HashSet<Integer>();
-        for (int ineigh = -1; ineigh <= 1; ineigh = ineigh + 2) {
-            int neighbor_cell = getNeighborCell(cell, ineigh, 0);
-            if (isValidCell(neighbor_cell)) {
-                neighbors.add(neighbor_cell);
-            }
-        }
-        return neighbors;
-    }
-
-    public boolean isValidCell(int cell) {
-        return (cell >= 0 && cell < HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR);
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSRawTrackerHitFitterDriver.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSRawTrackerHitFitterDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSRawTrackerHitFitterDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,130 +0,0 @@
-package org.hps.recon.tracking;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
-import org.hps.conditions.deprecated.HPSSVTCalibrationConstants.ChannelConstants;
-import org.hps.conditions.deprecated.HPSSVTConstants;
-import org.hps.readout.ecal.ReadoutTimestamp;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.lcio.LCIOConstants;
-import org.lcsim.util.Driver;
-
-/**
- *
- * @author mgraham
- */
-public class HPSRawTrackerHitFitterDriver extends Driver {
-
-    private boolean debug = false;
-    private HPSShaperFitAlgorithm _shaper = new DumbShaperFit();
-    private String rawHitCollectionName = "SVTRawTrackerHits";
-    private String fitCollectionName = "SVTShapeFitParameters";
-    private String fittedHitCollectionName = "SVTFittedRawTrackerHits";
-    private int genericObjectFlags = 1 << LCIOConstants.GOBIT_FIXED;
-    private int relationFlags = 0;
-    private boolean correctT0Shift = false;
-    private boolean useTimestamps = false;
-    private boolean useTruthTime = false;
-
-    /**
-     * Report time relative to the nearest expected truth event time.
-     *
-     * @param useTruthTime
-     */
-    public void setUseTruthTime(boolean useTruthTime) {
-        this.useTruthTime = useTruthTime;
-    }
-
-    public void setDebug(boolean debug) {
-        this.debug = debug;
-    }
-
-    public void setCorrectT0Shift(boolean correctT0Shift) {
-        this.correctT0Shift = correctT0Shift;
-    }
-
-    public void setUseTimestamps(boolean useTimestamps) {
-        this.useTimestamps = useTimestamps;
-    }
-
-    public void setFitAlgorithm(String fitAlgorithm) {
-        if (fitAlgorithm.equals("Analytic")) {
-            _shaper = new HPSShaperAnalyticFitAlgorithm();
-        } else {
-            throw new RuntimeException("Unrecognized fitAlgorithm: " + fitAlgorithm);
-        }
-    }
-
-    public void setFitCollectionName(String fitCollectionName) {
-        this.fitCollectionName = fitCollectionName;
-    }
-
-    public void setFittedHitCollectionName(String fittedHitCollectionName) {
-        this.fittedHitCollectionName = fittedHitCollectionName;
-    }
-
-    public void setRawHitCollectionName(String rawHitCollectionName) {
-        this.rawHitCollectionName = rawHitCollectionName;
-    }
-
-    @Override
-    public void startOfData() {
-        if (rawHitCollectionName == null) {
-            throw new RuntimeException("The parameter ecalCollectionName was not set!");
-        }
-    }
-
-    @Override
-    public void process(EventHeader event) {
-        if (!event.hasCollection(RawTrackerHit.class, rawHitCollectionName)) {
-            //System.out.println(rawHitCollectionName + " does not exist; skipping event");
-            return;
-        }
-
-        List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, rawHitCollectionName);
-        if (rawHits == null) {
-            throw new RuntimeException("Event is missing SVT hits collection!");
-        }
-        List<HPSFittedRawTrackerHit> hits = new ArrayList<HPSFittedRawTrackerHit>();
-        List<HPSShapeFitParameters> fits = new ArrayList<HPSShapeFitParameters>();
-
-        //  Make a fitted hit from this cluster
-        for (RawTrackerHit hit : rawHits) {
-            int strip = hit.getIdentifierFieldValue("strip");
-            ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants((SiSensor) hit.getDetectorElement(), strip);
-            HPSShapeFitParameters fit = _shaper.fitShape(hit, constants);
-            if (correctT0Shift) {
-                fit.setT0(fit.getT0() - constants.getT0Shift());
-            }
-            if (useTimestamps) {
-                double t0Svt = ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_TRACKER, event);
-                double t0Trig = ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_TRIGGER, event);
-                double corMod = (t0Svt - t0Trig);
-                fit.setT0(fit.getT0() + corMod);
-            }
-            if (useTruthTime) {
-                double t0Svt = ReadoutTimestamp.getTimestamp(ReadoutTimestamp.SYSTEM_TRACKER, event);
-                double absoluteHitTime = fit.getT0() + t0Svt;
-                double relativeHitTime = ((absoluteHitTime + 250.0) % 500.0) - 250.0;
-
-                fit.setT0(relativeHitTime);
-            }
-            if (debug) {
-                System.out.println(fit);
-            }
-            fits.add(fit);
-            HPSFittedRawTrackerHit hth = new HPSFittedRawTrackerHit(hit, fit);
-            hits.add(hth);
-            if (strip == HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR) { //drop unbonded channel
-                continue;
-            }
-            hit.getDetectorElement().getReadout().addHit(hth);
-        }
-        event.put(fitCollectionName, fits, HPSShapeFitParameters.class, genericObjectFlags);
-        event.put(fittedHitCollectionName, hits, HPSFittedRawTrackerHit.class, relationFlags);
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSSVTData.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSSVTData.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSSVTData.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,307 +0,0 @@
-package org.hps.recon.tracking;
-
-//--- Constants ---//
-
-import static org.hps.conditions.deprecated.HPSSVTConstants.APV_MASK;
-import static org.hps.conditions.deprecated.HPSSVTConstants.CHANNEL_MASK;
-import static org.hps.conditions.deprecated.HPSSVTConstants.FPGA_MASK;
-import static org.hps.conditions.deprecated.HPSSVTConstants.HYBRID_MASK;
-import static org.hps.conditions.deprecated.HPSSVTConstants.SAMPLE_MASK;
-import static org.hps.conditions.deprecated.HPSSVTConstants.TEMP_MASK;
-import static org.hps.conditions.deprecated.HPSSVTConstants.TOTAL_APV25_CHANNELS;
-import static org.hps.conditions.deprecated.HPSSVTConstants.TOTAL_APV25_PER_HYBRID;
-import static org.hps.conditions.deprecated.HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES;
-
-/**
- *
- *
- * @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSSVTData.java,v 1.8 2012/08/16 01:06:30 meeg Exp $
- */
-public class HPSSVTData {
-
-    // 4x32 
-    int[] data = new int[4];
-    // Time of the hit
-    int hitTime = 0;
-
-    /**
-     *
-     * Creates an SVT data packet from
-     *
-     * @param hybridNumber Hybrid number (0-3)
-     * @param apvNumber APV25 chip number (0-4)
-     * @param channelNumber Sensor strip number (0-127)
-     * @param fpgaAddress FPGA address
-     * @param adc ADC samples obtained by sampling the shaper output. Currently,
-     * six samples are obtained per raw hit.
-     */
-    public HPSSVTData(int hybridNumber, int apvNumber,
-            int channelNumber, int fpgaAddress, short[] adc) {
-        this.createSVTDataPacket(hybridNumber, apvNumber,
-                channelNumber, fpgaAddress, adc);
-    }
-
-    /**
-     * Creates and SVT data packet from existing SVT data
-     *
-     * @param data The packed data as int array of size 4
-     */
-    public HPSSVTData(int[] data) {
-        if (data.length != 4) {
-            throw new RuntimeException("Data sample size is not valid!");
-        }
-
-        this.data = data;
-    }
-
-    /**
-     * Get the packed data for this sample
-     *
-     * @return sample The packed data as an int array of size 4.
-     */
-    public int[] getData() {
-        return data;
-    }
-
-    /**
-     * Creates and SVT data packet
-     */
-    private void createSVTDataPacket(int hybridNumber, int apvNumber,
-            int channelNumber, int fpgaAddress, short[] adc) {
-        createSVTDataPacket(hybridNumber, apvNumber, channelNumber, fpgaAddress, adc, data);
-    }
-
-    public static void createSVTDataPacket(int hybridNumber, int apvNumber,
-            int channelNumber, int fpgaAddress, short[] adc, int[] data) {
-        /*
-         * Sample Data consists of the following: Z[xx:xx] = Zeros, O[xx:xx] =
-         * Ones data[0] = O[0], Z[0], Hybrid[1:0], Z[0], ApvChip[2:0], Z[0],
-         * Channel[6:0], FpgaAddress[15:0] data[1] = Z[1:0], Sample1[13:0]],
-         * Z[1:0], Sample0[13:0] data[2] = Z[1:0], Sample3[13:0]], Z[1:0],
-         * Sample2[13:0] data[3] = Z[1:0], Sample5[13:0]], Z[1:0], Sample4[13:0]
-         *
-         */
-
-        //--- data[0] ---//
-        //-----------------//
-
-        // The most significant digit of data[0] is set to 1
-        data[0] |= 0x80000000;
-
-        // Insert the hybrid number
-        data[0] = (data[0] &= ~(HYBRID_MASK << 28)) | ((hybridNumber & HYBRID_MASK) << 28);
-
-        // Insert the APV number
-        data[0] = (data[0] &= ~(APV_MASK << 24)) | ((apvNumber & APV_MASK) << 24);
-
-        // Insert the channel number
-        data[0] = (data[0] &= ~(CHANNEL_MASK << 16)) | ((channelNumber & CHANNEL_MASK) << 16);
-
-        // Insert the FPGA address
-        data[0] = (data[0] &= ~FPGA_MASK) | (fpgaAddress & FPGA_MASK);
-
-
-        //--- data[1] ----//
-        //------------------//
-
-        // Add data 0
-        data[1] = (data[1] &= ~SAMPLE_MASK) | (adc[0] & SAMPLE_MASK);
-
-        // Add data 1
-        data[1] = (data[1] &= ~(SAMPLE_MASK << 16)) | ((adc[1] & SAMPLE_MASK) << 16);
-
-
-
-        //--- data[2] ----//
-        //------------------//
-
-        // Add sample 2
-        data[2] = (data[2] &= ~SAMPLE_MASK) | (adc[2] & SAMPLE_MASK);
-
-
-        // Add sample 3
-        data[2] = (data[2] &= ~(SAMPLE_MASK << 16)) | ((adc[3] & SAMPLE_MASK) << 16);
-
-
-        //--- data[3] ----//
-        //------------------//
-
-        // Add sample 4
-        data[3] = (data[3] &= ~SAMPLE_MASK) | (adc[4] & SAMPLE_MASK);
-
-
-        // Add sample 5
-        data[3] = (data[3] &= ~(SAMPLE_MASK << 16)) | ((adc[5] & SAMPLE_MASK) << 16);
-    }
-
-    /**
-     * Get the hybrid number associated with this SVT data packet
-     *
-     * @return hybrid number (0-3)
-     */
-    public int getHybridNumber() {
-        return getHybridNumber(data);
-    }
-
-    public static int getHybridNumber(int[] data) {
-        return (data[0] >>> 28) & HYBRID_MASK;
-    }
-
-    /**
-     * Get the APV number associated with this SVT data packet
-     *
-     * @return APV number (0-4)
-     */
-    public int getAPVNumber() {
-        return getAPVNumber(data);
-    }
-
-    public static int getAPVNumber(int[] data) {
-        return (data[0] >>> 24) & APV_MASK;
-    }
-
-    /**
-     * Get the channel number associated with this SVT data packet
-     *
-     * @return channel number (0-127)
-     */
-    public int getChannelNumber() {
-        return getChannelNumber(data);
-    }
-
-    public static int getChannelNumber(int[] data) {
-        return (data[0] >>> 16) & CHANNEL_MASK;
-    }
-
-    /**
-     * Get the FPGA address associated with this SVT data packet
-     *
-     * @return FPGA address
-     */
-    public int getFPGAAddress() {
-        return getFPGAAddress(data);
-    }
-
-    public static int getFPGAAddress(int[] data) {
-        return data[0] & FPGA_MASK;
-    }
-
-    /**
-     * Get the nth SVT sample
-     *
-     * @param n The sample number of interest. Valid values are 0 to 5
-     * @throws RuntimeException if the sample number is out of range
-     * @return ADC value of the nth sample
-     *
-     *
-     */
-    public int getSample(int n) {
-        return getSample(n, data);
-    }
-
-    public static int getSample(int n, int[] data) {
-
-        switch (n) {
-            case 0:
-                return data[1] & SAMPLE_MASK;
-            case 1:
-                return (data[1] >>> 16) & SAMPLE_MASK;
-            case 2:
-                return data[2] & SAMPLE_MASK;
-            case 3:
-                return (data[2] >>> 16) & SAMPLE_MASK;
-            case 4:
-                return data[3] & SAMPLE_MASK;
-            case 5:
-                return (data[3] >>> 16) & SAMPLE_MASK;
-            default:
-                throw new RuntimeException("Invalid sample number! Valid range of values for n are from 0 - 5");
-        }
-    }
-
-    /**
-     * Get all SVT samples
-     *
-     * @return An array containing all SVT Shaper signal samples
-     */
-    public short[] getAllSamples() {
-        return getAllSamples(data);
-    }
-
-    public static short[] getAllSamples(int[] data) {
-        short[] samples = new short[TOTAL_NUMBER_OF_SAMPLES];
-        // Get all SVT Samples
-        for (int index = 0; index < TOTAL_NUMBER_OF_SAMPLES; index++) {
-            samples[index] = (short) getSample(index, data);
-        }
-
-        return samples;
-    }
-
-    /**
-     * Get the hit time at which the hit occurred
-     *
-     * @return The time at which the hit occurred with respect to the trigger
-     */
-    public int getHitTime() {
-        return hitTime;
-    }
-
-    /**
-     * Set the hit time at which the hit occurred
-     *
-     * @param hitTime : Time at which the hit occurred
-     */
-    public void setHitTime(int hitTime) {
-        this.hitTime = hitTime;
-    }
-
-    /**
-     *
-     */
-    public static double[] getTemperature(int[] data) {
-        double[] temperatures = new double[(data.length) * 2];
-
-        int tempIndex = 0;
-        for (int index = 0; index < data.length; index++) {
-            temperatures[tempIndex] = data[index] & TEMP_MASK;
-            temperatures[tempIndex + 1] = (data[index] >>> 16) & TEMP_MASK;
-            tempIndex += 2;
-        }
-
-        return temperatures;
-    }
-
-    /**
-     * Get the sensor (a k a physical) channel corresponding to a raw chip channel
-     *
-     * @param apv : APV25 chip number
-     * @param channel : APV25 raw channel number
-     *
-     * @return sensor channel number
-     */
-    public static int getSensorChannel(int apv, int channel) {
-        int sensorChannel = (TOTAL_APV25_PER_HYBRID - apv - 1) * TOTAL_APV25_CHANNELS + channel;
-        if (sensorChannel < 0 || sensorChannel >= TOTAL_APV25_PER_HYBRID * TOTAL_APV25_CHANNELS) {
-            throw new RuntimeException("sensor channel " + sensorChannel + " is outside of valid range! APV " + apv + ", channel " + channel);
-        }
-        return sensorChannel;
-    }
-
-    public static int getAPV(int sensorChannel) {
-        return TOTAL_APV25_PER_HYBRID - (sensorChannel / TOTAL_APV25_CHANNELS) - 1;
-    }
-
-    public static int getAPVChannel(int sensorChannel) {
-        return sensorChannel % TOTAL_APV25_CHANNELS;
-    }
-
-    public static int getSensorChannel(int[] data) {
-        return getSensorChannel(getAPVNumber(data), getChannelNumber(data));
-    }
-
-    public int getSensorChannel() {
-        return getSensorChannel(data);
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSShapeFitParameters.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSShapeFitParameters.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSShapeFitParameters.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,144 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.hps.recon.tracking;
-
-import org.lcsim.event.GenericObject;
-
-/**
- *
- * @author mgraham
- */
-public class HPSShapeFitParameters implements GenericObject {
-
-    private double _t0 = Double.NaN;
-    private double _t0Err = Double.NaN;
-    private double _amp = Double.NaN;
-    private double _ampErr = Double.NaN;
-    private double _tp = Double.NaN;
-    private double _tpErr = Double.NaN;
-    private double _chiSq = Double.NaN;
-
-    public HPSShapeFitParameters() {
-    }
-
-    public HPSShapeFitParameters(double t0, double amplitude) {
-        _t0 = t0;
-        _amp = amplitude;
-    }
-
-    public void setT0(double t0) {
-        _t0 = t0;
-    }
-
-    public void setAmp(double amp) {
-        _amp = amp;
-    }
-
-    public void setTp(double tp) {
-        _tp = tp;
-    }
-
-    public void setAmpErr(double _ampErr) {
-        this._ampErr = _ampErr;
-    }
-
-    public void setT0Err(double _t0Err) {
-        this._t0Err = _t0Err;
-    }
-
-    public void setTpErr(double _tpErr) {
-        this._tpErr = _tpErr;
-    }
-
-    public void setChiSq(double _chiSq) {
-        this._chiSq = _chiSq;
-    }
-
-    public double getT0() {
-        return _t0;
-    }
-
-    public double getAmp() {
-        return _amp;
-    }
-
-    public double getTp() {
-        return _tp;
-    }
-
-    public double getT0Err() {
-        return _t0Err;
-    }
-
-    public double getAmpErr() {
-        return _ampErr;
-    }
-
-    public double getTpErr() {
-        return _tpErr;
-    }
-
-    public double getChiSq() {
-        return _chiSq;
-    }
-
-    @Override
-    public int getNInt() {
-        return 0;
-    }
-
-    @Override
-    public int getNFloat() {
-        return 0;
-    }
-
-    @Override
-    public int getNDouble() {
-        return 7;
-    }
-
-    @Override
-    public int getIntVal(int index) {
-        throw new UnsupportedOperationException("No int values in " + this.getClass().getSimpleName());
-    }
-
-    @Override
-    public float getFloatVal(int index) {
-        throw new UnsupportedOperationException("No int values in " + this.getClass().getSimpleName());
-    }
-
-    @Override
-    public double getDoubleVal(int index) {
-        switch (index) {
-            case 0:
-                return _t0;
-            case 1:
-                return _t0Err;
-            case 2:
-                return _amp;
-            case 3:
-                return _ampErr;
-            case 4:
-                return _tp;
-            case 5:
-                return _tpErr;
-            case 6:
-                return _chiSq;
-            default:
-                throw new UnsupportedOperationException("Only 7 double values in " + this.getClass().getSimpleName());
-        }
-
-    }
-
-    @Override
-    public boolean isFixedSize() {
-        return true;
-    }
-
-    @Override
-    public String toString() {
-        return String.format("chisq=%f\tA=%f\tAerr=%f\tT0=%f\tT0err=%f", _chiSq, _amp, _ampErr, _t0, _t0Err);
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSShaperAnalyticFitAlgorithm.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSShaperAnalyticFitAlgorithm.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSShaperAnalyticFitAlgorithm.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,106 +0,0 @@
-package org.hps.recon.tracking;
-
-import org.hps.conditions.deprecated.HPSSVTCalibrationConstants.ChannelConstants;
-import org.hps.conditions.deprecated.HPSSVTConstants;
-import org.lcsim.event.RawTrackerHit;
-//import org.lcsim.math.chisq.ChisqProb;
-
-/**
- * Fast fitter; currently only fits single hits. Uses Tp from ChannelConstants;
- * fits values and errors for T0 and amplitude.
- *
- * @author meeg
- * @version $Id: HPSShaperAnalyticFitAlgorithm.java,v 1.4 2012/04/25 18:01:32
- * mgraham Exp $
- */
-public class HPSShaperAnalyticFitAlgorithm implements HPSShaperFitAlgorithm {
-
-    @Override
-    public HPSShapeFitParameters fitShape(RawTrackerHit rth, ChannelConstants constants) {
-        short[] samples = rth.getADCValues();
-        return this.fitShape(samples, constants);
-    }
-
-    public HPSShapeFitParameters fitShape(short[] samples, ChannelConstants constants) {
-        double minChisq = Double.POSITIVE_INFINITY;
-        int bestStart = 0;
-        HPSShapeFitParameters fit = new HPSShapeFitParameters();
-        for (int i = 0; i < samples.length - 2; i++) {
-            double chisq = fitSection(samples, constants, fit, i);
-//            System.out.println("i = " + i + ", " + fit);
-            if (chisq < minChisq) {
-                minChisq = chisq;
-                bestStart = i;
-            }
-        }
-        fitSection(samples, constants, fit, bestStart);
-//        System.out.format("%f\t%f\t%f\t%f\t%f\t%f\n", samples[0] - constants.getPedestal(), samples[1] - constants.getPedestal(), samples[2] - constants.getPedestal(), samples[3] - constants.getPedestal(), samples[4] - constants.getPedestal(), samples[5] - constants.getPedestal());
-//        System.out.println("start = " + bestStart + ", " + fit);
-        return fit;
-    }
-
-    private double fitSection(short[] samples, ChannelConstants constants, HPSShapeFitParameters fit, int start) {
-        int length = samples.length - start;
-        double[] y = new double[length];
-        double[] t = new double[length];
-
-        for (int i = 0; i < length; i++) {
-            y[i] = samples[start + i] - constants.getPedestal();
-            t[i] = HPSSVTConstants.SAMPLING_INTERVAL * i;
-        }
-
-        double[] p = new double[length];
-        double[] a = new double[length];
-        for (int i = 0; i < length; i++) {
-            p[i] = y[i] / constants.getNoise();
-            a[i] = Math.exp(1 - t[i] / constants.getTp()) / (constants.getTp() * constants.getNoise());
-        }
-
-        double pa, aatt, pat, aat, aa;
-        pa = 0;
-        aatt = 0;
-        pat = 0;
-        aat = 0;
-        aa = 0;
-        for (int i = 0; i < length; i++) {
-            pa += p[i] * a[i];
-            aatt += a[i] * a[i] * t[i] * t[i];
-            pat += p[i] * a[i] * t[i];
-            aat += a[i] * a[i] * t[i];
-            aa += a[i] * a[i];
-        }
-
-        double t0 = (pa * aatt - pat * aat) / (pa * aat - aa * pat);
-        double A = pa / ((Math.exp(t0 / constants.getTp()) * (aat - t0 * aa)));
-
-        double time_var = 0;
-        double height_var = 0;
-        for (int i = 0; i < length; i++) {
-            double dt_dp = a[i] * (aatt - t[i] * aat - t0 * (aat - t[i] * aa)) / (pa * aat - aa * pat);
-            double dh_dp = (a[i] * Math.exp(-1.0 * t0 / constants.getTp()) + A * dt_dp * aa) / (aat - t0 * aa) - A * dt_dp / constants.getTp();
-            time_var += dt_dp * dt_dp;
-            height_var += dh_dp * dh_dp;
-        }
-        t0 += HPSSVTConstants.SAMPLING_INTERVAL * start;
-        fit.setAmp(A);
-        fit.setAmpErr(Math.sqrt(height_var));
-        fit.setT0(t0);
-        fit.setT0Err(Math.sqrt(time_var));
-        fit.setTp(constants.getTp());
-
-        double chisq = 0;
-        for (int i = 0; i < samples.length; i++) {
-            double ti = HPSSVTConstants.SAMPLING_INTERVAL * i;
-            double fit_y = A * (Math.max(0, (ti - t0)) / constants.getTp()) * Math.exp(1 - (ti - t0) / constants.getTp()) + constants.getPedestal();
-            chisq += Math.pow((fit_y - samples[i]) / constants.getNoise(), 2);
-        }
-        fit.setChiSq(chisq);
-
-        if (A > 0) {
-//			return ChisqProb.gammp(samples.length - 2, chisq);
-            return chisq / (samples.length - 2);
-        } else {
-            return Double.POSITIVE_INFINITY;
-        }
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSShaperFitAlgorithm.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSShaperFitAlgorithm.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSShaperFitAlgorithm.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,18 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.hps.recon.tracking;
-
-import org.hps.conditions.deprecated.HPSSVTCalibrationConstants.ChannelConstants;
-import org.lcsim.event.RawTrackerHit;
-
-/**
- *
- * @author mgraham
- */
-public interface HPSShaperFitAlgorithm {
-    
-    public HPSShapeFitParameters fitShape(RawTrackerHit rth, ChannelConstants constants);
-
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSStripMaker.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSStripMaker.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSStripMaker.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,353 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.hps.recon.tracking;
-
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.IReadout;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.tracker.silicon.ChargeCarrier;
-import org.lcsim.detector.tracker.silicon.DopedSilicon;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
-import org.lcsim.detector.tracker.silicon.SiStrips;
-import org.lcsim.detector.tracker.silicon.SiTrackerIdentifierHelper;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.recon.tracking.digitization.sisim.SiSensorSim;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
-import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType;
-
-/**
- *
- * @author mgraham
- */
-public class HPSStripMaker {
-
-    private static String _NAME = "HPSStripClusterer";
-    // Clustering algorithm
-    HPSClusteringAlgorithm _clustering;
-    // Number of strips beyond which charge is averaged on center strips
-    int _max_noaverage_nstrips = 4;
-    // Absolute maximum cluster size
-    int _max_cluster_nstrips = 10;
-    // Sensor simulation needed to correct for Lorentz drift
-    SiSensorSim _simulation;
-    // Identifier helper (reset once per sensor)
-    SiTrackerIdentifierHelper _sid_helper;    
-    // Temporary map connecting hits to strip numbers for sake of speed (reset once per sensor)
-    Map<HPSFittedRawTrackerHit, Integer> _strip_map = new HashMap<HPSFittedRawTrackerHit, Integer>();
-    double _oneClusterErr = 1 / Math.sqrt(12);
-    double _twoClusterErr = 1 / 5;
-    double _threeClusterErr = 1 / 3;
-    double _fourClusterErr = 1 / 2;
-    double _fiveClusterErr = 1;
-    
-    boolean _debug = false;
-    
-    public HPSStripMaker(HPSClusteringAlgorithm algo) {
-        _clustering = algo;
-    }
-
-    public HPSStripMaker(SiSensorSim simulation, HPSClusteringAlgorithm algo) {
-        _clustering = algo;
-        _simulation = simulation;
-    }
-
-    public String getName() {
-        return _NAME;
-    }
-
-    // Make hits for all sensors within a DetectorElement
-    public List<SiTrackerHit> makeHits(IDetectorElement detector) {
-        System.out.println("makeHits(IDetectorElement): " + detector.getName());
-        List<SiTrackerHit> hits = new ArrayList<SiTrackerHit>();
-        List<SiSensor> sensors = detector.findDescendants(SiSensor.class);
-
-        // Loop over all sensors
-        for (SiSensor sensor : sensors) {
-            if (sensor.hasStrips()) {
-                hits.addAll(makeHits(sensor));
-            }
-        }
-
-        // Return hit list
-        return hits;
-    }
-
-    // Make hits for a sensor
-    public List<SiTrackerHit> makeHits(SiSensor sensor) {
-
-        //System.out.println("makeHits: " + sensor.getName());
-
-        List<SiTrackerHit> hits = new ArrayList<SiTrackerHit>();
-
-        // Get SiTrackerIdentifierHelper for this sensor and refresh the strip map used to increase speed
-        _sid_helper = (SiTrackerIdentifierHelper) sensor.getIdentifierHelper();
-        _strip_map.clear();
-
-        // Get hits for this sensor
-        IReadout ro = sensor.getReadout();
-        List<HPSFittedRawTrackerHit> hps_hits = ro.getHits(HPSFittedRawTrackerHit.class);
-
-        Map<SiSensorElectrodes, List<HPSFittedRawTrackerHit>> electrode_hits = new HashMap<SiSensorElectrodes, List<HPSFittedRawTrackerHit>>();
-
-        for (HPSFittedRawTrackerHit hps_hit : hps_hits) {
-
-            // get id and create strip map, get electrodes.
-            IIdentifier id = hps_hit.getRawTrackerHit().getIdentifier();
-            _strip_map.put(hps_hit, _sid_helper.getElectrodeValue(id));
-
-            // Get electrodes and check that they are strips
-            //System.out.println("proc raw hit from: " + DetectorElementStore.getInstance().find(raw_hit.getIdentifier()).get(0).getName());
-            ChargeCarrier carrier = ChargeCarrier.getCarrier(_sid_helper.getSideValue(id));
-            SiSensorElectrodes electrodes = ((SiSensor) hps_hit.getRawTrackerHit().getDetectorElement()).getReadoutElectrodes(carrier);
-            if (!(electrodes instanceof SiStrips)) {
-                continue;
-            }
-
-            if (electrode_hits.get(electrodes) == null) {
-                electrode_hits.put(electrodes, new ArrayList<HPSFittedRawTrackerHit>());
-            }
-
-            electrode_hits.get(electrodes).add(hps_hit);
-        }
-
-        for (Map.Entry entry : electrode_hits.entrySet()) {
-            hits.addAll(makeHits(sensor, (SiStrips) entry.getKey(), (List<HPSFittedRawTrackerHit>) entry.getValue()));
-        }
-
-        return hits;
-    }
-
-    public List<SiTrackerHit> makeHits(SiSensor sensor, SiSensorElectrodes electrodes, List<HPSFittedRawTrackerHit> hps_hits) {
-
-
-
-        //  Call the clustering algorithm to make clusters
-        List<List<HPSFittedRawTrackerHit>> cluster_list = _clustering.findClusters(hps_hits);
-
-        //  Create an empty list for the pixel hits to be formed from clusters
-        List<SiTrackerHit> hits = new ArrayList<SiTrackerHit>();
-
-        //  Make a pixel hit from this cluster
-        for (List<HPSFittedRawTrackerHit> cluster : cluster_list) {
-
-            // Make a TrackerHit from the cluster if it meets max cluster size requirement
-            if (cluster.size() <= _max_cluster_nstrips) {
-                SiTrackerHitStrip1D hit = makeTrackerHit(cluster, electrodes);
-                // Add to readout and to list of hits
-//                ((SiSensor) electrodes.getDetectorElement()).getReadout().addHit(hit);
-                hits.add(hit);
-                sensor.getReadout().addHit(hit);
-            }
-        }
-
-        return hits;
-    }
-
-    public void SetOneClusterErr(double err) {
-        _oneClusterErr = err;
-    }
-
-    public void SetTwoClusterErr(double err) {
-        _twoClusterErr = err;
-    }
-
-    public void SetThreeClusterErr(double err) {
-        _threeClusterErr = err;
-    }
-
-    public void SetFourClusterErr(double err) {
-        _fourClusterErr = err;
-    }
-
-    public void SetFiveClusterErr(double err) {
-        _fiveClusterErr = err;
-    }
-
-    public void setCentralStripAveragingThreshold(int max_noaverage_nstrips) {
-        _max_noaverage_nstrips = max_noaverage_nstrips;
-    }
-
-    public void setMaxClusterSize(int max_cluster_nstrips) {
-        _max_cluster_nstrips = max_cluster_nstrips;
-    }
-
-    private SiTrackerHitStrip1D makeTrackerHit(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " makeTrackerHit ");
-        Hep3Vector position = getPosition(cluster, electrodes);
-        SymmetricMatrix covariance = getCovariance(cluster, electrodes);
-        double time = getTime(cluster);
-        double energy = getEnergy(cluster);
-        TrackerHitType type = new TrackerHitType(TrackerHitType.CoordinateSystem.GLOBAL, TrackerHitType.MeasurementType.STRIP_1D);
-        List<RawTrackerHit> rth_cluster = new ArrayList<RawTrackerHit>();
-        for (HPSFittedRawTrackerHit bth : cluster) {
-            rth_cluster.add(bth.getRawTrackerHit());
-        }
-        SiTrackerHitStrip1D hit = new SiTrackerHitStrip1D(position, covariance, energy, time, rth_cluster, type);
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " SiTrackerHitStrip1D created at " + position + "(" + hit.getPositionAsVector().toString()+")" + " E " + energy + " time " + time);
-        return hit;
-    }
-
-    private Hep3Vector getPosition(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " getPosition for cluster size " + cluster.size());
-        List<Double> signals = new ArrayList<Double>();
-        List<Hep3Vector> positions = new ArrayList<Hep3Vector>();
-
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " Loop of " + cluster.size() + " and add signals and positions to vectors");
-        
-        for (HPSFittedRawTrackerHit hit : cluster) {
-            signals.add(hit.getAmp());
-            positions.add(((SiStrips) electrodes).getStripCenter(_strip_map.get(hit)));
-            if(_debug) System.out.println(this.getClass().getSimpleName() + " Added hit with signal " + hit.getAmp() + " at strip center posiiton " + (((SiStrips) electrodes).getStripCenter(_strip_map.get(hit))));
-        }
-
-        // Average charge on central strips of longer clusters
-        if (signals.size() > _max_noaverage_nstrips) {
-            int nstrips_center = signals.size() - 2;
-
-            // collect sum of charges on center strips
-            double center_charge_sum = 0.0;
-            for (int istrip = 1; istrip < signals.size() - 1; istrip++) {
-                center_charge_sum += signals.get(istrip);
-            }
-
-            // distribute evenly on center strips
-            double center_charge_strip = center_charge_sum / nstrips_center;
-            for (int istrip = 1; istrip < signals.size() - 1; istrip++) {
-                signals.set(istrip, center_charge_strip);
-            }
-        }
-
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " Calculate charge weighted mean for " + signals.size() + " signals");
-        
-        double total_charge = 0;
-        Hep3Vector position = new BasicHep3Vector(0, 0, 0);
-
-        for (int istrip = 0; istrip < signals.size(); istrip++) {
-            double signal = signals.get(istrip);
-
-            total_charge += signal;
-            position = VecOp.add(position, VecOp.mult(signal, positions.get(istrip)));
-            if(_debug) System.out.println(this.getClass().getSimpleName() + "strip " + istrip+": signal " + signal + " position " + positions.get(istrip) + " -> total_position " + position.toString() + " ( total charge " + total_charge + ")");
-            
-        }
-        position = VecOp.mult(1 / total_charge, position);
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " charge weighted position "+position.toString() + " (before trans)");
-        electrodes.getParentToLocal().inverse().transform(position);
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " charge weighted position "+position.toString() + " (after trans)");
-        
-        // Swim position back through lorentz drift direction to midpoint between bias surfaces
-        if(_simulation!=null) {
-            _simulation.setSensor((SiSensor) electrodes.getDetectorElement());
-            _simulation.lorentzCorrect(position, electrodes.getChargeCarrier());
-            if(_debug) System.out.println(this.getClass().getSimpleName() + ": Position " + position.toString() + " ( after Lorentz)");
-        }
-        
-        // return position in global coordinates
-        Hep3Vector newpos = ((SiSensor) electrodes.getDetectorElement()).getGeometry().getLocalToGlobal().transformed(position);
-        if(_debug) System.out.println(this.getClass().getSimpleName() + " final cluster position "+newpos.toString());
-        
-        return ((SiSensor) electrodes.getDetectorElement()).getGeometry().getLocalToGlobal().transformed(position);
-//        return electrodes.getLocalToGlobal().transformed(position);
-    }
-
-    private double getTime(List<HPSFittedRawTrackerHit> cluster) {
-        int time_sum = 0;
-        int signal_sum = 0;
-
-        for (HPSFittedRawTrackerHit hit : cluster) {
-
-            double signal = hit.getAmp();
-            double time = hit.getT0();
-
-            time_sum += time * signal;
-            signal_sum += signal;
-
-        }
-        return (double) time_sum / (double) signal_sum;
-    }
-
-    private SymmetricMatrix getCovariance(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        SymmetricMatrix covariance = new SymmetricMatrix(3);
-        covariance.setElement(0, 0, Math.pow(getMeasuredResolution(cluster, electrodes), 2));
-        covariance.setElement(1, 1, Math.pow(getUnmeasuredResolution(cluster, electrodes), 2));
-        covariance.setElement(2, 2, 0.0);
-
-        SymmetricMatrix covariance_global = electrodes.getLocalToGlobal().transformed(covariance);
-
-//        System.out.println("Global covariance matrix: \n"+covariance_global);
-
-        return covariance_global;
-
-//        BasicHep3Matrix rotation_matrix = (BasicHep3Matrix)electrodes.getLocalToGlobal().getRotation().getRotationMatrix();
-//        BasicHep3Matrix rotation_matrix_transposed = new BasicHep3Matrix(rotation_matrix);
-//        rotation_matrix_transposed.transpose();
-//
-////        System.out.println("Rotation matrix: \n"+rotation_matrix);
-////        System.out.println("Rotation matrix transposed: \n"+rotation_matrix_transposed);
-////        System.out.println("Local covariance matrix: \n"+covariance);
-//
-//        BasicHep3Matrix covariance_global = (BasicHep3Matrix)VecOp.mult(rotation_matrix,VecOp.mult(covariance,rotation_matrix_transposed));
-//
-////        System.out.println("Global covariance matrix: \n"+covariance_global);
-//
-//        return new SymmetricMatrix((Matrix)covariance_global);
-    }
-
-    private double getMeasuredResolution(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) // should replace this by a ResolutionModel class that gives expected resolution.  This could be a big job.
-    {
-        double measured_resolution;
-
-        double sense_pitch = ((SiSensor) electrodes.getDetectorElement()).getSenseElectrodes(electrodes.getChargeCarrier()).getPitch(0);
-
-//        double readout_pitch = electrodes.getPitch(0);
-//        double noise = _readout_chip.getChannel(strip_number).computeNoise(electrodes.getCapacitance(strip_number));
-//        double signal_expected = (0.000280/DopedSilicon.ENERGY_EHPAIR) *
-//                ((SiSensor)electrodes.getDetectorElement()).getThickness(); // ~280 KeV/mm for thick Si sensors
-
-        if (cluster.size() == 1) {
-            measured_resolution = sense_pitch * _oneClusterErr;
-        } else if (cluster.size() == 2) {
-            measured_resolution = sense_pitch * _twoClusterErr;
-        } else if (cluster.size() == 3) {
-            measured_resolution = sense_pitch * _threeClusterErr;
-        } else if (cluster.size() == 4) {
-            measured_resolution = sense_pitch * _fourClusterErr;
-        } else {
-            measured_resolution = sense_pitch * _fiveClusterErr;
-        }
-
-        return measured_resolution;
-    }
-
-    private double getUnmeasuredResolution(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
-        // Get length of longest strip in hit
-        double hit_length = 0;
-        for (HPSFittedRawTrackerHit hit : cluster) {
-            hit_length = Math.max(hit_length, ((SiStrips) electrodes).getStripLength(_strip_map.get(hit)));
-        }
-        return hit_length / Math.sqrt(12);
-    }
-
-    private double getEnergy(List<HPSFittedRawTrackerHit> cluster) {
-        double total_charge = 0.0;
-        for (HPSFittedRawTrackerHit hit : cluster) {
-            double signal = hit.getAmp();
-            total_charge += signal;
-        }
-        return total_charge * DopedSilicon.ENERGY_EHPAIR;
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSTrack.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSTrack.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSTrack.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -26,26 +26,29 @@
 import org.lcsim.util.swim.Trajectory;
 
 /**
- * Class HPSTrack: extension of HelicalTrackFit to include HPS-specific
- * variables other useful things.
- *
+ * Class HPSTrack: extension of HelicalTrackFit to include HPS-specific variables other useful
+ * things.
+ * 
  * @author mgraham created on 6/27/2011
  */
+// TODO: Check how much of the added behavior and information is really needed here.
+// It might be better to pull out a lot of the analytical functionality into a utility class.
+// FIXME: There are many instance variables marked as unused in my IDE.
 public class HPSTrack extends HelicalTrackFit {
 
     private BeamSpot _beam;
-    //all of the variables defined below are in the jlab (detector) frame
-    //this position & momentum are measured at the DOCA to the Y-axis,
-    //which is where the tracking returns it's parameters by default
+    // all of the variables defined below are in the jlab (detector) frame
+    // this position & momentum are measured at the DOCA to the Y-axis,
+    // which is where the tracking returns it's parameters by default
     private Hep3Vector _pDocaY;
     private Hep3Vector _posDocaY;
-    //the position & momentum of the track at the intersection of the target (z=0)
+    // the position & momentum of the track at the intersection of the target (z=0)
     private Hep3Vector _pTarget;
     private Hep3Vector _posTarget;
-    //the position & momentum of the track at DOCA to the beam axis (z)
+    // the position & momentum of the track at DOCA to the beam axis (z)
     private Hep3Vector _pDocaZ;
     private Hep3Vector _posDocaZ;
-    private double bField = 0.491;  //  make this set-able
+    private double bField = 0.491; // make this set-able
     private boolean _debug = false;
     private boolean _debugForward = false;
     private Trajectory _trajectory;
@@ -53,9 +56,7 @@
     Map<Pair<Integer, Integer>, Pair<Double, Double>> _fieldBins;
     private MCParticle mcParticle;
 
-    public HPSTrack(double[] pars, SymmetricMatrix cov, double[] chisq, int[] ndf,
-            Map<HelicalTrackHit, Double> smap, Map<HelicalTrackHit, MultipleScatter> msmap,
-            BeamSpot beam) {
+    public HPSTrack(double[] pars, SymmetricMatrix cov, double[] chisq, int[] ndf, Map<HelicalTrackHit, Double> smap, Map<HelicalTrackHit, MultipleScatter> msmap, BeamSpot beam) {
         super(pars, cov, chisq, ndf, smap, msmap);
         _beam = beam;
         calculateParametersAtTarget();
@@ -63,8 +64,7 @@
         calculateParametersAtDocaZ();
     }
 
-    public HPSTrack(double[] pars, SymmetricMatrix cov, double[] chisq, int[] ndf,
-            Map<HelicalTrackHit, Double> smap, Map<HelicalTrackHit, MultipleScatter> msmap) {
+    public HPSTrack(double[] pars, SymmetricMatrix cov, double[] chisq, int[] ndf, Map<HelicalTrackHit, Double> smap, Map<HelicalTrackHit, MultipleScatter> msmap) {
         super(pars, cov, chisq, ndf, smap, msmap);
         calculateParametersAtTarget();
         calculateParametersAtDocaY();
@@ -86,8 +86,7 @@
         calculateParametersAtDocaZ();
     }
 
-    public HPSTrack(double[] parameters, SymmetricMatrix covariance, double[] chiSquared, int[] ndf,
-            Map<HelicalTrackHit, Double> sMap, Map<HelicalTrackHit, MultipleScatter> msMap, MCParticle mcParticle) {
+    public HPSTrack(double[] parameters, SymmetricMatrix covariance, double[] chiSquared, int[] ndf, Map<HelicalTrackHit, Double> sMap, Map<HelicalTrackHit, MultipleScatter> msMap, MCParticle mcParticle) {
         super(parameters, covariance, chiSquared, ndf, sMap, msMap);
 
         // Set the MC particle associated with this fit
@@ -103,7 +102,7 @@
         Double zVal = zStart;
         Integer nstep = 0;
         while (zVal < zStop) {
-            Double[] xyz = {0.0, 0.0, 0.0};
+            Double[] xyz = { 0.0, 0.0, 0.0 };
             double s = HelixUtils.PathToXPlane(this, zVal, 1000.0, 1).get(0);
             xyz[0] = HelixUtils.PointOnHelix(this, s).y();
             xyz[1] = HelixUtils.PointOnHelix(this, s).z();
@@ -125,7 +124,7 @@
 
         Integer nstep = 0;
         while (zVal < zStop) {
-            Double[] xyz = {0.0, 0.0, 0.0};
+            Double[] xyz = { 0.0, 0.0, 0.0 };
             double s = HelixUtils.PathToXPlane(this, zVal, 1000.0, 1).get(0);
             xyz[0] = HelixUtils.Direction(this, s).y();
             xyz[1] = HelixUtils.Direction(this, s).z();
@@ -139,12 +138,12 @@
 
     private void calculateParametersAtTarget() {
         double pTot = this.p(bField);
-        //currently, PathToXPlane only returns a single path (no loopers!)
+        // currently, PathToXPlane only returns a single path (no loopers!)
         List<Double> paths = HelixUtils.PathToXPlane(this, 0.0, 100.0, 1);
         Hep3Vector posTargetTrkSystem = HelixUtils.PointOnHelix(this, paths.get(0));
         Hep3Vector dirTargetTrkSystem = HelixUtils.Direction(this, paths.get(0));
-        _posTarget = HPSTransformations.transformVectorToDetector(posTargetTrkSystem);
-        _pTarget = VecOp.mult(pTot, HPSTransformations.transformVectorToDetector(dirTargetTrkSystem));
+        _posTarget = CoordinateTransformations.transformVectorToDetector(posTargetTrkSystem);
+        _pTarget = VecOp.mult(pTot, CoordinateTransformations.transformVectorToDetector(dirTargetTrkSystem));
 
     }
 
@@ -152,8 +151,8 @@
         double pTot = this.p(bField);
         Hep3Vector posDocaYTrkSystem = HelixUtils.PointOnHelix(this, 0);
         Hep3Vector dirDocaYTrkSystem = HelixUtils.Direction(this, 0);
-        _posDocaY = HPSTransformations.transformVectorToDetector(posDocaYTrkSystem);
-        _pDocaY = VecOp.mult(pTot, HPSTransformations.transformVectorToDetector(dirDocaYTrkSystem));
+        _posDocaY = CoordinateTransformations.transformVectorToDetector(posDocaYTrkSystem);
+        _pDocaY = VecOp.mult(pTot, CoordinateTransformations.transformVectorToDetector(dirDocaYTrkSystem));
 
     }
 
@@ -162,25 +161,25 @@
         double sAtDocaZ = findPathToDocaZ();
         Hep3Vector posDocaZTrkSystem = HelixUtils.PointOnHelix(this, sAtDocaZ);
         Hep3Vector dirDocaZTrkSystem = HelixUtils.Direction(this, sAtDocaZ);
-        _posDocaZ = HPSTransformations.transformVectorToDetector(posDocaZTrkSystem);
-        _pDocaZ = VecOp.mult(pTot, HPSTransformations.transformVectorToDetector(dirDocaZTrkSystem));
+        _posDocaZ = CoordinateTransformations.transformVectorToDetector(posDocaZTrkSystem);
+        _pDocaZ = VecOp.mult(pTot, CoordinateTransformations.transformVectorToDetector(dirDocaZTrkSystem));
     }
 
-//    public Hep3Vector getPositionAtZ(double xFinal, double fringeHalfWidth, double step) {
-//        double startFringeUpstream = -2 * fringeHalfWidth;
-//        double stopFringeUpstream = 0;
-//        if (_debug)
-//            System.out.println(this.toString());
-//
-//
-//    }
+    // public Hep3Vector getPositionAtZ(double xFinal, double fringeHalfWidth, double step) {
+    // double startFringeUpstream = -2 * fringeHalfWidth;
+    // double stopFringeUpstream = 0;
+    // if (_debug)
+    // System.out.println(this.toString());
+    //
+    //
+    // }
     public Hep3Vector getPositionAtZ(double xFinal, double start, double stop, double step) {
 
         double startFringe = start;
         double stopFringe = stop;
-        //       _debugForward = false;
-        //       if (xFinal > 900)
-        //           _debugForward = true;
+        // _debugForward = false;
+        // if (xFinal > 900)
+        // _debugForward = true;
         // if looking upstream, we'll be propagating backwards
         if (xFinal < 0) {
             step = -step;
@@ -206,14 +205,9 @@
         double q = Math.signum(this.curvature());
         double phitmp = getPhi(xtmp, ytmp, xCtmp, yCtmp, q);
         if (_debugForward) {
-            System.out.println("\nOriginal xtmp = " + xtmp
-                    + "; ytmp = " + ytmp
-                    + "; ztmp = " + ztmp
-                    + "; phitmp = " + phitmp);
+            System.out.println("\nOriginal xtmp = " + xtmp + "; ytmp = " + ytmp + "; ztmp = " + ztmp + "; phitmp = " + phitmp);
 
-            System.out.println("nOriginal Rorig = " + Rorig
-                    + "; xCtmp = " + xCtmp
-                    + "; yCtmp = " + yCtmp);
+            System.out.println("nOriginal Rorig = " + Rorig + "; xCtmp = " + xCtmp + "; yCtmp = " + yCtmp);
         }
         if (_debugForward) {
             System.out.println("Original Direction at Fringe: " + HelixUtils.Direction(this, startFringe).toString());
@@ -238,7 +232,7 @@
             System.out.println("Extrpolating straight back from startFringe = (" + fooFinal.x() + "," + fooFinal.y() + "," + fooFinal.z() + ")");
 
         }
-        //follow trajectory while:  in fringe field, before end point, and we don't have a looper
+        // follow trajectory while: in fringe field, before end point, and we don't have a looper
         while (Math.signum(step) * xtmp < Math.signum(step) * stopFringe && Math.signum(step) * xtmp < Math.signum(step) * xFinal && Math.signum(pXOrig * pXTmp) > 0) {
             if (_debugForward) {
                 System.out.println("New step in Fringe Field");
@@ -249,7 +243,7 @@
             }
 
             double fringeFactor = getFringe(Math.signum(step) * (fringeMid - rTmp.x()), fringeHalfWidth);
-//            double myBField=bField * fringeFactor;
+            // double myBField=bField * fringeFactor;
             double myBField = FieldMap.getFieldFromMap(rTmp.x(), rTmp.y());
             if (_debugForward) {
                 System.out.println("rTmp.x() = " + rTmp.x() + " field = " + myBField);
@@ -266,38 +260,34 @@
             }
             totalS += step;
         }
-        //ok, done with field...extrapolate straight back...
+        // ok, done with field...extrapolate straight back...
         Hep3Vector pointInTrking;
         if (Math.signum(step) * xtmp < Math.signum(step) * xFinal) {
-            //get direction of the track before it hits fringe field
+            // get direction of the track before it hits fringe field
             double deltaX = xFinal - xtmp;
             Hep3Vector dir = _trajectory.getUnitTangentAtLength(0);
-//            double deltaY = deltaX * dir.y();
-//            double deltaZ = deltaX * dir.z();
+            // double deltaY = deltaX * dir.y();
+            // double deltaZ = deltaX * dir.z();
             Hep3Vector delta = extrapolateStraight(dir, deltaX);
-//            double deltaZ = Math.sqrt(deltaX*deltaX+deltaY*deltaY)* dir.z();
+            // double deltaZ = Math.sqrt(deltaX*deltaX+deltaY*deltaY)* dir.z();
             pointInTrking = new BasicHep3Vector(xFinal, delta.y() + ytmp, delta.z() + ztmp);
 
             if (_debugForward) {
-                System.out.println("Pointing straight forward from xtmp = " + xtmp
-                        + "; ytmp = " + ytmp
-                        + "; ztmp = " + ztmp
-                        + "; deltaX= " + deltaX);
+                System.out.println("Pointing straight forward from xtmp = " + xtmp + "; ytmp = " + ytmp + "; ztmp = " + ztmp + "; deltaX= " + deltaX);
                 System.out.println("Directions:  " + dir.toString());
                 System.out.println("Position at ECal:  x = " + xFinal + "; y = " + pointInTrking.y() + "; z = " + pointInTrking.z());
 
             }
-        } else {  // still in the fringe field...just return the current position
-//            pointInTrking = new BasicHep3Vector(xFinal, ytmp, ztmp);
+        } else { // still in the fringe field...just return the current position
+        // pointInTrking = new BasicHep3Vector(xFinal, ytmp, ztmp);
             pointInTrking = new BasicHep3Vector(rTmp.x(), rTmp.y(), rTmp.z());
         }
-        return HPSTransformations.transformVectorToDetector(pointInTrking);
+        return CoordinateTransformations.transformVectorToDetector(pointInTrking);
     }
 
     /**
-     * Get the position and direction on the track using B-field map for
-     * extrapolation
-     *
+     * Get the position and direction on the track using B-field map for extrapolation
+     * 
      * @param start = starting z-position of extrapolation
      * @param zFinal = final z-position
      * @param step = step size
@@ -336,14 +326,9 @@
         double q = Math.signum(this.curvature());
         double phitmp = getPhi(xtmp, ytmp, xCtmp, yCtmp, q);
         if (_debugForward) {
-            System.out.println("\nOriginal xtmp = " + xtmp
-                    + "; ytmp = " + ytmp
-                    + "; ztmp = " + ztmp
-                    + "; phitmp = " + phitmp);
+            System.out.println("\nOriginal xtmp = " + xtmp + "; ytmp = " + ytmp + "; ztmp = " + ztmp + "; phitmp = " + phitmp);
 
-            System.out.println("nOriginal Rorig = " + Rorig
-                    + "; xCtmp = " + xCtmp
-                    + "; yCtmp = " + yCtmp);
+            System.out.println("nOriginal Rorig = " + Rorig + "; xCtmp = " + xCtmp + "; yCtmp = " + yCtmp);
         }
         if (_debugForward) {
             System.out.println("Original Direction at Fringe: " + HelixUtils.Direction(this, startFringe).toString());
@@ -368,7 +353,7 @@
             System.out.println("Extrpolating straight back from startFringe = (" + fooFinal.x() + "," + fooFinal.y() + "," + fooFinal.z() + ")");
 
         }
-        //follow trajectory while:  in fringe field, before end point, and we don't have a looper
+        // follow trajectory while: in fringe field, before end point, and we don't have a looper
         while (Math.signum(step) * xtmp < Math.signum(step) * xFinal && Math.signum(pXOrig * pXTmp) > 0) {
             if (_debugForward) {
                 System.out.println("New step in Fringe Field");
@@ -395,7 +380,7 @@
             totalS += step;
         }
 
-        //Go with finer granularity in the end
+        // Go with finer granularity in the end
         rTmp = _trajectory.getPointAtDistance(0);
         xtmp = rTmp.x();
         pTmp = VecOp.mult(pTot, _trajectory.getUnitTangentAtLength(step));
@@ -428,18 +413,18 @@
             totalS += step;
         }
 
-        //ok, done with field.
+        // ok, done with field.
         Hep3Vector pointInTrking = new BasicHep3Vector(rTmp.x(), rTmp.y(), rTmp.z());
         if (_debugForward) {
             System.out.println("Position xfinal (tracking) :  x = " + xFinal + "; y = " + pointInTrking.y() + "; z = " + pointInTrking.z());
         }
-        Hep3Vector[] out = {HPSTransformations.transformVectorToDetector(pointInTrking), HPSTransformations.transformVectorToDetector(pTmp)};
+        Hep3Vector[] out = { CoordinateTransformations.transformVectorToDetector(pointInTrking), CoordinateTransformations.transformVectorToDetector(pTmp) };
 
         return out;
     }
 
     private double getPhi(double x, double y, double xc, double yc, double sign) {
-        //      System.out.println("Math.atan2(y - yc, x - xc)="+Math.atan2(y - yc, x - xc));
+        // System.out.println("Math.atan2(y - yc, x - xc)="+Math.atan2(y - yc, x - xc));
         return Math.atan2(y - yc, x - xc) - sign * Math.PI / 2;
     }
 
@@ -449,9 +434,9 @@
         return new BasicHep3Vector(deltaX, deltaY, deltaZ);
     }
 
-    //field that changes linearly from Bmax->0
+    // field that changes linearly from Bmax->0
     private double getFringe(double x, double halfWidth) {
-//        System.out.println("x = " + x + "; halfWidth = " + halfWidth);
+        // System.out.println("x = " + x + "; halfWidth = " + halfWidth);
         if (x / halfWidth > 1) {
             return 1;
         }
@@ -466,18 +451,18 @@
         double ux = Math.cos(phi) * this.sth();
         double uy = Math.sin(phi) * this.sth();
         double uz = this.cth();
-        //  Return the direction unit vector
+        // Return the direction unit vector
         return new BasicHep3Vector(ux, uy, uz);
     }
 
     private double findPathToDocaZ() {
-        double step = 0.1;//100 um step size
-        double maxS = 100.0; //go to 10cm
+        double step = 0.1;// 100 um step size
+        double maxS = 100.0; // go to 10cm
         double s = -30;
         double minDist = 999999;
         double minS = s;
         double dist = 999998;
-        //once the distance starts increasing, quit and return
+        // once the distance starts increasing, quit and return
         while (dist < minDist) {
             Hep3Vector pos = HelixUtils.PointOnHelix(this, s);
             dist = pos.y() * pos.y() + pos.z() * pos.z();
@@ -506,7 +491,7 @@
 
     /**
      * Get the MC Particle associated with the HelicalTrackFit
-     *
+     * 
      * @return mcParticle :
      */
     public MCParticle getMCParticle() {
@@ -515,7 +500,7 @@
 
     /**
      * Set the MC Particle associated with the HelicalTrackFit
-     *
+     * 
      * @param mcParticle :
      */
     public void setMCParticle(MCParticle mcParticle) {

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HPSTransformations.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSTransformations.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HPSTransformations.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,66 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.hps.recon.tracking;
-
-import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.BasicHep3Matrix;
-import hep.physics.vec.Hep3Matrix;
-import hep.physics.vec.Hep3Vector;
-
-import org.lcsim.detector.Rotation3D;
-import org.lcsim.detector.Transform3D;
-
-/**
- *  Class that contains the transformations between the JLAB and lcsim tracking coordinate systems
- * @author mgraham, phansson
- * created 6/27/2011
- * made static 10/14/2013
- * 
- */
-public class HPSTransformations {
-
-    private static final Transform3D _detToTrk = HPSTransformations.initialize();
-
-    /**
-     * Private constructor to prevent initialization
-     */
-    private HPSTransformations() {
-    }
-
-    /**
-     * Static private initialization of transform
-     * @return transform
-     */
-    private static Transform3D initialize() {
-    	BasicHep3Matrix tmp = new BasicHep3Matrix();
-        tmp.setElement(0, 2, 1);
-        tmp.setElement(1, 0, 1);
-        tmp.setElement(2, 1, 1);
-        return new Transform3D(new Rotation3D(tmp));
-    }
-    
-    public static Hep3Vector transformVectorToTracking(Hep3Vector vec) {
-        return _detToTrk.transformed(vec);
-    }
-
-    public static SymmetricMatrix transformCovarianceToTracking(SymmetricMatrix cov) {
-        return _detToTrk.transformed(cov);
-    }
-
-    public static Hep3Vector transformVectorToDetector(Hep3Vector vec) {
-        return (_detToTrk.inverse()).transformed(vec);
-    }
-
-    public static SymmetricMatrix transformCovarianceToDetector(SymmetricMatrix cov) {
-        return (_detToTrk.inverse()).transformed(cov);
-    }
-    public static Transform3D getTransform(){
-        return _detToTrk;
-    }
-    public static Hep3Matrix getMatrix(){
-        return _detToTrk.getRotation().getRotationMatrix();
-    }
-    
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HelicalTrackHitDriver.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelicalTrackHitDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelicalTrackHitDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -37,8 +37,9 @@
  * @author Mathew Graham <[log in to unmask]>
  * @author Per Hansson <[log in to unmask]>
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: HelicalTrackHitDriver.java,v 1.10 2013/10/17 22:08:33 omoreno Exp $          
+ * @version $Id: HelicalTrackHitDriver.java,v 1.10 2013/10/17 22:08:33 omoreno Exp $
  */
+// TODO: Add class documentation.
 public class HelicalTrackHitDriver extends org.lcsim.fit.helicaltrack.HelicalTrackHitDriver {
 
     private boolean _debug = false;
@@ -238,7 +239,6 @@
 
                 } // Loop over SiTrackerHits
 
-
                 if (_debug)
                     System.out.printf("%s: Create stereo hits from %d strips \n", this.getClass().getSimpleName(), striplistmap.size());
 
@@ -250,14 +250,13 @@
                     String id2 = _stereomap.get(id1);
 
                     if (_debug) {
-                        System.out.printf("%s: Form stereo hits from sensor id %s with %d hits and %s with %d hits\n", this.getClass().getSimpleName(), id1, striplistmap.get(id1) == null ? 0
-                                : striplistmap.get(id1).size(), id2, striplistmap.get(id2) == null ? 0 : striplistmap.get(id2).size());
+                        System.out.printf("%s: Form stereo hits from sensor id %s with %d hits and %s with %d hits\n", this.getClass().getSimpleName(), id1, striplistmap.get(id1) == null ? 0 : striplistmap.get(id1).size(), id2, striplistmap.get(id2) == null ? 0 : striplistmap.get(id2).size());
                     }
 
                     /*
-                     * Form the stereo hits and add them to our hit list Add LC
-                     * relations for stereo hit to SiTrackHitStrip1D object Add
-                     * LC relation between MC particle and stereo hit
+                     * Form the stereo hits and add them to our hit list Add LC relations for
+                     * stereo hit to SiTrackHitStrip1D object Add LC relation between MC particle
+                     * and stereo hit
                      */
                     List<HelicalTrackCross> cross_list = _crosser.MakeHits(striplistmap.get(id1), striplistmap.get(id2));
 
@@ -300,10 +299,9 @@
 
         } else if (LayerGeometryType.Split == _layerGeometryType) {
 
-        	
             // If the event does not have hit clusters, skip it.
-            if (!event.hasCollection(SiTrackerHit.class, _clusterCollectionName)){
-                if(_debug){
+            if (!event.hasCollection(SiTrackerHit.class, _clusterCollectionName)) {
+                if (_debug) {
                     System.out.println("Event: " + event.getRunNumber() + " does not contain the collection " + _clusterCollectionName);
                 }
                 return;
@@ -312,7 +310,6 @@
             // Get the list of SiTrackerHits for this collection
             List<SiTrackerHit> hitlist = event.get(SiTrackerHit.class, _clusterCollectionName);
 
-
             if (_debug) {
                 System.out.printf("%s: found %d SiTrackerHits\n", this.getClass().getSimpleName(), hitlist.size());
             }
@@ -321,48 +318,47 @@
             Map<SiSensor, List<HelicalTrackStrip>> striplistmap = new HashMap<SiSensor, List<HelicalTrackStrip>>();
             for (SiTrackerHit hit : hitlist) {
 
-                    // Cast the hit as a 1D strip hit and find the identifier
-                    // for the detector/layer combo
-                    SiTrackerHitStrip1D h = (SiTrackerHitStrip1D) hit;
-                    SiSensor sensor = h.getSensor();
+                // Cast the hit as a 1D strip hit and find the identifier
+                // for the detector/layer combo
+                SiTrackerHitStrip1D h = (SiTrackerHitStrip1D) hit;
+                SiSensor sensor = h.getSensor();
 
-                    List<HelicalTrackStrip> hitsOnSensor = striplistmap.get(sensor);
+                List<HelicalTrackStrip> hitsOnSensor = striplistmap.get(sensor);
 
-                    // If no hits on that sensor yet -> create the list
-                    if (hitsOnSensor == null) {
-                        hitsOnSensor = new ArrayList<HelicalTrackStrip>();
-                        striplistmap.put(sensor, hitsOnSensor);
-                    }
+                // If no hits on that sensor yet -> create the list
+                if (hitsOnSensor == null) {
+                    hitsOnSensor = new ArrayList<HelicalTrackStrip>();
+                    striplistmap.put(sensor, hitsOnSensor);
+                }
 
-                    // Create a HelicalTrackStrip for this hit
-                    HelicalTrackStrip strip = makeDigiStrip(h);
-                    for (RawTrackerHit rth : h.getRawHits()) {
-                        for (Object simHit : hittomc.allFrom(rth)) {
-                            strip.addMCParticle(((SimTrackerHit) simHit).getMCParticle());
-                        }
+                // Create a HelicalTrackStrip for this hit
+                HelicalTrackStrip strip = makeDigiStrip(h);
+                for (RawTrackerHit rth : h.getRawHits()) {
+                    for (Object simHit : hittomc.allFrom(rth)) {
+                        strip.addMCParticle(((SimTrackerHit) simHit).getMCParticle());
                     }
+                }
 
-                    if ((_clusterTimeCut > 0 && Math.abs(h.getTime()) < _clusterTimeCut) || _clusterTimeCut < 0) {
-                        // Add the strip to the list of strips on this sensor
-                        hitsOnSensor.add(strip);
+                if ((_clusterTimeCut > 0 && Math.abs(h.getTime()) < _clusterTimeCut) || _clusterTimeCut < 0) {
+                    // Add the strip to the list of strips on this sensor
+                    hitsOnSensor.add(strip);
 
-                        // Map a reference back to the hit needed to create the
-                        // stereo hit LC relations
-                        stripmap.put(strip, h);
+                    // Map a reference back to the hit needed to create the
+                    // stereo hit LC relations
+                    stripmap.put(strip, h);
 
-                        if (_debug)
-                            System.out.printf("%s: added strip org %s layer %d\n", this.getClass().getSimpleName(), strip.origin().toString(), strip.layer());
-                    }
+                    if (_debug)
+                        System.out.printf("%s: added strip org %s layer %d\n", this.getClass().getSimpleName(), strip.origin().toString(), strip.layer());
+                }
             } // Loop over SiTrackerHits
 
-
             // for(StereoPair pair : _det.getStereoPairs()) {
             for (StereoPair stereoPair : SvtUtils.getInstance().getStereoPairs()) {
 
                 /*
-                 * Form the stereo hits and add them to our hit list Add LC
-                 * relations for stereo hit to SiTrackHitStrip1D object Add LC
-                 * relation between MC particle and stereo hit
+                 * Form the stereo hits and add them to our hit list Add LC relations for stereo
+                 * hit to SiTrackHitStrip1D object Add LC relation between MC particle and stereo
+                 * hit
                  */
 
                 List<HelicalTrackCross> helicalTrackCrosses = null;
@@ -373,10 +369,7 @@
                 }
 
                 if (_debug)
-                    System.out.printf("%s: Found %d stereo hits from sensors\n%s: %s : %d hits\n%s: %s with %d hits\n", this.getClass().getSimpleName(), helicalTrackCrosses.size(), this.getClass()
-                            .getSimpleName(), stereoPair.getAxialSensor().getName(), striplistmap.get(stereoPair.getAxialSensor()) == null ? 0 : striplistmap.get(stereoPair.getAxialSensor()).size(),
-                            this.getClass().getSimpleName(), stereoPair.getStereoSensor().getName(),
-                            striplistmap.get(stereoPair.getStereoSensor()) == null ? 0 : striplistmap.get(stereoPair.getStereoSensor()).size());
+                    System.out.printf("%s: Found %d stereo hits from sensors\n%s: %s : %d hits\n%s: %s with %d hits\n", this.getClass().getSimpleName(), helicalTrackCrosses.size(), this.getClass().getSimpleName(), stereoPair.getAxialSensor().getName(), striplistmap.get(stereoPair.getAxialSensor()) == null ? 0 : striplistmap.get(stereoPair.getAxialSensor()).size(), this.getClass().getSimpleName(), stereoPair.getStereoSensor().getName(), striplistmap.get(stereoPair.getStereoSensor()) == null ? 0 : striplistmap.get(stereoPair.getStereoSensor()).size());
 
                 for (HelicalTrackCross cross : helicalTrackCrosses) {
                     stereoCrosses.add(cross);
@@ -412,8 +405,8 @@
                 addRotatedHitsToEvent(event, stereoCrosses);
             }
 
-        } 
-        
+        }
+
     } // Process()
 
     public void addCollection(String colname) {
@@ -448,9 +441,8 @@
             throw new RuntimeException(this.getClass().getName() + ": No SiTrackerModules found in detector.");
         }
 
+        if (LayerGeometryType.Common == this._layerGeometryType) {
 
-       if (LayerGeometryType.Common == this._layerGeometryType) {
-
             int nLayersTotal = detector.getSubdetector(_subdetectorName).getLayering().getLayers().getNumberOfLayers();
             if (_debug) {
                 System.out.printf("%s: %d layers \n", this.getClass().getSimpleName(), nLayersTotal);
@@ -542,9 +534,9 @@
                 String detname = strip.detector();
                 int layer = strip.layer();
                 BarrelEndcapFlag bec = strip.BarrelEndcapFlag();
-                Hep3Vector neworigin = HPSTransformations.transformVectorToTracking(origin);
-                Hep3Vector newu = HPSTransformations.transformVectorToTracking(u);
-                Hep3Vector newv = HPSTransformations.transformVectorToTracking(v);
+                Hep3Vector neworigin = CoordinateTransformations.transformVectorToTracking(origin);
+                Hep3Vector newu = CoordinateTransformations.transformVectorToTracking(u);
+                Hep3Vector newv = CoordinateTransformations.transformVectorToTracking(v);
                 HelicalTrackStrip newstrip = new HelicalTrackStrip(neworigin, newu, newv, umeas, du, vmin, vmax, dedx, time, rthList, detname, layer, bec);
                 for (MCParticle p : strip.MCParticles()) {
                     newstrip.addMCParticle(p);

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HelixConverter.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelixConverter.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelixConverter.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,4 +1,3 @@
-    
 package org.hps.recon.tracking;
 
 import hep.physics.matrix.BasicMatrix;
@@ -15,19 +14,20 @@
  * Convert a helix to a straight line track at a specified reference plane normal to the x axis.
  * This code was developed for simulating the Heavy Photon Search experiment where the target is
  * located outside the magnetic field volume.
- *
+ * 
  * @author Richard Partridge
  */
+// FIXME: If this is copy-pasted from lcsim, what behavior was changed here?  Is it needed? --JM
 public class HelixConverter {
 
     private double _xref;
 
     /**
-     * Constructor for the HelixConverter used to convert helices to StraightLineTracks
-     * at the magnetic field boundary.  The reference point xref identifies
-     * the x coordinate that specifies the magnetic field boundary.  The StraightLineTracks
-     * produced by this class will use xref as their reference point.
-     *
+     * Constructor for the HelixConverter used to convert helices to StraightLineTracks at the
+     * magnetic field boundary. The reference point xref identifies the x coordinate that specifies
+     * the magnetic field boundary. The StraightLineTracks produced by this class will use xref as
+     * their reference point.
+     * 
      * @param xref x coordinate that specifies the magnetic field boundary
      */
     public HelixConverter(double xref) {
@@ -36,13 +36,13 @@
 
     /**
      * Convert a helix to a StraightLineTrack.
-     *
+     * 
      * @param helix helix to be converted
      * @return resulting StraightLineTrack
      */
     public StraightLineTrack Convert(HelicalTrackFit helix) {
 
-        //  Get helix parameters used in this calculation
+        // Get helix parameters used in this calculation
         double RC = helix.R();
         double xc = helix.xc();
         double yc = helix.yc();
@@ -51,57 +51,62 @@
         double slope = helix.slope();
         double z0 = helix.z0();
 
-        //  First find path length to reference point
+        // First find path length to reference point
         double arg = (xc - _xref) / RC;
-        if (Math.abs(arg) > 1.0) return null;
+        if (Math.abs(arg) > 1.0)
+            return null;
         double phi = Math.asin(arg);
         double dphi = phi0 - phi;
-        if (dphi > Math.PI) dphi -= 2. * Math.PI;
-        if (dphi < -Math.PI) dphi += 2. * Math.PI;
+        if (dphi > Math.PI)
+            dphi -= 2. * Math.PI;
+        if (dphi < -Math.PI)
+            dphi += 2. * Math.PI;
         double s = RC * dphi;
         double cphi = Math.cos(phi);
         double sphi = Math.sin(phi);
         double cphi0 = Math.cos(phi0);
         double sphi0 = Math.sin(phi0);
 
-        //  Get the track position at the reference point
+        // Get the track position at the reference point
         double xref = xc - RC * sphi;
-        if (Math.abs(xref - _xref) > 1.e-10) System.out.println("Bad path length - x0: "+xref+" xref: "+_xref);
+        if (Math.abs(xref - _xref) > 1.e-10)
+            System.out.println("Bad path length - x0: " + xref + " xref: " + _xref);
         double yref = yc + RC * cphi;
         double zref = z0 + s * slope;
 
-        //  Get dy/dx and dz/dx for the straight-line track
+        // Get dy/dx and dz/dx for the straight-line track
         double dydx = sphi / cphi;
         double dzdx = slope / cphi;
 
-        //  Calculate the Jacobian between the straight line track parameters and the helix parameters
-        MutableMatrix deriv = new BasicMatrix(4,5);
-        double dydcurv = (cphi0 + s / RC * sphi - cphi) * RC*RC;
+        // Calculate the Jacobian between the straight line track parameters and the helix
+        // parameters
+        MutableMatrix deriv = new BasicMatrix(4, 5);
+        double dydcurv = (cphi0 + s / RC * sphi - cphi) * RC * RC;
         deriv.setElement(StraightLineTrack.y0Index, HelicalTrackFit.curvatureIndex, dydcurv);
         deriv.setElement(StraightLineTrack.y0Index, HelicalTrackFit.dcaIndex, cphi0);
         double dydphi0 = (RC - d0) * sphi0 - RC * sphi;
         deriv.setElement(StraightLineTrack.y0Index, HelicalTrackFit.phi0Index, dydphi0);
         deriv.setElement(StraightLineTrack.z0Index, HelicalTrackFit.z0Index, 1.);
         deriv.setElement(StraightLineTrack.z0Index, HelicalTrackFit.slopeIndex, s);
-        deriv.setElement(StraightLineTrack.dydxIndex, HelicalTrackFit.curvatureIndex, -s / (cphi*cphi));
-        deriv.setElement(StraightLineTrack.dydxIndex, HelicalTrackFit.phi0Index, 1. / (cphi*cphi));
-        double dzslopedphi0 = sphi * slope / (cphi*cphi);
+        deriv.setElement(StraightLineTrack.dydxIndex, HelicalTrackFit.curvatureIndex, -s / (cphi * cphi));
+        deriv.setElement(StraightLineTrack.dydxIndex, HelicalTrackFit.phi0Index, 1. / (cphi * cphi));
+        double dzslopedphi0 = sphi * slope / (cphi * cphi);
         deriv.setElement(StraightLineTrack.dzdxIndex, HelicalTrackFit.curvatureIndex, -s * dzslopedphi0);
         deriv.setElement(StraightLineTrack.dzdxIndex, HelicalTrackFit.phi0Index, dzslopedphi0);
         deriv.setElement(StraightLineTrack.dzdxIndex, HelicalTrackFit.slopeIndex, 1. / cphi);
 
-        //  Calculate the covariance matrix
+        // Calculate the covariance matrix
         Matrix derivT = MatrixTranspose(deriv);
         SymmetricMatrix hcov = helix.covariance();
         Matrix cov = MatrixOp.mult(deriv, MatrixOp.mult(hcov, derivT));
         SymmetricMatrix scov = new SymmetricMatrix(cov);
-      
+
         return new StraightLineTrack(xref, yref, zref, dydx, dzdx, scov);
     }
 
-     /**
+    /**
      * Convert a helix to a StraightLineTrack.
-     *
+     * 
      * @param helix helix to be converted
      * @return resulting StraightLineTrack
      */
@@ -109,24 +114,22 @@
 
         Hep3Vector unitVec = helix.getUnitTangentAtLength(0);
         Hep3Vector posVec = helix.getPointAtDistance(0);
-        double dzdx = unitVec.z()/unitVec.x();
-        double dydx = unitVec.y()/unitVec.x();
-        double zref = posVec.z() - dzdx*(posVec.x()-_xref); 
-        double yref = posVec.y() - dydx*(posVec.x()-_xref); 
+        double dzdx = unitVec.z() / unitVec.x();
+        double dydx = unitVec.y() / unitVec.x();
+        double zref = posVec.z() - dzdx * (posVec.x() - _xref);
+        double yref = posVec.y() - dydx * (posVec.x() - _xref);
         SymmetricMatrix scov = null;
         StraightLineTrack slt = new StraightLineTrack(_xref, yref, zref, dydx, dzdx, scov);
-        //System.out.printf("%s: unitVec %s posVec %s\n",this.getClass().getSimpleName(),unitVec.toString(),posVec.toString());
-        //System.out.printf("%s: dzdx=%f dydx=%s\n",this.getClass().getSimpleName(),dzdx,dydx);
-        //System.out.printf("%s: ref = %f,%f,%f\n",this.getClass().getSimpleName(),_xref,yref,zref);
+        // System.out.printf("%s: unitVec %s posVec %s\n",this.getClass().getSimpleName(),unitVec.toString(),posVec.toString());
+        // System.out.printf("%s: dzdx=%f dydx=%s\n",this.getClass().getSimpleName(),dzdx,dydx);
+        // System.out.printf("%s: ref = %f,%f,%f\n",this.getClass().getSimpleName(),_xref,yref,zref);
         return slt;
     }
 
-    
-    
     /**
-     * Returns the transpose of the matrix (inexplicably not handled by
-     * the matrix package for non-square matrices).
-     *
+     * Returns the transpose of the matrix (inexplicably not handled by the matrix package for
+     * non-square matrices).
+     * 
      * @param m matrix to be transposed
      * @return transposed matrix
      */

java/trunk/tracking/src/main/java/org/hps/recon/tracking
HelixFitter.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelixFitter.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelixFitter.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,29 +1,24 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 package org.hps.recon.tracking;
 
-
 /**
  * HPS extension of the fitter algorithm to enable the use of local classes
- * @author Per Hansson Adrian <[log in to unmask]>
- * @version $Id: HelixFitter.java,v 1.2 2013/11/07 03:54:58 phansson Exp $ $Date: 2013/11/07 03:54:58 $ $Author: phansson $ 
+ * @author Per Hansson <[log in to unmask]>
+ * @version $Id: $
  */
+// FIXME: This class does not seem to override any of the superclass's behavior. Is it needed? --JM
 public class HelixFitter extends org.lcsim.recon.tracking.seedtracker.HelixFitter {
-    
+
     public HelixFitter(MaterialManager materialManager) {
         super(materialManager);
-        //replace the multiple scattering to that given as parameter to be able to use a local version and not lcsim one
+        // replace the multiple scattering to that given as parameter to be able to use a local
+        // version and not lcsim one
         _scattering = new MultipleScattering(materialManager);
 
     }
-    
+
     public void setDebug(boolean debug) {
         super.setDebug(debug);
         _scattering.setDebug(debug);
-    } 
-    
+    }
 
-
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
LCIOTrackAnalysis.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/LCIOTrackAnalysis.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/LCIOTrackAnalysis.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,169 +0,0 @@
-package org.hps.recon.tracking;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.hps.conditions.deprecated.SvtUtils;
-import org.lcsim.detector.identifier.IIdentifier;
-import org.lcsim.detector.identifier.Identifier;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-
-/**
- *
- * @author Sho Uemura <[log in to unmask]>
- * @version $Id: LCIOTrackAnalysis.java,v 1.3 2013/10/24 18:11:43 meeg Exp $
- */
-public class LCIOTrackAnalysis {
-
-    protected Track track;
-    protected MCParticle _mcp = null;
-    protected double _purity;
-    protected int _nhits;
-    protected int _nbadhits;
-    private int _nAxialhits;
-    private int _nZhits;
-    protected boolean _hasLayerOne;
-    private int[] _nStripHitsPerLayer = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-    protected Map<Integer, Hep3Vector> _hitLocationPerLayer = new HashMap<Integer, Hep3Vector>();
-    protected int _nhitsNew;
-
-    public Track getTrack() {
-        return track;
-    }
-
-    public LCIOTrackAnalysis(Track trk, RelationalTable hittomc, RelationalTable hittostrip, RelationalTable hittorotated) {
-        track = trk;
-
-        //  Get the number of hits on the track
-        _nhits = trk.getTrackerHits().size();
-
-        //  Create a map containing the number of hits for each MCParticle associated with the track
-        Map<MCParticle, Integer> mcmap = new HashMap<MCParticle, Integer>();
-        _hasLayerOne = false;
-        //  Loop over the hits on the track (HelicalTrackHits)
-        for (TrackerHit rotatedHit : trk.getTrackerHits()) {
-            TrackerHit hit = (TrackerHit) hittorotated.from(rotatedHit);
-            //  get the set of MCParticles associated with this hit and update the hit count for each MCParticle
-            Set<MCParticle> mclist = hittomc.allFrom(hit);
-//            System.out.println("MCParticle count: " + mclist.size());
-            for (MCParticle mcp : mclist) {
-                if (mcp != null) {
-//                System.out.println(mcp.getOrigin());
-                    Integer mchits = 0;
-                    if (mcmap.containsKey(mcp)) {
-                        mchits = mcmap.get(mcp);
-                    }
-                    mchits++;
-                    mcmap.put(mcp, mchits);
-                }
-            }
-
-            Set<TrackerHit> hitlist = hittostrip.allFrom(hit);
-            for (TrackerHit cl : hitlist) {
-                int layer = -1;
-                int module = -1;
-                List<RawTrackerHit> rawHits = cl.getRawHits();
-//                System.out.println("RawHits: " + rawHits.size());
-                for (RawTrackerHit rawHit : rawHits) {
-//                    System.out.println(rawHit.getCellID());
-                    IIdentifier id = new Identifier(rawHit.getCellID());
-                    int newLayer = SvtUtils.getInstance().getHelper().getValue(id, "layer");
-                    if (layer != -1 && layer != newLayer) {
-                        System.out.format("TrackerHit has hits from multiple layers: %d and %d\n", layer, newLayer);
-                    }
-                    layer = newLayer;
-                    int newModule = SvtUtils.getInstance().getHelper().getValue(id, "module");
-                    if (module != -1 && module != newModule) {
-                        System.out.format("TrackerHit has hits from multiple modules: %d and %d\n", module, newModule);
-                    }
-                    module = newModule;
-//                    System.out.println(SvtUtils.getInstance().getHelper().getValue(id, "strip"));
-                }
-//                System.out.format("layer %d, module %d\n", layer, module);
-                if (layer == 1) {
-                    _hasLayerOne = true;
-                }
-
-
-                _nStripHitsPerLayer[layer - 1] = rawHits.size();
-                _hitLocationPerLayer.put(layer, new BasicHep3Vector(cl.getPosition()));
-                _nhitsNew++;
-
-                boolean isAxial = SvtUtils.getInstance().isAxial(SvtUtils.getInstance().getSensor(module, layer - 1));
-                if (isAxial) {
-                    _nAxialhits++;
-                } else {
-                    _nZhits++;
-
-                }
-            }
-        }
-
-        //  Find the MCParticle that has the most hits on the track
-
-        int nbest = 0;
-        MCParticle mcbest = null;
-        for (MCParticle mcp : mcmap.keySet()) {
-            int count = mcmap.get(mcp);
-            if (count > nbest) {
-                nbest = count;
-                mcbest = mcp;
-            }
-        }
-
-        if (nbest > 0) {
-            _mcp = mcbest;
-        }
-        _purity = (double) nbest / (double) _nhits;
-        _nbadhits = _nhits - nbest;
-    }
-
-    public MCParticle getMCParticle() {
-        return _mcp;
-    }
-
-    public int getNHits() {
-        return _nhits;
-    }
-
-    public int getNBadHits() {
-        return _nbadhits;
-    }
-
-    public double getPurity() {
-        return _purity;
-    }
-
-    public int getNHitsNew() {
-        return _nhitsNew;
-    }
-
-    public int getNAxialHits() {
-        return _nAxialhits;
-    }
-
-    public int getNZHits() {
-        return _nZhits;
-    }
-
-    public boolean hasLayerOne() {
-        return _hasLayerOne;
-    }
-
-    public Hep3Vector getClusterPosition(Integer layer) {
-        return _hitLocationPerLayer.get(layer);
-    }
-
-    public int getNumberOfStripHits(int layer) {
-        return _nStripHitsPerLayer[layer - 1];
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
MaterialManager.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/MaterialManager.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/MaterialManager.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -9,26 +9,26 @@
 
 import org.lcsim.recon.tracking.seedtracker.MaterialXPlane;
 
-
-
 /**
- *
+ * 
  * Extension to lcsim MaterialManager to allow more flexibility in track reconstruction
- *
- * @author Per Hansson Adrian <[log in to unmask]>
- * @version $Id: MaterialManager.java,v 1.3 2013/11/07 03:54:58 phansson Exp $ $Date: 2013/11/07 03:54:58 $ $Author: phansson $ 
+ * 
+ * @author Per Hansson <[log in to unmask]>
  */
 public class MaterialManager extends org.lcsim.recon.tracking.seedtracker.MaterialManager {
-    
+
     protected boolean _includeMS = true;
     private final static List<MaterialXPlane> _emptyMaterialXPlaneList = new ArrayList<MaterialXPlane>();
+
     public MaterialManager() {
         super();
     }
+
     public MaterialManager(boolean includeMS) {
         super();
         this._includeMS = includeMS;
     }
+
     @Override
     public List<MaterialXPlane> getMaterialXPlanes() {
         return this._includeMS ? super.getMaterialXPlanes() : _emptyMaterialXPlaneList;
@@ -38,6 +38,5 @@
     public void setDebug(boolean debug) {
         super.setDebug(debug);
     }
-    
-    
+
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
MaterialSupervisor.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/MaterialSupervisor.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/MaterialSupervisor.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -23,92 +23,98 @@
 import org.lcsim.detector.tracker.silicon.SiTrackerModule;
 import org.lcsim.geometry.Detector;
 
-
-
 /**
- * Material manager using the detector geometry. 
-
- * Uses a private class to set up detector volumes. 
- * This can probably make use of the DetectorGeometry classes from lcsim instead for the model.
- * Something to consider in the future.
- *  
- * @author Per Hansson Adrian <[log in to unmask]>
- * @version $Id: MaterialSupervisor.java,v 1.4 2013/11/07 03:54:58 phansson Exp $ $Date: 2013/11/07 03:54:58 $ $Author: phansson $ 
+ * Material manager using the detector geometry.
+ * 
+ * Uses a private class to set up detector volumes. This can probably make use of the
+ * DetectorGeometry classes from lcsim instead for the model. Something to consider in the future.
+ * 
+ * @author Per Hansson <[log in to unmask]>
  */
 public class MaterialSupervisor extends MaterialManager {
-    
+
     private List<ScatteringDetectorVolume> _detectorVolumes = new ArrayList<ScatteringDetectorVolume>();
-    
 
     public MaterialSupervisor() {
         super();
         this._includeMS = true;
     }
+
     public MaterialSupervisor(boolean includeMS) {
         super(includeMS);
     }
-    
+
     @Override
     public void setDebug(boolean debug) {
         super.setDebug(debug);
     }
-    
+
     public List<ScatteringDetectorVolume> getMaterialVolumes() {
         return _detectorVolumes;
     }
 
     @Override
     public void buildModel(Detector det) {
-        //super.buildModel(det);
-        //if(DEBUG) 
-        System.out.printf("%s: ###########################################################\n",this.getClass().getSimpleName());
-        System.out.printf("%s: Build detector model\n",this.getClass().getSimpleName());
+        // super.buildModel(det);
+        // if(DEBUG)
+        System.out.printf("%s: ###########################################################\n", this.getClass().getSimpleName());
+        System.out.printf("%s: Build detector model\n", this.getClass().getSimpleName());
         List<SiSensor> sensors = det.getSubdetector("Tracker").getDetectorElement().findDescendants(SiSensor.class);
-        //List<SiTrackerModule> modules = det.getDetectorElement().findDescendants(SiTrackerModule.class);
-        System.out.printf("%s: %d sensors\n",this.getClass().getSimpleName(),sensors.size());
-        System.out.printf("%s: %5s %32s %22s %15s %10s %10s\n",this.getClass().getSimpleName(),"ID","Pos (mm)","size(mm)","t(mm)","t(%R.L)","type");
-        for (SiSensor module: sensors) {
-            
+        // List<SiTrackerModule> modules =
+        // det.getDetectorElement().findDescendants(SiTrackerModule.class);
+        System.out.printf("%s: %d sensors\n", this.getClass().getSimpleName(), sensors.size());
+        System.out.printf("%s: %5s %32s %22s %15s %10s %10s\n", this.getClass().getSimpleName(), "ID", "Pos (mm)", "size(mm)", "t(mm)", "t(%R.L)", "type");
+        for (SiSensor module : sensors) {
+
             SiStripPlane plane = new SiStripPlane(module);
-                    
-            System.out.printf("%s: %5d %32s %15.2fx%.2f %10.2f %10.3f %10s\n",this.getClass().getSimpleName(),plane.getId(),plane.origin().toString(),
-                                                                                plane.getUnmeasuredDimension(),plane.getMeasuredDimension(),
-                                                                                plane.getThickness(),plane.getThicknessInRL()*100,
-                                                                                SvtUtils.getInstance().isAxial(module) ? "axial" : "stereo");            
-            _detectorVolumes.add(plane);     
+
+            System.out.printf("%s: %5d %32s %15.2fx%.2f %10.2f %10.3f %10s\n", this.getClass().getSimpleName(), plane.getId(), plane.origin().toString(), plane.getUnmeasuredDimension(), plane.getMeasuredDimension(), plane.getThickness(), plane.getThicknessInRL() * 100, SvtUtils.getInstance().isAxial(module) ? "axial" : "stereo");
+            _detectorVolumes.add(plane);
         }
-        System.out.printf("%s: ###########################################################\n",this.getClass().getSimpleName());
+        System.out.printf("%s: ###########################################################\n", this.getClass().getSimpleName());
     }
-    
-    
-    
+
     public interface ScatteringDetectorVolume {
+
         public String getName();
+
         public double getMaterialTraversed(Hep3Vector dir);
+
         public double getMaterialTraversedInRL(Hep3Vector dir);
+
         public void print();
+
         public IDetectorElement getDetectorElement();
     }
-    
-    //public abstract class DetectorPlane extends SiSensor {
-    public interface DetectorPlane  extends ScatteringDetectorVolume{
+
+    // public abstract class DetectorPlane extends SiSensor {
+    public interface DetectorPlane extends ScatteringDetectorVolume {
+
         public double getThickness();
+
         public double getThicknessInRL();
+
         public double getLength();
+
         public double getWidth();
+
         public Hep3Vector origin();
+
         public Hep3Vector normal();
+
         public int getId();
 
     }
-    
+
     private abstract class SiPlane implements DetectorPlane {
+
         abstract void addMaterial();
     }
-    
+
     public class SiStripPlane extends SiPlane {
+
         private Hep3Vector _org = null; // origin
-        private Hep3Vector _w = null;   // normal to plane
+        private Hep3Vector _w = null; // normal to plane
         private Hep3Vector _u = null;
         private Hep3Vector _v = null;
         private Materials _materials = new Materials();
@@ -124,27 +130,26 @@
             setUnmeasuredCoordinate();
             setDimensions();
             addMaterial();
-            
+
         }
-        
+
         @Override
         public IDetectorElement getDetectorElement() {
             return getSensor();
         }
-        
+
         private SiTrackerModule getModule() {
-            return (SiTrackerModule)getGeometry().getDetectorElement().getParent();
+            return (SiTrackerModule) getGeometry().getDetectorElement().getParent();
         }
-        
-     
-        private  IGeometryInfo getGeometry() {
+
+        private IGeometryInfo getGeometry() {
             return getSensor().getGeometry();
         }
-        
+
         SiSensor getSensor() {
             return _sensor;
         }
-        
+
         Polygon3D getPsidePlane() {
             return getSensor().getBiasSurface(ChargeCarrier.HOLE);
         }
@@ -152,48 +157,47 @@
         Polygon3D getNsidePlane() {
             return getSensor().getBiasSurface(ChargeCarrier.ELECTRON);
         }
-    
-       
-        
+
         @Override
         public double getMaterialTraversed(Hep3Vector dir) {
-            //the distance inside the plane (note I don't care about sign of unit vector only projection distance)
+            // the distance inside the plane (note I don't care about sign of unit vector only
+            // projection distance)
             double cth = Math.abs(VecOp.dot(dir, _w));
             double t = _materials.getThickness();
-            return t/cth;
+            return t / cth;
         }
 
         @Override
         public double getMaterialTraversedInRL(Hep3Vector dir) {
-            //the distance inside the plane (note I don't care about sign of unit vector only projection distance)
+            // the distance inside the plane (note I don't care about sign of unit vector only
+            // projection distance)
             double cth = Math.abs(VecOp.dot(dir, _w));
             double t = _materials.getThicknessInRL();
-            return t/cth;
+            return t / cth;
         }
 
         @Override
         protected void addMaterial() {
-            
+
             IPhysicalVolume parent = getModule().getGeometry().getPhysicalVolume();
             IPhysicalVolumeContainer daughters = parent.getLogicalVolume().getDaughters();
-            //System.out.printf("%s found %d daugters to SiTrackerModule\n",this.getClass().getSimpleName(),daughters.size());
-            for(IPhysicalVolume daughter : daughters) {
+            // System.out.printf("%s found %d daugters to SiTrackerModule\n",this.getClass().getSimpleName(),daughters.size());
+            for (IPhysicalVolume daughter : daughters) {
                 ILogicalVolume logicalVolume = daughter.getLogicalVolume();
                 IMaterial material = logicalVolume.getMaterial();
                 String name = material.getName();
-                double X0 = 10.0* material.getRadiationLength()/material.getDensity();
+                double X0 = 10.0 * material.getRadiationLength() / material.getDensity();
                 Box solid = (Box) logicalVolume.getSolid();
-                //System.out.printf("%s x %f y %f z %f box\n",this.getClass().getSimpleName(),solid.getXHalfLength(),solid.getYHalfLength(),solid.getZHalfLength());
+                // System.out.printf("%s x %f y %f z %f box\n",this.getClass().getSimpleName(),solid.getXHalfLength(),solid.getYHalfLength(),solid.getZHalfLength());
                 double halfThickness = solid.getZHalfLength();
-                addMaterial(name, material.getDensity()/1000.0, X0,2.0*halfThickness);
+                addMaterial(name, material.getDensity() / 1000.0, X0, 2.0 * halfThickness);
             }
         }
-        
+
         public void addMaterial(String type, double density, double radLen, double t) {
             _materials.add(type, density, radLen, t);
         }
-        
-        
+
         @Override
         public double getThickness() {
             return _materials.getThickness();
@@ -210,63 +214,61 @@
             ILogicalVolume logVol_parent = physVol_parent.getLogicalVolume();
             ISolid solid_parent = logVol_parent.getSolid();
             Box box_parent;
-            if(Box.class.isInstance(solid_parent)) {
+            if (Box.class.isInstance(solid_parent)) {
                 box_parent = (Box) solid_parent;
             } else {
                 throw new RuntimeException("Couldn't cast the module volume to a box!?");
             }
-            _length = box_parent.getXHalfLength()*2.0;
-            _width = box_parent.getYHalfLength()*2.0;
-            
+            _length = box_parent.getXHalfLength() * 2.0;
+            _width = box_parent.getYHalfLength() * 2.0;
+
         }
-        
+
         @Override
         public Hep3Vector origin() {
-            
+
             return _org;
         }
 
         public void setOrigin(Hep3Vector org) {
-             
+
             this._org = org;
         }
 
         private void setOrigin() {
             // Use origin of p-side surface
-            Hep3Vector origin = VecOp.mult(HPSTransformations.getMatrix(),_sensor.getGeometry().getPosition());
-            //transform to p-side
+            Hep3Vector origin = VecOp.mult(CoordinateTransformations.getMatrix(), _sensor.getGeometry().getPosition());
+            // transform to p-side
             Polygon3D psidePlane = this.getPsidePlane();
-            Translation3D transformToPside = new Translation3D(VecOp.mult(-1*psidePlane.getDistance(), psidePlane.getNormal()));
+            Translation3D transformToPside = new Translation3D(VecOp.mult(-1 * psidePlane.getDistance(), psidePlane.getNormal()));
             this._org = transformToPside.translated(origin);
         }
-        
+
         @Override
         public Hep3Vector normal() {
-            if(_w==null) {
+            if (_w == null) {
                 _w = this.getPsidePlane().getNormal();
-                System.out.printf("setting normal from pside normal %s\n",_w.toString());
-                _w = VecOp.mult(VecOp.mult(HPSTransformations.getMatrix(),getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal().getRotation().getRotationMatrix()), _w);
-                System.out.printf("normal after local to global to tracking rotation %s\n",_w.toString());
+                System.out.printf("setting normal from pside normal %s\n", _w.toString());
+                _w = VecOp.mult(VecOp.mult(CoordinateTransformations.getMatrix(), getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal().getRotation().getRotationMatrix()), _w);
+                System.out.printf("normal after local to global to tracking rotation %s\n", _w.toString());
             }
             return this._w;
         }
-        
+
         private void setNormal() {
             _w = this.getPsidePlane().getNormal();
-            _w = VecOp.mult(VecOp.mult(HPSTransformations.getMatrix(),getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal().getRotation().getRotationMatrix()), _w);
+            _w = VecOp.mult(VecOp.mult(CoordinateTransformations.getMatrix(), getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal().getRotation().getRotationMatrix()), _w);
         }
-        
+
         public void setNormal(Hep3Vector w) {
             this._w = w;
         }
 
         @Override
         public void print() {
-            System.out.printf("DetectorPlane:  org %s normal vector %s %.2fx%.2fmm  thickness %f R.L. (%fmm)\n",
-                                origin().toString(),normal().toString(),getLength(),getWidth(),
-                                getThicknessInRL(),getThickness());
+            System.out.printf("DetectorPlane:  org %s normal vector %s %.2fx%.2fmm  thickness %f R.L. (%fmm)\n", origin().toString(), normal().toString(), getLength(), getWidth(), getThicknessInRL(), getThickness());
         }
-        
+
         @Override
         public int getId() {
             return _sensor.getSensorID();
@@ -286,7 +288,7 @@
         public double getWidth() {
             return _width;
         }
-        
+
         double getMeasuredDimension() {
             return getLength();
         }
@@ -294,55 +296,49 @@
         double getUnmeasuredDimension() {
             return getWidth();
         }
-        
+
         Hep3Vector getUnmeasuredCoordinate() {
             return _v;
         }
+
         Hep3Vector getMeasuredCoordinate() {
             return _u;
         }
-        
-        private  void setMeasuredCoordinate()
-        {
+
+        private void setMeasuredCoordinate() {
             // p-side unit vector
             ITransform3D electrodes_to_global = getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
             Hep3Vector measuredCoordinate = getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getMeasuredCoordinate(0);
-            measuredCoordinate = VecOp.mult(VecOp.mult(HPSTransformations.getMatrix(),electrodes_to_global.getRotation().getRotationMatrix()), measuredCoordinate);
+            measuredCoordinate = VecOp.mult(VecOp.mult(CoordinateTransformations.getMatrix(), electrodes_to_global.getRotation().getRotationMatrix()), measuredCoordinate);
             _u = measuredCoordinate;
         }
-        
-        private  void setUnmeasuredCoordinate()
-        {
+
+        private void setUnmeasuredCoordinate() {
             // p-side unit vector
             ITransform3D electrodes_to_global = getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
             Hep3Vector unmeasuredCoordinate = getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getUnmeasuredCoordinate(0);
-            unmeasuredCoordinate = VecOp.mult(VecOp.mult(HPSTransformations.getMatrix(),electrodes_to_global.getRotation().getRotationMatrix()), unmeasuredCoordinate);
+            unmeasuredCoordinate = VecOp.mult(VecOp.mult(CoordinateTransformations.getMatrix(), electrodes_to_global.getRotation().getRotationMatrix()), unmeasuredCoordinate);
             _v = unmeasuredCoordinate;
         }
 
-        
-        
-
     }
-    
-    
-    
-    
-    
-    
+
     private static class Material {
+
         private String _name;
         private double _X0;
         private double _density;
         private double _thickness;
+
         public Material(String _name, double _X0, double _density, double _thickness) {
             this._name = _name;
             this._X0 = _X0;
             this._density = _density;
             this._thickness = _thickness;
         }
+
         private void add(double t) {
-            _thickness+=t;
+            _thickness += t;
         }
 
         public double getThickness() {
@@ -356,66 +352,64 @@
         public double getX0() {
             return _X0;
         }
-        
+
     }
-    
+
     private static class Materials {
+
         private List<Material> _materials = new ArrayList<Material>();
         private double _tot_X0 = -1;
+
         public Materials() {
         }
+
         public int numberOfMaterials() {
             return _materials.size();
         }
-        public void add(String mat,double density, double radLen, double t) {
+
+        public void add(String mat, double density, double radLen, double t) {
             boolean found = false;
-            for(Material m : _materials) {
-                if(m._name==mat) {
+            for (Material m : _materials) {
+                if (m._name == mat) {
                     m.add(t);
-                    found=true;
+                    found = true;
                     break;
-                } 
+                }
             }
             if (!found) {
-                //System.out.printf("%s: Adding %.2fmm of %s \n",this.getClass().getSimpleName(),t,mat);
-                _materials.add(new Material(mat,radLen,density,t));
+                // System.out.printf("%s: Adding %.2fmm of %s \n",this.getClass().getSimpleName(),t,mat);
+                _materials.add(new Material(mat, radLen, density, t));
             }
-            
+
         }
+
         public double getThicknessInRL() {
-            if(_materials.isEmpty()) return 0;
-            if(_tot_X0<0) {
+            if (_materials.isEmpty())
+                return 0;
+            if (_tot_X0 < 0) {
                 double sum = 0.;
-                for(Material m : _materials) {
-                    sum += m.getDensity()*m.getThickness();
+                for (Material m : _materials) {
+                    sum += m.getDensity() * m.getThickness();
                 }
-                //System.out.printf("sum = %f\n",sum);
+                // System.out.printf("sum = %f\n",sum);
                 double tot_X0 = 0.;
-                for(Material m : _materials) {
-                    double w_j = m._density*m.getThickness()/(numberOfMaterials()*sum);
-                    tot_X0 += w_j/(m.getThickness()/m.getX0());
+                for (Material m : _materials) {
+                    double w_j = m._density * m.getThickness() / (numberOfMaterials() * sum);
+                    tot_X0 += w_j / (m.getThickness() / m.getX0());
                 }
-                //System.out.printf("tot_X0 = %f\n",tot_X0);
-                _tot_X0 = 1.0/tot_X0;
+                // System.out.printf("tot_X0 = %f\n",tot_X0);
+                _tot_X0 = 1.0 / tot_X0;
             }
             return _tot_X0;
         }
 
         private double getThickness() {
             double t_tot = 0.;
-            for(Material m : _materials) {
+            for (Material m : _materials) {
                 t_tot += m.getThickness();
             }
             return t_tot;
         }
-        
-    }
-    
 
-
-    
-
-    
-    
-    
+    }
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
MultipleScattering.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/MultipleScattering.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/MultipleScattering.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 package org.hps.recon.tracking;
 
 import hep.physics.vec.Hep3Vector;
@@ -20,39 +16,35 @@
 import org.lcsim.fit.helicaltrack.HelixUtils;
 import org.lcsim.recon.tracking.seedtracker.ScatterAngle;
 
-
 /**
- * Extention of lcsim class to allow use of local classes.
- * Finds scatter points and magnitude from detector geometry directly.
- * @author Per Hansson Adrian <[log in to unmask]>
- * @version $Id: MultipleScattering.java,v 1.7 2013/11/07 03:54:58 phansson Exp $ $Date: 2013/11/07 03:54:58 $ $Author: phansson $ 
+ * Extention of lcsim class to allow use of local classes. Finds scatter points and magnitude from
+ * detector geometry directly.
+ * @author Per Hansson <[log in to unmask]>
  */
 public class MultipleScattering extends org.lcsim.recon.tracking.seedtracker.MultipleScattering {
 
-
-    
-    //public MultipleScattering(MaterialSupervisor materialmanager) {
-    //    super(materialmanager);
-    //}
-    
     public MultipleScattering(MaterialManager materialmanager) {
         super(materialmanager);
     }
 
     /**
-     * Override lcsim version and select material manager depending on object type. This allows to use a local extension of the material manager in teh lcsim track fitting code. 
+     * Override lcsim version and select material manager depending on object type. This allows to
+     * use a local extension of the material manager in teh lcsim track fitting code.
      * 
      * @param helix
-     * @return a list of ScatterAngle. 
+     * @return a list of ScatterAngle.
      */
     public List<ScatterAngle> FindScatters(HelicalTrackFit helix) {
-        if(_debug) System.out.printf("\n%s: FindScatters() for helix:\n%s\n",this.getClass().getSimpleName(),helix.toString());        
-        
-        if(MaterialSupervisor.class.isInstance(this._materialmanager)) {
-            if(_debug) System.out.printf("%s: use HPS scattering model",this.getClass().getSimpleName());    
+        if (_debug)
+            System.out.printf("\n%s: FindScatters() for helix:\n%s\n", this.getClass().getSimpleName(), helix.toString());
+
+        if (MaterialSupervisor.class.isInstance(this._materialmanager)) {
+            if (_debug)
+                System.out.printf("%s: use HPS scattering model", this.getClass().getSimpleName());
             return this.FindHPSScatters(helix);
         } else {
-            if(_debug) System.out.printf("%s: use default lcsim material manager to find scatters\n",this.getClass().getSimpleName());    
+            if (_debug)
+                System.out.printf("%s: use default lcsim material manager to find scatters\n", this.getClass().getSimpleName());
             return super.FindScatters(helix);
         }
     }
@@ -61,330 +53,316 @@
      * Extra interface to keep a function returning the same type as the lcsim version
      * 
      * @param helix
-     * @return a list of ScatterAngle. 
+     * @return a list of ScatterAngle.
      */
     private List<ScatterAngle> FindHPSScatters(HelicalTrackFit helix) {
         ScatterPoints scatterPoints = this.FindHPSScatterPoints(helix);
         return scatterPoints.getScatterAngleList();
     }
 
-
-    
     /**
      * Find scatter points along helix using the local material manager
      * 
      * @param helix
-     * @return the points of scatter along the helix 
+     * @return the points of scatter along the helix
      */
     public ScatterPoints FindHPSScatterPoints(HelicalTrackFit helix) {
-        if(_debug) System.out.printf("\n%s: FindHPSScatters() for helix:\n%s\n",this.getClass().getSimpleName(),helix.toString());  
-        
-        //  Check that B Field is set
-        if (_bfield == 0.) throw new RuntimeException("B Field must be set before calling FindScatters method");
+        if (_debug)
+            System.out.printf("\n%s: FindHPSScatters() for helix:\n%s\n", this.getClass().getSimpleName(), helix.toString());
 
-        //  Create a new list to contain the mutliple scatters
-        //List<ScatterAngle> scatters = new ArrayList<ScatterAngle>();
+        // Check that B Field is set
+        if (_bfield == 0.)
+            throw new RuntimeException("B Field must be set before calling FindScatters method");
+
+        // Create a new list to contain the mutliple scatters
+        // List<ScatterAngle> scatters = new ArrayList<ScatterAngle>();
         ScatterPoints scatters = new ScatterPoints();
-        
+
         MaterialSupervisor materialSupervisor = (MaterialSupervisor) this._materialmanager;
-        
+
         List<ScatteringDetectorVolume> materialVols = materialSupervisor.getMaterialVolumes();
-        
-        if(_debug) System.out.printf("%s: there are %d detector volumes in the model\n",this.getClass().getSimpleName(),materialVols.size());
-        
-        for(ScatteringDetectorVolume vol : materialVols) {
-        
-            if(_debug) System.out.printf("\n%s: found detector volume \"%s\"\n",this.getClass().getSimpleName(),vol.getName());
-                    
+
+        if (_debug)
+            System.out.printf("%s: there are %d detector volumes in the model\n", this.getClass().getSimpleName(), materialVols.size());
+
+        for (ScatteringDetectorVolume vol : materialVols) {
+
+            if (_debug)
+                System.out.printf("\n%s: found detector volume \"%s\"\n", this.getClass().getSimpleName(), vol.getName());
+
             // find intersection pathpoint with helix
-            Hep3Vector pos = getHelixIntersection(helix,vol);
+            Hep3Vector pos = getHelixIntersection(helix, vol);
 
-            if(pos!=null) {
+            if (pos != null) {
 
-                if(_debug) System.out.printf("%s: intersection position %s\n",this.getClass().getSimpleName(),pos.toString());
+                if (_debug)
+                    System.out.printf("%s: intersection position %s\n", this.getClass().getSimpleName(), pos.toString());
 
                 // find the track direction at the plane
 
-                double s = HelixUtils.PathToXPlane(helix, pos.x(), 0.,0).get(0);
+                double s = HelixUtils.PathToXPlane(helix, pos.x(), 0., 0).get(0);
 
-                if(_debug) System.out.printf("%s: path length %f\n",this.getClass().getSimpleName(),s);
+                if (_debug)
+                    System.out.printf("%s: path length %f\n", this.getClass().getSimpleName(), s);
 
                 Hep3Vector dir = HelixUtils.Direction(helix, s);
 
-                if(_debug) System.out.printf("%s: track dir %s\n",this.getClass().getSimpleName(),dir.toString());
+                if (_debug)
+                    System.out.printf("%s: track dir %s\n", this.getClass().getSimpleName(), dir.toString());
 
-
-                //Calculate the material the track will traverse
+                // Calculate the material the track will traverse
                 double radlen = vol.getMaterialTraversedInRL(dir);
 
-                if(_debug) System.out.printf("%s: material traversed: %f R.L. (%fmm) \n",
-                                            this.getClass().getSimpleName(),radlen,vol.getMaterialTraversed(dir));
+                if (_debug)
+                    System.out.printf("%s: material traversed: %f R.L. (%fmm) \n", this.getClass().getSimpleName(), radlen, vol.getMaterialTraversed(dir));
 
                 double p = helix.p(this._bfield);
                 double msangle = this.msangle(p, radlen);
 
-                ScatterAngle scat = new ScatterAngle(s,msangle);
+                ScatterAngle scat = new ScatterAngle(s, msangle);
 
-                if(_debug) System.out.printf("%s: scatter angle %f rad for p %f GeV at path length %f\n",
-                                            this.getClass().getSimpleName(),scat.Angle(),p,scat.PathLen());
+                if (_debug)
+                    System.out.printf("%s: scatter angle %f rad for p %f GeV at path length %f\n", this.getClass().getSimpleName(), scat.Angle(), p, scat.PathLen());
 
-                ScatterPoint scatterPoint = new ScatterPoint(vol.getDetectorElement(),scat);
+                ScatterPoint scatterPoint = new ScatterPoint(vol.getDetectorElement(), scat);
                 scatters.addPoint(scatterPoint);
-                
+
             } else {
-                
-                if(_debug) System.out.printf("\n%s: helix did not intersect this volume \n",this.getClass().getSimpleName());
-                
+
+                if (_debug)
+                    System.out.printf("\n%s: helix did not intersect this volume \n", this.getClass().getSimpleName());
+
             }
-                                           
+
         }
-        
-        //  Sort the multiple scatters by their path length
+
+        // Sort the multiple scatters by their path length
         Collections.sort(scatters._points);
 
-        if(_debug) {
-            System.out.printf("\n%s: found %d scatters for this helix:\n",this.getClass().getSimpleName(),scatters.getPoints().size());
-            System.out.printf("%s: %10s %10s\n",this.getClass().getSimpleName(),"s (mm)","theta(rad)");
+        if (_debug) {
+            System.out.printf("\n%s: found %d scatters for this helix:\n", this.getClass().getSimpleName(), scatters.getPoints().size());
+            System.out.printf("%s: %10s %10s\n", this.getClass().getSimpleName(), "s (mm)", "theta(rad)");
             for (ScatterPoint p : scatters.getPoints()) {
-                System.out.printf("%s: %10.2f %10f\n",this.getClass().getSimpleName(),p.getScatterAngle().PathLen(),p.getScatterAngle().Angle());
+                System.out.printf("%s: %10.2f %10f\n", this.getClass().getSimpleName(), p.getScatterAngle().PathLen(), p.getScatterAngle().Angle());
             }
         }
         return scatters;
-   
     }
-    
-    
+
     public Hep3Vector getHelixIntersection(HelicalTrackFit helix, ScatteringDetectorVolume plane) {
-        
-        if(SiStripPlane.class.isInstance(plane)) {
-            return getHelixIntersection( helix,  (SiStripPlane)plane);            
+
+        if (SiStripPlane.class.isInstance(plane)) {
+            return getHelixIntersection(helix, (SiStripPlane) plane);
         } else {
             throw new UnsupportedOperationException("This det volume type is not supported yet.");
         }
     }
 
     /*
-     * Returns interception between helix and plane
-     * Uses the origin x posiution of the plane
-     * and extrapolates linearly to find teh intersection
-     * If inside use an iterative "exact" way to determine the final position
+     * Returns interception between helix and plane Uses the origin x posiution of the plane and
+     * extrapolates linearly to find teh intersection If inside use an iterative "exact" way to
+     * determine the final position
      */
-    
     public Hep3Vector getHelixIntersection(HelicalTrackFit helix, SiStripPlane plane) {
-        
-        if(this._debug) {
-            System.out.printf("%s: calculate simple helix intercept\n",this.getClass().getSimpleName());
-            System.out.printf("%s: StripSensorPlane:\n",this.getClass().getSimpleName());
+
+        if (this._debug) {
+            System.out.printf("%s: calculate simple helix intercept\n", this.getClass().getSimpleName());
+            System.out.printf("%s: StripSensorPlane:\n", this.getClass().getSimpleName());
             plane.print();
         }
-        
-        
-        double s_origin = HelixUtils.PathToXPlane(helix, plane.origin().x(),0.,0).get(0);
 
-        if(Double.isNaN(s_origin)) {
-            if(this._debug) System.out.printf("%s: could not extrapolate to XPlane, too large curvature: origin is at %s \n", this.getClass().getSimpleName(),plane.origin().toString());
+        double s_origin = HelixUtils.PathToXPlane(helix, plane.origin().x(), 0., 0).get(0);
+
+        if (Double.isNaN(s_origin)) {
+            if (this._debug)
+                System.out.printf("%s: could not extrapolate to XPlane, too large curvature: origin is at %s \n", this.getClass().getSimpleName(), plane.origin().toString());
             return null;
         }
-        
+
         Hep3Vector pos = HelixUtils.PointOnHelix(helix, s_origin);
         Hep3Vector direction = HelixUtils.Direction(helix, s_origin);
 
-        if(this._debug) System.out.printf("%s: position at x=origin is %s with path length %f and direction %s\n",
-                                        this.getClass().getSimpleName(),pos.toString(),s_origin,direction.toString());
-                                        
+        if (this._debug)
+            System.out.printf("%s: position at x=origin is %s with path length %f and direction %s\n", this.getClass().getSimpleName(), pos.toString(), s_origin, direction.toString());
+
         // Use this approximate position to get a first estimate if the helix intercepted the plane
-        // This is only because the real intercept position is an iterative procedure and we'd 
+        // This is only because the real intercept position is an iterative procedure and we'd
         // like to avoid using it if possible
-        // Consider the plane as pure x-plane i.e. no rotations 
-        //-> this is not very general, as it assumes that strips are (mostly) along y -> FIX THIS!?
+        // Consider the plane as pure x-plane i.e. no rotations
+        // -> this is not very general, as it assumes that strips are (mostly) along y -> FIX
+        // THIS!?
 
-        
         // Transformation from tracking to detector frame
-        Hep3Vector pos_det = VecOp.mult(VecOp.inverse(HPSTransformations.getMatrix()),pos);
-        Hep3Vector direction_det = VecOp.mult(VecOp.inverse(HPSTransformations.getMatrix()),direction);
-        
-        
-        if(this._debug) System.out.printf("%s: position in det frame %s and direction %s\n",
-                                        this.getClass().getSimpleName(),pos_det.toString(),direction_det.toString());
-        
+        Hep3Vector pos_det = VecOp.mult(VecOp.inverse(CoordinateTransformations.getMatrix()), pos);
+        Hep3Vector direction_det = VecOp.mult(VecOp.inverse(CoordinateTransformations.getMatrix()), direction);
+
+        if (this._debug)
+            System.out.printf("%s: position in det frame %s and direction %s\n", this.getClass().getSimpleName(), pos_det.toString(), direction_det.toString());
+
         // Transformation from detector frame to sensor frame
         Hep3Vector pos_sensor = plane.getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getGlobalToLocal().transformed(pos_det);
         Hep3Vector direction_sensor = plane.getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getGlobalToLocal().rotated(direction_det);
-        
-        
-        if(this._debug) System.out.printf("%s: position in sensor frame %s and direction %s\n",
-                                        this.getClass().getSimpleName(),pos_sensor.toString(),direction_sensor.toString());
-        
-        
+
+        if (this._debug)
+            System.out.printf("%s: position in sensor frame %s and direction %s\n", this.getClass().getSimpleName(), pos_sensor.toString(), direction_sensor.toString());
+
         // find step in w to cross sensor plane
-        double delta_w = -1.0*pos_sensor.z()/direction_sensor.z();
-        
+        double delta_w = -1.0 * pos_sensor.z() / direction_sensor.z();
+
         // find the point where it crossed the plane
-        
+
         Hep3Vector pos_int = VecOp.add(pos_sensor, VecOp.mult(delta_w, direction_sensor));
         Hep3Vector pos_int_det = plane.getSensor().getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal().transformed(pos_int);
         // find the intercept in the tracking frame
-        Hep3Vector pos_int_trk = VecOp.mult(HPSTransformations.getMatrix(),pos_int_det);
- 
-        
-        if(this._debug) System.out.printf("%s: take step %f to get intercept position in sensor frame %s (det: %s trk: %s)\n",
-                                        this.getClass().getSimpleName(), delta_w, pos_int, pos_int_det.toString(), pos_int_trk.toString());
-        
+        Hep3Vector pos_int_trk = VecOp.mult(CoordinateTransformations.getMatrix(), pos_int_det);
+
+        if (this._debug)
+            System.out.printf("%s: take step %f to get intercept position in sensor frame %s (det: %s trk: %s)\n", this.getClass().getSimpleName(), delta_w, pos_int, pos_int_det.toString(), pos_int_trk.toString());
+
         // check if it's inside the sensor
         Inside result_inside = plane.getDetectorElement().getGeometry().getPhysicalVolume().getMotherLogicalVolume().getSolid().inside(pos_int);
         Inside result_inside_module = plane.getSensor().getGeometry().getDetectorElement().getParent().getGeometry().inside(pos_int_det);
-        
-        if(this._debug) System.out.printf("%s: Inside result sensor: %s module: %s\n",
-                                this.getClass().getSimpleName(), 
-                                result_inside.toString(),
-                                result_inside_module.toString());
 
-        
-        
+        if (this._debug)
+            System.out.printf("%s: Inside result sensor: %s module: %s\n", this.getClass().getSimpleName(), result_inside.toString(), result_inside_module.toString());
+
         boolean isInsideSolid = false;
-        if(result_inside.equals(Inside.INSIDE) || result_inside.equals(Inside.SURFACE)) {
+        if (result_inside.equals(Inside.INSIDE) || result_inside.equals(Inside.SURFACE)) {
             isInsideSolid = true;
         }
-        
+
         boolean isInsideSolidModule = false;
-        if(result_inside_module.equals(Inside.INSIDE) || result_inside_module.equals(Inside.SURFACE)) {
+        if (result_inside_module.equals(Inside.INSIDE) || result_inside_module.equals(Inside.SURFACE)) {
             isInsideSolidModule = true;
         }
 
-        
         boolean isInside = true;
-        if(Math.abs(pos_int.x()) > plane.getMeasuredDimension()/2.0) {
-            if(this._debug) System.out.printf("%s: intercept is outside in u\n", this.getClass().getSimpleName());
+        if (Math.abs(pos_int.x()) > plane.getMeasuredDimension() / 2.0) {
+            if (this._debug)
+                System.out.printf("%s: intercept is outside in u\n", this.getClass().getSimpleName());
             isInside = false;
         }
-        
-        if(Math.abs(pos_int.y()) > plane.getUnmeasuredDimension()/2.0) {
-            if(this._debug) System.out.printf("%s: intercept is outside in v\n", this.getClass().getSimpleName());
+
+        if (Math.abs(pos_int.y()) > plane.getUnmeasuredDimension() / 2.0) {
+            if (this._debug)
+                System.out.printf("%s: intercept is outside in v\n", this.getClass().getSimpleName());
             isInside = false;
         }
-        
-        
-        if(!isInside) return null;
-        
-        if(this._debug) {
-            System.out.printf("%s: found intercept at %s \n",this.getClass().getSimpleName(),pos_int_trk.toString());
+
+        if (!isInside)
+            return null;
+
+        if (this._debug) {
+            System.out.printf("%s: found intercept at %s \n", this.getClass().getSimpleName(), pos_int_trk.toString());
         }
 
-        
         // Check if it's inside sensor and module and if it contradicts the manual calculation
-        // For now: trust manual calculation and output warning if it's outside BOTH sensor AND module -> FIX THIS!?
-        
-        if(!isInsideSolid ) {
-            if(_debug) System.out.printf("%s: manual calculation says inside sensor, inside solid says outside -> contradiction \n", this.getClass().getSimpleName());
-            if(isInsideSolidModule) {
-                if(_debug) System.out.printf("%s: this intercept is outside sensor but inside module\n", this.getClass().getSimpleName());
+        // For now: trust manual calculation and output warning if it's outside BOTH sensor AND
+        // module -> FIX THIS!?
+
+        if (!isInsideSolid) {
+            if (_debug)
+                System.out.printf("%s: manual calculation says inside sensor, inside solid says outside -> contradiction \n", this.getClass().getSimpleName());
+            if (isInsideSolidModule) {
+                if (_debug)
+                    System.out.printf("%s: this intercept is outside sensor but inside module\n", this.getClass().getSimpleName());
             } else {
-                if(_debug) System.out.printf("%s: warning: this intercept at %s, in sensor frame %s, (sensor origin at %s ) is outside sensor and module!\n", 
-                                            this.getClass().getSimpleName(),pos_int_trk.toString(),pos_int.toString(),plane.origin().toString());
+                if (_debug)
+                    System.out.printf("%s: warning: this intercept at %s, in sensor frame %s, (sensor origin at %s ) is outside sensor and module!\n", this.getClass().getSimpleName(), pos_int_trk.toString(), pos_int.toString(), plane.origin().toString());
             }
         }
 
-        
-       
-
         // Catch special cases where the incidental iteration procedure seem to fail -> FIX THIS!
-        if(helix.p(Math.abs(_bfield)) < 0.3) {
+        if (helix.p(Math.abs(_bfield)) < 0.3) {
 
-            if(this._debug) System.out.printf("%s: momentum is low skip the iterative calculation\n",this.getClass().getSimpleName());
-            
+            if (this._debug)
+                System.out.printf("%s: momentum is low skip the iterative calculation\n", this.getClass().getSimpleName());
+
             return pos_int_trk;
         }
 
-        if(this._debug) System.out.printf("%s: calculate iterative helix intercept\n",this.getClass().getSimpleName());
+        if (this._debug)
+            System.out.printf("%s: calculate iterative helix intercept\n", this.getClass().getSimpleName());
 
-        
         pos = TrackUtils.getHelixPlaneIntercept(helix, plane.normal(), plane.origin(), _bfield);
-        
-        if(pos==null) {
-            
-//            throw new RuntimeException(String.format("%s: iterative intercept failed for helix \n%s\n with org=%s,w=%s, B=%f\n pdef=%f and pdef_pos=%s",
-//                                        this.getClass().getSimpleName(),helix.toString(),plane.origin().toString(),plane.normal().toString(),_bfield,s_origin,pos));                
-//            
-            System.out.printf("%s: iterative intercept failed for helix \n%s\n at sensor with org=%s, unit w=%s => use approx intercept pos=%s at path %f\n",
-                             this.getClass().getSimpleName(),helix.toString(),plane.origin().toString(),plane.normal().toString(),pos, s_origin);                
-            
+
+        if (pos == null) {
+
+            // throw new
+            // RuntimeException(String.format("%s: iterative intercept failed for helix \n%s\n with org=%s,w=%s, B=%f\n pdef=%f and pdef_pos=%s",
+            // this.getClass().getSimpleName(),helix.toString(),plane.origin().toString(),plane.normal().toString(),_bfield,s_origin,pos));
+            //
+            System.out.printf("%s: iterative intercept failed for helix \n%s\n at sensor with org=%s, unit w=%s => use approx intercept pos=%s at path %f\n", this.getClass().getSimpleName(), helix.toString(), plane.origin().toString(), plane.normal().toString(), pos, s_origin);
+
             return pos_int_trk;
-            
-        }   
-        
-        
-        if(this._debug) {
-            System.out.printf("%s: iterative helix intercept point at %s (diff to approx: %s) \n",this.getClass().getSimpleName(),pos.toString(),VecOp.sub(pos, pos_int_trk).toString());
+
         }
-        
-        
-        
+
+        if (this._debug) {
+            System.out.printf("%s: iterative helix intercept point at %s (diff to approx: %s) \n", this.getClass().getSimpleName(), pos.toString(), VecOp.sub(pos, pos_int_trk).toString());
+        }
+
         // find position in sensor frame
-        pos_int_det = VecOp.mult(VecOp.inverse(HPSTransformations.getMatrix()), pos);
-        Hep3Vector pos_int_sensor = plane.getSensor().getGeometry().getGlobalToLocal().transformed(VecOp.mult(VecOp.inverse(HPSTransformations.getMatrix()), pos));
-        
-        if(this._debug) System.out.printf("%s: found iterative helix intercept in sensor coordinates at %s\n",
-                this.getClass().getSimpleName(),pos_int_sensor.toString());
+        pos_int_det = VecOp.mult(VecOp.inverse(CoordinateTransformations.getMatrix()), pos);
+        Hep3Vector pos_int_sensor = plane.getSensor().getGeometry().getGlobalToLocal().transformed(VecOp.mult(VecOp.inverse(CoordinateTransformations.getMatrix()), pos));
+
+        if (this._debug)
+            System.out.printf("%s: found iterative helix intercept in sensor coordinates at %s\n", this.getClass().getSimpleName(), pos_int_sensor.toString());
         result_inside = plane.getDetectorElement().getGeometry().getPhysicalVolume().getMotherLogicalVolume().getSolid().inside(pos_int_sensor);
         result_inside_module = plane.getSensor().getGeometry().getDetectorElement().getParent().getGeometry().inside(pos_int_det);
-        
-        if(this._debug) System.out.printf("%s: Inside result sensor: %s module: %s\n",
-                                this.getClass().getSimpleName(), 
-                                result_inside.toString(),
-                                result_inside_module.toString());
 
-        
-        
+        if (this._debug)
+            System.out.printf("%s: Inside result sensor: %s module: %s\n", this.getClass().getSimpleName(), result_inside.toString(), result_inside_module.toString());
+
         isInsideSolid = false;
-        if(result_inside.equals(Inside.INSIDE) || result_inside.equals(Inside.SURFACE)) {
+        if (result_inside.equals(Inside.INSIDE) || result_inside.equals(Inside.SURFACE)) {
             isInsideSolid = true;
         }
-        
+
         isInsideSolidModule = false;
-        if(result_inside_module.equals(Inside.INSIDE) || result_inside_module.equals(Inside.SURFACE)) {
+        if (result_inside_module.equals(Inside.INSIDE) || result_inside_module.equals(Inside.SURFACE)) {
             isInsideSolidModule = true;
         }
 
-
         isInside = true;
-        if(Math.abs(pos_int.x()) > plane.getMeasuredDimension()/2.0) {
-            if(this._debug) System.out.printf("%s: intercept is outside in u\n", this.getClass().getSimpleName());
+        if (Math.abs(pos_int.x()) > plane.getMeasuredDimension() / 2.0) {
+            if (this._debug)
+                System.out.printf("%s: intercept is outside in u\n", this.getClass().getSimpleName());
             isInside = false;
         }
-        
-        if(Math.abs(pos_int.y()) > plane.getUnmeasuredDimension()/2.0) {
-            if(this._debug) System.out.printf("%s: intercept is outside in v\n", this.getClass().getSimpleName());
+
+        if (Math.abs(pos_int.y()) > plane.getUnmeasuredDimension() / 2.0) {
+            if (this._debug)
+                System.out.printf("%s: intercept is outside in v\n", this.getClass().getSimpleName());
             isInside = false;
         }
-        
-        
-        
-         
+
         // Check if it's inside sensor and module and if it contradicts the manual calculation
-        // For now: trust manual calculation and output warning if it's outside BOTH sensor AND module -> FIX THIS!?
-        
-        if(!isInsideSolid ) {
-            if(_debug) System.out.printf("%s: manual iterative calculation says inside sensor, inside solid says outside -> contradiction \n", this.getClass().getSimpleName());
-            if(isInsideSolidModule) {
-                if(_debug) System.out.printf("%s: this iterative intercept is outside sensor but inside module\n", this.getClass().getSimpleName());
+        // For now: trust manual calculation and output warning if it's outside BOTH sensor AND
+        // module -> FIX THIS!?
+
+        if (!isInsideSolid) {
+            if (_debug)
+                System.out.printf("%s: manual iterative calculation says inside sensor, inside solid says outside -> contradiction \n", this.getClass().getSimpleName());
+            if (isInsideSolidModule) {
+                if (_debug)
+                    System.out.printf("%s: this iterative intercept is outside sensor but inside module\n", this.getClass().getSimpleName());
             } else {
-                if(_debug) System.out.printf("%s: warning: this iterative intercept %s, sensor frame %s, (sensor origin %s ) is outside sensor and module!\n", 
-                            this.getClass().getSimpleName(),pos_int_trk.toString(),pos_int.toString(),plane.origin().toString());
+                if (_debug)
+                    System.out.printf("%s: warning: this iterative intercept %s, sensor frame %s, (sensor origin %s ) is outside sensor and module!\n", this.getClass().getSimpleName(), pos_int_trk.toString(), pos_int.toString(), plane.origin().toString());
             }
         }
-        
-        if(!isInside) return null;
-        
-        if(this._debug) {
-            System.out.printf("%s: found intercept at %s \n",this.getClass().getSimpleName(),pos_int_trk.toString());
+
+        if (!isInside)
+            return null;
+
+        if (this._debug) {
+            System.out.printf("%s: found intercept at %s \n", this.getClass().getSimpleName(), pos_int_trk.toString());
         }
-        
+
         return pos_int_trk;
-        
-      
-    
     }
-    
+
     @Override
     public void setDebug(boolean debug) {
         _debug = debug;
@@ -392,64 +370,75 @@
 
     public MaterialManager getMaterialManager() {
         // Should be safe to cast here
-        return (MaterialManager)_materialmanager;
+        return (MaterialManager) _materialmanager;
     }
-    
+
     /**
      * Nested class to encapsulate the scatter angles and which detector element it is related to
      */
     public class ScatterPoint implements Comparable<ScatterPoint> {
+
         IDetectorElement _det;
         ScatterAngle _scatterAngle;
+
         public ScatterPoint(IDetectorElement det, ScatterAngle scatterAngle) {
             _det = det;
             _scatterAngle = scatterAngle;
         }
+
         public IDetectorElement getDet() {
             return _det;
         }
+
         public ScatterAngle getScatterAngle() {
             return _scatterAngle;
         }
 
         @Override
         public int compareTo(ScatterPoint p) {
-                return p.getScatterAngle().PathLen() > this._scatterAngle.PathLen() ? -1 : 1;
+            return p.getScatterAngle().PathLen() > this._scatterAngle.PathLen() ? -1 : 1;
         }
     }
-    
+
     /**
      * Nested class to encapsulate a list of scatters
      * 
      */
     public class ScatterPoints {
+
         private List<ScatterPoint> _points;
+
         public ScatterPoints(List<ScatterPoint> _points) {
             this._points = _points;
         }
+
         private ScatterPoints() {
             _points = new ArrayList<ScatterPoint>();
         }
+
         public List<ScatterPoint> getPoints() {
             return _points;
         }
+
         public void addPoint(ScatterPoint point) {
             _points.add(point);
         }
+
         private List<ScatterAngle> getScatterAngleList() {
             List<ScatterAngle> scatters = new ArrayList<ScatterAngle>();
-            for(ScatterPoint p : _points) scatters.add(p._scatterAngle);
+            for (ScatterPoint p : _points)
+                scatters.add(p._scatterAngle);
             return scatters;
         }
 
         public ScatterPoint getScatterPoint(IDetectorElement detectorElement) {
-            for(ScatterPoint p : _points) {
-                if(p.getDet().equals(detectorElement)) {
+            for (ScatterPoint p : _points) {
+                if (p.getDet().equals(detectorElement)) {
                     return p;
                 }
             }
             return null;
         }
     }
-    
+
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
NoiselessReadoutChip.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/NoiselessReadoutChip.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/NoiselessReadoutChip.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -17,21 +17,22 @@
 import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeDataCollection;
 
 /**
- * Basic readout chip class.  This class supports the minimal functions expected of
- * a readout chip.  The charge on a strip/pixel is digitized as an integer number
- * with a simple ADC with programmable resolution and dynamic range.  A chip with
- * 1-bit ADC resolution (binary readout) is treated as a special case.
+ * Basic readout chip class. This class supports the minimal functions expected of a readout chip.
+ * The charge on a strip/pixel is digitized as an integer number with a simple ADC with
+ * programmable resolution and dynamic range. A chip with 1-bit ADC resolution (binary readout) is
+ * treated as a special case.
  * 
- * Noise is added to strips with charge and random noise hits are generated as well.
- * Methods are provided to decode the charge and time (although the current
- * implementation always returns a time of 0).
- *
- * This implementation has thresholds that are settable in units of RMS noise of
- * each channel to enable simluation of highly optimized readout chains.  If
- * absolute thresholds are desired, GenericReadoutChip should be used instead.
- *
+ * Noise is added to strips with charge and random noise hits are generated as well. Methods are
+ * provided to decode the charge and time (although the current implementation always returns a
+ * time of 0).
+ * 
+ * This implementation has thresholds that are settable in units of RMS noise of each channel to
+ * enable simluation of highly optimized readout chains. If absolute thresholds are desired,
+ * GenericReadoutChip should be used instead.
+ * 
  * @author Tim Nelson
  */
+// FIXME: Is this a copy-paste job from SiSim? What behavior is changed from there?
 public class NoiselessReadoutChip implements ReadoutChip {
 
     private BasicChannel _channel = new BasicChannel();
@@ -47,9 +48,9 @@
     }
 
     /**
-     * Set the noise intercept (i.e., the noise for 0 strip/pixel capacitance).
-     * Units are electrons of noise.
-     *
+     * Set the noise intercept (i.e., the noise for 0 strip/pixel capacitance). Units are electrons
+     * of noise.
+     * 
      * @param noise_intercept noise for 0 capacitance
      */
     public void setNoiseIntercept(double noise_intercept) {
@@ -57,9 +58,9 @@
     }
 
     /**
-     * Set the noise slope (i.e., the proportionality between noise and capacitance).
-     * Units are electrons of noise per fF of capacitance.
-     *
+     * Set the noise slope (i.e., the proportionality between noise and capacitance). Units are
+     * electrons of noise per fF of capacitance.
+     * 
      * @param noise_slope noise slope per unit capacitance
      */
     public void setNoiseSlope(double noise_slope) {
@@ -68,7 +69,7 @@
 
     /**
      * Set the number of bits of ADC resolution
-     *
+     * 
      * @param nbits
      */
     public void setNbits(int nbits) {
@@ -77,7 +78,7 @@
 
     /**
      * Set the dynamic range of the ADC
-     *
+     * 
      * @param dynamic_range in fC
      */
     public void setDynamicRange(double dynamic_range) {
@@ -85,10 +86,9 @@
     }
 
     /**
-     * Return the BasicChannel associated with a given channel number.
-     * For the basic readout, there is a single instance of BasicChannel
-     * and thus the channel number is ignored.
-     *
+     * Return the BasicChannel associated with a given channel number. For the basic readout, there
+     * is a single instance of BasicChannel and thus the channel number is ignored.
+     * 
      * @param channel_number channel number
      * @return associated BasicReadoutChannel
      */
@@ -102,33 +102,33 @@
     }
 
     /**
-     * Given a collection of electrode data (i.e., charge on strips/pixels),
-     * return a map associating the channel and it's list of raw data.
-     *
-     * @param data  electrode data from the charge distribution
-     * @param electrodes  strip or pixel electrodes
-     * @return  map containing the ADC counts for this sensor
+     * Given a collection of electrode data (i.e., charge on strips/pixels), return a map
+     * associating the channel and it's list of raw data.
+     * 
+     * @param data electrode data from the charge distribution
+     * @param electrodes strip or pixel electrodes
+     * @return map containing the ADC counts for this sensor
      */
     @Override
     public SortedMap<Integer, List<Integer>> readout(SiElectrodeDataCollection data, SiSensorElectrodes electrodes) {
 
-        //  If there is no electrode data for this readout chip,  create an empty
-        //  electrode data collection
+        // If there is no electrode data for this readout chip, create an empty
+        // electrode data collection
         if (data == null) {
             data = new SiElectrodeDataCollection();
         }
 
-        //  Add noise hits to the electrode data collection
-//        addNoise(data, electrodes);
+        // Add noise hits to the electrode data collection
+        // addNoise(data, electrodes);
 
-        //  return the digitized charge data as a map that associates a hit
-        //  channel with a list of raw data for the channel
+        // return the digitized charge data as a map that associates a hit
+        // channel with a list of raw data for the channel
         return digitize(data, electrodes);
     }
 
     /**
      * Decode the hit charge stored in the RawTrackerHit
-     *
+     * 
      * @param hit raw hit
      * @return hit charge in units of electrons
      */
@@ -138,9 +138,8 @@
     }
 
     /**
-     * Decode the hit time.  Currently, the basic readout chip ignores the
-     * hit time and returns 0.
-     *
+     * Decode the hit time. Currently, the basic readout chip ignores the hit time and returns 0.
+     * 
      * @param hit raw hit data
      * @return hit time
      */
@@ -151,47 +150,45 @@
 
     /**
      * Digitizes the hit channels in a SiElectrodeDataCollection.
-     *
-     * The SiElectrodeDataCollection is a map that associates a given channel with
-     * it's SiElectrodeData.  The SiElectrodeData encapsulates the deposited charge
-     * on an strip/pixel and any associated SimTrackerHits.
-     *
-     * The output of this class is a map that associates a channel number with
-     * a list of raw data
-     *
+     * 
+     * The SiElectrodeDataCollection is a map that associates a given channel with it's
+     * SiElectrodeData. The SiElectrodeData encapsulates the deposited charge on an strip/pixel and
+     * any associated SimTrackerHits.
+     * 
+     * The output of this class is a map that associates a channel number with a list of raw data
+     * 
      * @param data electrode data collection
      * @return map associating channels with a list of raw data
      */
-    private SortedMap<Integer, List<Integer>> digitize(SiElectrodeDataCollection data,
-            SiSensorElectrodes electrodes) {
-        //  Create the map that associates a given sensor channel with it's list of raw data
+    private SortedMap<Integer, List<Integer>> digitize(SiElectrodeDataCollection data, SiSensorElectrodes electrodes) {
+        // Create the map that associates a given sensor channel with it's list of raw data
         SortedMap<Integer, List<Integer>> chip_data = new TreeMap<Integer, List<Integer>>();
 
-        //  Loop over the channels contained in the SiElectrodeDataCollection
+        // Loop over the channels contained in the SiElectrodeDataCollection
         for (Integer channel : data.keySet()) {
             if (dropBadChannels && HPSSVTCalibrationConstants.isBadChannel((SiSensor) electrodes.getDetectorElement(), channel)) {
-//                System.out.format("%d bad\n", channel);
+                // System.out.format("%d bad\n", channel);
                 continue;
             }
-//                System.out.format("%d OK\n", channel);
-            //  Fetch the electrode data for this channel
+            // System.out.format("%d OK\n", channel);
+            // Fetch the electrode data for this channel
             SiElectrodeData eldata = data.get(channel);
 
-            //  Get the charge in units of electrons
+            // Get the charge in units of electrons
             double charge = eldata.getCharge();
 
-            //  Calculate the ADC value for this channel and make sure it is positive
+            // Calculate the ADC value for this channel and make sure it is positive
             int adc = getADC().convert(charge);
             if (adc <= 0) {
                 continue;
             }
 
-            //  Create a list containing the adc value - for the basic readout
-            //  there is only 1 word of raw data
+            // Create a list containing the adc value - for the basic readout
+            // there is only 1 word of raw data
             List<Integer> channel_data = new ArrayList<Integer>();
             channel_data.add(adc);
 
-            //  Save the list of raw data in the chip_data map
+            // Save the list of raw data in the chip_data map
             chip_data.put(channel, channel_data);
         }
 
@@ -200,11 +197,10 @@
 
     /**
      * BasicChannel class representing a single channel's behavior
-     *
-     * Note that binary readout is a special case.  Anything positive value
-     * passed to a binary ADC for digitization is assumed to have crossed t
-     * hreshold and is assigned a value of 1.  Decoding binary readout results
-     * in either 0 or dynamic_range.
+     * 
+     * Note that binary readout is a special case. Anything positive value passed to a binary ADC
+     * for digitization is assumed to have crossed t hreshold and is assigned a value of 1.
+     * Decoding binary readout results in either 0 or dynamic_range.
      */
     private class BasicChannel implements ReadoutChannel {
 
@@ -213,7 +209,7 @@
 
         /**
          * Set the noise (in electrons) for 0 capacitance
-         *
+         * 
          * @param noise_intercept noise intercept
          */
         private void setNoiseIntercept(double noise_intercept) {
@@ -222,7 +218,7 @@
 
         /**
          * Set the capacitative noise slope (in electrons / pF)
-         *
+         * 
          * @param noise_slope noise slope
          */
         private void setNoiseSlope(double noise_slope) {
@@ -231,7 +227,7 @@
 
         /**
          * Return the noise in electrons for a given strip/pixel capacitance
-         *
+         * 
          * @param capacitance capacitance in pF
          * @return noise in electrons
          */
@@ -250,7 +246,7 @@
 
         /**
          * Set the ADC resolution in number of bits.
-         *
+         * 
          * @param nbits number of bits
          */
         private void setNbits(int nbits) {
@@ -259,7 +255,7 @@
 
         /**
          * Set the dynamic range in fC
-         *
+         * 
          * @param dynamic range
          */
         private void setDynamicRange(double dynamic_range) {
@@ -268,7 +264,7 @@
 
         /**
          * Compute the maximum ADC value
-         *
+         * 
          * @return largest possible ADC value according to # of bits
          */
         private int maxADCValue() {
@@ -277,7 +273,7 @@
 
         /**
          * Compute the conversion constant in ADC/fC
-         *
+         * 
          * @return conversion constant for ADC
          */
         private double conversionConstant() {
@@ -286,7 +282,7 @@
 
         /**
          * Perform analog to digital conversion
-         *
+         * 
          * @return digital ADC output between 0 and maxADCValue
          */
         public int convert(double charge) {
@@ -303,7 +299,7 @@
 
         /**
          * Decode charge from ADC value
-         *
+         * 
          * @return charge specified by a given ADC value
          */
         public double decodeCharge(int adc_value) {

java/trunk/tracking/src/main/java/org/hps/recon/tracking
RunAlignment.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/RunAlignment.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/RunAlignment.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,96 +0,0 @@
-package org.hps.recon.tracking;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.Track;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- *
- * @author mgraham
- */
-public class RunAlignment extends Driver {
-
-    private AIDA aida = AIDA.defaultInstance();
-    String[] detNames = {"Tracker"};
-    Integer _minLayers = 8;
-    Integer[] nlayers = {8};
-    int nevt = 0;
-    double[] beamsize = {0.001, 0.02, 0.02};
-    String _config = "1pt8";
-    AlignmentParameters ap;
-    int totalTracks=0;
-// flipSign is a kludge...
-//  HelicalTrackFitter doesn't deal with B-fields in -ive Z correctly
-//  so we set the B-field in +iveZ and flip signs of fitted tracks
-//  note:  this should be -1 for Test configurations and +1 for Full (v3.X and lower) configurations
-//  this is set by the _config variable (detType in HeavyPhotonDriver)
-    int flipSign = 1;
-
-    public RunAlignment(int trackerLayers, int mintrkLayers, String config) {
-        nlayers[0] = trackerLayers;
-        _minLayers = mintrkLayers;
-        _config = config;
-        if (_config.contains("Test"))
-            flipSign = -1;
-        ap = new AlignmentParameters("/Users/mgraham/HPS/align.txt");
-
-    }
-
-    public void process(
-            EventHeader event) {
-
-
-        //  Create a map between tracks and the associated MCParticle
-        List<Track> tracklist = event.get(Track.class, "MatchedTracks");
-//        System.out.println("Number of Tracks = " + tracklist.size());
-        double duRange=0.1;
-         for (Track trk : tracklist) {
-            totalTracks++;
-            ap.PrintResidualsAndDerivatives(trk);
-
-            if(1==1){
-                aida.histogram1D("Track d0",50,-0.5,0.5).fill(trk.getTrackParameter(0));
-                aida.histogram1D("Track sin(phi0)",50,-0.5,0.5).fill(Math.sin(trk.getTrackParameter(1)));
-                aida.histogram1D("Track z0",50,-0.1,0.1).fill(Math.sin(trk.getTrackParameter(3)));
-                aida.histogram1D("Track chi^2",50,0,25).fill(trk.getChi2());
-                for (int i = 1; i < 11; i++) {
-                double[] res = ap.getResidual(trk, i);
-                int mylayer=(int)res[6];
-                if(mylayer<11){
-                     aida.histogram1D("Track chi^2 Positive Side",50,0,25).fill(trk.getChi2());
-                }else{
-                     aida.histogram1D("Track chi^2 Negative Side",50,0,25).fill(trk.getChi2());
-                }
-
-                aida.histogram1D("deltaU -- Layer " + mylayer,50,-duRange,duRange).fill(res[0]);
-                aida.histogram1D("deltaU Pull-- Layer " + mylayer,50,-3,3).fill(res[0]/res[3]);
-                if(i==3&&Math.sin(trk.getTrackParameter(1))>0){
-                    aida.histogram1D("Positive phi0  deltaU -- Layer " + mylayer,50,-duRange,duRange).fill(res[0]);
-                aida.histogram1D("Positive phi0 deltaU Pull-- Layer " + mylayer,50,-3,3).fill(res[0]/res[3]);
-                }
-                if(i==3&&Math.sin(trk.getTrackParameter(1))<0){
-                    aida.histogram1D("Negative phi0  deltaU -- Layer " + mylayer,50,-duRange,duRange).fill(res[0]);
-                aida.histogram1D("Negative phi0 deltaU Pull-- Layer " + mylayer,50,-3,3).fill(res[0]/res[3]);
-                }
- 
-             }
-            }
- }
-
-    }
-
-    public void endOfData() {
-        try {
-            System.out.println("Total Number of Tracks Found = "+totalTracks);
-            ap.closeFile();
-        } catch (IOException ex) {
-            Logger.getLogger(RunAlignment.class.getName()).log(Level.SEVERE, null, ex);
-        }
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
SVTBadChannelFilterDriver.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTBadChannelFilterDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTBadChannelFilterDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -11,10 +11,10 @@
 import org.lcsim.util.Driver;
 
 /**
- *
+ * 
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: SVTBadChannelFilterDriver.java,v 1.2 2012/08/29 21:02:46 meeg Exp $
  */
+// TODO: Add class documentation.
 public class SVTBadChannelFilterDriver extends Driver {
 
     private String rawTrackerHitCollection = "SVTRawTrackerHits";
@@ -31,7 +31,9 @@
                 int strip = hit.getIdentifierFieldValue("strip");
                 SiSensor sensor = (SiSensor) hit.getDetectorElement();
 
-//                System.out.format("module %d, layer %d, strip %d\n", hit.getIdentifierFieldValue("module"), hit.getIdentifierFieldValue("layer"), hit.getIdentifierFieldValue("strip"));
+                // System.out.format("module %d, layer %d, strip %d\n",
+                // hit.getIdentifierFieldValue("module"), hit.getIdentifierFieldValue("layer"),
+                // hit.getIdentifierFieldValue("strip"));
                 if (HPSSVTCalibrationConstants.isBadChannel(sensor, strip)) {
                     i.remove();
                 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
SVTRawTrackerHitThresholdDriver.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTRawTrackerHitThresholdDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/SVTRawTrackerHitThresholdDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,80 +0,0 @@
-package org.hps.recon.tracking;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.util.Driver;
-
-/**
- *
- * @author mgraham
- */
-public class SVTRawTrackerHitThresholdDriver extends Driver {
-
-    private String rawTrackerHitCollectionName = "RawTrackerHitMaker_RawTrackerHits";
-    private String outputHitCollectionName = "RawTrackerHitsThreshold";
-    private String calibFileName = "foobar";
-    private String trackerName = "Tracker";
-    private Detector detector;
-    private List<SiSensor> sensors;
-    private double noiseThreshold = 3;
-    private int nhitsAboveNoise = 2;
-
-    public SVTRawTrackerHitThresholdDriver() {
-    }
-
-    public void setRawTrackerHitCollectionName(String rawTrackerHitCollectionName) {
-        this.rawTrackerHitCollectionName = rawTrackerHitCollectionName;
-    }
-    
-    public void setOutputHitCollectionName(String outputHitCollectionName) {
-        this.outputHitCollectionName = outputHitCollectionName;
-    }
-    
-    public void setCalibFileName(String calibFileName) {
-        this.calibFileName = calibFileName;
-    }
-    
-    public void setNoiseThreshold(double thres){
-        this.noiseThreshold=thres;
-    }
-    
-    public void setNhitsAboveNoise(int nhits){
-        this.nhitsAboveNoise=nhits;
-    }
-
-    protected void detectorChanged(Detector detector) {
-    }
-
-    public void process(EventHeader event) {
-        if (event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
-            // Get RawTrackerHit collection from event.
-            List<RawTrackerHit> rawTrackerHits = event.get(RawTrackerHit.class, rawTrackerHitCollectionName);
-            List<RawTrackerHit> outputHits = new ArrayList<RawTrackerHit>();
-            
-            // Increment strip hit count.
-            for (RawTrackerHit hit : rawTrackerHits) {
-                SiSensor sensor=(SiSensor) hit.getDetectorElement();
-                int strip=hit.getIdentifierFieldValue("strip");
-                short[] adcVal=hit.getADCValues();                
-                double ped=HPSSVTCalibrationConstants.getPedestal(sensor, strip);
-                double noise=HPSSVTCalibrationConstants.getNoise(sensor, strip);
-                int nAbove=0;
-                for(int i=0;i<6;i++){
-                    double pedSubNorm=(adcVal[i]-ped)/noise;
-                    if(pedSubNorm>noiseThreshold)
-                        nAbove++;                    
-                }
-                if(nAbove>=nhitsAboveNoise)
-                    outputHits.add(hit);
-            }
-
-            event.put(outputHitCollectionName, outputHits, RawTrackerHit.class, 0);
-        }
-    }
-}
\ No newline at end of file

java/trunk/tracking/src/main/java/org/hps/recon/tracking
SeedTracker.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/SeedTracker.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/SeedTracker.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -12,7 +12,6 @@
 /**
  * Class extending lcsim version to allow extra flexibility
  * @author Per Hansson Adrian <[log in to unmask]>
- * @version $Id: SeedTracker.java,v 1.4 2013/11/07 03:54:58 phansson Exp $ $Date: 2013/11/07 03:54:58 $ $Author: phansson $ 
  */
 public class SeedTracker extends org.lcsim.recon.tracking.seedtracker.SeedTracker  {
 
@@ -71,6 +70,4 @@
         _finder.getConfirmer().setApplySectorBinning(applySectorBinning);
         
     }
-
-
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
SimpleSvtReadout.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/SimpleSvtReadout.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/SimpleSvtReadout.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,425 +0,0 @@
-package org.hps.recon.tracking;
-
-//--- java ---//
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.PriorityQueue;
-import java.util.Set;
-
-import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
-import org.hps.conditions.deprecated.HPSSVTConstants;
-import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.readout.ecal.ClockSingleton;
-import org.hps.readout.ecal.ReadoutTimestamp;
-import org.hps.readout.ecal.TriggerableDriver;
-import org.hps.util.RandomGaussian;
-//--- lcsim ---//
-import org.lcsim.detector.tracker.silicon.ChargeCarrier;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.LCRelation;
-import org.lcsim.event.RawTrackerHit;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.base.BaseLCRelation;
-import org.lcsim.event.base.BaseRawTrackerHit;
-import org.lcsim.geometry.Detector;
-import org.lcsim.lcio.LCIOConstants;
-import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim;
-import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeData;
-import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeDataCollection;
-import org.lcsim.recon.tracking.digitization.sisim.SiSensorSim;
-import org.lcsim.recon.tracking.digitization.sisim.config.SimTrackerHitReadoutDriver;
-
-/**
- *
- * @author Sho Uemura <[log in to unmask]>
- * @version $Id: SimpleSvtReadout.java,v 1.19 2013/08/07 23:38:32 meeg Exp $
- */
-public class SimpleSvtReadout extends TriggerableDriver {
-
-    private SimTrackerHitReadoutDriver readoutDriver = new SimTrackerHitReadoutDriver();
-    private SiSensorSim siSimulation = new CDFSiSensorSim();
-    private String outputCollection = "SVTRawTrackerHits";
-    private String relationCollection = "SVTTrueHitRelations";
-    private Map<SiSensor, PriorityQueue<StripHit>[]> hitMap = new HashMap<SiSensor, PriorityQueue<StripHit>[]>();
-    //readout period time offset in ns
-    private double readoutOffset = 0.0;
-    private double readoutLatency = 240.0;
-    private double pileupCutoff = 300.0;
-    private String readout = "TrackerHits";
-    private double timeOffset = 30.0;
-    private boolean noPileup = false;
-    private boolean addNoise = true;
-    //cut settings
-    private boolean enableThresholdCut = true;
-    private int samplesAboveThreshold = 3;
-    private double noiseThreshold = 2.0;
-    private boolean enablePileupCut = true;
-    private boolean dropBadChannels = true;
-
-    public SimpleSvtReadout() {
-        add(readoutDriver);
-        triggerDelay = 100.0;
-    }
-
-    public void setAddNoise(boolean addNoise) {
-        this.addNoise = addNoise;
-    }
-
-    public void setEnablePileupCut(boolean enablePileupCut) {
-        this.enablePileupCut = enablePileupCut;
-    }
-
-    public void setEnableThresholdCut(boolean enableThresholdCut) {
-        this.enableThresholdCut = enableThresholdCut;
-    }
-
-    public void setNoiseThreshold(double noiseThreshold) {
-        this.noiseThreshold = noiseThreshold;
-    }
-
-    public void setSamplesAboveThreshold(int samplesAboveThreshold) {
-        this.samplesAboveThreshold = samplesAboveThreshold;
-    }
-
-    public void setNoPileup(boolean noPileup) {
-        this.noPileup = noPileup;
-    }
-
-    public void setDropBadChannels(boolean dropBadChannels) {
-        this.dropBadChannels = dropBadChannels;
-    }
-
-    /**
-     *
-     */
-    @Override
-    public void detectorChanged(Detector detector) {
-        super.detectorChanged(detector);
-
-        String[] readouts = {readout};
-        readoutDriver.setCollections(readouts);
-
-        if (!noPileup) {
-            for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-                PriorityQueue<StripHit>[] hitQueues = new PriorityQueue[HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR];
-                hitMap.put(sensor, hitQueues);
-            }
-        }
-    }
-
-    /**
-     *
-     */
-    @Override
-    public void process(EventHeader event) {
-        super.process(event);
-
-        List<StripHit> stripHits = doSiSimulation();
-
-        if (!noPileup) {
-            for (StripHit stripHit : stripHits) {
-                SiSensor sensor = stripHit.sensor;
-                int channel = stripHit.channel;
-
-                PriorityQueue<StripHit>[] hitQueues = hitMap.get(sensor);
-                if (hitQueues[channel] == null) {
-                    hitQueues[channel] = new PriorityQueue<StripHit>();
-                }
-                hitQueues[channel].add(stripHit);
-            }
-
-            // dump stale hits
-            for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-                PriorityQueue<StripHit>[] hitQueues = hitMap.get(sensor);
-                for (int i = 0; i < hitQueues.length; i++) {
-                    if (hitQueues[i] != null) {
-                        while (!hitQueues[i].isEmpty() && hitQueues[i].peek().time < ClockSingleton.getTime() - (readoutLatency + pileupCutoff)) {
-//                                System.out.format("Time %f: Dump stale hit with time %f\n",ClockSingleton.getTime(),hitQueues[i].peek().time);
-                            hitQueues[i].poll();
-                        }
-                        if (hitQueues[i].isEmpty()) {
-                            hitQueues[i] = null;
-                        }
-                    }
-                }
-            }
-
-            // If an ECal trigger is received, make hits from pipelines
-            checkTrigger(event);
-        } else {
-            // Create a list to hold the analog data
-            List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
-
-            for (StripHit stripHit : stripHits) {
-                SiSensor sensor = stripHit.sensor;
-                int channel = stripHit.channel;
-                double amplitude = stripHit.amplitude;
-                short[] samples = new short[6];
-
-                double[] signal = new double[6];
-                for (int i = 0; i < 6; i++) {
-                    signal[i] = HPSSVTCalibrationConstants.getPedestal(sensor, channel);
-                }
-                if (addNoise) {
-                    addNoise(sensor, channel, signal);
-                }
-
-                for (int i = 0; i < 6; i++) {
-                    double time = i * HPSSVTConstants.SAMPLING_INTERVAL - timeOffset;
-                    signal[i] += amplitude * pulseAmplitude(time, HPSSVTCalibrationConstants.getTShaping(sensor, channel));
-//                    signal[i] += amplitude * pulseAmplitude(time, HPSSVTCalibrationConstants.getTShaping(sensor, channel)) + HPSSVTCalibrationConstants.getPedestal(sensor, channel);
-                    samples[i] = (short) Math.round(signal[i]);
-                }
-
-                long cell_id = SvtUtils.makeCellID(sensor, channel);
-
-                RawTrackerHit hit = new BaseRawTrackerHit(0, cell_id, samples, new ArrayList<SimTrackerHit>(stripHit.simHits), sensor);
-//                        System.out.println("Making RTH");
-                if (readoutCuts(hit)) {
-//                    System.out.println("RTH passed cuts");
-                    hits.add(hit);
-                }
-            }
-
-            int flags = 1 << LCIOConstants.TRAWBIT_ID1;
-//            flags += 1 << LCIOConstants.RTHBIT_HITS;
-            event.put(outputCollection, hits, RawTrackerHit.class, flags, readout);
-//            System.out.println("Made " + hits.size() + " RawTrackerHits");
-        }
-    }
-
-    private List<StripHit> doSiSimulation() {
-        List<StripHit> stripHits = new ArrayList<StripHit>();
-        for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-
-            // Set the sensor to be used in the charge deposition simulation
-            siSimulation.setSensor(sensor);
-
-            // Perform the charge deposition simulation
-            Map<ChargeCarrier, SiElectrodeDataCollection> electrodeDataMap = siSimulation.computeElectrodeData();
-
-            for (ChargeCarrier carrier : ChargeCarrier.values()) {
-
-                // If the sensor is capable of collecting the given charge carrier
-                // then obtain the electrode data for the sensor
-                if (sensor.hasElectrodesOnSide(carrier)) {
-
-                    SiElectrodeDataCollection electrodeDataCol = electrodeDataMap.get(carrier);
-
-                    // If there is no electrode data available create a new instance of electrode data
-                    if (electrodeDataCol == null) {
-                        electrodeDataCol = new SiElectrodeDataCollection();
-                    }
-
-                    // Loop over all sensor channels
-                    for (Integer channel : electrodeDataCol.keySet()) {
-
-                        // Get the electrode data for this channel
-                        SiElectrodeData electrodeData = electrodeDataCol.get(channel);
-                        Set<SimTrackerHit> simHits = electrodeData.getSimulatedHits();
-
-                        // compute hit time as the unweighted average of SimTrackerHit times; this is dumb but okay since there's generally only one SimTrackerHit
-                        double time = 0.0;
-                        for (SimTrackerHit hit : simHits) {
-                            time += hit.getTime();
-                        }
-                        time /= simHits.size();
-                        time += ClockSingleton.getTime();
-
-                        // Get the charge in units of electrons
-                        double charge = electrodeData.getCharge();
-
-                        double resistorValue = 100;  // Ohms
-                        double inputStageGain = 1.5;
-                        double amplitude = (charge / HPSSVTConstants.MIP) * resistorValue * inputStageGain * Math.pow(2, 14) / 2000;
-
-                        stripHits.add(new StripHit(sensor, channel, amplitude, time, simHits));
-                    }
-                }
-            }
-            // Clear the sensors of all deposited charge
-            siSimulation.clearReadout();
-        }
-        return stripHits;
-    }
-
-    private void addNoise(SiSensor sensor, int channel, double[] signal) {
-        double noise = HPSSVTCalibrationConstants.getNoise(sensor, channel);
-        for (int i = 0; i < 6; i++) {
-            signal[i] += RandomGaussian.getGaussian(0, noise);
-        }
-    }
-
-    private boolean readoutCuts(RawTrackerHit hit) {
-        if (enableThresholdCut && !samplesAboveThreshold(hit)) {
-//            System.out.println("Failed threshold cut");
-            return false;
-        }
-        if (enablePileupCut && !pileupCut(hit)) {
-//            System.out.println("Failed pileup cut");
-            return false;
-        }
-        if (dropBadChannels && !badChannelCut(hit)) {
-//            System.out.println("Failed bad channel cut");
-            return false;
-        }
-        return true;
-    }
-
-    private boolean badChannelCut(RawTrackerHit hit) {
-        SiSensor sensor = (SiSensor) hit.getDetectorElement();
-        int channel = hit.getIdentifierFieldValue("strip");
-        return !HPSSVTCalibrationConstants.isBadChannel(sensor, channel);
-    }
-
-    private boolean pileupCut(RawTrackerHit hit) {
-        short[] samples = hit.getADCValues();
-        return (samples[2] > samples[1] || samples[3] > samples[2]);
-    }
-
-    private boolean samplesAboveThreshold(RawTrackerHit hit) {
-        SiSensor sensor = (SiSensor) hit.getDetectorElement();
-        int channel = hit.getIdentifierFieldValue("strip");
-        HPSSVTCalibrationConstants.getChannelConstants(sensor, channel);
-        double pedestal = HPSSVTCalibrationConstants.getPedestal(sensor, channel);
-        double noise = HPSSVTCalibrationConstants.getNoise(sensor, channel);
-        int count = 0;
-        short[] samples = hit.getADCValues();
-        for (int i = 0; i < samples.length; i++) {
-//            System.out.format("%d, %d\n", samples[i] - pedestal, noise * 3.0);
-            if (samples[i] - pedestal > noise * noiseThreshold) {
-                count++;
-            }
-        }
-        return count >= samplesAboveThreshold;
-    }
-
-    @Override
-    protected void processTrigger(EventHeader event) {
-        if (noPileup) {
-            return;
-        }
-//            System.out.println("Got trigger");
-
-        // Create a list to hold the analog data
-        List<RawTrackerHit> hits = new ArrayList<RawTrackerHit>();
-        List<LCRelation> trueHitRelations = new ArrayList<LCRelation>();
-        // Calculate time of first sample
-        double firstSample = Math.floor((ClockSingleton.getTime() - readoutLatency - readoutOffset) / HPSSVTConstants.SAMPLING_INTERVAL) * HPSSVTConstants.SAMPLING_INTERVAL + readoutOffset;
-
-        for (SiSensor sensor : SvtUtils.getInstance().getSensors()) {
-            PriorityQueue<StripHit>[] hitQueues = hitMap.get(sensor);
-            for (int channel = 0; channel < hitQueues.length; channel++) {
-                if (!addNoise && (hitQueues[channel] == null || hitQueues[channel].isEmpty())) {
-                    continue;
-                }
-                double[] signal = new double[6];
-                for (int i = 0; i < 6; i++) {
-                    signal[i] = HPSSVTCalibrationConstants.getPedestal(sensor, channel);
-                }
-                if (addNoise) {
-                    addNoise(sensor, channel, signal);
-                }
-
-                List<SimTrackerHit> simHits = new ArrayList<SimTrackerHit>();
-
-                if (hitQueues[channel] != null) {
-                    for (StripHit hit : hitQueues[channel]) {
-                        double totalContrib = 0;
-                        for (int i = 0; i < 6; i++) {
-                            double sampleTime = firstSample + i * HPSSVTConstants.SAMPLING_INTERVAL;
-                            double signalAtTime = hit.amplitude * pulseAmplitude(sampleTime - hit.time, HPSSVTCalibrationConstants.getTShaping(sensor, channel));
-                            totalContrib += signalAtTime;
-                            signal[i] += signalAtTime;
-//                                    System.out.format("new value of signal[%d] = %f\n", i, signal[i]);
-                        }
-                        if (totalContrib > 4.0 * HPSSVTCalibrationConstants.getNoise(sensor, channel)) {
-//                            System.out.format("adding %d simHits\n", hit.simHits.size());
-                            simHits.addAll(hit.simHits);
-                        }
-                    }
-                }
-
-                short[] samples = new short[6];
-                for (int i = 0; i < 6; i++) {
-                    samples[i] = (short) Math.round(signal[i]);
-                }
-//                        if (hitQueues[channel] != null && !hitQueues[channel].isEmpty()) {
-//                            for (int i = 0; i < 6; i++) {
-//                                System.out.format("samples[%d] = %d\n", i, samples[i]);
-//                            }
-//                        }
-                long cell_id = SvtUtils.makeCellID(sensor, channel);
-                RawTrackerHit hit = new BaseRawTrackerHit(0, cell_id, samples, simHits, sensor);
-                if (readoutCuts(hit)) {
-                    hits.add(hit);
-//                    System.out.format("simHits: %d\n", simHits.size());
-                    for (SimTrackerHit simHit : hit.getSimTrackerHits()) {
-                        LCRelation hitRelation = new BaseLCRelation(hit, simHit);
-                        trueHitRelations.add(hitRelation);
-                    }
-                }
-            }
-        }
-
-        int flags = 1 << LCIOConstants.TRAWBIT_ID1;
-//            flags += 1 << LCIOConstants.RTHBIT_HITS;
-        event.put(outputCollection, hits, RawTrackerHit.class, flags, readout);
-        event.put(relationCollection, trueHitRelations, LCRelation.class, 0);
-        System.out.println("Made " + hits.size() + " RawTrackerHits");
-        System.out.println("Made " + trueHitRelations.size() + " LCRelations");
-    }
-
-    @Override
-    public double readoutDeltaT() {
-        double triggerTime = ClockSingleton.getTime() + triggerDelay;
-//        int cycle = (int) Math.floor((triggerTime - readoutOffset + ClockSingleton.getDt()) / Apv25Constants.SAMPLING_INTERVAL);
-        // Calculate time of first sample
-        double firstSample = Math.floor((triggerTime - readoutLatency - readoutOffset) / HPSSVTConstants.SAMPLING_INTERVAL) * HPSSVTConstants.SAMPLING_INTERVAL + readoutOffset;
-
-        return firstSample;
-    }
-
-    private class StripHit implements Comparable {
-
-        SiSensor sensor;
-        int channel;
-        double amplitude;
-        double time;
-        Set<SimTrackerHit> simHits;
-
-        public StripHit(SiSensor sensor, int channel, double amplitude, double time, Set<SimTrackerHit> simHits) {
-            this.sensor = sensor;
-            this.channel = channel;
-            this.amplitude = amplitude;
-            this.time = time;
-            this.simHits = simHits;
-        }
-
-        @Override
-        public int compareTo(Object o) {
-            double deltaT = time - ((StripHit) o).time;
-            if (deltaT > 0) {
-                return 1;
-            } else if (deltaT < 0) {
-                return -1;
-            } else {
-                return 0;
-            }
-        }
-    }
-
-    private double pulseAmplitude(double time, double tp) {
-        if (time <= 0.0) {
-            return 0.0;
-        }
-        return (time / tp) * Math.exp(1.0 - time / tp);
-    }
-    
-    public int getTimestampType() {
-        return ReadoutTimestamp.SYSTEM_TRACKER;
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
SimpleTrackerDigiDriver.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/SimpleTrackerDigiDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/SimpleTrackerDigiDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -6,14 +6,13 @@
 import org.lcsim.recon.tracking.digitization.sisim.StripHitMaker;
 
 /**
- * This Driver runs the tracker digitization to create raw hits and strip hits
- * from simulated data. The output can be used by a track reconstruction
- * algorithm like Seed Tracker.
+ * This Driver runs the tracker digitization to create raw hits and strip hits from simulated data.
+ * The output can be used by a track reconstruction algorithm like Seed Tracker.
  * 
- * Copied from org.lcsim.hps.recon.tracking.TrackerDigiDriver, with the difference that this driver does not make noise hits or add noise to hits, and drops bad channels.
+ * Copied from org.lcsim.hps.recon.tracking.TrackerDigiDriver, with the difference that this driver
+ * does not make noise hits or add noise to hits, and drops bad channels.
  * 
- * @author [log in to unmask]
- * @version $Id: SimpleTrackerDigiDriver.java,v 1.3 2012/11/20 19:59:35 meeg Exp $
+ * @author Sho Uemura
  */
 public class SimpleTrackerDigiDriver extends TrackerDigiDriver {
 

java/trunk/tracking/src/main/java/org/hps/recon/tracking
StraightLineTrack.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/StraightLineTrack.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/StraightLineTrack.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -4,7 +4,7 @@
 
 /**
  * Encapsulate position, direction, and covariance matrix for a straight-line track
- *
+ * 
  * @author Richard Partridge
  */
 public class StraightLineTrack {
@@ -19,15 +19,15 @@
     private double _dydx;
     private double _dzdx;
     private SymmetricMatrix _cov;
-    private double[] _poca = {0, 0, 0};
-    private double[] _yzT = {0, 0};
+    private double[] _poca = { 0, 0, 0 };
+    private double[] _yzT = { 0, 0 };
 
     /**
-     * Fully qualified constructor for the StraightLineTrack class.  A StraightLineTrack
-     * is specified by providing a position and the direction derivatives dydx and dzdx used
-     * in the vertex fitting.  It is assumed that the track is traveling in the +x direction
-     * (i.e., from the field-free region into the magnetized region).
-     *
+     * Fully qualified constructor for the StraightLineTrack class. A StraightLineTrack is
+     * specified by providing a position and the direction derivatives dydx and dzdx used in the
+     * vertex fitting. It is assumed that the track is traveling in the +x direction (i.e., from
+     * the field-free region into the magnetized region).
+     * 
      * @param x0 x coordinate of the reference plane
      * @param y0 y coordinate at the reference plane
      * @param z0 z coordinate at the reference plane
@@ -48,7 +48,7 @@
 
     /**
      * Return the x coordinate of the reference plane.
-     *
+     * 
      * @return x coordinate of the reference plane
      */
     public double x0() {
@@ -57,7 +57,7 @@
 
     /**
      * Return the y coordinate at the reference plane.
-     *
+     * 
      * @return y coordinate
      */
     public double y0() {
@@ -66,7 +66,7 @@
 
     /**
      * Return the z coordinate at the reference plane.
-     *
+     * 
      * @return z coordinate
      */
     public double z0() {
@@ -75,7 +75,7 @@
 
     /**
      * Return the direction derivative dy/dx.
-     *
+     * 
      * @return dy/dx
      */
     public double dydx() {
@@ -84,7 +84,7 @@
 
     /**
      * Return the direction derivative dz/dx.
-     *
+     * 
      * @return dz/dx
      */
     public double dzdx() {
@@ -93,7 +93,7 @@
 
     /**
      * Return the xPoca .
-     *
+     * 
      * @return xPoca
      */
     public double xPoca() {
@@ -102,7 +102,7 @@
 
     /**
      * Return the yPoca .
-     *
+     * 
      * @return yPoca
      */
     public double yPoca() {
@@ -111,7 +111,7 @@
 
     /**
      * Return the zPoca .
-     *
+     * 
      * @return zPoca
      */
     public double zPoca() {
@@ -120,7 +120,7 @@
 
     /**
      * Return the Doca .
-     *
+     * 
      * @return Doca
      */
     public double Doca() {
@@ -129,7 +129,7 @@
 
     /**
      * Return the Poca .
-     *
+     * 
      * @return Poca
      */
     public double[] Poca() {
@@ -138,56 +138,57 @@
 
     /**
      * Return the Y and Z positions of the track at X=0 (target).
-     *
+     * 
      * @return yzT
      */
     public double[] TargetYZ() {
         return _yzT;
     }
-    
-    public double[] getYZAtX(double xVal){
+
+    public double[] getYZAtX(double xVal) {
         return calculateYZAtX(xVal);
-    }   
-    
+    }
+
     /**
      * Return the covariance matrix.
-     *
+     * 
      * @return covariance matrix
      */
     public SymmetricMatrix cov() {
         return _cov;
     }
 
-    //  mg--for now just calculate the simple POCA (to the x-axis)...no errors
+    // mg--for now just calculate the simple POCA (to the x-axis)...no errors
     private void calculatePoca() {
-        _poca[0] = _x0-(_y0 * _dydx + _z0 * _dzdx) / (_dydx * _dydx + _dzdx * _dzdx);
-        _poca[1] = _y0 + _dydx * (_poca[0]-_x0);
-        _poca[2] = _z0 + _dzdx * (_poca[0]-_x0);
+        _poca[0] = _x0 - (_y0 * _dydx + _z0 * _dzdx) / (_dydx * _dydx + _dzdx * _dzdx);
+        _poca[1] = _y0 + _dydx * (_poca[0] - _x0);
+        _poca[2] = _z0 + _dzdx * (_poca[0] - _x0);
     }
 
     private void calculateTargetYZ() {
         _yzT[0] = _y0 - _x0 * _dydx;
         _yzT[1] = _z0 - _x0 * _dzdx;
     }
-    
+
     private double[] calculateYZAtX(double xVal) {
-        double[] yzAtX={-66,-66};
-        if(xVal>_x0)   //_x0 is where the field region starts...if xVal is bigger than this, need to get position on helix
+        double[] yzAtX = { -66, -66 };
+        if (xVal > _x0) // _x0 is where the field region starts...if xVal is bigger than this, need
+                        // to get position on helix
             return yzAtX;
-        yzAtX[0] = _y0 + (xVal-_x0) * _dydx;
-        yzAtX[1] = _z0 + (xVal-_x0) * _dzdx;
+        yzAtX[0] = _y0 + (xVal - _x0) * _dydx;
+        yzAtX[1] = _z0 + (xVal - _x0) * _dzdx;
         return yzAtX;
     }
-    
-    public double calculateXAtZEquals0() {       
-        return _x0-_z0/_dzdx;
+
+    public double calculateXAtZEquals0() {
+        return _x0 - _z0 / _dzdx;
     }
-    
-    public double[] calculateXYAtZ(double zVal) {       
-        double[] xyAtZ = {-99999,-99999};
-        xyAtZ[0] = (zVal-_z0)/(_dzdx)+_x0;
+
+    public double[] calculateXYAtZ(double zVal) {
+        double[] xyAtZ = { -99999, -99999 };
+        xyAtZ[0] = (zVal - _z0) / (_dzdx) + _x0;
         xyAtZ[1] = this.calculateYZAtX(xyAtZ[0])[0];
         return xyAtZ;
     }
-    
+
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
TrackAnalysis.java removed after 458
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackAnalysis.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackAnalysis.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,298 +0,0 @@
-/*
- * TrackAnalysis.java
- *
- * Created on October 16, 2008, 6:09 PM
- *
- */
-package org.hps.recon.tracking;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.RelationalTable;
-import org.lcsim.event.Track;
-import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
-
-/**
- *
- * @author Richard Partridge & Matt Graham
- */
-public class TrackAnalysis {
-
-    private enum HelixPar {
-        Curvature, Phi0, DCA, Z0, Slope
-    };
-    private MCParticle _mcp = null;
-    private int _nhits;
-    private int _nbadhits;
-    private double _purity;
-    private MCParticle _mcpNew = null;
-    private int _nhitsNew;
-    private int _nbadhitsNew;
-    private double _purityNew;
-    private int _nAxialhits;
-    private int _nZhits;
-    private int _nbadAxialhits;
-    private int _nbadZhits;
-    private boolean _hasLayerOne;
-    List<Integer> badHitList = new ArrayList();
-    List<Integer> sharedHitList = new ArrayList();
-    List<Integer> trackLayerList = new ArrayList();
-    Map<MCParticle, HelicalTrackCross> badhits = new HashMap<MCParticle, HelicalTrackCross>();
-    private int[] _nMCHitsPerLayer={0,0,0,0,0,0,0,0,0,0,0,0};
-    private int[] _nStripHitsPerLayer={0,0,0,0,0,0,0,0,0,0,0,0};
-     Map<Integer, Hep3Vector> _hitLocationPerLayer = new HashMap<Integer,Hep3Vector>();
-
-    /** Creates a new instance of TrackAnalysis */
-    public TrackAnalysis(Track trk, RelationalTable hittomc) {
-
-        //  Get the number of hits on the track
-        _nhits = trk.getTrackerHits().size();
-
-        //  Create a map containing the number of hits for each MCParticle associated with the track
-        Map<MCParticle, Integer> mcmap = new HashMap<MCParticle, Integer>();
-        Map<MCParticle, Integer> mcmapAll = new HashMap<MCParticle, Integer>();
-        Map<MCParticle, Integer> mcmapAxial = new HashMap<MCParticle, Integer>();
-        Map<MCParticle, Integer> mcmapZ = new HashMap<MCParticle, Integer>();
-        _hasLayerOne = false;
-        //  Loop over the hits on the track and make sure we have HelicalTrackHits (which contain the MC particle)
-        for (TrackerHit hit : trk.getTrackerHits()) {
-            //  get the set of MCParticles associated with this hit and update the hit count for each MCParticle
-            Set<MCParticle> mclist = hittomc.allFrom(hit);
-            for (MCParticle mcp : mclist) {
-                Integer mchits = 0;
-                if (mcmap.containsKey(mcp))
-                    mchits = mcmap.get(mcp);
-                mchits++;
-                mcmap.put(mcp, mchits);
-            }
-
-            BasicHep3Vector axial = new BasicHep3Vector();
-            axial.setV(0, 1, 0);
-            HelicalTrackHit htc = (HelicalTrackHit) hit;
-            if (hit instanceof HelicalTrackCross) {
-                HelicalTrackCross cross = (HelicalTrackCross) hit;
-                List<HelicalTrackStrip> clusterlist = cross.getStrips();
-
-                for (HelicalTrackStrip cl : clusterlist) {
-                    int layer = cl.layer();
-                    if (layer == 1) _hasLayerOne = true;
-
-                    _nStripHitsPerLayer[layer - 1] = cl.rawhits().size();
-                    _hitLocationPerLayer.put(layer,clusterPosition(cl));
-                    _nhitsNew++;
-                    double axdotu = VecOp.dot(cl.u(), axial);
-                    boolean isAxial = false;
-                    if (axdotu > 0.5) {
-                        isAxial = true;
-                        _nAxialhits++;
-                    } else _nZhits++;
-                    List<MCParticle> mcPartList = cl.MCParticles();
-                    _nMCHitsPerLayer[layer-1] = mcPartList.size();
-                    for (MCParticle mcp : mcPartList) {
-                        Integer mchits = 0;
-                        if (mcmapAll.containsKey(mcp))
-                            mchits = mcmapAll.get(mcp);
-                        mchits++;
-                        mcmapAll.put(mcp, mchits);
-                        if (isAxial) {
-                            Integer mchitsAxial = 0;
-                            if (mcmapAxial.containsKey(mcp))
-                                mchitsAxial = mcmapAxial.get(mcp);
-                            mchitsAxial++;
-                            mcmapAxial.put(mcp, mchitsAxial);
-                        } else {
-                            Integer mchitsZ = 0;
-                            if (mcmapZ.containsKey(mcp))
-                                mchitsZ = mcmapZ.get(mcp);
-                            mchitsZ++;
-                            mcmapZ.put(mcp, mchitsZ);
-                        }
-                    }
-                }
-            } else {
-                _nhitsNew++;
-                _nAxialhits++;
-                HelicalTrack2DHit hit2d = (HelicalTrack2DHit) hit;
-                List<MCParticle> mcPartList = hit2d.getMCParticles();
-                //assume that lone hits are all axial
-                boolean isAxial = true;
-                for (MCParticle mcp : mcPartList) {
-                    Integer mchits = 0;
-                    if (mcmapAll.containsKey(mcp))
-                        mchits = mcmapAll.get(mcp);
-                    mchits++;
-                    mcmapAll.put(mcp, mchits);
-                    Integer mchitsAxial = 0;
-                    if (mcmapAxial.containsKey(mcp))
-                        mchitsAxial = mcmapAxial.get(mcp);
-                    mchitsAxial++;
-                    mcmapAxial.put(mcp, mchitsAxial);
-                }
-            }
-        }
-
-        //  Find the MCParticle that has the most hits on the track
-
-        int nbest = 0;
-        MCParticle mcbest = null;
-        for (MCParticle mcp : mcmap.keySet()) {
-            int count = mcmap.get(mcp);
-            if (count > nbest) {
-                nbest = count;
-                mcbest = mcp;
-            }
-        }
-
-        if (nbest > 0)
-            _mcp = mcbest;
-        _purity = (double) nbest / (double) _nhits;
-        _nbadhits = _nhits - nbest;
-
-
-//single strip layer accounting.
-        int nbestAll = 0;
-        MCParticle mcbestAll = null;
-        for (MCParticle mcp : mcmapAll.keySet()) {
-            int count = mcmapAll.get(mcp);
-            if (count > nbestAll) {
-                nbestAll = count;
-                mcbestAll = mcp;
-            }
-        }
-
-        if (nbestAll > 0)
-            _mcpNew = mcbestAll;
-        _purityNew = (double) nbestAll / (double) _nhitsNew;
-        _nbadhitsNew = _nhitsNew - nbestAll;
-
-        for (TrackerHit hit : trk.getTrackerHits()) {
-            HelicalTrackHit htc = (HelicalTrackHit) hit;
-            if (hit instanceof HelicalTrackCross) {
-                HelicalTrackCross cross = (HelicalTrackCross) hit;
-                List<HelicalTrackStrip> clusterlist = cross.getStrips();
-                for (HelicalTrackStrip cl : clusterlist){
-                    trackLayerList.add(cl.layer());
-                    if (!(cl.MCParticles().contains(_mcpNew))) {
-                        badHitList.add(cl.layer());
-                        badhits.put(_mcpNew, cross);
-                    }
-                    if(cl.MCParticles().size()>1)
-                        sharedHitList.add(cl.layer());
-                }
-            }
-        }
-
-
-
-        if (_nAxialhits > 0)
-            if (mcmapAxial.containsKey(_mcpNew))
-                _nbadAxialhits = _nAxialhits - mcmapAxial.get(_mcpNew);
-            else _nbadAxialhits = _nAxialhits;
-        if (_nZhits > 0)
-            if (mcmapZ.containsKey(_mcpNew))
-                _nbadZhits = _nZhits - mcmapZ.get(_mcpNew);
-            else _nbadZhits = _nZhits;
-
-    }
-
-    public Hep3Vector clusterPosition(HelicalTrackStrip cl) {
-        Hep3Vector corigin = cl.origin();
-        Hep3Vector u = cl.u();
-        double umeas = cl.umeas();
-        Hep3Vector uvec = VecOp.mult(umeas, u);
-        return VecOp.add(corigin, uvec);
-
-    }
-
-    public MCParticle getMCParticle() {
-        return _mcp;
-    }
-
-    public int getNHits() {
-        return _nhits;
-    }
-
-    public int getNBadHits() {
-        return _nbadhits;
-    }
-
-    public double getPurity() {
-        return _purity;
-    }
-
-    public MCParticle getMCParticleNew() {
-        return _mcpNew;
-    }
-
-    public int getNHitsNew() {
-        return _nhitsNew;
-    }
-
-    public int getNAxialHits() {
-        return _nAxialhits;
-    }
-
-    public int getNZHits() {
-        return _nZhits;
-    }
-
-    public int getNBadHitsNew() {
-        return _nbadhitsNew;
-    }
-
-    public double getPurityNew() {
-        return _purityNew;
-    }
-
-    public int getNBadAxialHits() {
-        return _nbadAxialhits;
-    }
-
-    public int getNBadZHits() {
-        return _nbadZhits;
-    }
-
-    public boolean hasLayerOne() {
-        return _hasLayerOne;
-    }
-
-    public Hep3Vector getClusterPosition(Integer layer) {
-        return _hitLocationPerLayer.get(layer);
-    }
-
-    public int getNumberOfMCParticles(int layer) {
-        return _nMCHitsPerLayer[layer - 1];
-    }
-
-    public int getNumberOfStripHits(int layer) {
-        return _nStripHitsPerLayer[layer - 1];
-    }
-
-    public List<Integer> getBadHitList() {
-        return badHitList;
-    }
-     public List<Integer> getSharedHitList() {
-        return sharedHitList;
-    }
-     
-       public List<Integer> getTrackLayerList() {
-        return trackLayerList;
-    }
-
-    public Map<MCParticle, HelicalTrackCross> getBadHits() {
-        return badhits;
-    }
-}

java/trunk/tracking/src/main/java/org/hps/recon/tracking
TrackUtils.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackUtils.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackUtils.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -37,511 +37,512 @@
 import org.lcsim.util.swim.Helix;
 
 /**
- * Assorted helper functions for the track and helix objects in lcsim.
- * Re-use as much of HelixUtils as possible.
+ * Assorted helper functions for the track and helix objects in lcsim. Re-use as much of HelixUtils
+ * as possible.
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: TrackUtils.java,v 1.34 2013/11/14 01:50:43 phansson Exp $
- * TODO: Switch to tracking/LCsim coordinates for the extrapolation output!
  */
-
+// TODO: Switch to tracking/LCsim coordinates for the extrapolation output!
+// FIXME: This class should probably be broken up into several different sets of utilities by type. --JM
 public class TrackUtils {
 
-	/**
-	 * Private constructor to make class static only
-	 */
-	private TrackUtils(){
-	}
-	
-	/**
-	 * Extrapolate track to a position along the x-axis. Turn the track into a helix object in order to use HelixUtils.
-	 * @param track
-	 * @param x
-	 * @return
-	 */
-	public static Hep3Vector extrapolateHelixToXPlane(Track track, double x){
-		return extrapolateHelixToXPlane(getHTF(track),x);
-	}
+    /**
+     * Private constructor to make class static only
+     */
+    private TrackUtils() {
+    }
 
-	/**
-	 * Extrapolate helix to a position along the x-axis. Re-use HelixUtils.
-	 * @param track
-	 * @param x
-	 * @return
-	 */
-	public static Hep3Vector extrapolateHelixToXPlane(HelicalTrackFit htf, double x){
-		double s = HelixUtils.PathToXPlane(htf, x, 0., 0).get(0);
-		return HelixUtils.PointOnHelix(htf, s);
-	}
-	
-	// ==========================================================================
-	// Helper functions for track parameters and commonly used derived variables
+    /**
+     * Extrapolate track to a position along the x-axis. Turn the track into a helix object in
+     * order to use HelixUtils.
+     * @param track
+     * @param x
+     * @return
+     */
+    public static Hep3Vector extrapolateHelixToXPlane(Track track, double x) {
+        return extrapolateHelixToXPlane(getHTF(track), x);
+    }
 
-	public static double getPhi(Track track, Hep3Vector position){ 
-		double x = Math.sin(getPhi0(track)) - (1/getR(track))*(position.x() - getX0(track));
-		double y = Math.cos(getPhi0(track)) + (1/getR(track))*(position.y() - getY0(track));
-		return Math.atan2(x, y);
-	}
-	public static double getX0(Track track) {
-		return -1*getDoca(track)*Math.sin(getPhi0(track));
-	}
-	public static double getR(Track track) {
-		return 1.0/track.getTrackStates().get(0).getOmega();
-	}
-	public static double getY0(Track track) {
-		return getDoca(track)*Math.cos(getPhi0(track));
-	}
-	public static double getDoca(Track track) {
-		return track.getTrackStates().get(0).getD0();
-	}
-	public static double getPhi0(Track track) {
-		return track.getTrackStates().get(0).getPhi();
-	}
-	public static double getZ0(Track track) {
-		return track.getTrackStates().get(0).getZ0();
-	}
-	public static double getTanLambda(Track track) {
-		return track.getTrackStates().get(0).getTanLambda();
-	}
-	public static double getSinTheta(Track track){
-		return 1/Math.sqrt(1 + Math.pow(getTanLambda(track), 2));
-	}
-	public static double getCosTheta(Track track){
-		return getTanLambda(track)/Math.sqrt(1 + Math.pow(getTanLambda(track), 2));
-	}
-	// ==========================================================================
+    /**
+     * Extrapolate helix to a position along the x-axis. Re-use HelixUtils.
+     * @param track
+     * @param x
+     * @return
+     */
+    public static Hep3Vector extrapolateHelixToXPlane(HelicalTrackFit htf, double x) {
+        double s = HelixUtils.PathToXPlane(htf, x, 0., 0).get(0);
+        return HelixUtils.PointOnHelix(htf, s);
+    }
 
-       
+    // ==========================================================================
+    // Helper functions for track parameters and commonly used derived variables
 
-	/**
-	 * Calculate the point of interception between the helix and a plane in space. Uses an iterative procedure. 
-	 * @param helfit - helix 
-	 * @param unit_vec_normal_to_plane - unit vector normal to the plane
-	 * @param point_on_plane - point on the plane
-	 * @param bfield - magnetic field value
-	 * @return point at intercept
-	 */
-	public static Hep3Vector getHelixPlaneIntercept(HelicalTrackFit helfit, Hep3Vector unit_vec_normal_to_plane,Hep3Vector point_on_plane, double bfield) {
-            boolean debug = false;
-            boolean flipBfield = true; // be careful
-            Hep3Vector B = new BasicHep3Vector(0,0,flipBfield?-1:1);
-            WTrack wtrack = new WTrack(helfit,bfield,flipBfield); //
-            if(debug) System.out.printf("getHelixPlaneIntercept:find intercept between plane defined by point on plane %s, unit vec %s, bfield %.3f, h=%s and WTrack \n%s \n",point_on_plane.toString(),unit_vec_normal_to_plane.toString(), bfield, B.toString(),wtrack.toString());
-            Hep3Vector intercept_point =  wtrack.getHelixAndPlaneIntercept(point_on_plane, unit_vec_normal_to_plane, B);
-            if(debug) System.out.printf("getHelixPlaneIntercept: found intercept point at %s\n",intercept_point.toString());
-            return intercept_point;
+    public static double getPhi(Track track, Hep3Vector position) {
+        double x = Math.sin(getPhi0(track)) - (1 / getR(track)) * (position.x() - getX0(track));
+        double y = Math.cos(getPhi0(track)) + (1 / getR(track)) * (position.y() - getY0(track));
+        return Math.atan2(x, y);
+    }
+
+    public static double getX0(Track track) {
+        return -1 * getDoca(track) * Math.sin(getPhi0(track));
+    }
+
+    public static double getR(Track track) {
+        return 1.0 / track.getTrackStates().get(0).getOmega();
+    }
+
+    public static double getY0(Track track) {
+        return getDoca(track) * Math.cos(getPhi0(track));
+    }
+
+    public static double getDoca(Track track) {
+        return track.getTrackStates().get(0).getD0();
+    }
+
+    public static double getPhi0(Track track) {
+        return track.getTrackStates().get(0).getPhi();
+    }
+
+    public static double getZ0(Track track) {
+        return track.getTrackStates().get(0).getZ0();
+    }
+
+    public static double getTanLambda(Track track) {
+        return track.getTrackStates().get(0).getTanLambda();
+    }
+
+    public static double getSinTheta(Track track) {
+        return 1 / Math.sqrt(1 + Math.pow(getTanLambda(track), 2));
+    }
+
+    public static double getCosTheta(Track track) {
+        return getTanLambda(track) / Math.sqrt(1 + Math.pow(getTanLambda(track), 2));
+    }
+
+    // ==========================================================================
+
+    /**
+     * Calculate the point of interception between the helix and a plane in space. Uses an
+     * iterative procedure.
+     * @param helfit - helix
+     * @param unit_vec_normal_to_plane - unit vector normal to the plane
+     * @param point_on_plane - point on the plane
+     * @param bfield - magnetic field value
+     * @return point at intercept
+     */
+    public static Hep3Vector getHelixPlaneIntercept(HelicalTrackFit helfit, Hep3Vector unit_vec_normal_to_plane, Hep3Vector point_on_plane, double bfield) {
+        boolean debug = false;
+        boolean flipBfield = true; // be careful
+        Hep3Vector B = new BasicHep3Vector(0, 0, flipBfield ? -1 : 1);
+        WTrack wtrack = new WTrack(helfit, bfield, flipBfield); //
+        if (debug)
+            System.out.printf("getHelixPlaneIntercept:find intercept between plane defined by point on plane %s, unit vec %s, bfield %.3f, h=%s and WTrack \n%s \n", point_on_plane.toString(), unit_vec_normal_to_plane.toString(), bfield, B.toString(), wtrack.toString());
+        Hep3Vector intercept_point = wtrack.getHelixAndPlaneIntercept(point_on_plane, unit_vec_normal_to_plane, B);
+        if (debug)
+            System.out.printf("getHelixPlaneIntercept: found intercept point at %s\n", intercept_point.toString());
+        return intercept_point;
+    }
+
+    /**
+     * Calculate the point of interception between the helix and a plane in space. Uses an
+     * iterative procedure.
+     * @param helfit - helix
+     * @param strip - strip cluster that will define the plane
+     * @param bfield - magnetic field value
+     * @return point at intercept
+     */
+    public static Hep3Vector getHelixPlaneIntercept(HelicalTrackFit helfit, HelicalTrackStrip strip, double bfield) {
+        Hep3Vector point_on_plane = strip.origin();
+        Hep3Vector unit_vec_normal_to_plane = VecOp.cross(strip.u(), strip.v());// strip.w();
+        Hep3Vector intercept_point = getHelixPlaneIntercept(helfit, unit_vec_normal_to_plane, point_on_plane, bfield);
+        return intercept_point;
+    }
+
+    /*
+     * Calculates the point on the helix in the x-y plane at the intercept with plane The normal of
+     * the plane is in the same x-y plane as the circle.
+     * @param helix
+     * @param vector normal to plane
+     * @param origin of plane
+     * @return point in the x-y plane of the intercept
+     */
+    public Hep3Vector getHelixXPlaneIntercept(HelicalTrackFit helix, Hep3Vector w, Hep3Vector origin) {
+        throw new RuntimeException("this function is not working properly; don't use it");
+
+        // FInd the intercept point x_int,y_int, between the circle and sensor, which becomes a
+        // line in the x-y plane in this case.
+        // y_int = k*x_int + m
+        // R^2 = (y_int-y_c)^2 + (x_int-x_c)^2
+        // solve for x_int
+
+    }
+
+    /**
+     * Get position of a track extrapolated to the HARP in the HPS test run 2012
+     * @param track
+     * @return position at HARP
+     */
+    public static Hep3Vector getTrackPositionAtHarp(Track track) {
+        return extrapolateTrack(track, BeamlineConstants.HARP_POSITION_TESTRUN);
+    }
+
+    /**
+     * Get position of a track extrapolated to the ECAL face in the HPS test run 2012
+     * @param track
+     * @return position at ECAL
+     */
+    public static Hep3Vector getTrackPositionAtEcal(Track track) {
+        return extrapolateTrack(track, BeamlineConstants.ECAL_FACE_TESTRUN);
+    }
+
+    /**
+     * Extrapolate track to given position.
+     * @param helix - to be extrapolated
+     * @param track - position along the x-axis of the helix in lcsim coordiantes
+     * @return
+     */
+    public static Hep3Vector extrapolateTrack(Track track, double z) {
+
+        Hep3Vector trackPosition = null;
+        double dz = 0;
+        if (z >= BeamlineConstants.DIPOLE_EDGE_TESTRUN) {
+            trackPosition = extrapolateHelixToXPlane(track, BeamlineConstants.DIPOLE_EDGE_TESTRUN);
+            dz = z - BeamlineConstants.DIPOLE_EDGE_TESTRUN;
+        } else if (z <= BeamlineConstants.DIPOLE_EDGELOW_TESTRUN) {
+            trackPosition = extrapolateHelixToXPlane(track, BeamlineConstants.DIPOLE_EDGELOW_TESTRUN);
+            dz = z - trackPosition.x();
+        } else {
+            Hep3Vector detVecTracking = extrapolateHelixToXPlane(track, z);
+            // System.out.printf("detVec %s\n", detVecTracking.toString());
+            return new BasicHep3Vector(detVecTracking.y(), detVecTracking.z(), detVecTracking.x());
         }
-        
-        /**
-         * Calculate the point of interception between the helix and a plane in space. Uses an iterative procedure. 
-         * @param helfit - helix
-         * @param strip - strip cluster that will define the plane
-         * @param bfield - magnetic field value
-         * @return point at intercept
-         */
-        public static Hep3Vector getHelixPlaneIntercept(HelicalTrackFit helfit, HelicalTrackStrip strip, double bfield) {
-            Hep3Vector point_on_plane = strip.origin();
-            Hep3Vector unit_vec_normal_to_plane = VecOp.cross(strip.u(),strip.v());//strip.w();
-            Hep3Vector intercept_point = getHelixPlaneIntercept(helfit, unit_vec_normal_to_plane, point_on_plane, bfield);
-            return intercept_point;
-        }
- 
-        
-        /*
-    	 *  Calculates the point on the helix in the x-y plane at the intercept with plane
-    	 *  The normal of the plane is in the same x-y plane as the circle.
-    	 * 
-    	 * @param helix
-    	 * @param vector normal to plane
-    	 * @param origin of plane
-    	 * @return point in the x-y plane of the intercept
-    	 * 
-    	 */
-    	public Hep3Vector getHelixXPlaneIntercept(HelicalTrackFit helix, Hep3Vector w, Hep3Vector origin) {
-    		throw new RuntimeException("this function is not working properly; don't use it");
-    		
-    		// FInd the intercept point x_int,y_int, between the circle and sensor, which becomes a line in the x-y plane in this case.
-    	    // y_int = k*x_int + m 
-    	    // R^2 = (y_int-y_c)^2 + (x_int-x_c)^2
-    	    // solve for x_int
 
-    	}
+        // Get the track azimuthal angle
+        double phi = getPhi(track, trackPosition);
 
-        
-        
-        
-        /**
-         * Get position of a track extrapolated to the HARP in the HPS test run 2012
-         * @param track 
-         * @return position at HARP
-         */
-        public static Hep3Vector getTrackPositionAtHarp(Track track){
-			return extrapolateTrack(track, BeamlineConstants.HARP_POSITION_TESTRUN);
-		}
+        // Find the distance to the point of interest
+        double r = dz / (getSinTheta(track) * Math.cos(phi));
+        double dx = r * getSinTheta(track) * Math.sin(phi);
+        double dy = r * getCosTheta(track);
 
-        /**
-         * Get position of a track extrapolated to the ECAL face in the HPS test run 2012
-         * @param track 
-         * @return position at ECAL
-         */
-		public static Hep3Vector getTrackPositionAtEcal(Track track){
-			return extrapolateTrack(track, BeamlineConstants.ECAL_FACE_TESTRUN);
-		}
+        // Find the track position at the point of interest
+        double x = trackPosition.y() + dx;
+        double y = trackPosition.z() + dy;
 
-		/**
-		 * Extrapolate track to given position.
-		 * @param helix - to be extrapolated
-		 * @param track - position along the x-axis of the helix in lcsim coordiantes
-		 * @return
-		 */
-		public static Hep3Vector extrapolateTrack(Track track, double z){
-		
-			Hep3Vector trackPosition = null;
-			double dz = 0;
-			if(z >= BeamlineConstants.DIPOLE_EDGE_TESTRUN){
-				trackPosition = extrapolateHelixToXPlane(track, BeamlineConstants.DIPOLE_EDGE_TESTRUN);
-				dz = z - BeamlineConstants.DIPOLE_EDGE_TESTRUN;
-			} else if(z <= BeamlineConstants.DIPOLE_EDGELOW_TESTRUN){
-				trackPosition  = extrapolateHelixToXPlane(track, BeamlineConstants.DIPOLE_EDGELOW_TESTRUN);
-				dz = z - trackPosition.x();
-			} else {
-				Hep3Vector detVecTracking = extrapolateHelixToXPlane(track,z);
-				//System.out.printf("detVec %s\n", detVecTracking.toString());
-				return new BasicHep3Vector(detVecTracking.y(),detVecTracking.z(),detVecTracking.x());
-			}
-			
-			// Get the track azimuthal angle
-			double phi = getPhi(track, trackPosition);
-		
-			// Find the distance to the point of interest
-			double r = dz/(getSinTheta(track)*Math.cos(phi));
-			double dx = r*getSinTheta(track)*Math.sin(phi);
-			double dy = r*getCosTheta(track);
-			
-			// Find the track position at the point of interest
-			double x = trackPosition.y() + dx;
-			double y = trackPosition.z() + dy;
-			
-			return new BasicHep3Vector(x, y, z);
-		}
+        return new BasicHep3Vector(x, y, z);
+    }
 
-		/**
-		 * Extrapolate helix to given position
-		 * @param helix - to be extrapolated
-		 * @param z - position along the x-axis of the helix in lcsim coordiantes
-		 * @return
-		 */
-		public static Hep3Vector extrapolateTrack(HelicalTrackFit helix, double z){
-		    SeedTrack trk = new SeedTrack();
-		    //bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0, 0, 0)).y()));
-		    double bfield = 0.;        
-		    // Here we aren't really using anything related to momentum so B-field is not important
-		    trk.setTrackParameters(helix.parameters(), bfield); // Sets first TrackState.
-		    trk.setCovarianceMatrix(helix.covariance()); // Modifies first TrackState.
-		    trk.setChisq(helix.chisqtot());
-		    trk.setNDF(helix.ndf()[0]+helix.ndf()[1]);        
-		    return TrackUtils.extrapolateTrack(trk,z);
-		}
+    /**
+     * Extrapolate helix to given position
+     * @param helix - to be extrapolated
+     * @param z - position along the x-axis of the helix in lcsim coordiantes
+     * @return
+     */
+    public static Hep3Vector extrapolateTrack(HelicalTrackFit helix, double z) {
+        SeedTrack trk = new SeedTrack();
+        // bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0, 0, 0)).y()));
+        double bfield = 0.;
+        // Here we aren't really using anything related to momentum so B-field is not important
+        trk.setTrackParameters(helix.parameters(), bfield); // Sets first TrackState.
+        trk.setCovarianceMatrix(helix.covariance()); // Modifies first TrackState.
+        trk.setChisq(helix.chisqtot());
+        trk.setNDF(helix.ndf()[0] + helix.ndf()[1]);
+        return TrackUtils.extrapolateTrack(trk, z);
+    }
 
-		/**
-         * @param helix input helix object
-         * @param origin of the plane to intercept
-         * @param normal of the plane to intercept
-         * @param eps  criteria on the distance to the plane before stopping iteration
-         * @return position in space at the intercept of the plane
-         */
-        public static Hep3Vector getHelixPlanePositionIter(HelicalTrackFit helix, Hep3Vector origin, Hep3Vector normal, double eps) {
-        	boolean debug = false;
-        	if(debug) {
-        	System.out.printf("--- getHelixPlanePositionIter ---\n");
-        	System.out.printf("Target origin [%.10f %.10f %.10f] normal [%.10f %.10f %.10f]\n",origin.x(),origin.y(),origin.z(),normal.x(),normal.y(),normal.z());
-        	System.out.printf("%.10f %.10f %.10f %.10f %.10f\n",helix.dca(),helix.z0(),helix.phi0(),helix.slope(),helix.R());
-        	}
-        	double x = origin.x();
-        	double d = 9999.9;
-        	double dx = 0.0;
-        	int nIter = 0;
-        	Hep3Vector pos = null;
-        	while( Math.abs(d) > eps && nIter < 50) {
-        		// Calculate position on helix at x
-        		pos = getHelixPosAtX(helix, x + dx);
-        		//	 Check if we are on the plane
-        		d =  VecOp.dot(VecOp.sub(pos, origin), normal);
-        		dx += -1.0 * d / 2.0;
-        	    if(debug) System.out.printf("%d d %.10f pos [%.10f %.10f %.10f] dx %.10f\n", nIter, d, pos.x(),pos.y(),pos.z(), dx);
-        	    nIter +=  1;
-        	}
-    	    return pos;
+    /**
+     * @param helix input helix object
+     * @param origin of the plane to intercept
+     * @param normal of the plane to intercept
+     * @param eps criteria on the distance to the plane before stopping iteration
+     * @return position in space at the intercept of the plane
+     */
+    public static Hep3Vector getHelixPlanePositionIter(HelicalTrackFit helix, Hep3Vector origin, Hep3Vector normal, double eps) {
+        boolean debug = false;
+        if (debug) {
+            System.out.printf("--- getHelixPlanePositionIter ---\n");
+            System.out.printf("Target origin [%.10f %.10f %.10f] normal [%.10f %.10f %.10f]\n", origin.x(), origin.y(), origin.z(), normal.x(), normal.y(), normal.z());
+            System.out.printf("%.10f %.10f %.10f %.10f %.10f\n", helix.dca(), helix.z0(), helix.phi0(), helix.slope(), helix.R());
         }
-        
-        /*
-         *  Calculates the point on the helix at a given point along the x-axis
-         *  The normal of the plane is in the same x-y plane as the circle.
-         * 
-         * @param helix
-         * @param x point along x-axis 
-         * @return point on helix at x-coordinate
-         * 
-         */
-        private static Hep3Vector getHelixPosAtX(HelicalTrackFit helix, double x) {
-        	//double C = (double)Math.round(helix.curvature()*1000000)/1000000;
-        	//double R = 1.0/C;
-        	double R = helix.R();
-    	    double dca = helix.dca();
-    	    double z0 = helix.z0();
-    	    double phi0 = helix.phi0();
-    	    double slope = helix.slope();    
-        	//System.out.printf("%.10f %.10f %.10f %.10f %.10f\n",dca,z0,phi0,slope,R);
-    	    
-    	    double xc = (R - dca) * Math.sin(phi0);
-    	    double sinPhi = (xc - x)/R;
-    	    double phi_at_x = Math.asin(sinPhi);
-    	    double dphi_at_x = phi_at_x - phi0;
-    	    if (dphi_at_x > Math.PI) dphi_at_x -= 2.0 * Math.PI;
-    	    if (dphi_at_x < -Math.PI) dphi_at_x += 2.0 * Math.PI;
-    	    double s_at_x = -1.0 * dphi_at_x * R;    
-    	    double y = dca * Math.cos(phi0) - R * Math.cos(phi0) + R * Math.cos(phi_at_x);
-    	    double z = z0 + s_at_x * slope;
-    	    BasicHep3Vector pos = new BasicHep3Vector(x,y,z);
-    	    //System.out.printf("pos %s xc %f phi_at_x %f dphi_at_x %f s_at_x %f\n", pos.toString(),xc,phi_at_x,dphi_at_x,s_at_x);
-    	    Hep3Vector posXCheck =TrackUtils.extrapolateHelixToXPlane(helix, x);
-    	    if(VecOp.sub(pos,posXCheck).magnitude()>0.0000001) {
-    	    	throw new RuntimeException(String.format("ERROR the helix propagation equations do not agree? (%f,%f,%f) vs (%f,%f,%f) in HelixUtils",pos.x(),pos.y(),pos.z(),posXCheck.x(),posXCheck.y(),posXCheck.z()));
-    	    }
-    	    return pos;
+        double x = origin.x();
+        double d = 9999.9;
+        double dx = 0.0;
+        int nIter = 0;
+        Hep3Vector pos = null;
+        while (Math.abs(d) > eps && nIter < 50) {
+            // Calculate position on helix at x
+            pos = getHelixPosAtX(helix, x + dx);
+            // Check if we are on the plane
+            d = VecOp.dot(VecOp.sub(pos, origin), normal);
+            dx += -1.0 * d / 2.0;
+            if (debug)
+                System.out.printf("%d d %.10f pos [%.10f %.10f %.10f] dx %.10f\n", nIter, d, pos.x(), pos.y(), pos.z(), dx);
+            nIter += 1;
         }
-        
+        return pos;
+    }
 
-        
-        /**
+    /*
+     * Calculates the point on the helix at a given point along the x-axis The normal of the plane
+     * is in the same x-y plane as the circle.
+     * @param helix
+     * @param x point along x-axis
+     * @return point on helix at x-coordinate
+     */
+    private static Hep3Vector getHelixPosAtX(HelicalTrackFit helix, double x) {
+        // double C = (double)Math.round(helix.curvature()*1000000)/1000000;
+        // double R = 1.0/C;
+        double R = helix.R();
+        double dca = helix.dca();
+        double z0 = helix.z0();
+        double phi0 = helix.phi0();
+        double slope = helix.slope();
+        // System.out.printf("%.10f %.10f %.10f %.10f %.10f\n",dca,z0,phi0,slope,R);
+
+        double xc = (R - dca) * Math.sin(phi0);
+        double sinPhi = (xc - x) / R;
+        double phi_at_x = Math.asin(sinPhi);
+        double dphi_at_x = phi_at_x - phi0;
+        if (dphi_at_x > Math.PI)
+            dphi_at_x -= 2.0 * Math.PI;
+        if (dphi_at_x < -Math.PI)
+            dphi_at_x += 2.0 * Math.PI;
+        double s_at_x = -1.0 * dphi_at_x * R;
+        double y = dca * Math.cos(phi0) - R * Math.cos(phi0) + R * Math.cos(phi_at_x);
+        double z = z0 + s_at_x * slope;
+        BasicHep3Vector pos = new BasicHep3Vector(x, y, z);
+        // System.out.printf("pos %s xc %f phi_at_x %f dphi_at_x %f s_at_x %f\n",
+        // pos.toString(),xc,phi_at_x,dphi_at_x,s_at_x);
+        Hep3Vector posXCheck = TrackUtils.extrapolateHelixToXPlane(helix, x);
+        if (VecOp.sub(pos, posXCheck).magnitude() > 0.0000001) {
+            throw new RuntimeException(String.format("ERROR the helix propagation equations do not agree? (%f,%f,%f) vs (%f,%f,%f) in HelixUtils", pos.x(), pos.y(), pos.z(), posXCheck.x(), posXCheck.y(), posXCheck.z()));
+        }
+        return pos;
+    }
+
+    /**
         *
         */
-        public static double findTriangleArea(double x0, double y0, double x1, double y1, double x2, double y2){
-            return .5*(x1*y2 - y1*x2 -x0*y2 + y0*x2 + x0*y1 - y0*x1); 
-        }
+    public static double findTriangleArea(double x0, double y0, double x1, double y1, double x2, double y2) {
+        return .5 * (x1 * y2 - y1 * x2 - x0 * y2 + y0 * x2 + x0 * y1 - y0 * x1);
+    }
 
-        
-        /**
+    /**
         *
         */
-        public static boolean sensorContainsTrack(Hep3Vector trackPosition, SiSensor sensor){
-            boolean debug = false;
-            ITransform3D localToGlobal = sensor.getGeometry().getLocalToGlobal();
+    public static boolean sensorContainsTrack(Hep3Vector trackPosition, SiSensor sensor) {
+        boolean debug = false;
+        ITransform3D localToGlobal = sensor.getGeometry().getLocalToGlobal();
 
-            Box sensorSolid = (Box) sensor.getGeometry().getLogicalVolume().getSolid();
-            Polygon3D sensorFace = sensorSolid.getFacesNormalTo(new BasicHep3Vector(0, 0, 1)).get(0);
-            if(debug){
-                    System.out.println("sensorContainsTrack:  Sensor: " + SvtUtils.getInstance().getDescription(sensor));
-                    System.out.println("sensorContainsTrack:  Track Position: " + trackPosition.toString());
-            }
+        Box sensorSolid = (Box) sensor.getGeometry().getLogicalVolume().getSolid();
+        Polygon3D sensorFace = sensorSolid.getFacesNormalTo(new BasicHep3Vector(0, 0, 1)).get(0);
+        if (debug) {
+            System.out.println("sensorContainsTrack:  Sensor: " + SvtUtils.getInstance().getDescription(sensor));
+            System.out.println("sensorContainsTrack:  Track Position: " + trackPosition.toString());
+        }
 
-            List<Point3D> vertices = new ArrayList<Point3D>();
-            for(int index = 0; index < 4; index++){
-                    vertices.add(new Point3D());
-            }
-            for(Point3D vertex : sensorFace.getVertices()){
-                if(vertex.y() < 0 && vertex.x() > 0){
-                    localToGlobal.transform(vertex);
-                    //vertices.set(0, new Point3D(vertex.y() + sensorPos.x(), vertex.x() + sensorPos.y(), vertex.z() + sensorPos.z()));
-                    vertices.set(0, new Point3D(vertex.x(), vertex.y(), vertex.z()));
-                    if(debug){
-                            System.out.println("sensorContainsTrack:  Vertex 1 Position: " + vertices.get(0).toString());
-                            //System.out.println("sensorContainsTrack:  Transformed Vertex 1 Position: " + localToGlobal.transformed(vertex).toString());
-                    }
-                } 
-                else if(vertex.y() > 0 && vertex.x() > 0){
-                    localToGlobal.transform(vertex);
-                    //vertices.set(1, new Point3D(vertex.y() + sensorPos.x(), vertex.x() + sensorPos.y(), vertex.z() + sensorPos.z()));
-                    vertices.set(1, new Point3D(vertex.x(), vertex.y(), vertex.z()));
-                    if(debug){
+        List<Point3D> vertices = new ArrayList<Point3D>();
+        for (int index = 0; index < 4; index++) {
+            vertices.add(new Point3D());
+        }
+        for (Point3D vertex : sensorFace.getVertices()) {
+            if (vertex.y() < 0 && vertex.x() > 0) {
+                localToGlobal.transform(vertex);
+                // vertices.set(0, new Point3D(vertex.y() + sensorPos.x(), vertex.x() +
+                // sensorPos.y(), vertex.z() + sensorPos.z()));
+                vertices.set(0, new Point3D(vertex.x(), vertex.y(), vertex.z()));
+                if (debug) {
+                    System.out.println("sensorContainsTrack:  Vertex 1 Position: " + vertices.get(0).toString());
+                    // System.out.println("sensorContainsTrack:  Transformed Vertex 1 Position: " +
+                    // localToGlobal.transformed(vertex).toString());
+                }
+            } else if (vertex.y() > 0 && vertex.x() > 0) {
+                localToGlobal.transform(vertex);
+                // vertices.set(1, new Point3D(vertex.y() + sensorPos.x(), vertex.x() +
+                // sensorPos.y(), vertex.z() + sensorPos.z()));
+                vertices.set(1, new Point3D(vertex.x(), vertex.y(), vertex.z()));
+                if (debug) {
                     System.out.println("sensorContainsTrack:  Vertex 2 Position: " + vertices.get(1).toString());
-                    //System.out.println("sensorContainsTrack:  Transformed Vertex 2 Position: " + localToGlobal.transformed(vertex).toString());
-                    }
-                } 
-                else if(vertex.y() > 0 && vertex.x() < 0){
-                    localToGlobal.transform(vertex);
-                    //vertices.set(2, new Point3D(vertex.y() + sensorPos.x(), vertex.x() + sensorPos.y(), vertex.z() + sensorPos.z()));
-                    vertices.set(2, new Point3D(vertex.x(), vertex.y(), vertex.z()));
-                    if(debug){
+                    // System.out.println("sensorContainsTrack:  Transformed Vertex 2 Position: " +
+                    // localToGlobal.transformed(vertex).toString());
+                }
+            } else if (vertex.y() > 0 && vertex.x() < 0) {
+                localToGlobal.transform(vertex);
+                // vertices.set(2, new Point3D(vertex.y() + sensorPos.x(), vertex.x() +
+                // sensorPos.y(), vertex.z() + sensorPos.z()));
+                vertices.set(2, new Point3D(vertex.x(), vertex.y(), vertex.z()));
+                if (debug) {
                     System.out.println("sensorContainsTrack:  Vertex 3 Position: " + vertices.get(2).toString());
-                    //System.out.println("sensorContainsTrack:  Transformed Vertex 3 Position: " + localToGlobal.transformed(vertex).toString());
-                    }
-                }             
-                else if(vertex.y() < 0 && vertex.x() < 0){
-                    localToGlobal.transform(vertex);
-                    //vertices.set(3, new Point3D(vertex.y() + sensorPos.x(), vertex.x() + sensorPos.y(), vertex.z() + sensorPos.z()));
-                    vertices.set(3, new Point3D(vertex.x(), vertex.y(), vertex.z()));
-                    if(debug){
+                    // System.out.println("sensorContainsTrack:  Transformed Vertex 3 Position: " +
+                    // localToGlobal.transformed(vertex).toString());
+                }
+            } else if (vertex.y() < 0 && vertex.x() < 0) {
+                localToGlobal.transform(vertex);
+                // vertices.set(3, new Point3D(vertex.y() + sensorPos.x(), vertex.x() +
+                // sensorPos.y(), vertex.z() + sensorPos.z()));
+                vertices.set(3, new Point3D(vertex.x(), vertex.y(), vertex.z()));
+                if (debug) {
                     System.out.println("sensorContainsTrack:  Vertex 4 Position: " + vertices.get(3).toString());
-                    //System.out.println("sensorContainsTrack:  Transformed Vertex 4 Position: " + localToGlobal.transformed(vertex).toString());
-                    }
-                } 
+                    // System.out.println("sensorContainsTrack:  Transformed Vertex 4 Position: " +
+                    // localToGlobal.transformed(vertex).toString());
+                }
             }
+        }
 
-            double area1 = TrackUtils.findTriangleArea(vertices.get(0).x(), vertices.get(0).y(), vertices.get(1).x(), vertices.get(1).y(), trackPosition.y(), trackPosition.z()); 
-            double area2 = TrackUtils.findTriangleArea(vertices.get(1).x(), vertices.get(1).y(), vertices.get(2).x(), vertices.get(2).y(), trackPosition.y(), trackPosition.z()); 
-            double area3 = TrackUtils.findTriangleArea(vertices.get(2).x(), vertices.get(2).y(), vertices.get(3).x(), vertices.get(3).y(), trackPosition.y(), trackPosition.z()); 
-            double area4 = TrackUtils.findTriangleArea(vertices.get(3).x(), vertices.get(3).y(), vertices.get(0).x(), vertices.get(0).y(), trackPosition.y(), trackPosition.z()); 
+        double area1 = TrackUtils.findTriangleArea(vertices.get(0).x(), vertices.get(0).y(), vertices.get(1).x(), vertices.get(1).y(), trackPosition.y(), trackPosition.z());
+        double area2 = TrackUtils.findTriangleArea(vertices.get(1).x(), vertices.get(1).y(), vertices.get(2).x(), vertices.get(2).y(), trackPosition.y(), trackPosition.z());
+        double area3 = TrackUtils.findTriangleArea(vertices.get(2).x(), vertices.get(2).y(), vertices.get(3).x(), vertices.get(3).y(), trackPosition.y(), trackPosition.z());
+        double area4 = TrackUtils.findTriangleArea(vertices.get(3).x(), vertices.get(3).y(), vertices.get(0).x(), vertices.get(0).y(), trackPosition.y(), trackPosition.z());
 
-            if((area1 > 0 && area2 > 0 && area3 > 0 && area4 > 0) || (area1 < 0 && area2 < 0 && area3 < 0 && area4 < 0)) return true;
+        if ((area1 > 0 && area2 > 0 && area3 > 0 && area4 > 0) || (area1 < 0 && area2 < 0 && area3 < 0 && area4 < 0))
+            return true;
 
-            return false;
-        } 
+        return false;
+    }
 
-        
-        public static Map<String,Double> calculateTrackHitResidual(HelicalTrackHit hth,HelicalTrackFit track, boolean includeMS ) {
-            
-            boolean debug = false;
-            Map<String,Double> residuals = new HashMap<String,Double>();
+    public static Map<String, Double> calculateTrackHitResidual(HelicalTrackHit hth, HelicalTrackFit track, boolean includeMS) {
 
-            Map<HelicalTrackHit, MultipleScatter> msmap = track.ScatterMap();
-            double msdrphi = 0;
-            double msdz = 0; 
+        boolean debug = false;
+        Map<String, Double> residuals = new HashMap<String, Double>();
 
-            if(includeMS) {
-                msdrphi = msmap.get(hth).drphi();
-                msdz = msmap.get(hth).dz();
-            }
-            
-            //Calculate the residuals that are being used in the track fit
+        Map<HelicalTrackHit, MultipleScatter> msmap = track.ScatterMap();
+        double msdrphi = 0;
+        double msdz = 0;
 
-            //Start with the bendplane y
-            double drphi_res = hth.drphi();
-            double wrphi = Math.sqrt(drphi_res*drphi_res + msdrphi*msdrphi);
-            //This is the normal way to get s
-            double s_wrong = track.PathMap().get(hth);
-            //This is how I do it with HelicalTrackFits
-            double s = HelixUtils.PathToXPlane(track, hth.x(), 0, 0).get(0);
-            //System.out.printf("x %f s %f smap %f\n",hth.x(),s,s_wrong);
-            if(Double.isNaN(s)) {
-                double xc=track.xc();
-                double RC = track.R();
-                System.out.printf("calculateTrackHitResidual: s is NaN. p=%.3f RC=%.3f, x=%.3f, xc=%.3f\n",track.p(-0.491),RC,hth.x(),xc);
-                return residuals;
-            }         
-            
-            Hep3Vector posOnHelix = HelixUtils.PointOnHelix(track, s);
-            double resy = hth.y() - posOnHelix.y();
-            double erry = includeMS ? wrphi : drphi_res;
-            
-            //Now the residual for the "measurement" direction z
-            double resz = hth.z() - posOnHelix.z();
-            double dz_res = HitUtils.zres(hth, msmap, track);
-            double dz_res2 = hth.getCorrectedCovMatrix().diagonal(2);
+        if (includeMS) {
+            msdrphi = msmap.get(hth).drphi();
+            msdz = msmap.get(hth).dz();
+        }
 
-            if(Double.isNaN(resy)) {
-                System.out.printf("calculateTrackHitResidual: resy is NaN. hit at %s posOnHelix=%s path=%.3f wrong_path=%.3f helix:\n%s\n",hth.getCorrectedPosition().toString(),posOnHelix.toString(),s,s_wrong,track.toString());
-                return residuals;            
-            }
+        // Calculate the residuals that are being used in the track fit
 
-            
-            residuals.put("resy", resy);
-            residuals.put("erry", erry);
-            residuals.put("drphi", drphi_res);
-            residuals.put("msdrphi",msdrphi);
+        // Start with the bendplane y
+        double drphi_res = hth.drphi();
+        double wrphi = Math.sqrt(drphi_res * drphi_res + msdrphi * msdrphi);
+        // This is the normal way to get s
+        double s_wrong = track.PathMap().get(hth);
+        // This is how I do it with HelicalTrackFits
+        double s = HelixUtils.PathToXPlane(track, hth.x(), 0, 0).get(0);
+        // System.out.printf("x %f s %f smap %f\n",hth.x(),s,s_wrong);
+        if (Double.isNaN(s)) {
+            double xc = track.xc();
+            double RC = track.R();
+            System.out.printf("calculateTrackHitResidual: s is NaN. p=%.3f RC=%.3f, x=%.3f, xc=%.3f\n", track.p(-0.491), RC, hth.x(), xc);
+            return residuals;
+        }
 
-            residuals.put("resz",resz);
-            residuals.put("errz",dz_res);
-            residuals.put("dz_res",Math.sqrt(dz_res2));
-            residuals.put("msdz",msdz);
-            
-            
-            if(debug) {
-                System.out.printf("calculateTrackHitResidual: HTH hit at (%f,%f,%f)\n",hth.x(),hth.y(),hth.z());
-                System.out.printf("calculateTrackHitResidual: helix params d0=%f phi0=%f R=%f z0=%f slope=%f chi2=%f/%f chi2tot=%f\n",track.dca(),track.phi0(),track.R(),track.z0(),track.slope(),track.chisq()[0],track.chisq()[1],track.chisqtot());
-                System.out.printf("calculateTrackHitResidual: => resz=%f resy=%f at s=%f\n",resz,resy,s);
-                //System.out.printf("calculateTrackHitResidual: resy=%f eresy=%f drphi=%f msdrphi=%f \n",resy,erry,drphi_res,msdrphi);
-                //System.out.printf("calculateTrackHitResidual: resz=%f eresz=%f dz_res=%f msdz=%f \n",resz,dz_res,Math.sqrt(dz_res2),msdz);
-            }          
-            
-        
+        Hep3Vector posOnHelix = HelixUtils.PointOnHelix(track, s);
+        double resy = hth.y() - posOnHelix.y();
+        double erry = includeMS ? wrphi : drphi_res;
+
+        // Now the residual for the "measurement" direction z
+        double resz = hth.z() - posOnHelix.z();
+        double dz_res = HitUtils.zres(hth, msmap, track);
+        double dz_res2 = hth.getCorrectedCovMatrix().diagonal(2);
+
+        if (Double.isNaN(resy)) {
+            System.out.printf("calculateTrackHitResidual: resy is NaN. hit at %s posOnHelix=%s path=%.3f wrong_path=%.3f helix:\n%s\n", hth.getCorrectedPosition().toString(), posOnHelix.toString(), s, s_wrong, track.toString());
             return residuals;
         }
-        
 
-        public static Map<String,Double> calculateLocalTrackHitResiduals(Track track, HelicalTrackHit hth, HelicalTrackStrip strip, double bFieldInZ) {
-            
-            SeedTrack st = (SeedTrack) track;
-            SeedCandidate seed = st.getSeedCandidate();
-            HelicalTrackFit _trk = seed.getHelix();
-            Map<HelicalTrackHit,MultipleScatter> msmap = seed.getMSMap();
-            double msdrdphi = msmap.get(hth).drphi();
-            double msdz = msmap.get(hth).dz();
-            return calculateLocalTrackHitResiduals(_trk, strip,  msdrdphi,  msdz,  bFieldInZ);
+        residuals.put("resy", resy);
+        residuals.put("erry", erry);
+        residuals.put("drphi", drphi_res);
+        residuals.put("msdrphi", msdrphi);
+
+        residuals.put("resz", resz);
+        residuals.put("errz", dz_res);
+        residuals.put("dz_res", Math.sqrt(dz_res2));
+        residuals.put("msdz", msdz);
+
+        if (debug) {
+            System.out.printf("calculateTrackHitResidual: HTH hit at (%f,%f,%f)\n", hth.x(), hth.y(), hth.z());
+            System.out.printf("calculateTrackHitResidual: helix params d0=%f phi0=%f R=%f z0=%f slope=%f chi2=%f/%f chi2tot=%f\n", track.dca(), track.phi0(), track.R(), track.z0(), track.slope(), track.chisq()[0], track.chisq()[1], track.chisqtot());
+            System.out.printf("calculateTrackHitResidual: => resz=%f resy=%f at s=%f\n", resz, resy, s);
+            // System.out.printf("calculateTrackHitResidual: resy=%f eresy=%f drphi=%f msdrphi=%f \n",resy,erry,drphi_res,msdrphi);
+            // System.out.printf("calculateTrackHitResidual: resz=%f eresz=%f dz_res=%f msdz=%f \n",resz,dz_res,Math.sqrt(dz_res2),msdz);
         }
-        
-        public static Map<String,Double> calculateLocalTrackHitResiduals(HelicalTrackFit _trk, HelicalTrackStrip strip, double msdrdphi, double msdz, double bFieldInZ) {
-        
-        
-            boolean debug = false;
-            boolean includeMS = true;
-            
-            
-            Hep3Vector u = strip.u();
-            Hep3Vector corigin = strip.origin();
 
-            //Find interception with plane that the strips belongs to
-            Hep3Vector trkpos = TrackUtils.getHelixPlaneIntercept(_trk, strip, bFieldInZ);
-        
-            if(debug) {
-                System.out.printf("calculateLocalTrackHitResiduals: found interception point at %s \n",trkpos.toString());
-            }
-        
+        return residuals;
+    }
 
-            if(Double.isNaN(trkpos.x()) || Double.isNaN(trkpos.y()) || Double.isNaN(trkpos.z())) {
-                System.out.printf("calculateLocalTrackHitResiduals: failed to get interception point (%s) \n",trkpos.toString());
-                System.out.printf("calculateLocalTrackHitResiduals: track params\n%s\n",_trk.toString());
-                System.out.printf("calculateLocalTrackHitResiduals: track pT=%.3f chi2=[%.3f][%.3f] \n",_trk.pT(bFieldInZ),_trk.chisq()[0],_trk.chisq()[1]);
-                trkpos = TrackUtils.getHelixPlaneIntercept(_trk, strip, bFieldInZ);
-                System.exit(1);
-            }
-        
-            double xint = trkpos.x();
-            double phi0 = _trk.phi0();
-            double R = _trk.R();
-            double s = HelixUtils.PathToXPlane(_trk, xint, 0, 0).get(0);
-            double phi = -s/R + phi0;
+    public static Map<String, Double> calculateLocalTrackHitResiduals(Track track, HelicalTrackHit hth, HelicalTrackStrip strip, double bFieldInZ) {
 
-            
-            Hep3Vector mserr = new BasicHep3Vector(msdrdphi * Math.sin(phi), msdrdphi * Math.sin(phi), msdz);
-            double msuError = VecOp.dot(mserr, u);
+        SeedTrack st = (SeedTrack) track;
+        SeedCandidate seed = st.getSeedCandidate();
+        HelicalTrackFit _trk = seed.getHelix();
+        Map<HelicalTrackHit, MultipleScatter> msmap = seed.getMSMap();
+        double msdrdphi = msmap.get(hth).drphi();
+        double msdz = msmap.get(hth).dz();
+        return calculateLocalTrackHitResiduals(_trk, strip, msdrdphi, msdz, bFieldInZ);
+    }
 
-            Hep3Vector vdiffTrk = VecOp.sub(trkpos, corigin);
-            TrackerHitUtils thu = new TrackerHitUtils(debug);
-            Hep3Matrix trkToStrip = thu.getTrackToStripRotation(strip);
-            Hep3Vector vdiff = VecOp.mult(trkToStrip, vdiffTrk);
+    public static Map<String, Double> calculateLocalTrackHitResiduals(HelicalTrackFit _trk, HelicalTrackStrip strip, double msdrdphi, double msdz, double bFieldInZ) {
 
+        boolean debug = false;
+        boolean includeMS = true;
 
-            double umc = vdiff.x();
-            double vmc = vdiff.y();
-            double wmc = vdiff.z();
-            double umeas = strip.umeas();
-            double uError = strip.du();
-            double vmeas = 0;
-            double vError = (strip.vmax() - strip.vmin()) / Math.sqrt(12);
-            double wmeas = 0;
-            double wError = 10.0/Math.sqrt(12); //0.001;
+        Hep3Vector u = strip.u();
+        Hep3Vector corigin = strip.origin();
 
-            Map<String,Double> res = new HashMap<String,Double>();
-            res.put("ures", umeas-umc);
-            res.put("ureserr", includeMS ? Math.sqrt(uError * uError + msuError * msuError) : uError);
-            res.put("vres", vmeas-vmc);
-            res.put("vreserr", vError);
-            res.put("wres", wmeas-wmc);
-            res.put("wreserr", wError);
-            
-            res.put("vdiffTrky",vdiffTrk.y());
+        // Find interception with plane that the strips belongs to
+        Hep3Vector trkpos = TrackUtils.getHelixPlaneIntercept(_trk, strip, bFieldInZ);
 
-            return res;
+        if (debug) {
+            System.out.printf("calculateLocalTrackHitResiduals: found interception point at %s \n", trkpos.toString());
         }
-        
-        
+
+        if (Double.isNaN(trkpos.x()) || Double.isNaN(trkpos.y()) || Double.isNaN(trkpos.z())) {
+            System.out.printf("calculateLocalTrackHitResiduals: failed to get interception point (%s) \n", trkpos.toString());
+            System.out.printf("calculateLocalTrackHitResiduals: track params\n%s\n", _trk.toString());
+            System.out.printf("calculateLocalTrackHitResiduals: track pT=%.3f chi2=[%.3f][%.3f] \n", _trk.pT(bFieldInZ), _trk.chisq()[0], _trk.chisq()[1]);
+            trkpos = TrackUtils.getHelixPlaneIntercept(_trk, strip, bFieldInZ);
+            System.exit(1);
+        }
+
+        double xint = trkpos.x();
+        double phi0 = _trk.phi0();
+        double R = _trk.R();
+        double s = HelixUtils.PathToXPlane(_trk, xint, 0, 0).get(0);
+        double phi = -s / R + phi0;
+
+        Hep3Vector mserr = new BasicHep3Vector(msdrdphi * Math.sin(phi), msdrdphi * Math.sin(phi), msdz);
+        double msuError = VecOp.dot(mserr, u);
+
+        Hep3Vector vdiffTrk = VecOp.sub(trkpos, corigin);
+        TrackerHitUtils thu = new TrackerHitUtils(debug);
+        Hep3Matrix trkToStrip = thu.getTrackToStripRotation(strip);
+        Hep3Vector vdiff = VecOp.mult(trkToStrip, vdiffTrk);
+
+        double umc = vdiff.x();
+        double vmc = vdiff.y();
+        double wmc = vdiff.z();
+        double umeas = strip.umeas();
+        double uError = strip.du();
+        double vmeas = 0;
+        double vError = (strip.vmax() - strip.vmin()) / Math.sqrt(12);
+        double wmeas = 0;
+        double wError = 10.0 / Math.sqrt(12); // 0.001;
+
+        Map<String, Double> res = new HashMap<String, Double>();
+        res.put("ures", umeas - umc);
+        res.put("ureserr", includeMS ? Math.sqrt(uError * uError + msuError * msuError) : uError);
+        res.put("vres", vmeas - vmc);
+        res.put("vreserr", vError);
+        res.put("wres", wmeas - wmc);
+        res.put("wreserr", wError);
+
+        res.put("vdiffTrky", vdiffTrk.y());
+
+        return res;
+    }
+
     public static int[] getHitsInTopBottom(Track track) {
-        int n[] = {0,0};
+        int n[] = { 0, 0 };
         List<TrackerHit> hitsOnTrack = track.getTrackerHits();
-        for(TrackerHit hit : hitsOnTrack) {
+        for (TrackerHit hit : hitsOnTrack) {
             HelicalTrackHit hth = (HelicalTrackHit) hit;
-            if(SvtUtils.getInstance().isTopLayer((SiSensor)((RawTrackerHit)hth.getRawHits().get(0)).getDetectorElement())) {
+            if (SvtUtils.getInstance().isTopLayer((SiSensor) ((RawTrackerHit) hth.getRawHits().get(0)).getDetectorElement())) {
                 n[0] = n[0] + 1;
             } else {
                 n[1] = n[1] + 1;
@@ -549,187 +550,186 @@
         }
         return n;
     }
-    
-    public static boolean isTopTrack(Track track,int minhits) {
-        return isTopOrBottomTrack(track,minhits)==1?true:false;
+
+    public static boolean isTopTrack(Track track, int minhits) {
+        return isTopOrBottomTrack(track, minhits) == 1 ? true : false;
     }
 
-    public static boolean isBottomTrack(Track track,int minhits) {
-        return isTopOrBottomTrack(track,minhits)==0?true:false;
+    public static boolean isBottomTrack(Track track, int minhits) {
+        return isTopOrBottomTrack(track, minhits) == 0 ? true : false;
     }
 
-    public static int isTopOrBottomTrack(Track track,int minhits) {
+    public static int isTopOrBottomTrack(Track track, int minhits) {
         int nhits[] = getHitsInTopBottom(track);
-        if (nhits[0]>=minhits && nhits[1]==0) {
+        if (nhits[0] >= minhits && nhits[1] == 0) {
             return 1;
-        } else if (nhits[1]>=minhits && nhits[0]==0) {
+        } else if (nhits[1] >= minhits && nhits[0] == 0) {
             return 0;
         } else {
             return -1;
         }
     }
-    
+
     public static boolean hasTopBotHit(Track track) {
         int nhits[] = getHitsInTopBottom(track);
-        if (nhits[0]>0 && nhits[1]>0) return true;
[truncated at 1000 lines; 246 more skipped]

java/trunk/tracking/src/main/java/org/hps/recon/tracking
TrackerDigiDriver.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackerDigiDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackerDigiDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -25,14 +25,12 @@
 import org.lcsim.util.Driver;
 
 /**
- * This Driver runs the tracker digitization to create raw hits and strip hits
- * from simulated data. The output can be used by a track reconstruction
- * algorithm like Seed Tracker.
- * 
- * @author jeremym
- * @version $Id: TrackerDigiDriver.java,v 1.12 2012/11/20 19:59:35 meeg Exp $
+ * This Driver runs the tracker digitization to create raw hits and strip hits from simulated data.
+ * The output can be used by a track reconstruction algorithm like Seed Tracker.
  */
+// FIXME: Who authored this Driver?  It wasn't me. --JM
 public class TrackerDigiDriver extends Driver {
+
     // Debug switch for development.
 
     private boolean debug = false;
@@ -206,8 +204,8 @@
     }
 
     /**
-     * This is executed before detectorChanged and initialization of
-     * digitization objects is done here.
+     * This is executed before detectorChanged and initialization of digitization objects is done
+     * here.
      */
     @Override
     public void startOfData() {
@@ -247,11 +245,11 @@
 
         for (IDetectorElement detectorElement : processDEs) {
             processSensors.addAll(detectorElement.findDescendants(SiSensor.class));
-            //if (debug)
-            //    System.out.println("added " + processSensors.size() + " sensors");
+            // if (debug)
+            // System.out.println("added " + processSensors.size() + " sensors");
             processModules.addAll(detectorElement.findDescendants(SiTrackerModule.class));
-            //if (debug)
-            //    System.out.println("added " + processModules.size() + " modules");
+            // if (debug)
+            // System.out.println("added " + processModules.size() + " modules");
         }
     }
 

java/trunk/tracking/src/main/java/org/hps/recon/tracking
TrackerHitUtils.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackerHitUtils.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackerHitUtils.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -29,10 +29,11 @@
 import org.lcsim.fit.helicaltrack.HelixUtils;
 
 /**
- *
+ * 
  * @author Per Hansson <[log in to unmask]>
  * @version $Id: TrackerHitUtils.java,v 1.4 2013/10/15 00:33:53 phansson Exp $
  */
+// TODO: Add class documentation.
 public class TrackerHitUtils {
 
     private boolean _DEBUG = false;
@@ -48,13 +49,12 @@
         _DEBUG = debug;
     }
 
-
     public Hep3Matrix detToTrackRotationMatrix() {
-        return (BasicHep3Matrix) HPSTransformations.getMatrix();
+        return (BasicHep3Matrix) CoordinateTransformations.getMatrix();
     }
 
     public ITransform3D GetGlobalToLocal(HelicalTrackStrip strip) {
-        //Transform from JLab frame (RawTrackerHit) to sensor frame (i.e. u,v,w)
+        // Transform from JLab frame (RawTrackerHit) to sensor frame (i.e. u,v,w)
         RawTrackerHit rth = (RawTrackerHit) strip.rawhits().get(0);
         IDetectorElement ide = rth.getDetectorElement();
         SiSensor sensor = ide.findDescendants(SiSensor.class).get(0);
@@ -63,14 +63,14 @@
     }
 
     public Hep3Matrix getStripToTrackRotation(HelicalTrackStrip strip) {
-        //This function transforms the hit to the tracking coordinates
+        // This function transforms the hit to the tracking coordinates
 
-        //Transform from JLab frame to sensor frame (done through the RawTrackerHit)
+        // Transform from JLab frame to sensor frame (done through the RawTrackerHit)
         ITransform3D detToStrip = GetGlobalToLocal(strip);
-        //Get rotation matrix
+        // Get rotation matrix
         Hep3Matrix detToStripMatrix = (BasicHep3Matrix) detToStrip.getRotation().getRotationMatrix();
-        //Transformation between the JLAB and tracking coordinate systems
-        Hep3Matrix detToTrackMatrix = (BasicHep3Matrix) HPSTransformations.getMatrix();
+        // Transformation between the JLAB and tracking coordinate systems
+        Hep3Matrix detToTrackMatrix = (BasicHep3Matrix) CoordinateTransformations.getMatrix();
 
         if (_DEBUG) {
             System.out.println("gblToLoc translation:");
@@ -81,17 +81,17 @@
             System.out.println(detToTrackMatrix.toString());
         }
 
-        return (Hep3Matrix) VecOp.mult(detToTrackMatrix,VecOp.inverse(detToStripMatrix));
+        return (Hep3Matrix) VecOp.mult(detToTrackMatrix, VecOp.inverse(detToStripMatrix));
     }
 
     public Hep3Matrix getTrackToStripRotation(HelicalTrackStrip strip) {
-        //This function transforms the hit to the sensor coordinates
+        // This function transforms the hit to the sensor coordinates
 
-        //Transform from JLab frame to sensor frame (done through the RawTrackerHit)
+        // Transform from JLab frame to sensor frame (done through the RawTrackerHit)
         ITransform3D detToStrip = this.GetGlobalToLocal(strip);
-        //Get rotation matrix
+        // Get rotation matrix
         Hep3Matrix detToStripMatrix = (BasicHep3Matrix) detToStrip.getRotation().getRotationMatrix();
-        //Transformation between the JLAB and tracking coordinate systems
+        // Transformation between the JLAB and tracking coordinate systems
         Hep3Matrix detToTrackMatrix = this.detToTrackRotationMatrix();
 
         if (_DEBUG) {
@@ -106,34 +106,42 @@
         return (Hep3Matrix) VecOp.mult(detToStripMatrix, VecOp.inverse(detToTrackMatrix));
     }
 
-
-
     public Hep3Vector getClusterPosition(HelicalTrackStrip strip, boolean stripInTrackingFrame) {
-        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " getClusterPosition--");
-        Hep3Vector origin = stripInTrackingFrame ? strip.origin() : VecOp.mult(HPSTransformations.getMatrix(),strip.origin());
-        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " origin " + origin.toString());
-        Hep3Vector hit_vec_LOCAL = new BasicHep3Vector(strip.umeas(),0,0);
-        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " hit_vec_LOCAL " + hit_vec_LOCAL.toString());
+        if (_DEBUG)
+            System.out.println(this.getClass().getSimpleName() + " getClusterPosition--");
+        Hep3Vector origin = stripInTrackingFrame ? strip.origin() : VecOp.mult(CoordinateTransformations.getMatrix(), strip.origin());
+        if (_DEBUG)
+            System.out.println(this.getClass().getSimpleName() + " origin " + origin.toString());
+        Hep3Vector hit_vec_LOCAL = new BasicHep3Vector(strip.umeas(), 0, 0);
+        if (_DEBUG)
+            System.out.println(this.getClass().getSimpleName() + " hit_vec_LOCAL " + hit_vec_LOCAL.toString());
         Hep3Matrix stripToTrack = this.getStripToTrackRotation(strip);
-        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " stripToTrack " + stripToTrack.toString());
-        Hep3Vector hit_vec_TRACK = VecOp.mult(stripToTrack, hit_vec_LOCAL); 
-        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " hit_vec_TRACK " + hit_vec_TRACK.toString());
+        if (_DEBUG)
+            System.out.println(this.getClass().getSimpleName() + " stripToTrack " + stripToTrack.toString());
+        Hep3Vector hit_vec_TRACK = VecOp.mult(stripToTrack, hit_vec_LOCAL);
+        if (_DEBUG)
+            System.out.println(this.getClass().getSimpleName() + " hit_vec_TRACK " + hit_vec_TRACK.toString());
         Hep3Vector strip_pos = VecOp.add(origin, hit_vec_TRACK);
-        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " strip_pos " + strip_pos.toString());
+        if (_DEBUG)
+            System.out.println(this.getClass().getSimpleName() + " strip_pos " + strip_pos.toString());
 
-        //        Hep3Vector hit_vec_LOCAL_dep = new BasicHep3Vector(strip.umeas(),0,0.16);
-        //        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " hit_vec_LOCAL_dep " + hit_vec_LOCAL_dep.toString());
-        //        Hep3Vector hit_vec_TRACK_dep = VecOp.mult(stripToTrack, hit_vec_LOCAL_dep); 
-        //        Hep3Vector strip_pos_dep = VecOp.add(origin, hit_vec_TRACK_dep);
-        //        if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " strip_pos ALTERNATE " + strip_pos_dep.toString());
+        // Hep3Vector hit_vec_LOCAL_dep = new BasicHep3Vector(strip.umeas(),0,0.16);
+        // if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " hit_vec_LOCAL_dep " +
+        // hit_vec_LOCAL_dep.toString());
+        // Hep3Vector hit_vec_TRACK_dep = VecOp.mult(stripToTrack, hit_vec_LOCAL_dep);
+        // Hep3Vector strip_pos_dep = VecOp.add(origin, hit_vec_TRACK_dep);
+        // if(_DEBUG) System.out.println(this.getClass().getSimpleName() + " strip_pos ALTERNATE "
+        // + strip_pos_dep.toString());
 
         return strip_pos;
     }
 
     public Hep3Vector CalculateStripUncertaintyInGlobalFrame(HelicalTrackStrip strip, HelicalTrackFit trk, double msdrdphi, double msdz) {
 
-        if(_DEBUG) System.out.println("--- CalculateStripUncertainyInGlobalFrame ---");
-        if(_DEBUG) System.out.println("Strip origin = " + strip.origin().toString());
+        if (_DEBUG)
+            System.out.println("--- CalculateStripUncertainyInGlobalFrame ---");
+        if (_DEBUG)
+            System.out.println("Strip origin = " + strip.origin().toString());
         Hep3Vector u = strip.u();
         Hep3Vector v = strip.v();
         Hep3Vector w = strip.w();
@@ -142,98 +150,106 @@
         double phi0 = trk.phi0();
         double R = trk.R();
         double xint = strip.origin().x();
-        //double xint = this.calculateHelixInterceptXPlane(_trk, strip);
-        double s = HelixUtils.PathToXPlane(trk, xint, 0,0).get(0);
-        double phi = -s/R + phi0;
-        if(_DEBUG) System.out.println("phi0 " + phi0 + " R " + R + " xint " + xint + " s " + s + " phi " + phi);
-        //if(_DEBUG) System.out.println("trkpos = "+trkpos.toString());
-        //if(_DEBUG) System.out.println("origin = "+corigin.toString());
+        // double xint = this.calculateHelixInterceptXPlane(_trk, strip);
+        double s = HelixUtils.PathToXPlane(trk, xint, 0, 0).get(0);
+        double phi = -s / R + phi0;
+        if (_DEBUG)
+            System.out.println("phi0 " + phi0 + " R " + R + " xint " + xint + " s " + s + " phi " + phi);
+        // if(_DEBUG) System.out.println("trkpos = "+trkpos.toString());
+        // if(_DEBUG) System.out.println("origin = "+corigin.toString());
 
         Hep3Vector mserr = new BasicHep3Vector(msdrdphi * Math.sin(phi), msdrdphi * Math.sin(phi), msdz);
-        if(_DEBUG) System.out.println("msdrdphi = " + msdrdphi + " msdz = " + msdz);
-        if(_DEBUG) System.out.println("mserr = " + mserr.toString());
+        if (_DEBUG)
+            System.out.println("msdrdphi = " + msdrdphi + " msdz = " + msdz);
+        if (_DEBUG)
+            System.out.println("mserr = " + mserr.toString());
         double uHitError = strip.du();
         double msuError = VecOp.dot(mserr, u);
         double uError = Math.sqrt(uHitError * uHitError + msuError * msuError);
-        if(_DEBUG) System.out.println("uError = " + uError + "(MS "+msuError  + ",u=" + u.toString()+")");
+        if (_DEBUG)
+            System.out.println("uError = " + uError + "(MS " + msuError + ",u=" + u.toString() + ")");
         double vHitError = (strip.vmax() - strip.vmin()) / Math.sqrt(12);
         double msvError = VecOp.dot(mserr, v);
         double vError = Math.sqrt(vHitError * vHitError + msvError * msvError);
-        if(_DEBUG) System.out.println("vError = " + vError + "(MS "+msvError  + ",v=" + v.toString()+")");
+        if (_DEBUG)
+            System.out.println("vError = " + vError + "(MS " + msvError + ",v=" + v.toString() + ")");
 
-        double wHitError = 10.0/Math.sqrt(12); //0.001;
+        double wHitError = 10.0 / Math.sqrt(12); // 0.001;
         double mswError = VecOp.dot(mserr, w);
         double wError = Math.sqrt(wHitError * wHitError + mswError * mswError);
-        if(_DEBUG) System.out.println("wError = " + wError + "(MS "+mswError  + ",w=" + w.toString()+")");
+        if (_DEBUG)
+            System.out.println("wError = " + wError + "(MS " + mswError + ",w=" + w.toString() + ")");
 
-        Hep3Vector dq_local = new BasicHep3Vector(uError,vError,wError);
-        if(_DEBUG) System.out.println("dq_local = " + dq_local.toString());
+        Hep3Vector dq_local = new BasicHep3Vector(uError, vError, wError);
+        if (_DEBUG)
+            System.out.println("dq_local = " + dq_local.toString());
         Hep3Matrix trackToStripRot = getTrackToStripRotation(strip);
-        if(_DEBUG) System.out.println("trackToStripRot:\n " + trackToStripRot.toString());
+        if (_DEBUG)
+            System.out.println("trackToStripRot:\n " + trackToStripRot.toString());
         Hep3Matrix stripToTrackRot = VecOp.inverse(trackToStripRot);
-        if(_DEBUG) System.out.println("stripToTrackRot:\n " + stripToTrackRot.toString());
+        if (_DEBUG)
+            System.out.println("stripToTrackRot:\n " + stripToTrackRot.toString());
         Hep3Vector dq_global = VecOp.mult(stripToTrackRot, dq_local);
-        if(_DEBUG) System.out.println("q_global = " + dq_global.toString());
+        if (_DEBUG)
+            System.out.println("q_global = " + dq_global.toString());
         return dq_global;
     }
 
-    public List<SimTrackerHit> stripClusterToSimHits(HelicalTrackStrip strip, List<SimTrackerHit> simTrackerHits, boolean stripsInTrackingFrame){
+    public List<SimTrackerHit> stripClusterToSimHits(HelicalTrackStrip strip, List<SimTrackerHit> simTrackerHits, boolean stripsInTrackingFrame) {
 
         int layer = strip.layer();
-        Hep3Vector stripPosition = this.getClusterPosition(strip,stripsInTrackingFrame);
+        Hep3Vector stripPosition = this.getClusterPosition(strip, stripsInTrackingFrame);
 
         // Sort the SimTrackerHits by Layer
         Map<Integer, List<SimTrackerHit>> layerToSimTrackerHit = new HashMap<Integer, List<SimTrackerHit>>();
-        for(SimTrackerHit simTrackerHit : simTrackerHits){
-            if(!layerToSimTrackerHit.containsKey(simTrackerHit.getLayer()))
+        for (SimTrackerHit simTrackerHit : simTrackerHits) {
+            if (!layerToSimTrackerHit.containsKey(simTrackerHit.getLayer()))
                 layerToSimTrackerHit.put(simTrackerHit.getLayer(), new ArrayList<SimTrackerHit>());
             layerToSimTrackerHit.get(simTrackerHit.getLayer()).add(simTrackerHit);
         }
 
-        // 
+        //
         List<SimTrackerHit> simhits = new ArrayList<SimTrackerHit>();
 
-        if(layerToSimTrackerHit.get(strip.layer()) == null) {
+        if (layerToSimTrackerHit.get(strip.layer()) == null) {
             System.out.println(this.getClass().getSimpleName() + ": WARNING there is a strip in layer " + strip.layer() + " but no SimTrackerHits");
             return simhits;
         }
 
         // If there is only a single SimTrackerHit on a layer and it's in the same volume as the
         // strip hit then they likely match to each other
-        if(layerToSimTrackerHit.get(strip.layer()).size() == 1){
+        if (layerToSimTrackerHit.get(strip.layer()).size() == 1) {
             Hep3Vector simTrackerHitPosition = layerToSimTrackerHit.get(strip.layer()).get(0).getPositionVec();
-            if(Math.signum(simTrackerHitPosition.y()) == Math.signum(stripPosition.z())){            
+            if (Math.signum(simTrackerHitPosition.y()) == Math.signum(stripPosition.z())) {
                 simhits.add(layerToSimTrackerHit.get(strip.layer()).get(0));
                 layerToSimTrackerHit.remove(strip.layer());
-                if(_DEBUG) {
+                if (_DEBUG) {
                     System.out.println(this.getClass().getSimpleName() + ": SimTrackerHit position: " + simTrackerHitPosition.toString());
                     System.out.println(this.getClass().getSimpleName() + ": Cluster position: " + stripPosition.toString());
                 }
             } else {
                 System.out.println(this.getClass().getSimpleName() + ": Cluster and SimTrackerHit are on different volumes");
             }
-        }
-        else if(layerToSimTrackerHit.get(strip.layer()).size() > 1){
-            if(_DEBUG) System.out.println(this.getClass().getSimpleName() + ": found " + layerToSimTrackerHit.get(strip.layer()).size() + " SimTrackerHits to match to strip in layer " + strip.layer());
-            //System.exit(1);
+        } else if (layerToSimTrackerHit.get(strip.layer()).size() > 1) {
+            if (_DEBUG)
+                System.out.println(this.getClass().getSimpleName() + ": found " + layerToSimTrackerHit.get(strip.layer()).size() + " SimTrackerHits to match to strip in layer " + strip.layer());
+            // System.exit(1);
             double deltaZ = Double.MAX_VALUE;
             SimTrackerHit simTrackerHitMatch = null;
-            for(SimTrackerHit simTrackerHit : layerToSimTrackerHit.get(strip.layer())){
-                if(Math.abs(simTrackerHit.getPositionVec().y() - stripPosition.z()) < deltaZ){
+            for (SimTrackerHit simTrackerHit : layerToSimTrackerHit.get(strip.layer())) {
+                if (Math.abs(simTrackerHit.getPositionVec().y() - stripPosition.z()) < deltaZ) {
                     deltaZ = Math.abs(simTrackerHit.getPositionVec().y() - stripPosition.z());
                     simTrackerHitMatch = simTrackerHit;
                 }
             }
             simhits.add(simTrackerHitMatch);
             layerToSimTrackerHit.remove(strip.layer()).remove(simTrackerHitMatch);
-            if(_DEBUG) {
+            if (_DEBUG) {
                 System.out.println(this.getClass().getSimpleName() + ": SimTrackerHit position: " + simTrackerHitMatch.getPositionVec().toString());
                 System.out.println(this.getClass().getSimpleName() + ": Cluster position: " + stripPosition);
             }
         }
 
-
-
         return simhits;
     }
 
@@ -243,7 +259,7 @@
      * @param sensor : The sensor on which the SimTrackerHit is created on
      * @return A 32-bit SimTrackerHit identifier
      */
-    public static IIdentifier makeSimTrackerHitId(SiSensor sensor){
+    public static IIdentifier makeSimTrackerHitId(SiSensor sensor) {
 
         // Get the sensors identifier
         IExpandedIdentifier id = new ExpandedIdentifier(sensor.getExpandedIdentifier());
@@ -260,21 +276,24 @@
 
     }
 
-    //   public List<SiTrackerHit> stripClusterToSiHits(HelicalTrackStrip strip, List<SiTrackerHit> siTrackerHits, boolean stripsInTrackingFrame)
-    //    {
-    //     
-    //        //Should be a one to one match with a strip!
-    //        Hep3Vector stripPosition = this.getClusterPosition(strip,stripsInTrackingFrame);
-    //        if(_DEBUG) System.out.println("Strip position " + stripPosition.toString() + " ( " + strip.origin().toString() + ")");
-    //        
-    //        for(SiTrackerHit siTrackerHit : siTrackerHits){
-    //            SiTrackerHitStrip1D h = (SiTrackerHitStrip1D) siTrackerHit;
-    //            if(_DEBUG) System.out.println("SiTrackerHit origin position " + h.getPositionAsVector().toString());
-    //            
-    //        }
-    //            
-    //        List<SiTrackerHit> hits = new ArrayList<SiTrackerHit>();
-    //        return hits;
-    //          
-    //    }
+    // public List<SiTrackerHit> stripClusterToSiHits(HelicalTrackStrip strip, List<SiTrackerHit>
+    // siTrackerHits, boolean stripsInTrackingFrame)
+    // {
+    //
+    // //Should be a one to one match with a strip!
+    // Hep3Vector stripPosition = this.getClusterPosition(strip,stripsInTrackingFrame);
+    // if(_DEBUG) System.out.println("Strip position " + stripPosition.toString() + " ( " +
+    // strip.origin().toString() + ")");
+    //
+    // for(SiTrackerHit siTrackerHit : siTrackerHits){
+    // SiTrackerHitStrip1D h = (SiTrackerHitStrip1D) siTrackerHit;
+    // if(_DEBUG) System.out.println("SiTrackerHit origin position " +
+    // h.getPositionAsVector().toString());
+    //
+    // }
+    //
+    // List<SiTrackerHit> hits = new ArrayList<SiTrackerHit>();
+    // return hits;
+    //
+    // }
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking
TrackerReconDriver.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackerReconDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/TrackerReconDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -16,13 +16,11 @@
 import org.lcsim.util.Driver;
 
 /**
- * This class runs the Track Reconstruction for the HPS Test Proposal detector.
- * The tracker digitization must be run in front of it. It is intended to work
- * with the {@link TrackerDigiDriver} digitization Driver.
- *
- * @author jeremym
- * @version $Id: TrackerReconDriver.java,v 1.18 2012/05/03 20:50:29 mgraham Exp
- * $
+ * This class runs the Track Reconstruction for the HPS Test Proposal detector. The tracker
+ * digitization must be run in front of it. It is intended to work with the
+ * {@link TrackerDigiDriver} digitization Driver.
+ * 
+ * @author Matt Graham
  */
 public final class TrackerReconDriver extends Driver {
 
@@ -52,7 +50,7 @@
     private boolean _useHPSMaterialManager = true;
     // enable the use of sectoring using sector binning in SeedTracker
     private boolean _applySectorBinning = true;
-    
+
     public TrackerReconDriver() {
     }
 
@@ -62,9 +60,8 @@
 
     /**
      * Set the tracking strategy resource.
-     *
-     * @param strategyResource The absolute path to the strategy resource in the
-     * hps-java jar.
+     * 
+     * @param strategyResource The absolute path to the strategy resource in the hps-java jar.
      */
     public void setStrategyResource(String strategyResource) {
         this.strategyResource = strategyResource;
@@ -81,29 +78,29 @@
     public void setIncludeMS(boolean incMS) {
         this.includeMS = incMS;
     }
-    
-     /**
-     * Set to enable the use of the HPS material manager implementation 
+
+    /**
+     * Set to enable the use of the HPS material manager implementation
      * 
      * @param useHPSMaterialManager switch
      */
     public void setUseHPSMaterialManager(boolean useHPSMaterialManager) {
         this._useHPSMaterialManager = useHPSMaterialManager;
     }
-    
+
     public void setIterativeFits(int val) {
         this._iterativeConfirmed = val;
     }
-    
-     /**
+
+    /**
      * Set to enable the sectoring to use the sector bins in checking for consistent hits.
-     *
+     * 
      * @param applySectorBinning apply sector binning switch
      */
     public void setApplySectorBinning(boolean applySectorBinning) {
         this._applySectorBinning = applySectorBinning;
     }
-   
+
     /**
      * This is used to setup the Drivers after XML config.
      */
@@ -116,7 +113,7 @@
         // FIXME Is this always right?
         this.bfield = Math.abs((detector.getFieldMap().getField(new BasicHep3Vector(0, 0, 0)).y()));
         if (debug) {
-            System.out.printf("%s: Set B-field to %.3f\n",this.getClass().getSimpleName(),this.bfield);
+            System.out.printf("%s: Set B-field to %.3f\n", this.getClass().getSimpleName(), this.bfield);
         }
 
         initialize();
@@ -137,17 +134,17 @@
             strategyResource = "/org/hps/recon/tracking/strategies/" + strategyResource;
         }
         List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromInputStream(this.getClass().getResourceAsStream(strategyResource));
-        SeedTracker stFinal = new SeedTracker(sFinallist,this._useHPSMaterialManager,this.includeMS);
+        SeedTracker stFinal = new SeedTracker(sFinallist, this._useHPSMaterialManager, this.includeMS);
         stFinal.setApplySectorBinning(_applySectorBinning);
         stFinal.setUseDefaultXPlane(false);
         stFinal.setDebug(this.debug);
         stFinal.setIterativeConfirmed(_iterativeConfirmed);
-        stFinal.setMaterialManagerTransform(HPSTransformations.getTransform());
+        stFinal.setMaterialManagerTransform(CoordinateTransformations.getTransform());
         stFinal.setInputCollectionName(stInputCollectionName);
         stFinal.setTrkCollectionName(trackCollectionName);
         stFinal.setBField(bfield);
         stFinal.setDiagnostics(new SeedTrackerDiagnostics());
-//        stFinal.setSectorParams(false); //this doesn't actually seem to do anything
+        // stFinal.setSectorParams(false); //this doesn't actually seem to do anything
         stFinal.setSectorParams(1, 10000);
         add(stFinal);
 
@@ -158,8 +155,7 @@
     }
 
     /**
-     * This method is used to run the reconstruction and print debug
-     * information.
+     * This method is used to run the reconstruction and print debug information.
      */
     @Override
     public void process(EventHeader event) {
@@ -168,7 +164,7 @@
 
         // Debug printouts.
         if (debug) {
-            if(event.hasCollection(HelicalTrackHit.class,stInputCollectionName)) {
+            if (event.hasCollection(HelicalTrackHit.class, stInputCollectionName)) {
                 System.out.println(this.getClass().getSimpleName() + ": The HelicalTrackHit collection " + stInputCollectionName + " has " + event.get(HelicalTrackHit.class, stInputCollectionName).size() + " hits.");
             } else {
                 System.out.println(this.getClass().getSimpleName() + ": No HelicalTrackHit collection for this event");

java/trunk/tracking/src/main/java/org/hps/recon/tracking
WTrack.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/WTrack.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/WTrack.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -12,21 +12,25 @@
 import org.lcsim.fit.helicaltrack.HelicalTrackFit;
 
 /**
- *
+ * 
  * @author phansson
  */
 public class WTrack {
 
     private boolean _debug = false;
-    public enum PARAM{TEST;}
+
+    public enum PARAM {
+        TEST;
+    }
+
     private double[] _parameters = new double[7];
     public HelicalTrackFit _htf = null;
     private double _bfield;
     private double _a;
-    
+
     static int max_iterations_intercept = 10;
     static double epsilon_intercept = 1e-4;
-    
+
     public WTrack(WTrack trk) {
         _bfield = trk._bfield;
         _a = trk._a;
@@ -34,112 +38,108 @@
         _htf = trk._htf;
         _debug = trk._debug;
     }
-    
+
     public WTrack(HelicalTrackFit track, double bfield) {
         initWithTrack(track, bfield, false);
     }
-    
+
     public WTrack(HelicalTrackFit track, double bfield, boolean flip) {
         initWithTrack(track, bfield, flip);
     }
+
     public void initWithTrack(HelicalTrackFit track, double bfield, boolean flip) {
         _htf = track;
-        _bfield = flip ? -1.0*bfield : bfield; // flip if needed
-        _a = -1*Constants.fieldConversion*_bfield*Math.signum(track.R());
+        _bfield = flip ? -1.0 * bfield : bfield; // flip if needed
+        _a = -1 * Constants.fieldConversion * _bfield * Math.signum(track.R());
         double p = track.p(Math.abs(_bfield));
-        double theta = Math.PI/2.0 - Math.atan(track.slope());
+        double theta = Math.PI / 2.0 - Math.atan(track.slope());
         double phi = track.phi0();
-        _parameters[0] = p*Math.cos(phi)*Math.sin(theta);
-        _parameters[1] = p*Math.sin(phi)*Math.sin(theta);
-        _parameters[2] = p*Math.cos(theta); 
-        _parameters[3] = Math.sqrt(_parameters[0]*_parameters[0]+_parameters[1]*_parameters[1]+_parameters[2]*_parameters[2]);
-        _parameters[4] = -1*track.dca()*Math.sin(phi); //x0
-        _parameters[5] = track.dca()*Math.cos(phi); //y0
-        _parameters[6] = track.z0(); //z0
-        if(_debug) {
-            System.out.printf("%s: WTrack initialized (p=%f,bfield=%f,theta=%f,phi=%f) from HelicalTrackFit:\n%s:%s\n",this.getClass().getSimpleName(),
-                    p,_bfield,theta,phi,
-                    this.getClass().getSimpleName(),this.toString());
+        _parameters[0] = p * Math.cos(phi) * Math.sin(theta);
+        _parameters[1] = p * Math.sin(phi) * Math.sin(theta);
+        _parameters[2] = p * Math.cos(theta);
+        _parameters[3] = Math.sqrt(_parameters[0] * _parameters[0] + _parameters[1] * _parameters[1] + _parameters[2] * _parameters[2]);
+        _parameters[4] = -1 * track.dca() * Math.sin(phi); // x0
+        _parameters[5] = track.dca() * Math.cos(phi); // y0
+        _parameters[6] = track.z0(); // z0
+        if (_debug) {
+            System.out.printf("%s: WTrack initialized (p=%f,bfield=%f,theta=%f,phi=%f) from HelicalTrackFit:\n%s:%s\n", this.getClass().getSimpleName(), p, _bfield, theta, phi, this.getClass().getSimpleName(), this.toString());
         }
     }
-    public void setTrackParameters(double [] params) {
+
+    public void setTrackParameters(double[] params) {
         _parameters = params;
     }
-    
+
     public double[] getParameters() {
         return _parameters;
     }
-    
+
     private boolean goingForward() {
         // assuming the track should go in the x-direction --> not very general -> FIX THIS!?
-        return getP0().x()>0 ? true : false;
+        return getP0().x() > 0 ? true : false;
     }
-    
-    
+
     public double a() {
         return _a;
 
     }
-    
+
     private int getCharge() {
         return (int) Math.signum(_htf.R());
     }
-    
+
     public Hep3Vector getP0() {
-        return ( new BasicHep3Vector(_parameters[0],_parameters[1],_parameters[2]));
+        return (new BasicHep3Vector(_parameters[0], _parameters[1], _parameters[2]));
     }
-    
+
     public Hep3Vector getX0() {
-        return ( new BasicHep3Vector(_parameters[4],_parameters[5],_parameters[6]));
+        return (new BasicHep3Vector(_parameters[4], _parameters[5], _parameters[6]));
     }
-        
+
     public String paramsToString() {
         String str = "";
-        for(int i=0;i<7;++i) str += _parameters[i] + ", ";
+        for (int i = 0; i < 7; ++i)
+            str += _parameters[i] + ", ";
         return str;
     }
+
     public String toString() {
-        
+
         String str = "WTrack params [" + paramsToString() + "]";
-        if(this._htf!=null) {
+        if (this._htf != null) {
             str += "\n with corresponding HelicalTrackFit:\n";
-            str += this._htf.toString(); 
+            str += this._htf.toString();
         }
-       return str;
+        return str;
     }
-    
-    
-    
-    
-    
-    
-     private Hep3Vector getMomentumOnHelix(double s) {
+
+    private Hep3Vector getMomentumOnHelix(double s) {
         WTrack track = this;
         double a = track.a();
         Hep3Vector p0 = track.getP0();
         double rho = a / p0.magnitude();
-        double px = p0.x()*Math.cos(rho*s) - p0.y()*Math.sin(rho*s);
-        double py = p0.y()*Math.cos(rho*s) + p0.x()*Math.sin(rho*s);
-        double pz = p0.z(); 
-        return (new BasicHep3Vector(px,py,pz));
+        double px = p0.x() * Math.cos(rho * s) - p0.y() * Math.sin(rho * s);
+        double py = p0.y() * Math.cos(rho * s) + p0.x() * Math.sin(rho * s);
+        double pz = p0.z();
+        return (new BasicHep3Vector(px, py, pz));
     }
-    
+
     private Hep3Vector getPointOnHelix(double s) {
         WTrack track = this;
         double a = track.a();
         Hep3Vector p0 = track.getP0();
         Hep3Vector x0 = track.getX0();
         double rho = a / p0.magnitude();
-        double x = x0.x() + p0.x()/a*Math.sin(rho*s) - p0.y()/a*(1-Math.cos(rho*s));
-        double y = x0.y() + p0.y()/a*Math.sin(rho*s) + p0.x()/a*(1-Math.cos(rho*s));
-        double z = x0.z() + p0.z()/p0.magnitude()*s;
-        return (new BasicHep3Vector(x,y,z));
+        double x = x0.x() + p0.x() / a * Math.sin(rho * s) - p0.y() / a * (1 - Math.cos(rho * s));
+        double y = x0.y() + p0.y() / a * Math.sin(rho * s) + p0.x() / a * (1 - Math.cos(rho * s));
+        double z = x0.z() + p0.z() / p0.magnitude() * s;
+        return (new BasicHep3Vector(x, y, z));
     }
-    
+
     private double getPathLengthToPlaneApprox(Hep3Vector xp, Hep3Vector eta, Hep3Vector h) {
         /*
-         * Find the approximate path length to the point xp 
-         * in arbitrary oriented, constant magnetic field with unit vector h
+         * Find the approximate path length to the point xp in arbitrary oriented, constant
+         * magnetic field with unit vector h
          */
         WTrack track = this;
         double a = track.a();
@@ -147,12 +147,12 @@
         Hep3Vector x0 = track.getX0();
         double p = p0.magnitude();
         double rho = a / p;
-        double A = VecOp.dot(eta,VecOp.cross(p0, h))/p*0.5*rho;
-        double B = VecOp.dot(p0,eta)/p;
-        double C = VecOp.dot(VecOp.sub(x0,xp),eta);
-        double t = B*B-4*A*C;
-        if(t<0) {
-            System.out.println(" getPathLengthToPlaneApprox ERROR t is negative (" + t + ")!" );
+        double A = VecOp.dot(eta, VecOp.cross(p0, h)) / p * 0.5 * rho;
+        double B = VecOp.dot(p0, eta) / p;
+        double C = VecOp.dot(VecOp.sub(x0, xp), eta);
+        double t = B * B - 4 * A * C;
+        if (t < 0) {
+            System.out.println(" getPathLengthToPlaneApprox ERROR t is negative (" + t + ")!");
             System.out.println(" p " + p + " rho " + rho + " a " + a + " A " + A + " B " + B + " C " + C);
             System.out.println(" track params: " + track.paramsToString());
             System.out.println(" xp " + xp.toString());
@@ -160,39 +160,40 @@
             System.out.println(" h " + h.toString());
             System.exit(1);
         }
-        double root1 = (-B + Math.sqrt(t)) /(2*A);
-        double root2 = (-B - Math.sqrt(t)) /(2*A);
+        double root1 = (-B + Math.sqrt(t)) / (2 * A);
+        double root2 = (-B - Math.sqrt(t)) / (2 * A);
 
         // choose the smallest positive solution
         // if both negative choose the smallest negative ???
-        //if(root1==0 || root2==0) root=0;
+        // if(root1==0 || root2==0) root=0;
         double root = Math.abs(root1) <= Math.abs(root2) ? root1 : root2;
-//        else if(Math.signum(root1)>0 && Math.signum(root2)<0) root = root1;
-//        else if(Math.signum(root2)>0 && Math.signum(root1)<0) root = root2;
-//        else if(Math.signum(root1)>0 && Math.signum(root2)>0) root =  root1 > root2 ? root2 : root1;
-//        else if(Math.signum(root1)<0 && Math.signum(root2)<0) root =  root1 < root2 ? root2 : root1;
-//        else {
-//            System.out.println(" I should never get here! (root1=" + root1 + " root2=" + root2+")");
-//            System.exit(1);
-//        }
-        if(_debug) {
-                System.out.println(" getPathLengthToPlaneApprox ");
-                System.out.println(" " + track.paramsToString());
-                System.out.println(" xp " + xp.toString());
-                System.out.println(" eta " + eta.toString());
-                System.out.println(" h " + h.toString());
-                System.out.println(" p " + p + " rho " + rho + " t " + t + " A " + A + " B " + B + " C " + C);
-                System.out.println(" root1 " + root1 + " root2 " + root2 + " -> root " + root);
+        // else if(Math.signum(root1)>0 && Math.signum(root2)<0) root = root1;
+        // else if(Math.signum(root2)>0 && Math.signum(root1)<0) root = root2;
+        // else if(Math.signum(root1)>0 && Math.signum(root2)>0) root = root1 > root2 ? root2 :
+        // root1;
+        // else if(Math.signum(root1)<0 && Math.signum(root2)<0) root = root1 < root2 ? root2 :
+        // root1;
+        // else {
+        // System.out.println(" I should never get here! (root1=" + root1 + " root2=" + root2+")");
+        // System.exit(1);
+        // }
+        if (_debug) {
+            System.out.println(" getPathLengthToPlaneApprox ");
+            System.out.println(" " + track.paramsToString());
+            System.out.println(" xp " + xp.toString());
+            System.out.println(" eta " + eta.toString());
+            System.out.println(" h " + h.toString());
+            System.out.println(" p " + p + " rho " + rho + " t " + t + " A " + A + " B " + B + " C " + C);
+            System.out.println(" root1 " + root1 + " root2 " + root2 + " -> root " + root);
         }
         return root;
-    
+
     }
-    
-    
+
     private Hep3Vector getPointOnHelix(double s, Hep3Vector h) {
         /*
-         * Get point on helix at path lenght s 
-         * in arbitrary oriented, constant magnetic field with unit vector h
+         * Get point on helix at path lenght s in arbitrary oriented, constant magnetic field with
+         * unit vector h
          */
         WTrack track = this;
         double a = track.a();
@@ -200,139 +201,125 @@
         double p = p0.magnitude();
         Hep3Vector x0 = track.getX0();
         double rho = a / p0.magnitude();
-        double srho = s*rho;
-        Hep3Vector a1 = VecOp.mult(1/a*Math.sin(srho), p0);
-        Hep3Vector a2 = VecOp.mult(1/a*(1-Math.cos(srho)),VecOp.cross(p0,h));
-        Hep3Vector a3 = VecOp.mult(VecOp.dot(p0, h)/p,h);
-        Hep3Vector a4 = VecOp.mult(s-Math.sin(srho)/rho, a3);
-        Hep3Vector x = VecOp.add(x0,a1);
-        x = VecOp.sub(x,a2);
-        x = VecOp.add(x,a4);
+        double srho = s * rho;
+        Hep3Vector a1 = VecOp.mult(1 / a * Math.sin(srho), p0);
+        Hep3Vector a2 = VecOp.mult(1 / a * (1 - Math.cos(srho)), VecOp.cross(p0, h));
+        Hep3Vector a3 = VecOp.mult(VecOp.dot(p0, h) / p, h);
+        Hep3Vector a4 = VecOp.mult(s - Math.sin(srho) / rho, a3);
+        Hep3Vector x = VecOp.add(x0, a1);
+        x = VecOp.sub(x, a2);
+        x = VecOp.add(x, a4);
         return x;
     }
-    
+
     private Hep3Vector getMomentumOnHelix(double s, Hep3Vector h) {
         /*
-         * Get point on helix at path lenght s 
-         * in arbitrary oriented, constant magnetic field with unit vector h
+         * Get point on helix at path lenght s in arbitrary oriented, constant magnetic field with
+         * unit vector h
          */
         WTrack track = this;
         double a = track.a();
         Hep3Vector p0 = track.getP0();
         double rho = a / p0.magnitude();
-        double srho = s*rho;
+        double srho = s * rho;
         Hep3Vector a1 = VecOp.mult(Math.cos(srho), p0);
-        Hep3Vector a2 = VecOp.cross(p0, VecOp.mult(Math.sin(srho),h));
-        Hep3Vector a3 = VecOp.mult(VecOp.dot(p0,h),VecOp.mult(1-Math.cos(srho),h));
-        Hep3Vector p  = VecOp.sub(a1,a2);
-        p = VecOp.add(p,a3);
+        Hep3Vector a2 = VecOp.cross(p0, VecOp.mult(Math.sin(srho), h));
+        Hep3Vector a3 = VecOp.mult(VecOp.dot(p0, h), VecOp.mult(1 - Math.cos(srho), h));
+        Hep3Vector p = VecOp.sub(a1, a2);
+        p = VecOp.add(p, a3);
         return p;
     }
-    
-    
+
     private double[] getHelixParametersAtPathLength(double s, Hep3Vector h) {
         /*
-         * Calculate the exact position of the new helix parameters at path length s
-         * in an arbitrarily oriented, constant magnetic field
-         * 
-         * point xp is the point 
-         * h is a unit vector in the direction of the magnetic field
+         * Calculate the exact position of the new helix parameters at path length s in an
+         * arbitrarily oriented, constant magnetic field point xp is the point h is a unit vector
+         * in the direction of the magnetic field
          */
-        
+
         // Find track parameters at that path length
         Hep3Vector p = getMomentumOnHelix(s, h);
         Hep3Vector x = getPointOnHelix(s, h);
-        
+
         Hep3Vector p_tmp = getMomentumOnHelix(s);
         Hep3Vector x_tmp = getPointOnHelix(s);
-        
-        if(_debug) {
+
+        if (_debug) {
             System.out.println(" point on helix at s");
             System.out.println(" p  " + p.toString() + "   p_tmp " + p_tmp.toString());
             System.out.println(" x  " + x.toString() + "   x_tmp " + x_tmp.toString());
         }
-        
-        
-        //Create the new parameter array
-        double [] pars = new double[7];
+
+        // Create the new parameter array
+        double[] pars = new double[7];
         pars[0] = p.x();
         pars[1] = p.y();
         pars[2] = p.z();
-        pars[3] = getParameters()[3]; //E is unchanged
+        pars[3] = getParameters()[3]; // E is unchanged
         pars[4] = x.x();
         pars[5] = x.y();
         pars[6] = x.z();
         return pars;
     }
-    
-    
+
     public Hep3Vector getHelixAndPlaneIntercept(Hep3Vector xp, Hep3Vector eta, Hep3Vector h) {
-    
+
         /*
-         * Find the interception point between the helix and plane
-         * xp: point on the plane
-         * eta: unit vector of the plane
-         * h: unit vector of magnetic field
+         * Find the interception point between the helix and plane xp: point on the plane eta: unit
+         * vector of the plane h: unit vector of magnetic field
          */
-        
-        
+
         int iteration = 1;
         double s_total = 0.;
         double step = 9999999.9;
-        //List<WTrack> tracks = new ArrayList<WTrack>();
+        // List<WTrack> tracks = new ArrayList<WTrack>();
         WTrack trk = this;
-        while(iteration<=max_iterations_intercept && Math.abs(step)>epsilon_intercept) {
-            
-            if(_debug) {
-                System.out.printf("%s: Iteration %d\n", this.getClass().getSimpleName(),iteration);
-                System.out.printf("%s: s_total %f prev_step %.3f current trk params: %s \n",
-                                        this.getClass().getSimpleName(),s_total,step,trk.paramsToString());
+        while (iteration <= max_iterations_intercept && Math.abs(step) > epsilon_intercept) {
+
+            if (_debug) {
+                System.out.printf("%s: Iteration %d\n", this.getClass().getSimpleName(), iteration);
+                System.out.printf("%s: s_total %f prev_step %.3f current trk params: %s \n", this.getClass().getSimpleName(), s_total, step, trk.paramsToString());
             }
-            
+
             // check that the track is not looping
-            
-            if(trk.goingForward()) {
-                
 
+            if (trk.goingForward()) {
+
                 // Start by approximating the path length to the point
                 step = getPathLengthToPlaneApprox(xp, eta, h);
 
-                if(_debug) System.out.printf("%s: path length step s=%.3f\n",this.getClass().getSimpleName(),step);
+                if (_debug)
+                    System.out.printf("%s: path length step s=%.3f\n", this.getClass().getSimpleName(), step);
 
                 // Find the track parameters at this point
                 double[] params = getHelixParametersAtPathLength(step, h);
 
-                // update the track parameters           
+                // update the track parameters
                 trk.setTrackParameters(params);
 
-                if(_debug) System.out.printf("%s: updated track params: [%s]\n",this.getClass().getSimpleName(),trk.paramsToString());
+                if (_debug)
+                    System.out.printf("%s: updated track params: [%s]\n", this.getClass().getSimpleName(), trk.paramsToString());
 
-                //tracks.add(trk);
+                // tracks.add(trk);
                 iteration++;
                 s_total += step;
 
-                //Save distance between point and estimate
-                //Hep3Vector dpoint = VecOp.sub(xp, trk.getX0());
-            
+                // Save distance between point and estimate
+                // Hep3Vector dpoint = VecOp.sub(xp, trk.getX0());
+
             } else {
-                //if(_debug) 
-                    System.out.printf("%s: this track started to go backwards?! params [%s]\n",this.getClass().getSimpleName(),trk.toString());
+                // if(_debug)
+                System.out.printf("%s: this track started to go backwards?! params [%s]\n", this.getClass().getSimpleName(), trk.toString());
                 return null;
             }
-            
-            
+
         }
-        
-        if(_debug) System.out.printf("%s: final total_s=%f with final step %f after %d iterations gave track params: %s\n",
-                                        this.getClass().getSimpleName(),s_total,step,iteration,trk.paramsToString());
-        
+
+        if (_debug)
+            System.out.printf("%s: final total_s=%f with final step %f after %d iterations gave track params: %s\n", this.getClass().getSimpleName(), s_total, step, iteration, trk.paramsToString());
+
         return trk.getX0();
-    
+
     }
-    
-   
-    
-  
-    
-    
+
 }

java/trunk/tracking/src/main/java/org/hps/recon/tracking/apv25
HPSDataProcessingModule.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/apv25/HPSDataProcessingModule.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/apv25/HPSDataProcessingModule.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -16,7 +16,7 @@
 import java.util.Set;
 
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.HPSSVTData;
+import org.hps.readout.svt.SVTData;
 import org.lcsim.detector.IReadout;
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.event.EventHeader;
@@ -51,8 +51,8 @@
 	List<RawTrackerHit> rawHitsNoCuts;  // No cuts are applied to samples
 	
 	// Collection of all SVT data
-	List<HPSSVTData> svtData;
-	List<HPSSVTData> svtFpgaData;
+	List<SVTData> svtData;
+	List<SVTData> svtFpgaData;
 	List<Double> samples;
 
 	int numberOfSamples = 0;        // Total number of APV25 samples
@@ -82,8 +82,8 @@
 		sensorToSamplesMap = new HashMap<SiSensor, Map<Integer, List<Double>>>();
 		rawHits = new ArrayList<RawTrackerHit>();
 		rawHitsNoCuts = new ArrayList<RawTrackerHit>();
-		svtData = new ArrayList<HPSSVTData>();
-		svtFpgaData = new ArrayList<HPSSVTData>();
+		svtData = new ArrayList<SVTData>();
+		svtFpgaData = new ArrayList<SVTData>();
 	}
 
 	/**
@@ -284,7 +284,7 @@
 				//if(debug) System.out.println(this.getClass().getSimpleName() + ": Raw Channel Number: " + rawChannel);
 				
 				// Create an svtData packet
-				HPSSVTData data = new HPSSVTData(hybridNumber, apvNumber, rawChannel, fpgaNumber, adc);
+				SVTData data = new SVTData(hybridNumber, apvNumber, rawChannel, fpgaNumber, adc);
 				svtData.add(data);
 				svtFpgaData.add(data);
 				
@@ -388,7 +388,7 @@
 
 			// Add SVTData to event
 			System.out.println("Adding SVTData Collection of size: " + svtData.size() + " to the Event");
-			event.put(this.svtCollectionName, this.svtData, HPSSVTData.class, 0);
+			event.put(this.svtCollectionName, this.svtData, SVTData.class, 0);
 
 			
 			//

java/trunk/tracking/src/main/java/org/hps/recon/tracking/apv25
HPSSVTDataBuffer.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/apv25/HPSSVTDataBuffer.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/apv25/HPSSVTDataBuffer.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -10,9 +10,11 @@
 import java.util.Map;
 
 // Constants
-import org.hps.recon.tracking.FpgaData;
-import org.hps.recon.tracking.HPSSVTData;
 
+
+import org.hps.readout.svt.FpgaData;
+import org.hps.readout.svt.SVTData;
+
 /**
  *
  * @author Omar Moreno <[log in to unmask]>
@@ -47,7 +49,7 @@
      * @param svtData : List of SVT data packets
      * @param fpga : FPGA from which the data emerges from
      */
-    public static void addToBuffer(List<HPSSVTData> svtData, int fpga){
+    public static void addToBuffer(List<SVTData> svtData, int fpga){
         // If the FPGA data block is empty, add header information and data, otherwise
     	// just add the data
     	instance.encapsulateSVTData(svtData, fpga);        
@@ -88,7 +90,7 @@
      * @param svtData : List of SVT data packets
      * @param fpga : FPGA from which the data emerges from
      */
-    private void encapsulateSVTData(List<HPSSVTData> svtData, int fpga){
+    private void encapsulateSVTData(List<SVTData> svtData, int fpga){
     	// Ignore FPGA 7 for now 
     	if(fpga == 7) return;
     	
@@ -122,7 +124,7 @@
 
         // Add all samples emerging from this FPGA
         if(!svtData.isEmpty()){
-        	for(HPSSVTData svtDatum : svtData){ 
+        	for(SVTData svtDatum : svtData){ 
             	if(debug){
             		System.out.println("FPGA: " + svtDatum.getFPGAAddress() + " Hybrid: " + svtDatum.getHybridNumber() + " APV: " 
             							+ svtDatum.getAPVNumber() + " Channel: " + svtDatum.getChannelNumber());

java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl
GBLFileIO.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLFileIO.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLFileIO.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 package org.hps.recon.tracking.gbl;
 
 import hep.physics.matrix.BasicMatrix;
@@ -15,9 +11,9 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.hps.recon.tracking.RunAlignment;
 import org.hps.recon.tracking.gbl.GBLOutput.ClParams;
 import org.hps.recon.tracking.gbl.GBLOutput.PerigeeParams;
+import org.hps.svt.alignment.RunAlignment;
 import org.lcsim.fit.helicaltrack.HelicalTrackFit;
 
 /**

java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl
GBLOutput.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLOutput.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLOutput.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -18,7 +18,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.hps.recon.tracking.MaterialSupervisor;
 import org.hps.recon.tracking.MaterialSupervisor.DetectorPlane;
 import org.hps.recon.tracking.MaterialSupervisor.ScatteringDetectorVolume;
@@ -81,7 +81,7 @@
     	}
         _materialmanager = new MaterialSupervisor();
         _scattering = new MultipleScattering(_materialmanager);
-        _B = HPSTransformations.transformVectorToTracking(bfield);
+        _B = CoordinateTransformations.transformVectorToTracking(bfield);
         _scattering.setBField(Math.abs(_B.z())); // only absolute of B is needed as it's used for momentum calculation only
     }
 
@@ -323,7 +323,7 @@
                 	if(_debug>0) {
                 		double s_truthSimHit = HelixUtils.PathToXPlane(htfTruth, simHit.getPositionVec().z(), 0, 0).get(0);
                 		Hep3Vector trkposTruthSimHit = HelixUtils.PointOnHelix(htfTruth, s_truthSimHit);
-                		Hep3Vector resTruthSimHit = VecOp.sub(HPSTransformations.transformVectorToTracking(simHit.getPositionVec()),trkposTruthSimHit);
+                		Hep3Vector resTruthSimHit = VecOp.sub(CoordinateTransformations.transformVectorToTracking(simHit.getPositionVec()),trkposTruthSimHit);
                 		System.out.printf("TruthSimHit residual %s for layer %d\n",resTruthSimHit.toString(),strip.layer());
                 	}
                 }
@@ -416,7 +416,7 @@
                 // sim hit residual
                 
                 if(simHit!=null) { 
-                    Hep3Vector simHitPos = HPSTransformations.transformVectorToTracking(simHit.getPositionVec());
+                    Hep3Vector simHitPos = CoordinateTransformations.transformVectorToTracking(simHit.getPositionVec());
                     if(_debug>0) System.out.printf("simHitPos  %s\n",simHitPos.toString());
                     Hep3Vector vdiffSimHit = VecOp.sub(simHitPos, trkpos);
                     Hep3Vector simHitPos_meas = VecOp.mult(trkToStripRot, vdiffSimHit);

java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl
TruthResiduals.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/TruthResiduals.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/TruthResiduals.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -18,7 +18,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.hps.recon.tracking.TrackUtils;
 import org.lcsim.event.MCParticle;
 import org.lcsim.event.SimTrackerHit;
@@ -53,7 +53,7 @@
      * Bz in Tesla
      */
     public TruthResiduals(Hep3Vector bfield) {
-        _B = HPSTransformations.transformVectorToTracking(bfield);
+        _B = CoordinateTransformations.transformVectorToTracking(bfield);
         System.out.printf("%s: B field %s\n",this.getClass().getSimpleName(),_B.toString());
     }
     public void setDebug(int debug) {
@@ -73,7 +73,7 @@
         Map<Integer, List<SimTrackerHit>> simHitsLayerMap = new HashMap<Integer, List<SimTrackerHit> >();
         Map<MCParticle, List<SimTrackerHit> > mcPartSimHitsMap = new HashMap<MCParticle, List<SimTrackerHit > >();
         for(SimTrackerHit sh : simTrackerHits) {
-        	 Hep3Vector shpos = HPSTransformations.transformVectorToTracking(sh.getPositionVec());
+        	 Hep3Vector shpos = CoordinateTransformations.transformVectorToTracking(sh.getPositionVec());
         	if(Math.abs(shpos.x()) < 50.0) {
         		 System.out.printf("%s: Weird hit at %s (%s) in layer %d for MC part %d org %s p %s\n",
                          this.getClass().getSimpleName(),sh.getPositionVec().toString(),shpos.toString(),sh.getIdentifierFieldValue("layer"),
@@ -119,7 +119,7 @@
                     if(mcp.getMomentum().magnitude()<0.5) continue;
                 	
                     // Position in tracking coord
-                    Hep3Vector simHitPosTracking = HPSTransformations.transformVectorToTracking(simHit.getPositionVec());
+                    Hep3Vector simHitPosTracking = CoordinateTransformations.transformVectorToTracking(simHit.getPositionVec());
                     
                     if(_debug>0) {
                         System.out.printf("%s: simHit for layer %d at %s (%s) from MC part %d org %s p %s\n",
@@ -139,7 +139,7 @@
                     Hep3Vector trkposExtraPolator = TrackUtils.extrapolateTrack(htfTruth,simHitPosTracking.x());
                     //System.out.printf("trkposextrapol (det) %s\n",trkposExtraPolator.toString());
                     
-                    trkposExtraPolator = HPSTransformations.transformVectorToTracking(trkposExtraPolator);
+                    trkposExtraPolator = CoordinateTransformations.transformVectorToTracking(trkposExtraPolator);
                     
                     // Calculate residuals
                     Hep3Vector res = VecOp.sub(simHitPosTracking, trkposExtraPolator);
@@ -175,7 +175,7 @@
                     	double xpos = mcp.getOriginZ();
                     	while(xpos< 100.) {
                     		xpos += dx;
-                    		trkposExtraPolator = HPSTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(htfTruth,xpos));
+                    		trkposExtraPolator = CoordinateTransformations.transformVectorToTracking(TrackUtils.extrapolateTrack(htfTruth,xpos));
                     		double ypos = trkposExtraPolator.y();
                     		trkpos_y_vs_x.fill(xpos,ypos);
                     	}

java/trunk/tracking/src/main/java/org/hps/svt/alignment
AlignmentParameters.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/svt/alignment/AlignmentParameters.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/svt/alignment/AlignmentParameters.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -18,7 +18,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.ITransform3D;
 import org.lcsim.detector.tracker.silicon.ChargeCarrier;
@@ -320,7 +320,7 @@
     private Hep3Matrix getTrackToStripRotation(HelicalTrackStrip strip) {
         ITransform3D detToStrip = GetGlobalToLocal(strip);
         Hep3Matrix detToStripMatrix = (BasicHep3Matrix) detToStrip.getRotation().getRotationMatrix();
-        Hep3Matrix detToTrackMatrix = (BasicHep3Matrix) HPSTransformations.getMatrix();
+        Hep3Matrix detToTrackMatrix = (BasicHep3Matrix) CoordinateTransformations.getMatrix();
 
         if (_DEBUG) {
             System.out.println("gblToLoc translation:");

java/trunk/tracking/src/main/java/org/hps/svt/alignment
BuildCompact.java 458 -> 459
--- java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildCompact.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/main/java/org/hps/svt/alignment/BuildCompact.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -33,7 +33,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.hps.conditions.deprecated.HPSSVTSensorSetup;
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.jdom.Document;
 import org.jdom.Element;
 import org.jdom.JDOMException;
@@ -507,7 +507,7 @@
         // p-side unit vector
         ITransform3D electrodes_to_global = sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getLocalToGlobal();
         Hep3Vector measuredCoordinate = sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getMeasuredCoordinate(0);
-        measuredCoordinate = VecOp.mult(VecOp.mult(HPSTransformations.getMatrix(),electrodes_to_global.getRotation().getRotationMatrix()), measuredCoordinate);
+        measuredCoordinate = VecOp.mult(VecOp.mult(CoordinateTransformations.getMatrix(),electrodes_to_global.getRotation().getRotationMatrix()), measuredCoordinate);
         return measuredCoordinate;
     }
 	

java/trunk/tracking/src/test/java/org/hps/recon/tracking
HelicalTrackHitDriverTest.java 458 -> 459
--- java/trunk/tracking/src/test/java/org/hps/recon/tracking/HelicalTrackHitDriverTest.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/test/java/org/hps/recon/tracking/HelicalTrackHitDriverTest.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -55,7 +55,7 @@
         int nEvents = 5000; 
 
         // Setup the drivers
-        HPSRawTrackerHitFitterDriver hitFitter = new HPSRawTrackerHitFitterDriver();
+        RawTrackerHitFitterDriver hitFitter = new RawTrackerHitFitterDriver();
         hitFitter.setFitAlgorithm("Analytic");
         hitFitter.setCorrectT0Shift(true);
 
@@ -162,6 +162,7 @@
                 aida.saveAs(outputFile);
             } catch(IOException exception){
                 Logger.getLogger(ComparisonPlotsDriver.class.getName()).log(Level.SEVERE, "Unable to save to file " + outputFile.getName());
+                throw new RuntimeException("Failed to save AIDA file.", exception);
             }
         
             nTopClusters.reset();

java/trunk/tracking/src/test/java/org/hps/recon/tracking
TestRunTrackReconTest.java 458 -> 459
--- java/trunk/tracking/src/test/java/org/hps/recon/tracking/TestRunTrackReconTest.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/test/java/org/hps/recon/tracking/TestRunTrackReconTest.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -208,7 +208,7 @@
             //calibDriver.setRunNumber(1351); //not sure what should be done here!? -> FIX THIS!
             add(calibDriver);
             add(new RawTrackerHitSensorSetup());
-            HPSRawTrackerHitFitterDriver hitfitter = new HPSRawTrackerHitFitterDriver();
+            RawTrackerHitFitterDriver hitfitter = new RawTrackerHitFitterDriver();
             hitfitter.setFitAlgorithm("Analytic");
             hitfitter.setCorrectT0Shift(true);
             add(hitfitter);

java/trunk/tracking/src/test/java/org/hps/recon/tracking
TruthResidualTest.java 458 -> 459
--- java/trunk/tracking/src/test/java/org/hps/recon/tracking/TruthResidualTest.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/tracking/src/test/java/org/hps/recon/tracking/TruthResidualTest.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -128,7 +128,7 @@
             //calibDriver.setRunNumber(1351); //not sure what should be done here!? -> FIX THIS!
             add(calibDriver);
             add(new RawTrackerHitSensorSetup());
-            HPSRawTrackerHitFitterDriver hitfitter = new HPSRawTrackerHitFitterDriver();
+            RawTrackerHitFitterDriver hitfitter = new RawTrackerHitFitterDriver();
             hitfitter.setFitAlgorithm("Analytic");
             hitfitter.setCorrectT0Shift(true);
             add(hitfitter);

java/trunk/users/src/main/java/org/hps/users/jeremym
EcalConditionsTestDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/jeremym/EcalConditionsTestDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/jeremym/EcalConditionsTestDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,11 +1,8 @@
 package org.hps.users.jeremym;
 
-import hep.aida.IAnalysisFactory;
 import hep.aida.IHistogram1D;
-import hep.aida.IHistogramFactory;
 import hep.aida.IPlotter;
 import hep.aida.IPlotterFactory;
-import hep.aida.ITree;
 
 import java.util.ArrayList;
 import java.util.List;

java/trunk/users/src/main/java/org/hps/users/mgraham
DetailedAnalysisDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/DetailedAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/DetailedAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -24,9 +24,9 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.hps.analysis.examples.TrackAnalysis;
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.hps.recon.vertexing.BilliorTrack;
 import org.hps.recon.vertexing.BilliorVertex;
 import org.hps.recon.vertexing.BilliorVertexer;

java/trunk/users/src/main/java/org/hps/users/mgraham
ElwinsTrackingRecon.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/ElwinsTrackingRecon.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/ElwinsTrackingRecon.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -18,7 +18,7 @@
 import org.hps.conditions.deprecated.SvtUtils;
 import org.hps.recon.ecal.HPSEcalCluster;
 import org.hps.recon.tracking.DumbShaperFit;
-import org.hps.recon.tracking.HPSShaperFitAlgorithm;
+import org.hps.recon.tracking.ShaperFitAlgorithm;
 import org.hps.recon.tracking.HPSTrack;
 import org.hps.recon.tracking.HelixConverter;
 import org.hps.recon.tracking.StraightLineTrack;
@@ -117,7 +117,7 @@
     double zAtColl = -1500;
     IHistogram1D trkPx;
     IHistogram1D nTracks;
-    HPSShaperFitAlgorithm _shaper = new DumbShaperFit();
+    ShaperFitAlgorithm _shaper = new DumbShaperFit();
 
     protected void detectorChanged(Detector detector) {
         this.detector = detector;

java/trunk/users/src/main/java/org/hps/users/mgraham
FastTrackAnalysisDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/FastTrackAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/FastTrackAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -17,9 +17,9 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.hps.analysis.examples.TrackAnalysis;
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.hps.recon.vertexing.BilliorTrack;
 import org.hps.recon.vertexing.BilliorVertex;
 import org.hps.recon.vertexing.BilliorVertexer;

java/trunk/users/src/main/java/org/hps/users/mgraham
JasAnalysisDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/JasAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/JasAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -20,9 +20,9 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.hps.analysis.examples.TrackAnalysis;
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.hps.recon.vertexing.BFitter;
 import org.hps.recon.vertexing.BilliorTrack;
 import org.hps.recon.vertexing.BilliorVertex;

java/trunk/users/src/main/java/org/hps/users/mgraham
MainJASDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/MainJASDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/MainJASDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -2,7 +2,7 @@
 
 import org.hps.conditions.deprecated.CalibrationDriver;
 import org.hps.recon.tracking.DataTrackerHitDriver;
-import org.hps.recon.tracking.HPSRawTrackerHitFitterDriver;
+import org.hps.recon.tracking.RawTrackerHitFitterDriver;
 import org.hps.recon.tracking.HelicalTrackHitDriver;
 import org.hps.recon.tracking.TrackerReconDriver;
 import org.lcsim.recon.tracking.digitization.sisim.config.RawTrackerHitSensorSetup;
@@ -22,7 +22,7 @@
         add(new CalibrationDriver());
         add(new RawTrackerHitSensorSetup());
         //   Can remove HPSRawTrackerHitFitterDriver and DataTrackerHitDriver for integrated MC
-        HPSRawTrackerHitFitterDriver hitfitter=new HPSRawTrackerHitFitterDriver();
+        RawTrackerHitFitterDriver hitfitter=new RawTrackerHitFitterDriver();
         hitfitter.setCorrectT0Shift(true);
         hitfitter.setFitAlgorithm("Analytic");
         add(hitfitter);

java/trunk/users/src/main/java/org/hps/users/mgraham
SingleSensorHelicalTrackHitDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/SingleSensorHelicalTrackHitDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/SingleSensorHelicalTrackHitDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -12,7 +12,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.ITransform3D;
 import org.lcsim.detector.tracker.silicon.SiTrackerModule;
@@ -355,9 +355,9 @@
                 String detname = strip.detector();
                 int layer = strip.layer();
                 BarrelEndcapFlag bec = strip.BarrelEndcapFlag();
-                Hep3Vector neworigin = HPSTransformations.transformVectorToTracking(origin);
-                Hep3Vector newu = HPSTransformations.transformVectorToTracking(u);
-                Hep3Vector newv = HPSTransformations.transformVectorToTracking(v);
+                Hep3Vector neworigin = CoordinateTransformations.transformVectorToTracking(origin);
+                Hep3Vector newu = CoordinateTransformations.transformVectorToTracking(u);
+                Hep3Vector newv = CoordinateTransformations.transformVectorToTracking(v);
                 HelicalTrackStrip newstrip = new HelicalTrackStrip(neworigin, newu, newv, umeas, du, vmin, vmax, dedx, time, rthList, detname, layer, bec);
                 for (MCParticle p : strip.MCParticles()) {
                     newstrip.addMCParticle(p);

java/trunk/users/src/main/java/org/hps/users/mgraham
SingleSensorTrackerReconDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/SingleSensorTrackerReconDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/SingleSensorTrackerReconDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -5,7 +5,7 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.hps.recon.tracking.SeedTracker;
 import org.hps.recon.tracking.TrackerDigiDriver;
 import org.lcsim.event.EventHeader;
@@ -113,7 +113,7 @@
         }
         List<SeedStrategy> sFinallist = StrategyXMLUtils.getStrategyListFromInputStream(this.getClass().getResourceAsStream(strategyResource));
         SeedTracker stFinal = new SeedTracker(sFinallist,this.includeMS);
-        stFinal.setMaterialManagerTransform(HPSTransformations.getTransform());
+        stFinal.setMaterialManagerTransform(CoordinateTransformations.getTransform());
         stFinal.setInputCollectionName(stInputCollectionName);
         stFinal.setTrkCollectionName(trackCollectionName);
         stFinal.setBField(bfield);

java/trunk/users/src/main/java/org/hps/users/mgraham
TestAnalysisDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/TestAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/TestAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -14,8 +14,8 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.hps.recon.tracking.HPSFittedRawTrackerHit;
-import org.hps.recon.tracking.TrackAnalysis;
+import org.hps.analysis.examples.TrackAnalysis;
+import org.hps.recon.tracking.FittedRawTrackerHit;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.event.RelationalTable;
@@ -45,7 +45,7 @@
         nevents++;
 
         List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, "SVTRawTrackerHits");
-        List<HPSFittedRawTrackerHit> fittedrawHits = event.get(HPSFittedRawTrackerHit.class, "SVTFittedRawTrackerHits");
+        List<FittedRawTrackerHit> fittedrawHits = event.get(FittedRawTrackerHit.class, "SVTFittedRawTrackerHits");
 
         List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D");
     
@@ -57,7 +57,7 @@
         Map<Track, Double> l1DeltaZ = new HashMap<Track, Double>();
         
         String fittedHitsDir = "FittedHits/";
-        for(HPSFittedRawTrackerHit hrth:fittedrawHits){
+        for(FittedRawTrackerHit hrth:fittedrawHits){
             double fittedAmp=hrth.getAmp();
             double fittedT0=hrth.getT0();
             String sensorName=hrth.getRawTrackerHit().getDetectorElement().getName();

java/trunk/users/src/main/java/org/hps/users/mgraham/alignment
AlignmentParameters.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/alignment/AlignmentParameters.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/alignment/AlignmentParameters.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -18,7 +18,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.hps.recon.tracking.HPSTransformations;
+import org.hps.recon.tracking.CoordinateTransformations;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.ITransform3D;
 import org.lcsim.detector.tracker.silicon.ChargeCarrier;
@@ -320,7 +320,7 @@
     private Hep3Matrix getTrackToStripRotation(HelicalTrackStrip strip) {
         ITransform3D detToStrip = GetGlobalToLocal(strip);
         Hep3Matrix detToStripMatrix = (BasicHep3Matrix) detToStrip.getRotation().getRotationMatrix();
-        Hep3Matrix detToTrackMatrix = (BasicHep3Matrix) HPSTransformations.getMatrix();
+        Hep3Matrix detToTrackMatrix = (BasicHep3Matrix) CoordinateTransformations.getMatrix();
 
         if (_DEBUG) {
             System.out.println("gblToLoc translation:");

java/trunk/users/src/main/java/org/hps/users/mgraham/jlabrotation
DetailedAnalysisDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/mgraham/jlabrotation/DetailedAnalysisDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/mgraham/jlabrotation/DetailedAnalysisDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -24,9 +24,9 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.hps.analysis.examples.TrackAnalysis;
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.StraightLineTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.hps.recon.vertexing.BilliorTrack;
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.event.EventHeader;

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtPerformance.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtPerformance.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtPerformance.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -14,8 +14,8 @@
 
 import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
 import org.hps.conditions.deprecated.HPSSVTCalibrationConstants.ChannelConstants;
-import org.hps.recon.tracking.HPSShapeFitParameters;
-import org.hps.recon.tracking.HPSShaperAnalyticFitAlgorithm;
+import org.hps.recon.tracking.ShapeFitParameters;
+import org.hps.recon.tracking.ShaperAnalyticFitAlgorithm;
 import org.lcsim.detector.tracker.silicon.HpsSiSensor;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.RawTrackerHit;
@@ -37,7 +37,7 @@
 
     private AIDA aida;
     private List<IPlotter> plotters = new ArrayList<IPlotter>();
-    HPSShaperAnalyticFitAlgorithm shaperFitter = new HPSShaperAnalyticFitAlgorithm();
+    ShaperAnalyticFitAlgorithm shaperFitter = new ShaperAnalyticFitAlgorithm();
     
     File performanceOutputFile;
     BufferedWriter performanceWriter;
@@ -305,7 +305,7 @@
         int maxClusterChannel = 0; 
         int hitsPerCluster = 0;  
         ChannelConstants constants = null;
-        HPSShapeFitParameters fit = null;
+        ShapeFitParameters fit = null;
         double clusterAmplitude, maxClusterAmplitude;
         double noise = 0;
         double chiSquared = -1;

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtQA.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtQA.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtQA.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -18,9 +18,9 @@
 import org.hps.conditions.deprecated.HPSSVTCalibrationConstants;
 import org.hps.conditions.deprecated.HPSSVTCalibrationConstants.ChannelConstants;
 import org.hps.conditions.deprecated.SvtUtils;
-import org.hps.recon.tracking.HPSFittedRawTrackerHit;
-import org.hps.recon.tracking.HPSShapeFitParameters;
-import org.hps.recon.tracking.HPSShaperAnalyticFitAlgorithm;
+import org.hps.recon.tracking.FittedRawTrackerHit;
+import org.hps.recon.tracking.ShapeFitParameters;
+import org.hps.recon.tracking.ShaperAnalyticFitAlgorithm;
 import org.hps.recon.tracking.TrackUtils;
 import org.hps.recon.tracking.apv25.SvtReadout;
 import org.hps.util.AIDAFrame;
@@ -51,7 +51,7 @@
 public class SvtQA extends Driver {
 
     private AIDA aida;
-    private HPSShaperAnalyticFitAlgorithm shaperFitter = new HPSShaperAnalyticFitAlgorithm();
+    private ShaperAnalyticFitAlgorithm shaperFitter = new ShaperAnalyticFitAlgorithm();
     private List<AIDAFrame>    frames   = new ArrayList<AIDAFrame>();
     private List<IHistogram1D> histos1D = new ArrayList<IHistogram1D>();
     private List<IHistogram2D> histos2D = new ArrayList<IHistogram2D>();
@@ -473,7 +473,7 @@
 
         SiSensor sensor = null;
         ChannelConstants constants = null;
-        HPSShapeFitParameters fit = null;
+        ShapeFitParameters fit = null;
         for(RawTrackerHit rawHit : rawHits){
 
             // Get the sensor on which this hit occurred
@@ -554,17 +554,17 @@
         }*/
 
         // If the event doesn't contain FittedRawTrackerHits then skip it
-        if(!event.hasCollection(HPSFittedRawTrackerHit.class, fittedHitCollectionName)){
+        if(!event.hasCollection(FittedRawTrackerHit.class, fittedHitCollectionName)){
             if(verbose) System.out.println("Event doesn't contain FittedRawTrackerHits! Skipping event ...");
             return;
         }
 
         // Get the RawTrackerHits from the event
-        List<HPSFittedRawTrackerHit> fittedHits = event.get(HPSFittedRawTrackerHit.class, fittedHitCollectionName);
+        List<FittedRawTrackerHit> fittedHits = event.get(FittedRawTrackerHit.class, fittedHitCollectionName);
         
         //System.out.println(this.getClass().getSimpleName() + ": Number of FittedRawTrackerHits " + fittedHits.size());
 
-        for(HPSFittedRawTrackerHit fittedHit : fittedHits){
+        for(FittedRawTrackerHit fittedHit : fittedHits){
 
 
             // Get the channel number

java/trunk/users/src/main/java/org/hps/users/omoreno
SvtTrackRecoEfficiency.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackRecoEfficiency.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/omoreno/SvtTrackRecoEfficiency.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -20,9 +20,9 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.hps.analysis.examples.TrackAnalysis;
 import org.hps.conditions.deprecated.SvtUtils;
 import org.hps.recon.tracking.FindableTrack;
-import org.hps.recon.tracking.TrackAnalysis;
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.MCParticle;

java/trunk/users/src/main/java/org/hps/users/phansson
ECalGainDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/phansson/ECalGainDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/ECalGainDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -22,7 +22,6 @@
 
 import org.hps.conditions.deprecated.EcalConditions;
 import org.hps.recon.ecal.HPSEcalCluster;
-import org.hps.recon.tracking.EcalTrackMatch;
 import org.hps.recon.tracking.TrackUtils;
 import org.hps.util.AIDAFrame;
 import org.hps.util.Redrawable;

java/trunk/users/src/main/java/org/hps/users/phansson
MultScatAnalysis.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/phansson/MultScatAnalysis.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/MultScatAnalysis.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -19,7 +19,6 @@
 import org.hps.conditions.deprecated.EcalConditions;
 import org.hps.readout.ecal.TriggerData;
 import org.hps.recon.ecal.HPSEcalCluster;
-import org.hps.recon.tracking.EcalTrackMatch;
 import org.hps.recon.tracking.TrackUtils;
 import org.hps.util.AIDAFrame;
 import org.lcsim.detector.identifier.ExpandedIdentifier;

java/trunk/users/src/main/java/org/hps/users/phansson
TrigRateDriver.java 458 -> 459
--- java/trunk/users/src/main/java/org/hps/users/phansson/TrigRateDriver.java	2014-04-04 22:39:56 UTC (rev 458)
+++ java/trunk/users/src/main/java/org/hps/users/phansson/TrigRateDriver.java	2014-04-04 23:46:06 UTC (rev 459)
@@ -1,7 +1,3 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 package org.hps.users.phansson;
 
 import hep.aida.IAnalysisFactory;
@@ -22,7 +18,6 @@
 import org.hps.conditions.deprecated.BeamlineConstants;
 import org.hps.conditions.deprecated.EcalConditions;
 import org.hps.recon.ecal.HPSEcalCluster;
-import org.hps.recon.tracking.EcalTrackMatch;
 import org.hps.util.AIDAFrame;
 import org.lcsim.detector.identifier.ExpandedIdentifier;
 import org.lcsim.detector.identifier.IExpandedIdentifier;
SVNspam 0.1