Commit in hps-java on MAIN
src/main/java/org/lcsim/hps/recon/tracking/apv25/SvtHalfModule.java+4-41.6 -> 1.7
                                                /SvtReadout.java+3-31.11 -> 1.12
                                                /RearTransitionModule.java+4-81.1 -> 1.2
                                                /Apv25Full.java+18-231.8 -> 1.9
                                                /Apv25Constants.java-291.4 removed
src/main/java/org/lcsim/hps/recon/tracking/HPSSVTConstants.java+15-11.6 -> 1.7
                                          /SimpleSvtReadout.java+6-71.15 -> 1.16
                                          /HPSTrack.java+76-371.5 -> 1.6
                                          /HPSShaperAnalyticFitAlgorithm.java+4-41.11 -> 1.12
                                          /DataTrackerFakeHitDriver.java+415-3861.7 -> 1.8
                                          /ParticleMaker.java-1321.1 removed
                                          /HpsHelicalTrackFit.java-571.1 removed
src/main/java/org/lcsim/hps/users/omoreno/ParticleMaker.java+133added 1.1
src/main/java/org/lcsim/hps/users/phansson/ParticleHelixProducer.java+126-1121.8 -> 1.9
sandbox/HpsHelicalTrackFit.java+57added 1.1
src/main/java/org/lcsim/hps/monitoring/svt/SVTPulseFitPlots.java+1-21.4 -> 1.5
+862-805
2 added + 3 removed + 11 modified, total 16 files
clean up some more redundant classes in recon.tracking

hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
SvtHalfModule.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- SvtHalfModule.java	15 Sep 2012 01:28:29 -0000	1.6
+++ SvtHalfModule.java	25 Apr 2013 22:11:14 -0000	1.7
@@ -2,16 +2,16 @@
 
 //--- constants ---//
 import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_APV25_PER_HYBRID;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.CHANNELS;
 
 //--- lcsim ---//
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants;
+import org.lcsim.hps.recon.tracking.HPSSVTConstants;
 
 /**
  * 
  * @author Omar Moreno
- * @version $Id: SvtHalfModule.java,v 1.6 2012/09/15 01:28:29 omoreno Exp $
+ * @version $Id: SvtHalfModule.java,v 1.7 2013/04/25 22:11:14 meeg Exp $
  */
 public class SvtHalfModule {
 
@@ -26,7 +26,7 @@
         // Instantiate the APV25's
         for(int chip = 0; chip < TOTAL_APV25_PER_HYBRID; chip++){
             apv25[chip] = new Apv25Full();
-            for(int channel = 0; channel < CHANNELS; channel++){
+            for(int channel = 0; channel < HPSSVTConstants.CHANNELS; channel++){
                 int physicalChannel = 639 - (chip*128 + 127 - channel);
                 
                 // Mark all bad channels which were found during QA
@@ -50,7 +50,7 @@
     }
     
     public int getAPV25Number(int physicalChannel){
-    	return (int) ((TOTAL_APV25_PER_HYBRID - 1) - Math.floor(physicalChannel/CHANNELS));
+    	return (int) ((TOTAL_APV25_PER_HYBRID - 1) - Math.floor(physicalChannel/HPSSVTConstants.CHANNELS));
     }
     
     public Apv25Full[] getAllApv25s(){

hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
SvtReadout.java 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- SvtReadout.java	20 Dec 2012 08:25:46 -0000	1.11
+++ SvtReadout.java	25 Apr 2013 22:11:14 -0000	1.12
@@ -17,6 +17,7 @@
 import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.event.EventHeader;
 import org.lcsim.geometry.Detector;
+import org.lcsim.hps.recon.tracking.HPSSVTConstants;
 import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim;
 import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeData;
 import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeDataCollection;
@@ -29,7 +30,6 @@
 import org.lcsim.hps.util.ClockSingleton;
 
 //--- Constants ---//
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.SAMPLING_INTERVAL;
 import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_APV25_CHANNELS;
 import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES;
 import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR;
@@ -37,7 +37,7 @@
 /**
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtReadout.java,v 1.11 2012/12/20 08:25:46 omoreno Exp $
+ * @version $Id: SvtReadout.java,v 1.12 2013/04/25 22:11:14 meeg Exp $
  */
 public class SvtReadout extends Driver {
 
@@ -152,7 +152,7 @@
         eventNumber++;
         
         // Increment all trigger pointer and writer positions when necessary
-        if((ClockSingleton.getTime() + ClockSingleton.getDt()) % SAMPLING_INTERVAL == 0){
+        if((ClockSingleton.getTime() + ClockSingleton.getDt()) % HPSSVTConstants.SAMPLING_INTERVAL == 0){
         	for(SvtHalfModule halfModule : halfModules){
                 for(Apv25Full apv : halfModule.getAllApv25s()){
                 	apv.incrementPointerPositions();

hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
RearTransitionModule.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- RearTransitionModule.java	15 Mar 2013 21:05:28 -0000	1.1
+++ RearTransitionModule.java	25 Apr 2013 22:11:14 -0000	1.2
@@ -7,23 +7,19 @@
 //--- org.lcsim ---//
 import org.lcsim.event.EventHeader;
 import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants;
+import org.lcsim.hps.recon.tracking.HPSSVTConstants;
 import org.lcsim.util.Driver;
 
 //--- hps-java ---//
-import org.lcsim.hps.recon.tracking.apv25.Apv25AnalogData;
-import org.lcsim.hps.recon.tracking.apv25.Apv25DigitalData;
 import org.lcsim.hps.util.RandomGaussian;
 
 //--- Constants ---//
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.CHANNELS;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.MULTIPLEXER_GAIN;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.MIP;
 import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR;
 
 /**
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: RearTransitionModule.java,v 1.1 2013/03/15 21:05:28 meeg Exp $
+ * @version $Id: RearTransitionModule.java,v 1.2 2013/04/25 22:11:14 meeg Exp $
  */
 public class RearTransitionModule extends Driver {
 
@@ -115,10 +111,10 @@
 
                     // Get the physical channel 
                     int physicalChannel = TOTAL_STRIPS_PER_SENSOR 
-                        - (analogDatum.getApvNumber()*CHANNELS + (CHANNELS - 1) - (index - 12));
+                        - (analogDatum.getApvNumber()*HPSSVTConstants.CHANNELS + (HPSSVTConstants.CHANNELS - 1) - (index - 12));
 
                     apv25Output[index] += 4; // mA
-                    apv25Output[index] *= (MIP/MULTIPLEXER_GAIN);
+                    apv25Output[index] *= (HPSSVTConstants.MIP/HPSSVTConstants.MULTIPLEXER_GAIN);
 
                     // Digitize the signal 
                     apv25Output[index] *= HPSSVTCalibrationConstants.getGain(analogDatum.getSensor(), physicalChannel);

hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
Apv25Full.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- Apv25Full.java	15 Sep 2012 01:28:28 -0000	1.8
+++ Apv25Full.java	25 Apr 2013 22:11:14 -0000	1.9
@@ -1,12 +1,7 @@
 package org.lcsim.hps.recon.tracking.apv25;
 
 //--- Constants ---//
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.ANALOG_PIPELINE_LENGTH;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.FRONT_END_GAIN;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.MIP;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.SAMPLING_INTERVAL;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.MULTIPLEXER_GAIN;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.CHANNELS;
+import org.lcsim.hps.recon.tracking.HPSSVTConstants;
 
 //--- hps-java ---//
 import org.lcsim.hps.util.ClockSingleton;
@@ -15,7 +10,7 @@
 /**
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: Apv25Full.java,v 1.8 2012/09/15 01:28:28 omoreno Exp $
+ * @version $Id: Apv25Full.java,v 1.9 2013/04/25 22:11:14 meeg Exp $
  */
 public class Apv25Full {
     
@@ -25,7 +20,7 @@
     protected int triggerLatencyTime = 240; // ns
     
     // APV25 Channels; An APV25 Readout Chip contains a total of 128 channels
-    private Apv25Channel[] channels = new Apv25Channel[CHANNELS];
+    private Apv25Channel[] channels = new Apv25Channel[HPSSVTConstants.CHANNELS];
   
     /**
      * Default Ctor
@@ -33,7 +28,7 @@
     public Apv25Full(){
         
         // Instantiate all APV25 channels
-        for(int channelN = 0; channelN < CHANNELS; channelN++){
+        for(int channelN = 0; channelN < HPSSVTConstants.CHANNELS; channelN++){
             channels[channelN] = new Apv25Channel();
         }
         // Set the trigger latency
@@ -44,8 +39,8 @@
      * 
      */
     public void setLatency(int triggerLatencyTime /*ns*/){
-        this.triggerLatency = (int) Math.floor(triggerLatencyTime/SAMPLING_INTERVAL);
-        for(int channelN = 0; channelN < CHANNELS; channelN++) channels[channelN].getPipeline().resetPointerPositions();
+        this.triggerLatency = (int) Math.floor(triggerLatencyTime/HPSSVTConstants.SAMPLING_INTERVAL);
+        for(int channelN = 0; channelN < HPSSVTConstants.CHANNELS; channelN++) channels[channelN].getPipeline().resetPointerPositions();
     }
     
     /**
@@ -55,7 +50,7 @@
      * @return an instance of an Apv25Channel
      */
     public Apv25Channel getChannel(int channel){
-        if(channel >= CHANNELS) throw new RuntimeException();
+        if(channel >= HPSSVTConstants.CHANNELS) throw new RuntimeException();
         return channels[channel];
     }
     
@@ -90,12 +85,12 @@
     public Apv25AnalogData readOut(){
         
         Apv25AnalogData data = new Apv25AnalogData();
-        for(int channel = 0; channel < CHANNELS; channel++){
+        for(int channel = 0; channel < HPSSVTConstants.CHANNELS; channel++){
             
             // Only readout the channel if the channel isn't bad
             if(!this.getChannel(channel).isBadChannel()){
                 // Readout the value stored in the buffer
-                double sample = (this.getChannel(channel).getPipeline().readout()/FRONT_END_GAIN)*MULTIPLEXER_GAIN;
+                double sample = (this.getChannel(channel).getPipeline().readout()/HPSSVTConstants.FRONT_END_GAIN)*HPSSVTConstants.MULTIPLEXER_GAIN;
                 data.setChannelData(channel, sample);
             }
         }
@@ -169,10 +164,10 @@
             // Fill the analog pipeline starting with the cell to which the writer pointer is pointing 
             // to. Signals arriving within the same bucket of length <samplingTime> will be shifted in
             // time depending on when they arrive.
-            for(int cell = 0; cell < ANALOG_PIPELINE_LENGTH; cell++){
+            for(int cell = 0; cell < HPSSVTConstants.ANALOG_PIPELINE_LENGTH; cell++){
                 
                 // Time at which the shaper signal will be sampled
-            	int sampleTime = cell*((int) SAMPLING_INTERVAL) - (int) (beamTime%SAMPLING_INTERVAL);
+            	int sampleTime = cell*((int) HPSSVTConstants.SAMPLING_INTERVAL) - (int) (beamTime%HPSSVTConstants.SAMPLING_INTERVAL);
                 
                 // Sample the shaper signal
                 double sample = shaperSignal.getAmplitudeAtTime(sampleTime, shapingTime);
@@ -199,17 +194,17 @@
         public Apv25Pipeline(){
              
             // Initialize the pipeline to the APV25 pipeline length
-            super(ANALOG_PIPELINE_LENGTH);
+            super(HPSSVTConstants.ANALOG_PIPELINE_LENGTH);
             
             // Initialize the position of the trigger pointer to a random position
-            this.ptr = (int) (Math.random()*ANALOG_PIPELINE_LENGTH);
+            this.ptr = (int) (Math.random()*HPSSVTConstants.ANALOG_PIPELINE_LENGTH);
         }        
         
         /**
          * 
          */
         public void resetPointerPositions(){
-        	writerPointer = (ptr + triggerLatency)%ANALOG_PIPELINE_LENGTH;
+        	writerPointer = (ptr + triggerLatency)%HPSSVTConstants.ANALOG_PIPELINE_LENGTH;
         }
         
         /**
@@ -217,7 +212,7 @@
          */
         @Override
         public void addToCell(int position, double element){
-            int writePosition = (writerPointer + position)%ANALOG_PIPELINE_LENGTH;
+            int writePosition = (writerPointer + position)%HPSSVTConstants.ANALOG_PIPELINE_LENGTH;
             if(writePosition == this.ptr) return;
             array[writePosition] += element;
         }
@@ -237,7 +232,7 @@
         @Override
         public void step(){
             super.step();
-            writerPointer = (ptr + triggerLatency)%ANALOG_PIPELINE_LENGTH;
+            writerPointer = (ptr + triggerLatency)%HPSSVTConstants.ANALOG_PIPELINE_LENGTH;
         }
         
         /**
@@ -246,7 +241,7 @@
         @Override
         public String toString(){
             String analogPipeline = "[ ";
-            for(int element = 0; element < ANALOG_PIPELINE_LENGTH; element++){
+            for(int element = 0; element < HPSSVTConstants.ANALOG_PIPELINE_LENGTH; element++){
                 if(element == ptr) analogPipeline += " TP ===>";
                 else if(element == writerPointer) analogPipeline += " WP ===>";
                 analogPipeline += (array[element] + ", ");
@@ -278,7 +273,7 @@
          */
         Apv25ShaperSignal(double charge) {
             // Find the maximum amplitude of the shaper signal
-            maxAmp = (charge/MIP)*FRONT_END_GAIN;  // mV
+            maxAmp = (charge/HPSSVTConstants.MIP)*HPSSVTConstants.FRONT_END_GAIN;  // mV
         }
 
         /**

hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
Apv25Constants.java removed after 1.4
diff -N Apv25Constants.java
--- Apv25Constants.java	17 Aug 2012 01:17:08 -0000	1.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-package org.lcsim.hps.recon.tracking.apv25;
-
-/**
- * 
- * @author Omar Moreno <[log in to unmask]>
- * @version $Id: Apv25Constants.java,v 1.4 2012/08/17 01:17:08 omoreno Exp $
- */
-public class Apv25Constants {
-
-    // Total number of channels an APV25 ASIC contains
-    public static final int CHANNELS = 128;
-    
-    // Number of electron-hole pairs created by a min. ionizing particle
-    // in 300 micrometers of Si
-    public static final int MIP = 25000; // electrons
-    
-    // Time intervals at which an APV25 shaper signal is sampled at
-    public static final double SAMPLING_INTERVAL = 24.0; // [ns]
-    
-    // The APV25 front end gain
-    public static final double FRONT_END_GAIN = 100.0;  //
-    
-    // Length of the APV25 analog pipeline
-    public static final int    ANALOG_PIPELINE_LENGTH = 192;
-    
-    // The APV25 gain after multiplexing
-    public static final double MULTIPLEXER_GAIN = 1;
-    
-}

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSSVTConstants.java 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- HPSSVTConstants.java	16 Aug 2012 01:06:30 -0000	1.6
+++ HPSSVTConstants.java	25 Apr 2013 22:11:14 -0000	1.7
@@ -3,7 +3,7 @@
 /**
  * 
  * @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSSVTConstants.java,v 1.6 2012/08/16 01:06:30 meeg Exp $
+ * @version $Id: HPSSVTConstants.java,v 1.7 2013/04/25 22:11:14 meeg Exp $
  *
  */
 
@@ -43,5 +43,19 @@
     public static final double V_REF = 2.5;
     public static final double R_DIV = 10000.;
     public static final double TEMP_INC = 0.01;
+    
+    // Length of the APV25 analog pipeline
+    public static final int ANALOG_PIPELINE_LENGTH = 192;
+    // Total number of channels an APV25 ASIC contains
+    public static final int CHANNELS = 128;
+    // Number of electron-hole pairs created by a min. ionizing particle
+    // in 300 micrometers of Si
+    public static final int MIP = 25000; // electrons
+    // Time intervals at which an APV25 shaper signal is sampled at
+    public static final double SAMPLING_INTERVAL = 24.0; // [ns]
+    // The APV25 gain after multiplexing
+    public static final double MULTIPLEXER_GAIN = 1;
+    // The APV25 front end gain
+    public static final double FRONT_END_GAIN = 100.0; //
     	
 }

hps-java/src/main/java/org/lcsim/hps/recon/tracking
SimpleSvtReadout.java 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- SimpleSvtReadout.java	25 Apr 2013 21:33:41 -0000	1.15
+++ SimpleSvtReadout.java	25 Apr 2013 22:11:14 -0000	1.16
@@ -19,7 +19,6 @@
 import org.lcsim.event.base.BaseRawTrackerHit;
 import org.lcsim.geometry.Detector;
 import org.lcsim.hps.readout.ecal.TriggerableDriver;
-import org.lcsim.hps.recon.tracking.apv25.Apv25Constants;
 import org.lcsim.hps.util.ClockSingleton;
 import org.lcsim.hps.util.RandomGaussian;
 import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim;
@@ -32,7 +31,7 @@
 /**
  *
  * @author Sho Uemura <[log in to unmask]>
- * @version $Id: SimpleSvtReadout.java,v 1.15 2013/04/25 21:33:41 meeg Exp $
+ * @version $Id: SimpleSvtReadout.java,v 1.16 2013/04/25 22:11:14 meeg Exp $
  */
 public class SimpleSvtReadout extends TriggerableDriver {
 
@@ -162,7 +161,7 @@
                 }
 
                 for (int i = 0; i < 6; i++) {
-                    double time = i * Apv25Constants.SAMPLING_INTERVAL - timeOffset;
+                    double time = i * HPSSVTConstants.SAMPLING_INTERVAL - timeOffset;
                     signal[i] += amplitude * pulseAmplitude(time, HPSSVTCalibrationConstants.getTShaping(sensor, channel)) + HPSSVTCalibrationConstants.getPedestal(sensor, channel);
                     samples[i] = (short) Math.round(signal[i]);
                 }
@@ -227,7 +226,7 @@
 
                         double resistorValue = 100;  // Ohms
                         double inputStageGain = 1.5;
-                        double amplitude = (charge / Apv25Constants.MIP) * resistorValue * inputStageGain * Math.pow(2, 14) / 2000;
+                        double amplitude = (charge / HPSSVTConstants.MIP) * resistorValue * inputStageGain * Math.pow(2, 14) / 2000;
 
                         stripHits.add(new StripHit(sensor, channel, amplitude, time, simHits));
                     }
@@ -301,7 +300,7 @@
         List<RawTrackerHit> hits = new ArrayList<>();
         List<LCRelation> trueHitRelations = new ArrayList<>();
         // Calculate time of first sample
-        double firstSample = Math.floor((ClockSingleton.getTime() - readoutLatency - readoutOffset) / Apv25Constants.SAMPLING_INTERVAL) * Apv25Constants.SAMPLING_INTERVAL + readoutOffset;
+        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);
@@ -323,7 +322,7 @@
                     for (StripHit hit : hitQueues[channel]) {
                         double totalContrib = 0;
                         for (int i = 0; i < 6; i++) {
-                            double sampleTime = firstSample + i * Apv25Constants.SAMPLING_INTERVAL;
+                            double sampleTime = firstSample + i * HPSSVTConstants.SAMPLING_INTERVAL;
                             double signalAtTime = hit.amplitude * pulseAmplitude(sampleTime - hit.time, HPSSVTCalibrationConstants.getTShaping(sensor, channel));
                             totalContrib += signalAtTime;
                             signal[i] += signalAtTime;
@@ -371,7 +370,7 @@
         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) / Apv25Constants.SAMPLING_INTERVAL) * Apv25Constants.SAMPLING_INTERVAL + readoutOffset;
+        double firstSample = Math.floor((triggerTime - readoutLatency - readoutOffset) / HPSSVTConstants.SAMPLING_INTERVAL) * HPSSVTConstants.SAMPLING_INTERVAL + readoutOffset;
 
         return firstSample;
     }

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSTrack.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- HPSTrack.java	13 Mar 2013 19:29:52 -0000	1.5
+++ HPSTrack.java	25 Apr 2013 22:11:14 -0000	1.6
@@ -4,16 +4,10 @@
  */
 package org.lcsim.hps.recon.tracking;
 
-import java.util.HashMap;
 import hep.physics.matrix.SymmetricMatrix;
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
 import hep.physics.vec.VecOp;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.StreamTokenizer;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -25,20 +19,19 @@
 import org.lcsim.hps.event.HPSTransformations;
 import org.lcsim.spacegeom.CartesianVector;
 import org.lcsim.spacegeom.SpacePoint;
-import org.lcsim.spacegeom.SpaceVector;
 import org.lcsim.util.swim.Helix;
 import org.lcsim.util.swim.Line;
 import org.lcsim.util.swim.Trajectory;
 import org.lcsim.spacegeom.SpaceVector;
 import static org.lcsim.constants.Constants.fieldConversion;
-import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.event.MCParticle;
 import org.lcsim.hps.util.Pair;
 
 /**
- Class HPSTrack: extension of HelicalTrackFit to include HPS-specific variables
- other useful things.
-
- @author mgraham created on 6/27/2011
+ * Class HPSTrack: extension of HelicalTrackFit to include HPS-specific
+ * variables other useful things.
+ *
+ * @author mgraham created on 6/27/2011
  */
 public class HPSTrack extends HelicalTrackFit {
 
@@ -63,6 +56,7 @@
     private Trajectory _trajectory;
     Map<Pair<Integer, Integer>, Double> _fieldMap;
     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,
@@ -75,6 +69,15 @@
         calculateParametersAtDocaZ();
     }
 
+    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);
+        _detToTrk = new HPSTransformations();
+        calculateParametersAtTarget();
+        calculateParametersAtDocaY();
+        calculateParametersAtDocaZ();
+    }
+
     public HPSTrack(HelicalTrackFit htf, BeamSpot beam) {
         super(htf.parameters(), htf.covariance(), htf.chisq(), htf.ndf(), htf.PathMap(), htf.ScatterMap());
         _beam = beam;
@@ -92,11 +95,19 @@
         calculateParametersAtDocaZ();
     }
 
+    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
+        this.setMCParticle(mcParticle);
+    }
+
     /**
-     Get map of the the track trajectory within the uniform bfield
+     Get map of the the track trajectory within the uniform bfield
      */
     public Map<Integer, Double[]> trackTrajectory(double zStart, double zStop, int nSteps) {
-        Map<Integer, Double[]> traj = new HashMap<Integer, Double[]>();
+        Map<Integer, Double[]> traj = new HashMap<>();
         double step = (zStop - zStart) / nSteps;
         Double zVal = zStart;
         Integer nstep = 0;
@@ -114,10 +125,10 @@
     }
 
     /**
-     Get map of the the track direction within the uniform bfield
+     Get map of the the track direction within the uniform bfield
      */
     public Map<Integer, Double[]> trackDirection(double zStart, double zStop, int nSteps) {
-        Map<Integer, Double[]> traj = new HashMap<Integer, Double[]>();
+        Map<Integer, Double[]> traj = new HashMap<>();
         double step = (zStop - zStart) / nSteps;
         Double zVal = zStart;
 
@@ -187,12 +198,14 @@
         }
         double fringeHalfWidth = Math.abs(stopFringe - startFringe) / 2;
         double fringeMid = (stopFringe + startFringe) / 2;
-        if (_debugForward)
+        if (_debugForward) {
             System.out.println(this.toString());
+        }
 
         double sStartFringe = HelixUtils.PathToXPlane(this, startFringe, 1000.0, 1).get(0);
-        if (_debugForward)
+        if (_debugForward) {
             System.out.println("path to end of fringe = " + sStartFringe + "; xFinal = " + xFinal);
+        }
         double xtmp = startFringe;
         double ytmp = HelixUtils.PointOnHelix(this, sStartFringe).y();
         double ztmp = HelixUtils.PointOnHelix(this, sStartFringe).z();
@@ -211,8 +224,9 @@
                     + "; xCtmp = " + xCtmp
                     + "; yCtmp = " + yCtmp);
         }
-        if (_debugForward)
+        if (_debugForward) {
             System.out.println("Original Direction at Fringe: " + HelixUtils.Direction(this, startFringe).toString());
+        }
         double Rtmp = Rorig;
         // now start stepping through the fringe field
         Hep3Vector r0Tmp = HelixUtils.PointOnHelix(this, sStartFringe);
@@ -290,34 +304,38 @@
     }
 
     /**
-     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
-     @return position[0] and direction[1] at Z=zfinal
+     * 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
+     * @return position[0] and direction[1] at Z=zfinal
      */
     public Hep3Vector[] getPositionAtZMap(double start, double xFinal, double step) {
         return this.getPositionAtZMap(start, xFinal, step, true);
     }
-        public Hep3Vector[] getPositionAtZMap(double start, double xFinal, double step, boolean debugOk) {
+
+    public Hep3Vector[] getPositionAtZMap(double start, double xFinal, double step, boolean debugOk) {
 
         double startFringe = start;
 
         _debugForward = false;
-        if (xFinal > 900)
+        if (xFinal > 900) {
             _debugForward = debugOk ? true : false;
+        }
         // if looking upstream, we'll be propagating backwards
         if (xFinal < 0) {
             step = -step;
         }
-        if (_debugForward)
+        if (_debugForward) {
             System.out.println(this.toString());
+        }
 
         double sStartFringe = HelixUtils.PathToXPlane(this, startFringe, 1000.0, 1).get(0);
-        if (_debugForward)
+        if (_debugForward) {
             System.out.println("path to end of fringe = " + sStartFringe + "; xFinal = " + xFinal);
+        }
         double xtmp = startFringe;
         double ytmp = HelixUtils.PointOnHelix(this, sStartFringe).y();
         double ztmp = HelixUtils.PointOnHelix(this, sStartFringe).z();
@@ -336,8 +354,9 @@
                     + "; xCtmp = " + xCtmp
                     + "; yCtmp = " + yCtmp);
         }
-        if (_debugForward)
+        if (_debugForward) {
             System.out.println("Original Direction at Fringe: " + HelixUtils.Direction(this, startFringe).toString());
+        }
         double Rtmp = Rorig;
         // now start stepping through the fringe field
         Hep3Vector r0Tmp = HelixUtils.PointOnHelix(this, sStartFringe);
@@ -384,13 +403,13 @@
             }
             totalS += step;
         }
-        
+
         //Go with finer granularity in the end
         rTmp = _trajectory.getPointAtDistance(0);
         xtmp = rTmp.x();
         pTmp = VecOp.mult(pTot, _trajectory.getUnitTangentAtLength(step));
         pXTmp = pTmp.x();
-        step = step/10.0;
+        step = step / 10.0;
 
         while (Math.signum(step) * xtmp < Math.signum(step) * xFinal && Math.signum(pXOrig * pXTmp) > 0) {
             if (_debugForward) {
@@ -417,7 +436,7 @@
             }
             totalS += step;
         }
-        
+
         //ok, done with field.
         Hep3Vector pointInTrking = new BasicHep3Vector(rTmp.x(), rTmp.y(), rTmp.z());
         if (_debugForward) {
@@ -442,10 +461,12 @@
     //field that changes linearly from Bmax->0
     private double getFringe(double x, double halfWidth) {
 //        System.out.println("x = " + x + "; halfWidth = " + halfWidth);
-        if (x / halfWidth > 1)
+        if (x / halfWidth > 1) {
             return 1;
-        if (x / halfWidth < -1)
+        }
+        if (x / halfWidth < -1) {
             return 0;
+        }
 
         return (1.0 / 2.0) * (1 + x / halfWidth);
     }
@@ -487,8 +508,26 @@
             _trajectory = new Line(r0, phi, lambda);
         }
     }
-    
+
     public Trajectory getTrajectory() {
         return this._trajectory;
     }
+
+    /**
+     * Get the MC Particle associated with the HelicalTrackFit
+     *
+     * @return mcParticle :
+     */
+    public MCParticle getMCParticle() {
+        return this.mcParticle;
+    }
+
+    /**
+     * Set the MC Particle associated with the HelicalTrackFit
+     *
+     * @param mcParticle :
+     */
+    public void setMCParticle(MCParticle mcParticle) {
+        this.mcParticle = mcParticle;
+    }
 }

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HPSShaperAnalyticFitAlgorithm.java 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- HPSShaperAnalyticFitAlgorithm.java	13 Aug 2012 23:06:02 -0000	1.11
+++ HPSShaperAnalyticFitAlgorithm.java	25 Apr 2013 22:11:14 -0000	1.12
@@ -3,7 +3,6 @@
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants.ChannelConstants;
 //import org.lcsim.math.chisq.ChisqProb;
-import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.SAMPLING_INTERVAL;
 
 /**
  * Fast fitter; currently only fits single hits. Uses Tp from ChannelConstants;
@@ -15,6 +14,7 @@
  */
 public class HPSShaperAnalyticFitAlgorithm implements HPSShaperFitAlgorithm {
 
+    @Override
     public HPSShapeFitParameters fitShape(RawTrackerHit rth, ChannelConstants constants) {
         short[] samples = rth.getADCValues();
         return this.fitShape(samples, constants);
@@ -45,7 +45,7 @@
 
         for (int i = 0; i < length; i++) {
             y[i] = samples[start + i] - constants.getPedestal();
-            t[i] = SAMPLING_INTERVAL * i;
+            t[i] = HPSSVTConstants.SAMPLING_INTERVAL * i;
         }
 
         double[] p = new double[length];
@@ -80,7 +80,7 @@
             time_var += dt_dp * dt_dp;
             height_var += dh_dp * dh_dp;
         }
-        t0 += SAMPLING_INTERVAL * start;
+        t0 += HPSSVTConstants.SAMPLING_INTERVAL * start;
         fit.setAmp(A);
         fit.setAmpErr(Math.sqrt(height_var));
         fit.setT0(t0);
@@ -89,7 +89,7 @@
 
         double chisq = 0;
         for (int i = 0; i < samples.length; i++) {
-            double ti = SAMPLING_INTERVAL * 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);
         }

hps-java/src/main/java/org/lcsim/hps/recon/tracking
DataTrackerFakeHitDriver.java 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- DataTrackerFakeHitDriver.java	27 Nov 2012 02:17:29 -0000	1.7
+++ DataTrackerFakeHitDriver.java	25 Apr 2013 22:11:14 -0000	1.8
@@ -41,7 +41,7 @@
  * @author phansson
  */
 public class DataTrackerFakeHitDriver extends Driver {
-    
+
     private boolean debug = false;
     TrackUtils trackUtils = new TrackUtils();
     TrackerHitUtils trackerhitutils = new TrackerHitUtils();
@@ -49,37 +49,30 @@
     SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
     Hep3Vector _bfield;
     TrackerHitType trackerType = new TrackerHitType(TrackerHitType.CoordinateSystem.GLOBAL, TrackerHitType.MeasurementType.STRIP_1D);
-    CoordinateSystem coordinate_system =  trackerType.getCoordinateSystem();
+    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<SimTrackerHit> simHits = null;
     List<SiTrackerHit> stripHits1D = null;
-    List<HelicalTrackHit> hths     = 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>();
-
-    
+    private List<String> processPaths = new ArrayList<>();
+    private List<IDetectorElement> processDEs = new ArrayList<>();
+    private Set<SiSensor> processSensors = new HashSet<>();
     //Visualization
     private boolean hideFrame = false;
     private AIDA aida = AIDA.defaultInstance();
-    private HashMap<SiSensor,IProfile1D> _delta_histos = new HashMap<SiSensor,IProfile1D>();
-    private HashMap<SiSensor,IHistogram1D> _delta_itercount = new HashMap<SiSensor,IHistogram1D>();
+    private HashMap<SiSensor, IProfile1D> _delta_histos;
+    private HashMap<SiSensor, IHistogram1D> _delta_itercount = new HashMap<>();
     IProfile1D _prf_final_deltas;
     IProfile1D _prf_all_deltas;
     IHistogram1D _h_nstriphits_top;
@@ -89,12 +82,8 @@
     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) {
@@ -104,15 +93,15 @@
     public void setHideFrame(boolean hide) {
         this.hideFrame = hide;
     }
-    
+
     public void setDoHth(boolean debug) {
         this._doHth = debug;
     }
-    
+
     /**
-     *  Enable/disable the creation of SimTrackerHits 
+     * Enable/disable the creation of SimTrackerHits
      */
-    public void setCreateSimTrackerHits(boolean createSimTrackerHits){
+    public void setCreateSimTrackerHits(boolean createSimTrackerHits) {
         this.createSimTrackerHits = createSimTrackerHits;
     }
 
@@ -126,20 +115,20 @@
     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<>();
     }
 
     /**
@@ -151,12 +140,12 @@
         // 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());
+        _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();
@@ -175,9 +164,9 @@
 
         // Set the detector to process.
         processPaths.add(subdetectorName);
-        
+
         this.makePlots();
-        
+
     }
 
     /**
@@ -188,123 +177,140 @@
 
 
         // Obtain the tracks from the event
-        if(!event.hasCollection(HpsHelicalTrackFit.class, trackCollectionName)){
-            this.printDebug("No HpsHelicalTrackFits were found, skipping event");
+        if (!event.hasCollection(HPSTrack.class, trackCollectionName)) {
+            this.printDebug("No HPSTracks were found, skipping event");
             simHits = null;
             return;
         }
-        List<HpsHelicalTrackFit> tracks = event.get(HpsHelicalTrackFit.class, trackCollectionName);
-        
-        if(debug) System.out.println(this.getClass().getSimpleName() + ": found " + tracks.size() + " tracks (" + this.trackCollectionName + ")");
+        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){
+        if (this._doHth) {
             this.printDebug("Creating HelicalTrackHits...");
-            hths = new ArrayList<HelicalTrackHit>();
-        } else if(createSimTrackerHits){
+            hths = new ArrayList<>();
+        } else if (createSimTrackerHits) {
             this.printDebug("Creating SimTrackerHits...");
-            simHits = new ArrayList<SimTrackerHit>();
+            simHits = new ArrayList<>();
             metaData = event.getMetaData(event.get(SimTrackerHit.class, "TrackerHits"));
-        } else { 
+        } else {
             // Create StripHit1Ds by default
             this.printDebug("Creating StripHit1D...");
-            stripHits1D = new ArrayList<SiTrackerHit>();
+            stripHits1D = new ArrayList<>();
         }
 
-        if(debug) System.out.println(this.getClass().getSimpleName() + ": Add hits for " + tracks.size() + " tracks (" + this.trackCollectionName + ")");
-        
-        for(HpsHelicalTrackFit helix : tracks) {
-            if(debug) System.out.println(this.getClass().getSimpleName() + ": trying to add hits for this track");
+        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) {
+
+            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)
+            WTrack wtrack = new WTrack(helix, Math.abs(_bfield.z()), true); //remove sign from B-field (assumed to go along z-direction)
 
-            if(debug) {   
+            if (debug) {
                 System.out.println(this.getClass().getSimpleName() + ": " + wtrack.toString());
 
             }
 
-            
+
             extrapolator.setTrack(helix.parameters());
-            
+
             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());
-                
+
+                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");
+                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;
+                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");
                     }
-                    else {
+                    if (SvtUtils.getInstance().isTopLayer(sensor)) {
+                        n_hits_top++;
+                        isTopTrack = true;
+                    } else {
                         n_hits_bot++;
-                        isBotTrack=true;
+                        isBotTrack = true;
                     }
-                    if(this._doHth) {
+                    if (this._doHth) {
                         hths.add(this.makeHelicalTrackHit(sensor, wtrack));
-                    } else if(createSimTrackerHits){
+                    } 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));             
+                        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 (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) this._h_nstriphits_top.fill(n_hits_top);
-            if(isBotTrack) this._h_nstriphits_bottom.fill(n_hits_bot);
-            if(isTopTrack && isBotTrack) {
+            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);
-            */
+             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 (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);
+            if (hths != null) {
+                System.out.println(this.getClass().getSimpleName() + ": Produced " + hths.size() + " hits for collection " + this.hthOutputCollectionName);
             }
         }
 
@@ -313,162 +319,184 @@
         //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);
+        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 { 
+        } 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();
-                }
-            }
-        }*/
+
+        /*
+         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) {
+        //private SiTrackerHitStrip1D makeTrackerHit(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
         //create fake raw tracker hit
-        
-        if(debug) System.out.println(this.getClass().getSimpleName() + ": makeTrackerHit");
-        
+
+        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() );
+        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);        
+        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) {
+        } else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
             local_to_global = sensor.getGeometry().getLocalToGlobal();
-        }
-        else {
+        } 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);    
+        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) {
+        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() + "  -> ");
+        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");
-        
+        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()));
+        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());
-        
+        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());
-        
-        
+
+        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());
-        
-        
-        
+
+        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());
-        
+        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());
-        
+
+        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());
-        
-        
-        
-        
+
+        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());
-        
-        
+
+        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
      */
@@ -485,29 +513,27 @@
         ITransform3D local_to_global;
         if (coordinate_system == TrackerHitType.CoordinateSystem.GLOBAL) {
             local_to_global = new Transform3D();
-        }
-        else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
+        } else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
             local_to_global = sensor.getGeometry().getLocalToGlobal();
-        }
-        else {
+        } 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);  
+        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
      */
@@ -516,8 +542,8 @@
          * 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() );
+        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
@@ -528,33 +554,34 @@
         ITransform3D local_to_global;
         if (coordinate_system == TrackerHitType.CoordinateSystem.GLOBAL) {
             local_to_global = new Transform3D();
-        }
-        else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
+        } else if (coordinate_system == TrackerHitType.CoordinateSystem.SENSOR) {
             local_to_global = sensor.getGeometry().getLocalToGlobal();
-        }
-        else {
+        } 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() + "  -> ");
+        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(_orgloc.toString());
+        }
+
         return _orgloc;
-        
+
     }
-    
-    
+
     private Hep3Vector getHelixPlaneIntercept(SiSensor sensor, WTrack wtrack) {
-        Hep3Vector eta = this.getPlaneUnitVector(sensor);   
+        Hep3Vector eta = this.getPlaneUnitVector(sensor);
         Hep3Vector _orgloc = this.getOrgLoc(sensor);
-        Hep3Vector h = new BasicHep3Vector(_bfield.x(),_bfield.y(),Math.abs(_bfield.z()));
+        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) {
+        if (debug) {
             HelicalTrackFit htf = wtrack._htf;
             List<Double> s = HelixUtils.PathToXPlane(htf, position.x(), 0, 0);
             Hep3Vector posOnHelix = HelixUtils.PointOnHelix(htf, s.get(0));
@@ -562,25 +589,28 @@
             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;  
+
+
+        return position;
     }
-    
-    
+
     private HelicalTrackHit makeHelicalTrackHit(SiSensor sensor, WTrack wtrack) {
-    //private SiTrackerHitStrip1D makeTrackerHit(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
+        //private SiTrackerHitStrip1D makeTrackerHit(List<HPSFittedRawTrackerHit> cluster, SiSensorElectrodes electrodes) {
         //create fake raw tracker hit
-        
-        if(debug) System.out.println(this.getClass().getSimpleName() + ": makeTrackerHit");
-        
+
+        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");
-        
+
+        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);
@@ -588,75 +618,79 @@
         double cov_yy = cov_xx;
         double cov_zz = cov_xx;
         covariance.setElement(0, 0, cov_xx);
-        covariance.setElement(1, 1, cov_yy); 
+        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);
+
+        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);
+
+        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 + ")");
-                
-        
+
+        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
+     * @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){
+    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);
+        // 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
+
+        // 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);
+        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);
+        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());
@@ -664,35 +698,35 @@
         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");
+        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()));
+        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);
+        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");
+        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());
@@ -700,78 +734,78 @@
         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");
+        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);
+        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");
+        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");
+        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 { 
[truncated at 1000 lines; 295 more skipped]

hps-java/src/main/java/org/lcsim/hps/recon/tracking
ParticleMaker.java removed after 1.1
diff -N ParticleMaker.java
--- ParticleMaker.java	19 Jun 2012 01:44:55 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,132 +0,0 @@
-package org.lcsim.hps.recon.tracking;
-
-//--- java ---//
-import java.util.List;
-import java.util.ArrayList;
-
-//--- org.lcsim ---//
-import org.lcsim.util.Driver;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.ReconstructedParticle;
-import org.lcsim.event.base.BaseReconstructedParticle;
-import org.lcsim.recon.tracking.seedtracker.SeedTrack;
-
-//--- hps-java ---//
-import org.lcsim.hps.recon.ecal.HPSEcalCluster;
-
-//--- hep ---//
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-
-
-/**
- * 
- * @author Omar Moreno <[log in to unmask]>
- * @version $Id: ParticleMaker.java,v 1.1 2012/06/19 01:44:55 omoreno Exp $
- */
-public class ParticleMaker extends Driver {
-
-    List<ReconstructedParticle> reconParticles = new ArrayList<ReconstructedParticle>();
-
-    double maxXTrackClusterMatchResidual = 100; // [mm]
-    double maxYTrackClusterMatchResidual = 100; // [mm]
-
-    // Collections
-    String ecalClustersCollectionName = "EcalClusters";
-    String tracksCollectionName = "MatchedTracks";
-    String reconParticlesCollectionName = "allRecoParticles";
-
-    SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
-
-    public ParticleMaker() {
-    };
-
-    public void setMaxXTrackClusterMatchResidual(double maxXTrackClusterMatchResidual) {
-        this.maxXTrackClusterMatchResidual = maxXTrackClusterMatchResidual;
-    }
-
-    public void setMaxYTrackClusterMatchResidual(double maxYTrackClusterMatchResidual) {
-        this.maxYTrackClusterMatchResidual = maxYTrackClusterMatchResidual;
-    }
-    
-    public void setEcalClusterCollectionName(String ecalClustersCollectionName){
-        this.ecalClustersCollectionName = ecalClustersCollectionName;
-    }
-
-    public void setTrackCollectoinName(String tracksCollectionName){
-        this.tracksCollectionName = tracksCollectionName;
-    }
-    
-    public void setReconParticlesCollectionName(String reconParticlesCollectionName){
-        this.reconParticlesCollectionName = reconParticlesCollectionName;
-    }
-    
-    public void process(EventHeader event) {
-
-        // If the event does not have Ecal clusters, skip the event
-        if (!event.hasCollection(HPSEcalCluster.class, ecalClustersCollectionName))
-            return;
-
-        // Get the clusters in the event
-        List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalClustersCollectionName);
-
-        // Get the tracks in the event
-        List<SeedTrack> tracks = event.get(SeedTrack.class, tracksCollectionName);
-
-        // Match tracks to clusters
-        if (!tracks.isEmpty()) {
-
-            // If the event only contains a single cluster and a single track then they are most
-            // likely associated with each other
-            if (clusters.size() == 1 && tracks.size() == 1) {
-
-                ReconstructedParticle particle = new BaseReconstructedParticle();
-                particle.addCluster(clusters.get(0));
-                particle.addTrack(tracks.get(0));
-                reconParticles.add(particle);
-                clusters.clear();
-            }
-            else { 
-                
-                // Loop over all tracks and find the associated cluster 
-                for(SeedTrack track : tracks){
-                    extrapolator.setTrack(track);
-                    
-                    ReconstructedParticle particle = new BaseReconstructedParticle();
-                    particle.addTrack(track);
-                    
-                    Hep3Vector positionEcal = extrapolator.getTrackPositionAtEcal();
-                    System.out.println(this.getClass().getSimpleName() + ": Position at Ecal: " + positionEcal.toString());
-                    
-                    
-                    double rMax = 1000;
-                    HPSEcalCluster matchedCluster = null;
-                    for(HPSEcalCluster cluster : clusters){
-                        Hep3Vector clusterPosition = new BasicHep3Vector(cluster.getPosition());
-                        System.out.println(this.getClass().getSimpleName() + ": Cluster position: " + clusterPosition.toString());
-                        
-                        double xDiff = positionEcal.x() - clusterPosition.x();
-                        double yDiff = positionEcal.y() - clusterPosition.y();
-                        double r = Math.sqrt(xDiff*xDiff + yDiff*yDiff);
-                        if(r < rMax){
-                            rMax = r;
-                            matchedCluster = cluster;
-                        }
-                    }
-                    clusters.remove(matchedCluster);
-                    particle.addCluster(matchedCluster);
-                    reconParticles.add(particle);
-                }
-            }
-        }
-        
-        if(!clusters.isEmpty()){
-            for(HPSEcalCluster cluster : clusters){
-                ReconstructedParticle particle = new BaseReconstructedParticle();
-                particle.addCluster(cluster); 
-            }
-        }
-            
-        event.put(reconParticlesCollectionName, reconParticles, ReconstructedParticle.class, 0);
-    }
-}

hps-java/src/main/java/org/lcsim/hps/recon/tracking
HpsHelicalTrackFit.java removed after 1.1
diff -N HpsHelicalTrackFit.java
--- HpsHelicalTrackFit.java	20 Oct 2012 06:13:39 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,57 +0,0 @@
-package org.lcsim.hps.recon.tracking;
-
-//--- java ---//
-import java.util.Map;
-
-//--- hep ---//
-import hep.physics.matrix.SymmetricMatrix;
-
-import org.lcsim.event.MCParticle;
-//--- lcsim ---//
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
-import org.lcsim.fit.helicaltrack.MultipleScatter;
-
-/**
- * 
- * @author Omar Moreno
- * @version $Id: HpsHelicalTrackFit.java,v 1.1 2012/10/20 06:13:39 omoreno Exp $ 
- */
-public class HpsHelicalTrackFit extends HelicalTrackFit {
-
-    MCParticle mcParticle;
-    
-    /**
-     * Constructor
-     * @param parameters : an array of helix parameters
-     * @param covariance : covariance matrix of the helix fit
-     * @param chiSquared : chi squared of the circle fit
-     * @param ndf : number of degrees of freedom for the circle fit
-     * @param sMap : a map containing the x-y path lengths
-     * @param msMap : a map containing the multiple scattering uncertainties 
-     * @param mcParticle : the MC particle associated with the fit
-     */
-    public HpsHelicalTrackFit(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
-        this.setMCParticle(mcParticle);
-    }
-    
-    /**
-     * Get the MC Particle associated with the HelicalTrackFit
-     * @return mcParticle : 
-     */
-    public MCParticle getMCParticle(){
-        return this.mcParticle;
-    }
-    
-    /**
-     * Set the MC Particle associated with the HelicalTrackFit
-     * @param mcParticle : 
-     */
-    public void setMCParticle(MCParticle mcParticle){
-        this.mcParticle = mcParticle;
-    }
-}

hps-java/src/main/java/org/lcsim/hps/users/omoreno
ParticleMaker.java added at 1.1
diff -N ParticleMaker.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ParticleMaker.java	25 Apr 2013 22:11:14 -0000	1.1
@@ -0,0 +1,133 @@
+package org.lcsim.hps.users.omoreno;
+
+//--- java ---//
+import java.util.List;
+import java.util.ArrayList;
+
+//--- org.lcsim ---//
+import org.lcsim.util.Driver;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.base.BaseReconstructedParticle;
+import org.lcsim.recon.tracking.seedtracker.SeedTrack;
+
+//--- hps-java ---//
+import org.lcsim.hps.recon.ecal.HPSEcalCluster;
+
+//--- hep ---//
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import org.lcsim.hps.recon.tracking.SvtTrackExtrapolator;
+
+
+/**
+ * 
+ * @author Omar Moreno <[log in to unmask]>
+ * @version $Id: ParticleMaker.java,v 1.1 2013/04/25 22:11:14 meeg Exp $
+ */
+public class ParticleMaker extends Driver {
+
+    List<ReconstructedParticle> reconParticles = new ArrayList<ReconstructedParticle>();
+
+    double maxXTrackClusterMatchResidual = 100; // [mm]
+    double maxYTrackClusterMatchResidual = 100; // [mm]
+
+    // Collections
+    String ecalClustersCollectionName = "EcalClusters";
+    String tracksCollectionName = "MatchedTracks";
+    String reconParticlesCollectionName = "allRecoParticles";
+
+    SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
+
+    public ParticleMaker() {
+    };
+
+    public void setMaxXTrackClusterMatchResidual(double maxXTrackClusterMatchResidual) {
+        this.maxXTrackClusterMatchResidual = maxXTrackClusterMatchResidual;
+    }
+
+    public void setMaxYTrackClusterMatchResidual(double maxYTrackClusterMatchResidual) {
+        this.maxYTrackClusterMatchResidual = maxYTrackClusterMatchResidual;
+    }
+    
+    public void setEcalClusterCollectionName(String ecalClustersCollectionName){
+        this.ecalClustersCollectionName = ecalClustersCollectionName;
+    }
+
+    public void setTrackCollectoinName(String tracksCollectionName){
+        this.tracksCollectionName = tracksCollectionName;
+    }
+    
+    public void setReconParticlesCollectionName(String reconParticlesCollectionName){
+        this.reconParticlesCollectionName = reconParticlesCollectionName;
+    }
+    
+    public void process(EventHeader event) {
+
+        // If the event does not have Ecal clusters, skip the event
+        if (!event.hasCollection(HPSEcalCluster.class, ecalClustersCollectionName))
+            return;
+
+        // Get the clusters in the event
+        List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, ecalClustersCollectionName);
+
+        // Get the tracks in the event
+        List<SeedTrack> tracks = event.get(SeedTrack.class, tracksCollectionName);
+
+        // Match tracks to clusters
+        if (!tracks.isEmpty()) {
+
+            // If the event only contains a single cluster and a single track then they are most
+            // likely associated with each other
+            if (clusters.size() == 1 && tracks.size() == 1) {
+
+                ReconstructedParticle particle = new BaseReconstructedParticle();
+                particle.addCluster(clusters.get(0));
+                particle.addTrack(tracks.get(0));
+                reconParticles.add(particle);
+                clusters.clear();
+            }
+            else { 
+                
+                // Loop over all tracks and find the associated cluster 
+                for(SeedTrack track : tracks){
+                    extrapolator.setTrack(track);
+                    
+                    ReconstructedParticle particle = new BaseReconstructedParticle();
+                    particle.addTrack(track);
+                    
+                    Hep3Vector positionEcal = extrapolator.getTrackPositionAtEcal();
+                    System.out.println(this.getClass().getSimpleName() + ": Position at Ecal: " + positionEcal.toString());
+                    
+                    
+                    double rMax = 1000;
+                    HPSEcalCluster matchedCluster = null;
+                    for(HPSEcalCluster cluster : clusters){
+                        Hep3Vector clusterPosition = new BasicHep3Vector(cluster.getPosition());
+                        System.out.println(this.getClass().getSimpleName() + ": Cluster position: " + clusterPosition.toString());
+                        
+                        double xDiff = positionEcal.x() - clusterPosition.x();
+                        double yDiff = positionEcal.y() - clusterPosition.y();
+                        double r = Math.sqrt(xDiff*xDiff + yDiff*yDiff);
+                        if(r < rMax){
+                            rMax = r;
+                            matchedCluster = cluster;
+                        }
+                    }
+                    clusters.remove(matchedCluster);
+                    particle.addCluster(matchedCluster);
+                    reconParticles.add(particle);
+                }
+            }
+        }
+        
+        if(!clusters.isEmpty()){
+            for(HPSEcalCluster cluster : clusters){
+                ReconstructedParticle particle = new BaseReconstructedParticle();
+                particle.addCluster(cluster); 
+            }
+        }
+            
+        event.put(reconParticlesCollectionName, reconParticles, ReconstructedParticle.class, 0);
+    }
+}

hps-java/src/main/java/org/lcsim/hps/users/phansson
ParticleHelixProducer.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- ParticleHelixProducer.java	19 Nov 2012 22:20:07 -0000	1.8
+++ ParticleHelixProducer.java	25 Apr 2013 22:11:14 -0000	1.9
@@ -14,13 +14,12 @@
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.MCParticle;
 import org.lcsim.event.util.ParticleTypeClassifier;
-import org.lcsim.fit.helicaltrack.HelicalTrackFit;
 import org.lcsim.fit.helicaltrack.HelicalTrackHit;
 import org.lcsim.fit.helicaltrack.HelixParamCalculator;
 import org.lcsim.fit.helicaltrack.MultipleScatter;
 import org.lcsim.geometry.Detector;
 import org.lcsim.hps.analysis.ecal.HPSMCParticlePlotsDriver;
-import org.lcsim.hps.recon.tracking.HpsHelicalTrackFit;
+import org.lcsim.hps.recon.tracking.HPSTrack;
 import org.lcsim.hps.recon.tracking.SvtTrackExtrapolator;
 import org.lcsim.hps.recon.tracking.TrackUtils;
 import org.lcsim.hps.recon.tracking.TrackerHitUtils;
@@ -32,10 +31,11 @@
 /**
  *
  * @author phansson
- * @version $Id: ParticleHelixProducer.java,v 1.8 2012/11/19 22:20:07 omoreno Exp $
+ * @version $Id: ParticleHelixProducer.java,v 1.8 2012/11/19 22:20:07 omoreno
+ * Exp $
  */
 public class ParticleHelixProducer extends Driver {
-    
+
     private boolean debug = false;
     private boolean hideFrame = true;
     private boolean saveSingleTrack = false;
@@ -48,12 +48,9 @@
     SvtTrackExtrapolator extrapolator = new SvtTrackExtrapolator();
     Hep3Vector _bfield;
     TrackerHitType trackerType = new TrackerHitType(TrackerHitType.CoordinateSystem.GLOBAL, TrackerHitType.MeasurementType.STRIP_1D);
-    CoordinateSystem coordinate_system =  trackerType.getCoordinateSystem();
-    
-    
+    CoordinateSystem coordinate_system = trackerType.getCoordinateSystem();
     // Name of StripHit1D output collection.
     private String trackOutputCollectionName = "MCParticle_HelicalTrackFit";
-   
     private AIDA aida = AIDA.defaultInstance();
     IPlotter plotter_trkparams;
     ICloud1D h_pt;
@@ -70,7 +67,7 @@
     public void setHideFrame(boolean hide) {
         this.hideFrame = hide;
     }
-    
+
     public void setNoTopTracks(boolean doTop) {
         this.noTopTracks = doTop;
     }
@@ -86,7 +83,7 @@
     public void setTrackOutputCollectionName(String trackOutputCollectionName) {
         this.trackOutputCollectionName = trackOutputCollectionName;
     }
-    
+
     /**
      * Creates a new instance of TrackerHitDriver.
      */
@@ -101,33 +98,35 @@
 
         // Call sub-Driver's detectorChanged methods.
         super.detectorChanged(detector);
-        
-        if(this.noTopTracks && this.noBottomTracks) {
+
+        if (this.noTopTracks && this.noBottomTracks) {
             System.out.println(this.getClass().getSimpleName() + ": ERROR you need to produce top or bottom tracks!");
             System.exit(1);
         }
-        
+
         Hep3Vector IP = new BasicHep3Vector(0., 0., 1.);
-        _bfield = new BasicHep3Vector(0,0,detector.getFieldMap().getField(IP).y());
+        _bfield = new BasicHep3Vector(0, 0, detector.getFieldMap().getField(IP).y());
         detToTrk = trackerhitutils.detToTrackRotationMatrix();
-        
-        
+
+
         plotter_trkparams = aida.analysisFactory().createPlotterFactory().create();
-        plotter_trkparams.createRegions(3,2);
-         h_pt = aida.cloud1D("Track pT");
-         h_R = aida.cloud1D("Track R");
-         h_phi0 = aida.cloud1D("Track phi0");
-         h_d0 = aida.cloud1D("Track d0");
-         h_slope = aida.cloud1D("Track slope");
-         h_z0 = aida.cloud1D("Track z0");
+        plotter_trkparams.createRegions(3, 2);
+        h_pt = aida.cloud1D("Track pT");
+        h_R = aida.cloud1D("Track R");
+        h_phi0 = aida.cloud1D("Track phi0");
+        h_d0 = aida.cloud1D("Track d0");
+        h_slope = aida.cloud1D("Track slope");
+        h_z0 = aida.cloud1D("Track z0");
         plotter_trkparams.region(0).plot(h_pt);
         plotter_trkparams.region(1).plot(h_R);
         plotter_trkparams.region(2).plot(h_phi0);
         plotter_trkparams.region(3).plot(h_d0);
         plotter_trkparams.region(4).plot(h_slope);
         plotter_trkparams.region(5).plot(h_z0);
-        if(!this.hideFrame) plotter_trkparams.show();
-        
+        if (!this.hideFrame) {
+            plotter_trkparams.show();
+        }
+
 
     }
 
@@ -136,28 +135,28 @@
      */
     @Override
     public void process(EventHeader event) {
-        
-        
+
+
         //Make new tracks based on the MC particles
         //List<HelicalTrackFit> tracks = new ArrayList<HelicalTrackFit>();
-        List<HpsHelicalTrackFit> tracks = new ArrayList<HpsHelicalTrackFit>();
-        
-        if(event.hasCollection(MCParticle.class)) {
+        List<HPSTrack> tracks = new ArrayList<>();
+
+        if (event.hasCollection(MCParticle.class)) {
             List<MCParticle> mcparticles = event.get(MCParticle.class).get(0);
             List<MCParticle> fsParticles = HPSMCParticlePlotsDriver.makeGenFSParticleList(mcparticles);
-            
+
             //-----> DEBUG
-            if(debug){
+            if (debug) {
                 String particleList = "[ ";
-                for(MCParticle mcParticle : mcparticles){
+                for (MCParticle mcParticle : mcparticles) {
                     particleList += mcParticle.getPDGID() + ", ";
                 }
                 particleList += "]";
                 this.printDebug("MC Particles: " + particleList);
             }
-            if(debug){
+            if (debug) {
                 String particleList = "[ ";
-                for(MCParticle fsParticle : fsParticles){
+                for (MCParticle fsParticle : fsParticles) {
                     particleList += fsParticle.getPDGID() + ", ";
                 }
                 particleList += "]";
@@ -166,140 +165,155 @@
             //------> DEBUG
 
             double bfield = Math.abs(_bfield.z()); //remove sign from B-field, assumed to be along z-direction
-            if(debug) System.out.println(this.getClass().getSimpleName() + ": bfield " + bfield );
-            
-            for(MCParticle part : fsParticles) {
-                if(Math.random()>0.5){
-                	this.printDebug("Random value below threshold. Skipping the final state MC particle " + part.getPDGID());
-                	continue;
+            if (debug) {
+                System.out.println(this.getClass().getSimpleName() + ": bfield " + bfield);
+            }
+
+            for (MCParticle part : fsParticles) {
+                if (Math.random() > 0.5) {
+                    this.printDebug("Random value below threshold. Skipping the final state MC particle " + part.getPDGID());
+                    continue;
                 }
-                if(ParticleTypeClassifier.isElectron(part.getPDGID()) || ParticleTypeClassifier.isPositron(part.getPDGID())) {
-                    
-                    
+                if (ParticleTypeClassifier.isElectron(part.getPDGID()) || ParticleTypeClassifier.isPositron(part.getPDGID())) {
+
+
                     Hep3Vector p = part.getMomentum();
                     Hep3Vector org = part.getOrigin();
-                    double q = -1*part.getCharge(); //since I flipped the B-field I need to flip the charge
+                    double q = -1 * part.getCharge(); //since I flipped the B-field I need to flip the charge
 
-                    
-                    if(p.magnitude()<0.3 ) {
-                        if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small momentum p=" + p.toString());
+
+                    if (p.magnitude() < 0.3) {
+                        if (debug) {
+                            System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small momentum p=" + p.toString());
+                        }
                         continue;
                     }
-                    
-                    double thetay = Math.atan(p.y()/p.z());
-                    
-                    if(Math.abs(thetay) < 0.01) {
-                        if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small thetay =" + Math.abs( Math.atan(p.y()/p.z()) ));
+
+                    double thetay = Math.atan(p.y() / p.z());
+
+                    if (Math.abs(thetay) < 0.01) {
+                        if (debug) {
+                            System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small thetay =" + Math.abs(Math.atan(p.y() / p.z())));
+                        }
                         continue;
                     }
-                    
-                    if(this.noTopTracks && thetay > 0.0) {
-                        if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had negative thetay ("+thetay+") and we only want top tracks");
+
+                    if (this.noTopTracks && thetay > 0.0) {
+                        if (debug) {
+                            System.out.println(this.getClass().getSimpleName() + ": this MC particle had negative thetay (" + thetay + ") and we only want top tracks");
+                        }
                         continue;
                     }
-                    if(this.noBottomTracks && thetay < 0.0) {
-                        if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had positive thetay ("+thetay+") and we only want bottom tracks");
+                    if (this.noBottomTracks && thetay < 0.0) {
+                        if (debug) {
+                            System.out.println(this.getClass().getSimpleName() + ": this MC particle had positive thetay (" + thetay + ") and we only want bottom tracks");
+                        }
                         continue;
                     }
-                    
-                    
+
+
                     //propagate to start of field region if needed
-                    double dz = 0-org.z();
-                    if(dz>0) {
+                    double dz = 0 - org.z();
+                    if (dz > 0) {
                         System.out.print(this.getClass().getSimpleName() + ": Propagate MC particle to field region from org=" + org.toString());
-                        double tanPxPz = p.x()/p.z();
-                        double tanPyPz = p.y()/p.z();
-                        double dx = dz*tanPxPz;
-                        double dy = dz*tanPyPz;
-                        
-                        org = new BasicHep3Vector(org.x()+dx,org.y()+dy,org.z()+dz);
-                        
-                        System.out.println( " to   org=" + org.toString() + " (p=" + p.toString()+ ")");
-                        
-                    }          
-                    
+                        double tanPxPz = p.x() / p.z();
+                        double tanPyPz = p.y() / p.z();
+                        double dx = dz * tanPxPz;
+                        double dy = dz * tanPyPz;
+
+                        org = new BasicHep3Vector(org.x() + dx, org.y() + dy, org.z() + dz);
+
+                        System.out.println(" to   org=" + org.toString() + " (p=" + p.toString() + ")");
+
+                    }
+
                     //if(debug) System.out.println(this.getClass().getSimpleName() + ": MC particle p=" + p.toString() +" org=" + org.toString() +" q = " + q);
                     p = VecOp.mult(detToTrk, p);
                     org = VecOp.mult(detToTrk, org);
-                    if(debug) System.out.println(this.getClass().getSimpleName() + ": MC particle p=" + p.toString() +" org=" + org.toString() +" q = " + q + " (rotated)");
-                    
-                    if(debug) {
-                        double pt = Math.sqrt(p.x()*p.x() + p.y()*p.y());
-                        double Rman = q*pt/(Constants.fieldConversion*bfield); 
-                        double phi = Math.atan2(p.y(),p.x());
-                        double xc = org.x() + Rman*Math.sin(phi);
-                        double yc = org.y() - Rman*Math.cos(phi);                      
-                        double Rc = Math.sqrt(xc*xc+yc*yc);
-                        double dca = q >0 ? (Rman - Rc) : (Rman + Rc);
-                        System.out.println(this.getClass().getSimpleName() + ": manual calcualtion gives pt " + pt +" R " + Rman + " phi " + phi + " xc " + xc + " yc " + yc + " Rc " + Rc + " DCA " + dca );
+                    if (debug) {
+                        System.out.println(this.getClass().getSimpleName() + ": MC particle p=" + p.toString() + " org=" + org.toString() + " q = " + q + " (rotated)");
+                    }
+
+                    if (debug) {
+                        double pt = Math.sqrt(p.x() * p.x() + p.y() * p.y());
+                        double Rman = q * pt / (Constants.fieldConversion * bfield);
+                        double phi = Math.atan2(p.y(), p.x());
+                        double xc = org.x() + Rman * Math.sin(phi);
+                        double yc = org.y() - Rman * Math.cos(phi);
+                        double Rc = Math.sqrt(xc * xc + yc * yc);
+                        double dca = q > 0 ? (Rman - Rc) : (Rman + Rc);
+                        System.out.println(this.getClass().getSimpleName() + ": manual calcualtion gives pt " + pt + " R " + Rman + " phi " + phi + " xc " + xc + " yc " + yc + " Rc " + Rc + " DCA " + dca);
                     }
                     //HelixParamCalculator hpc = new HelixParamCalculator(part,bfield);
-                    HelixParamCalculator hpc = new  HelixParamCalculator(p, org, (int)q,bfield); //remove sign from b-field
+                    HelixParamCalculator hpc = new HelixParamCalculator(p, org, (int) q, bfield); //remove sign from b-field
                     double[] pars = new double[5];
                     pars[0] = hpc.getDCA();
                     pars[1] = hpc.getPhi0();
-                    pars[2] = 1/hpc.getRadius();
+                    pars[2] = 1 / hpc.getRadius();
                     pars[3] = hpc.getZ0();
                     pars[4] = hpc.getSlopeSZPlane();
                     //HelicalTrackFit htf = this.trackUtils.makeHelicalTrackFit(pars);
-                    HpsHelicalTrackFit htf = this.makeHpsHelicalTrackFit(pars, part);
+                    HPSTrack htf = this.makeHPSTrack(pars, part);
                     tracks.add(htf);
-                    if(debug) {
+                    if (debug) {
                         System.out.println(this.getClass().getSimpleName() + ": MC particle created HelicalTrackFit " + htf.toString());
-                     
+
                     }
-         
+
                     h_pt.fill(htf.pT(bfield));
                     h_R.fill(htf.R());
                     h_d0.fill(htf.dca());
                     h_phi0.fill(htf.phi0());
                     h_slope.fill(htf.slope());
                     h_z0.fill(htf.z0());
-                    
-                    
-                    if(saveSingleTrack && tracks.size()==1) break;
-                    
+
+
+                    if (saveSingleTrack && tracks.size() == 1) {
+                        break;
+                    }
+
                 }
             }
         }
-        
+
         // If there were not HpsHelicalTrackFits created, skip the event
-        if(tracks.isEmpty()){
-        	this.printDebug("No tracks were created. Skipping the event ...");
+        if (tracks.isEmpty()) {
+            this.printDebug("No tracks were created. Skipping the event ...");
             return;
         }
-        
+
         this.printDebug("created " + tracks.size() + " MC particle helix tracks");
-        event.put(this.trackOutputCollectionName, tracks, HpsHelicalTrackFit.class, 0);
+        event.put(this.trackOutputCollectionName, tracks, HPSTrack.class, 0);
         _totalTracks += tracks.size();
     }
-    
+
     /**
      * Create an HpsHelicalTrackFit
-     * 
+     *
      * @param helixParameters : an array of helix parameters
      * @param mcParticle : MC particle associated to this HelicalTrackFit
-     * @return HpsHelicalTrackFit : 
+     * @return HpsHelicalTrackFit :
      */
-    public HpsHelicalTrackFit makeHpsHelicalTrackFit(double[] helixParameters, MCParticle mcParticle){
-        return new HpsHelicalTrackFit(helixParameters, new SymmetricMatrix(5), new double[2], new int[2], 
+    public HPSTrack makeHPSTrack(double[] helixParameters, MCParticle mcParticle) {
+        return new HPSTrack(helixParameters, new SymmetricMatrix(5), new double[2], new int[2],
                 new HashMap<HelicalTrackHit, Double>(), new HashMap<HelicalTrackHit, MultipleScatter>(), mcParticle);
     }
-    
+
     /**
      * print debug statement
-     * 
+     *
      * @param debugStatement : debug statement
      */
-    public void printDebug(String debugStatement){
-        if(!debug) return;
-        System.out.println(this.getClass().getSimpleName() + ": " + debugStatement);     
+    public void printDebug(String debugStatement) {
+        if (!debug) {
+            return;
+        }
+        System.out.println(this.getClass().getSimpleName() + ": " + debugStatement);
     }
-    
-    
+
     @Override
     public void endOfData() {
-        
+
         System.out.println(this.getClass().getSimpleName() + ": produced " + _totalTracks);
     }
 }

hps-java/sandbox
HpsHelicalTrackFit.java added at 1.1
diff -N HpsHelicalTrackFit.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HpsHelicalTrackFit.java	25 Apr 2013 22:11:14 -0000	1.1
@@ -0,0 +1,57 @@
+package org.lcsim.hps.recon.tracking;
+
+//--- java ---//
+import java.util.Map;
+
+//--- hep ---//
+import hep.physics.matrix.SymmetricMatrix;
+
+import org.lcsim.event.MCParticle;
+//--- lcsim ---//
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.fit.helicaltrack.MultipleScatter;
+
+/**
+ * 
+ * @author Omar Moreno
+ * @version $Id: HpsHelicalTrackFit.java,v 1.1 2013/04/25 22:11:14 meeg Exp $ 
+ */
+public class HpsHelicalTrackFit extends HelicalTrackFit {
+
+    MCParticle mcParticle;
+    
+    /**
+     * Constructor
+     * @param parameters : an array of helix parameters
+     * @param covariance : covariance matrix of the helix fit
+     * @param chiSquared : chi squared of the circle fit
+     * @param ndf : number of degrees of freedom for the circle fit
+     * @param sMap : a map containing the x-y path lengths
+     * @param msMap : a map containing the multiple scattering uncertainties 
+     * @param mcParticle : the MC particle associated with the fit
+     */
+    public HpsHelicalTrackFit(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
+        this.setMCParticle(mcParticle);
+    }
+    
+    /**
+     * Get the MC Particle associated with the HelicalTrackFit
+     * @return mcParticle : 
+     */
+    public MCParticle getMCParticle(){
+        return this.mcParticle;
+    }
+    
+    /**
+     * Set the MC Particle associated with the HelicalTrackFit
+     * @param mcParticle : 
+     */
+    public void setMCParticle(MCParticle mcParticle){
+        this.mcParticle = mcParticle;
+    }
+}

hps-java/src/main/java/org/lcsim/hps/monitoring/svt
SVTPulseFitPlots.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- SVTPulseFitPlots.java	13 Aug 2012 23:11:11 -0000	1.4
+++ SVTPulseFitPlots.java	25 Apr 2013 22:11:14 -0000	1.5
@@ -14,7 +14,6 @@
 import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants;
 import org.lcsim.hps.recon.tracking.HPSSVTConstants;
 import org.lcsim.hps.recon.tracking.SvtUtils;
-import org.lcsim.hps.recon.tracking.apv25.Apv25Constants;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 
@@ -157,7 +156,7 @@
             t0a[module][layer - 1].fill(fit.getT0(), fit.getAmp());
             if (fit.getAmp() > 4 * noise) {
                 for (int i = 0; i < fit.getRawTrackerHit().getADCValues().length; i++) {
-                    shape[module][layer - 1].fill((i * Apv25Constants.SAMPLING_INTERVAL - fit.getT0()) / tp, (fit.getRawTrackerHit().getADCValues()[i] - pedestal) / fit.getAmp());
+                    shape[module][layer - 1].fill((i * HPSSVTConstants.SAMPLING_INTERVAL - fit.getT0()) / tp, (fit.getRawTrackerHit().getADCValues()[i] - pedestal) / fit.getAmp());
 //                    shape.fill((i * HPSSVTConstants.SAMPLE_INTERVAL - hrth.getT0()) / tp, (hrth.getRawTrackerHit().getADCValues()[i] - pedestal) / hrth.getAmp());
                 }
             }
CVSspam 0.2.12


Use REPLY-ALL to reply to list

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